Michael Decker: Driver Development

Week A


30 July

This is my first entry for week A. As you can see, I've decided to go hex with my week numbers. This is because I'm just that cool.

It's been a few days since my last journal entry, so let's have a quick state of the code address. Within my repository, you'll find the eepro100 branch and the skge branch.

The eepro100 is now stable according to testing by mdc and myself. This driver was converted from the Etherboot version. It was then transformed a great deal into a mostly new beast. I've identified one issue the Linux driver addresses which the gPXE driver does not - that is a rare rx-hang bug in an 82559B-based NIC. This is addressable by owners via an EEPROM update, however.

The skge is not yet stable. Testing with DOS over AoE, I haven't encountered any problems. However, mdc has found some intermittent problems with this driver with iSCSI. This driver is a stripped-down version of the Linux driver. I don't have any datasheet for this device, and haven't reproduced the error, so debugging is .. difficult.

I converted the atlx Linux driver in hopes of supporting the Attansic L2 on-board NIC on my test machine. However, it seems this driver may not fully support the L2 as of yet. I don't have an L1 to test this with, so I have abandoned this code for now. I decided to push it anyway, as someone else may find my hard work useful. Who knows, it may just work with an L1 as-is. All removed code is just commented out, so it will be easy to modify.

I have a few 3c905-based NICs to work with here. There is an existing Etherboot driver for these cards, but mdc said that driver is no good. He gave the go-ahead to convert the Linux driver for these cards, so that is next on my plate.

31 July

The 3c905 is under development. Two commits have been made. The Linux driver was added:

Transition from Linux to gPXE API is in-progress:

This is a sizable driver, and progress is slow and steady. I've already converted a Linux driver twice before, so I have a list of changes to follow. I posted these in a soc-mentors email, but I'll post them here for others to reference:

The following functions were replaced with nothing:
    pci_unmap_addr_set
    pci_unmap_len_set
    pci_unmap_single
    pci_unmap_page
    pci_dma_sync_single_for_cpu
    pci_dma_sync_single_for_device
    netif_tx_lock_bh
    netif_tx_unlock_bh
    skb_padto(skb,ETH_ZLEN) (io_buffer already pads)
    netif_stop_queue
    netif_msg_X
    netif_wake_queue
    netif_queue_stopped
    __netif_rx_complete
    spin_lock_irqsave
    spin_unlock_irqrestore
    netif_napi_add
    spin_lock_bh
    spin_unlock_bh
    napi_enable (after open() will enable polling)
    spin_lock_irq
    spin_unlock_irq
    pci_release_regions
    pci_disable_device

The following features were considered unneeded and relevant code was omitted:
    wol
    ethtool
    tx/rx checksum offload
    jumbo frames
    skb fragments
    power management

The following function replacements were made:
    pci_alloc_consistent
        malloc_dma, virt_to_phys, memset
    pci_free_consistent
        free_dma
    pci_map_single
        virt_to_phys
    smp_wmb
        wmb
    netif_running
        mostly nothing, a few netdev_link_ok
    netif_receive_skb
        netdev_rx
    netif_carrier_off
        netdev_link_down
    skb_copy_from_linear_data
        memcpy
    netdev_alloc_skb
        alloc_iob, memset
    kcalloc
        malloc_dma, memset
    dev_kfree_skb
        free_iob
    kzalloc
        malloc_dma, memset

This is not an all-inclusive list, as I have already made some replacements that I haven't added here. I will update the list as I have time to review the code.

Also, the skge driver was updated. Linux performs a memory clear during pci_alloc_consistent and netdev_alloc_skb, which I hadn't duplicated.

My next goal is to get the 3c59x running. This shouldn't be more than a few days of hard work if no problems are encountered.