aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/net/intelxl.h
AgeCommit message (Collapse)AuthorFilesLines
2022-08-16[intelxl] Negotiate virtual function API version 1.1Michael Brown1-0/+2
Negotiate API version 1.1 in order to allow access to virtual function opcodes that are disallowed by default on the E810. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-12[intelxl] Add driver for Intel 100 Gigabit Ethernet NICsMichael Brown1-0/+10
Add a driver for the E810 family of 100 Gigabit Ethernet NICs. The core datapath is identical to that of the 40 Gigabit XL710, and this part of the code is shared between both drivers. The admin queue mechanism is sufficiently similar to make it worth reusing substantial portions of the code, with separate implementations for several commands to handle the (unnecessarily) breaking changes in data structure layouts. The major differences are in the mechanisms for programming queue contexts (where the E810 abandons TX/RX symmetry) and for configuring the transmit scheduler and receive filters: these portions are sufficiently different to justify a separate driver. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-12[intelxl] Use admin queue to set port MAC address and maximum frame sizeMichael Brown1-16/+37
Remove knowledge of the PRTGL_SA[HL] registers, and instead use the admin queue to set the MAC address and maximum frame size. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-12[intelxl] Use admin queue to get port MAC addressMichael Brown1-6/+30
Remove knowledge of the PRTPM_SA[HL] registers, and instead use the admin queue to retrieve the MAC address. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-12[intelxl] Set maximum frame size to 9728 bytes as per datasheetMichael Brown1-2/+4
The PRTGL_SAH register contains the current maximum frame size, and is not guaranteed on reset to contain the actual maximum frame size supported by the hardware, which the datasheet specifies as 9728 bytes (including the 4-byte CRC). Set the maximum packet size to a hardcoded 9728 bytes instead of reading from the PRTGL_SAH register. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-11[intelxl] Always issue "clear PXE mode" admin queue commandMichael Brown1-4/+3
Remove knowledge of the GLLAN_RCTL_0 register (which changes location between the XL810 and E810 register maps), and instead unconditionally issue the "clear PXE mode" command with the EEXIST error silenced. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-11[intelxl] Increase data buffer size to 4kBMichael Brown1-2/+5
At least one E810 admin queue command (Query Default Scheduling Tree Topology) insists upon being provided with a 4kB data buffer, even when the data to be returned is much smaller. Work around this requirement by increasing the admin queue data buffer size to 4kB. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-11[intelxl] Separate virtual function driver definitionsMichael Brown1-206/+4
Move knowledge of the virtual function data structures and admin command definitions from intelxl.h to intelxlvf.h. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-11[intelxl] Reuse admin command descriptor and buffer for VF responsesMichael Brown1-4/+0
Remove the large static admin data buffer structure embedded within struct intelxl_nic, and instead copy the response received via the "send to VF" admin queue event to the (already consumed and completed) admin command descriptor and data buffer. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-11[intelxl] Handle admin events via a callbackMichael Brown1-4/+11
The physical and virtual function drivers each care about precisely one admin queue event type. Simplify event handling by using a per-driver callback instead of the existing weak function symbol. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-10[intelxl] Increase receive descriptor ring size to 64 entriesMichael Brown1-2/+2
The E810 requires that receive descriptor rings have at least 64 entries (and are a multiple of 32 entries). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-10[intelxl] Negotiate API version for virtual function via admin queueMichael Brown1-0/+19
Do not attempt to use the admin commands to get the firmware version and report the driver version for the virtual function driver, since these will be rejected by the E810 firmware as invalid commands when issued by a virtual function. Instead, use the mailbox interface to negotiate the API version with the physical function driver. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-10[intelxl] Use non-zero MSI-X vector for virtual function interruptsMichael Brown1-3/+8
The 100 Gigabit physical function driver requires a virtual function driver to request that transmit and receive queues are mapped to MSI-X vector 1 or higher. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-08[intelxl] Use function-level reset instead of PFGEN_CTRL.PFSWRMichael Brown1-7/+0
Remove knowledge of the PFGEN_CTRL register (which changes location between XL710 and E810 register maps), and instead use PCIe FLR to reset the physical function. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-08[intelxl] Add missing padding bytes to receive queue contextMichael Brown1-0/+2
For the sake of completeness, ensure that all 32 bytes of the receive queue context are programmed (including the unused final 8 bytes). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-08-08[intelxl] Fix bit width of function number in PFFUNC_RID registerMichael Brown1-1/+1
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2020-11-28[dma] Move I/O buffer DMA operations to iobuf.hMichael Brown1-23/+7
Include a potential DMA mapping within the definition of an I/O buffer, and move all I/O buffer DMA mapping functions from dma.h to iobuf.h. This avoids the need for drivers to maintain a separate list of DMA mappings for each I/O buffer that they may handle. Network device drivers typically do not keep track of transmit I/O buffers, since the network device core already maintains a transmit queue. Drivers will typically call netdev_tx_complete_next() to complete a transmission without first obtaining the relevant I/O buffer pointer (and will rely on the network device core automatically cancelling any pending transmissions when the device is closed). To allow this driver design approach to be retained, update the netdev_tx_complete() family of functions to automatically perform the DMA unmapping operation if required. For symmetry, also update the netdev_rx() family of functions to behave the same way. As a further convenience for drivers, allow the network device core to automatically perform DMA mapping on the transmit datapath before calling the driver's transmit() method. This avoids the need to introduce a mapping error handling code path into the typically error-free transmit methods. With these changes, the modifications required to update a typical network device driver to use the new DMA API are fairly minimal: - Allocate and free descriptor rings and similar coherent structures using dma_alloc()/dma_free() rather than malloc_phys()/free_phys() - Allocate and free receive buffers using alloc_rx_iob()/free_rx_iob() rather than alloc_iob()/free_iob() - Calculate DMA addresses using dma() or iob_dma() rather than virt_to_bus() - Set a 64-bit DMA mask if needed using dma_set_mask_64bit() and thereafter eliminate checks on DMA address ranges - Either record the DMA device in netdev->dma, or call iob_map_tx() as part of the transmit() method - Ensure that debug messages use virt_to_phys() when displaying "hardware" addresses Signed-off-by: Michael Brown <mcb30@ipxe.org>
2020-11-21[intelxl] Update driver to use DMA APIMichael Brown1-11/+42
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2020-11-21[intelxl] Read PCI bus:dev.fn number from PFFUNC_RID registerMichael Brown1-0/+5
For the physical function driver, the transmit queue needs to be configured to be associated with the relevant physical function number. This is currently obtained from the bus:dev.fn address of the underlying PCI device. In the case of a virtual machine using the physical function via PCI passthrough, the PCI bus:dev.fn address within the virtual machine is unrelated to the real physical function number. Such a function will typically be presented to the virtual machine as a single-function device. The function number extracted from the PCI bus:dev.fn address will therefore always be zero. Fix by reading from the Function Requester ID Information Register, which always returns the real PCI bus:dev.fn address as used by the physical host. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2020-11-20[intelxl] Read MAC address from PRTPM_SA[HL] instead of PRTGL_SA[HL]Michael Brown1-0/+6
The datasheet is fairly incomprehensible in terms of identifying the appropriate MAC address for use by the physical function driver. Choose to read the MAC address from PRTPM_SAH and PRTPM_SAL, which at least matches the MAC address as selected by the Linux i40e driver. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27[intelxl] Add driver for Intel 40 Gigabit Ethernet NIC virtual functionsMichael Brown1-2/+183
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27[intelxl] Choose to operate in non-PXE modeMichael Brown1-8/+42
The physical function defaults to operating in "PXE mode" after a power-on reset. In this mode, receive descriptors are fetched and written back as single descriptors. In normal (non-PXE mode) operation, receive descriptors are fetched and written back only as complete cachelines unless an interrupt is raised. There is no way to return to PXE mode from non-PXE mode, and there is no way for the virtual function driver to operate in PXE mode. Choose to operate in non-PXE mode. This requires us to trick the hardware into believing that it is raising an interrupt, so that it will not defer writing back receive descriptors until a complete cacheline (i.e. four packets) have been consumed. We do so by configuring the hardware to use MSI-X with a dummy target location in place of the usual APIC register. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27[intelxl] Expose functions required by virtual function driverMichael Brown1-0/+18
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27[intelxl] Allow for arbitrary placement of interrupt control registerMichael Brown1-3/+5
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27[intelxl] Allow for arbitrary placement of ring tail registersMichael Brown1-0/+2
The virtual function transmit and receive ring tail register offsets do not match those of the physical function. Allow the tail register offsets to be specified separately. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27[intelxl] Use 32-byte receive descriptorsMichael Brown1-11/+28
The physical function driver does not allow the virtual function to request the use of 16-byte receive descriptors. Switch to using 32-byte receive descriptors. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27[intelxl] Provide a mechanism for handling "send to VF" eventsMichael Brown1-0/+10
Provide a weak stub function for handling the "send to VF" event used for communications between the physical and virtual function drivers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27[intelxl] Allow admin cookie to hold extended opcode and return codeMichael Brown1-4/+9
The "send to PF" and "send to VF" admin queue descriptors (ab)use the cookie field to hold the extended opcode and return code values. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27[intelxl] Use one admin queue buffer per admin queue descriptorMichael Brown1-2/+4
We currently use a single data buffer shared between all admin queue descriptors. This works for the physical function driver since we have at most one command in progress and only a single event (which does not use a data buffer). The communication path between the physical and virtual function drivers uses the event data buffer, and there is no way to prevent a solicited event (i.e. a response to a request) from being overwritten by an unsolicited event (e.g. a link status change). Provide individual data buffers for each admin event queue descriptor (and for each admin command queue descriptor, for the sake of consistency). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27[intelxl] Allow for virtual function admin queue register mapsMichael Brown1-5/+28
The register map for the virtual functions appears to have been constructed using a random number generator. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2019-04-27[intelxl] Use VLAN tag in receive descriptor if presentMichael Brown1-1/+8
The physical function driver does not allow the virtual function to request that VLAN tags are left unstripped. Extract and use the VLAN tag from the receive descriptor if present. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-07-17[intelxl] Add driver for Intel 40 Gigabit Ethernet NICsMichael Brown1-0/+790
Signed-off-by: Michael Brown <mcb30@ipxe.org>