iPXE
|
Intel 100 Gigabit Ethernet network card driver. More...
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/netdevice.h>
#include <ipxe/ethernet.h>
#include <ipxe/if_ether.h>
#include <ipxe/iobuf.h>
#include <ipxe/pci.h>
#include "ice.h"
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static int | ice_admin_version (struct intelxl_nic *intelxl) |
Get firmware version. More... | |
static int | ice_admin_mac_read (struct net_device *netdev) |
Get MAC address. More... | |
static int | ice_admin_mac_write (struct net_device *netdev) |
Set MAC address. More... | |
static int | ice_admin_switch (struct intelxl_nic *intelxl) |
Get switch configuration. More... | |
static int | ice_admin_rules (struct intelxl_nic *intelxl, uint8_t *mac) |
Add switch rules. More... | |
static struct ice_admin_schedule_node * | ice_admin_schedule_is_parent (struct ice_admin_schedule_branch *branch, struct ice_admin_schedule_node *node) |
Check if scheduler node is a parent (i.e. More... | |
static int | ice_admin_schedule (struct intelxl_nic *intelxl) |
Query default scheduling tree topology. More... | |
static int | ice_admin_autoneg (struct intelxl_nic *intelxl) |
Restart autonegotiation. More... | |
static int | ice_admin_link (struct net_device *netdev) |
Get link status. More... | |
static void | ice_admin_event (struct net_device *netdev, struct intelxl_admin_descriptor *xlevt, union intelxl_admin_buffer *xlbuf __unused) |
Handle admin event. More... | |
static int | ice_admin_add_txq (struct intelxl_nic *intelxl, struct intelxl_ring *ring) |
Add transmit queue. More... | |
static int | ice_admin_disable_txq (struct intelxl_nic *intelxl) |
Disable transmit queue. More... | |
static void | ice_dump_tx (struct intelxl_nic *intelxl) |
Dump transmit queue context (for debugging) More... | |
static void | ice_dump_rx (struct intelxl_nic *intelxl) |
Dump receive queue context (for debugging) More... | |
static int | ice_create_tx (struct intelxl_nic *intelxl, struct intelxl_ring *ring) |
Create transmit queue. More... | |
static void | ice_destroy_tx (struct intelxl_nic *intelxl, struct intelxl_ring *ring) |
Destroy transmit queue. More... | |
static int | ice_context_rx (struct intelxl_nic *intelxl, physaddr_t address) |
Program receive queue context. More... | |
static int | ice_open (struct net_device *netdev) |
Open network device. More... | |
static void | ice_close (struct net_device *netdev) |
Close network device. More... | |
static int | ice_probe (struct pci_device *pci) |
Probe PCI device. More... | |
static void | ice_remove (struct pci_device *pci) |
Remove PCI device. More... | |
Variables | |
static uint8_t | ice_magic_mac [ETH_HLEN] = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } |
Magic MAC address. More... | |
static struct net_device_operations | ice_operations |
Network device operations. More... | |
static struct pci_device_id | ice_nics [] |
PCI device IDs. More... | |
struct pci_driver ice_driver | __pci_driver |
PCI driver. More... | |
Intel 100 Gigabit Ethernet network card driver.
Definition in file ice.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Get firmware version.
intelxl | Intel device |
rc | Return status code |
Definition at line 65 of file ice.c.
References ice_admin_version_params::api, cmd, cpu_to_le16, DBGC, ENOTSUP, ice_admin_command_descriptor(), INTELXL_ADMIN_API_MAJOR, intelxl_admin_command(), INTELXL_ADMIN_VERSION, rc, and version.
|
static |
Get MAC address.
netdev | Network device |
rc | Return status code |
Definition at line 101 of file ice.c.
References cmd, cpu_to_le16, DBGC, EINVAL, ENOENT, ETH_ALEN, eth_ntoa(), net_device::hw_addr, ice_admin_command_buffer(), ice_admin_command_descriptor(), ICE_ADMIN_MAC_READ_TYPE_LAN, intelxl_admin_command(), INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_MAC_READ, INTELXL_ADMIN_MAC_READ_VALID_LAN, is_valid_ether_addr(), mac, ice_admin_mac_read_buffer::mac, ice_admin_buffer::mac_read, memcpy(), netdev, net_device::priv, rc, and read.
Referenced by ice_probe().
|
static |
Set MAC address.
netdev | Network device |
rc | Return status code |
Definition at line 163 of file ice.c.
References cmd, cpu_to_le16, ETH_ALEN, ice_admin_command_descriptor(), intelxl_admin_command(), INTELXL_ADMIN_MAC_WRITE, net_device::ll_addr, memcpy(), netdev, net_device::priv, rc, and write.
Referenced by ice_open().
|
static |
Get switch configuration.
intelxl | Intel device |
rc | Return status code |
Definition at line 188 of file ice.c.
References ice_admin_switch_buffer::cfg, cmd, cpu_to_le16, DBGC, DBGC2, DBGC2_HDA, ENOENT, ice_admin_switch_config::func, ice_admin_command_buffer(), ice_admin_command_descriptor(), ICE_ADMIN_SWITCH_TYPE_MASK, ICE_ADMIN_SWITCH_TYPE_VSI, intelxl_admin_command(), INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_SWITCH, le16_to_cpu, next, rc, ice_admin_switch_config::seid, ice_admin_buffer::sw, type, ice_admin_switch_config::uplink, and intelxl_nic::vsi.
Referenced by ice_probe().
|
static |
Add switch rules.
intelxl | Intel device |
mac | MAC address |
rc | Return status code |
Definition at line 246 of file ice.c.
References ice_admin_rules_buffer::action, cmd, cpu_to_le16, cpu_to_le32, ice_admin_rules_buffer::eth, ETH_ALEN, ETH_P_8021Q, ethhdr::h_dest, ethhdr::h_protocol, ethhdr::h_source, ice_admin_rules_buffer::hdr, htons, ICE_ADMIN_ADD_RULES, ice_admin_command_buffer(), ice_admin_command_descriptor(), ICE_ADMIN_RULES_ACTION_VALID, ICE_ADMIN_RULES_ACTION_VSI, ICE_ADMIN_RULES_RECIPE_PROMISC, ice_magic_mac, intelxl_admin_command(), INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_FL_RD, ice_admin_rules_buffer::len, mac, memcpy(), ice_admin_rules_buffer::port, intelxl_nic::port, rc, ice_admin_rules_buffer::recipe, ice_admin_buffer::rules, and intelxl_nic::vsi.
Referenced by ice_probe().
|
static |
Check if scheduler node is a parent (i.e.
non-leaf) node
branch | Scheduler topology branch |
node | Scheduler topology node |
child | Any child node, or NULL if not found |
Definition at line 285 of file ice.c.
References count, ice_admin_schedule_branch::count, le16_to_cpu, node, ice_admin_schedule_branch::node, NULL, and ice_admin_schedule_node::parent.
Referenced by ice_admin_schedule().
|
static |
Query default scheduling tree topology.
intelxl | Intel device |
rc | Return status code |
Definition at line 307 of file ice.c.
References ice_admin_schedule_buffer::branch, cmd, ice_admin_schedule_branch::count, cpu_to_le16, DBGC, DBGC2, EINVAL, ice_admin_command_buffer(), ice_admin_command_descriptor(), ICE_ADMIN_SCHEDULE, ice_admin_schedule_is_parent(), intelxl_admin_command(), INTELXL_ADMIN_FL_BUF, le16_to_cpu, le32_to_cpu, node, ice_admin_schedule_branch::node, rc, ice_admin_buffer::sched, and intelxl_nic::teid.
Referenced by ice_probe().
|
static |
Restart autonegotiation.
intelxl | Intel device |
rc | Return status code |
Definition at line 359 of file ice.c.
References cmd, cpu_to_le16, ice_admin_autoneg_params::flags, ice_admin_command_descriptor(), INTELXL_ADMIN_AUTONEG, INTELXL_ADMIN_AUTONEG_FL_ENABLE, INTELXL_ADMIN_AUTONEG_FL_RESTART, intelxl_admin_command(), and rc.
Referenced by ice_open().
|
static |
Get link status.
netdev | Network device |
rc | Return status code |
Definition at line 384 of file ice.c.
References cmd, cpu_to_le16, DBGC, ice_admin_command_buffer(), ice_admin_command_descriptor(), intelxl_admin_command(), INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_LINK, INTELXL_ADMIN_LINK_NOTIFY, INTELXL_ADMIN_LINK_UP, le16_to_cpu, link, ice_admin_buffer::link, netdev, netdev_link_down(), netdev_link_up(), net_device::priv, rc, ice_admin_link_buffer::speed, and ice_admin_link_buffer::status.
Referenced by ice_admin_event(), ice_open(), and ice_probe().
|
static |
Handle admin event.
netdev | Network device |
xlevt | Event descriptor |
xlbuf | Data buffer |
Definition at line 423 of file ice.c.
References container_of, cpu_to_le16, DBGC, ice_admin_link(), INTELXL_ADMIN_LINK, le16_to_cpu, netdev, ice_admin_descriptor::opcode, net_device::priv, and ice_admin_descriptor::xl.
Referenced by ice_probe().
|
static |
Add transmit queue.
intelxl | Intel device |
ring | Descriptor ring |
rc | Return status code |
Definition at line 448 of file ice.c.
References ice_admin_buffer::add_txq, address, cmd, ice_schedule_tx::commit_weight, ice_admin_add_txq_params::count, ice_admin_add_txq_buffer::count, cpu_to_le16, cpu_to_le32, cpu_to_le64, ice_admin_add_txq_buffer::ctx, ctx, DBGC, intelxl_ring::desc, dma(), ice_schedule_tx::excess_weight, ICE_ADMIN_ADD_TXQ, ice_admin_command_buffer(), ice_admin_command_descriptor(), ICE_SCHEDULE_COMMIT, ICE_SCHEDULE_EXCESS, ICE_SCHEDULE_GENERIC, ICE_SCHEDULE_WEIGHT, ICE_TXQ_BASE_PORT, ICE_TXQ_FL_LEGACY, ICE_TXQ_FL_TSO, ICE_TXQ_LEN, ICE_TXQ_PF_TYPE, intelxl_admin_command(), INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_FL_RD, INTELXL_TX_NUM_DESC, le32_to_cpu, intelxl_ring::map, ice_admin_add_txq_buffer::parent, intelxl_nic::pf, intelxl_nic::port, intelxl_ring::raw, rc, ice_admin_add_txq_buffer::sched, ice_schedule_tx::sections, ice_admin_add_txq_buffer::teid, intelxl_nic::teid, and intelxl_nic::vsi.
Referenced by ice_create_tx().
|
static |
Disable transmit queue.
intelxl | Intel device |
ring | Descriptor ring |
rc | Return status code |
Definition at line 498 of file ice.c.
References cmd, ice_admin_disable_txq_buffer::count, cpu_to_le16, cpu_to_le32, ice_admin_buffer::disable_txq, ice_admin_command_buffer(), ice_admin_command_descriptor(), ICE_ADMIN_DISABLE_TXQ, ICE_TXQ_FL_FLUSH, ICE_TXQ_TIMEOUT, intelxl_admin_command(), INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_FL_RD, ice_admin_disable_txq_buffer::parent, rc, and intelxl_nic::teid.
Referenced by ice_destroy_tx().
|
static |
Dump transmit queue context (for debugging)
intelxl | Intel device |
Definition at line 536 of file ice.c.
References cpu_to_le32, ctx, DBG_EXTRA, DBGC2, DBGC2_HDA, ICE_GLCOMM_QTX_CNTX_BUSY, ICE_GLCOMM_QTX_CNTX_CTL, ICE_GLCOMM_QTX_CNTX_CTL_CMD_READ, ICE_GLCOMM_QTX_CNTX_CTL_EXEC, ICE_GLCOMM_QTX_CNTX_DATA, ICE_GLCOMM_QTX_CNTX_STAT, INTELXL_CTX_MAX_WAIT_MS, mdelay(), readl(), intelxl_nic::regs, and writel().
Referenced by ice_close().
|
static |
Dump receive queue context (for debugging)
intelxl | Intel device |
Definition at line 578 of file ice.c.
References cpu_to_le32, ctx, DBG_EXTRA, DBGC2, DBGC2_HDA, ICE_QRX_CONTEXT, readl(), and intelxl_nic::regs.
Referenced by ice_close().
|
static |
Create transmit queue.
intelxl | Intel device |
ring | Descriptor ring |
rc | Return status code |
Definition at line 605 of file ice.c.
References ice_admin_add_txq(), intelxl_alloc_ring(), intelxl_free_ring(), and rc.
Referenced by ice_open().
|
static |
Destroy transmit queue.
intelxl | Intel device |
ring | Descriptor ring |
rc | Return status code |
Definition at line 632 of file ice.c.
References ice_admin_disable_txq(), intelxl_free_ring(), and rc.
Referenced by ice_close(), and ice_open().
|
static |
Program receive queue context.
intelxl | Intel device |
address | Descriptor ring base address |
rc | Return status code |
Definition at line 653 of file ice.c.
References address, intelxl_context_rx::base_count, cpu_to_le16, cpu_to_le64, ctx, ICE_QRX_CONTEXT, INTELXL_CTX_RX_BASE_COUNT, INTELXL_CTX_RX_FL_CRCSTRIP, INTELXL_CTX_RX_FL_DSIZE, INTELXL_CTX_RX_LEN, INTELXL_CTX_RX_MFS, INTELXL_RX_NUM_DESC, le32_to_cpu, memset(), intelxl_nic::mfs, raw, intelxl_nic::regs, rx, and writel().
Referenced by ice_probe().
|
static |
Open network device.
netdev | Network device |
rc | Return status code |
Definition at line 686 of file ice.c.
References ETH_HLEN, ice_admin_autoneg(), ice_admin_link(), ice_admin_mac_write(), ice_create_tx(), ice_destroy_tx(), intelxl_admin_mac_config(), INTELXL_ALIGN, intelxl_create_ring(), intelxl_destroy_ring(), intelxl_nic::mfs, net_device::mtu, netdev, net_device::priv, rc, intelxl_nic::rx, and intelxl_nic::tx.
|
static |
Close network device.
netdev | Network device |
Definition at line 732 of file ice.c.
References ice_destroy_tx(), ice_dump_rx(), ice_dump_tx(), intelxl_destroy_ring(), intelxl_empty_rx(), netdev, net_device::priv, intelxl_nic::rx, and intelxl_nic::tx.
|
static |
Probe PCI device.
pci | PCI device |
rc | Return status code |
Definition at line 770 of file ice.c.
References adjust_pci_device(), alloc_etherdev(), intelxl_nic::command, DBGC, intelxl_ring::desc, pci_device::dev, net_device::dev, pci_device::dma, net_device::dma, intelxl_nic::dma, dma_set_mask_64bit(), ENODEV, ENOMEM, ENXIO, eth_broadcast, intelxl_nic::event, intelxl_nic::exp, intelxl_nic::handle, ice_admin_event(), ice_admin_link(), ice_admin_mac_read(), ice_admin_rules(), ice_admin_schedule(), ice_admin_switch(), ICE_BAR_SIZE, ice_context_rx(), ICE_GLINT_DYN_CTL, ice_magic_mac, ice_operations, ICE_PFFUNC_RID, ICE_PFFUNC_RID_FUNC_NUM, ICE_PFGEN_PORTNUM, ICE_PFGEN_PORTNUM_PORT_NUM, ICE_QINT_RQCTL, ICE_QINT_RQCTL_CAUSE_ENA, ICE_QINT_RQCTL_ITR_INDX_NONE, ICE_QINT_TQCTL, ICE_QINT_TQCTL_CAUSE_ENA, ICE_QINT_TQCTL_ITR_INDX_NONE, ICE_QRX_CTRL, ICE_QRX_FLXP_CNTXT, ICE_QRX_FLXP_CNTXT_RXDID_IDX_LEGACY_32, ICE_QRX_FLXP_CNTXT_RXDID_PRIO_MAX, ICE_QRX_TAIL, ICE_QTX_COMM_DBELL, intelxl_admin_clear_pxe(), INTELXL_ADMIN_CMD, INTELXL_ADMIN_EVT, intelxl_close_admin(), intelxl_init_admin(), intelxl_init_ring(), INTELXL_MAX_PKT_LEN, intelxl_msix_disable(), intelxl_msix_enable(), INTELXL_MSIX_VECTOR, intelxl_open_admin(), INTELXL_RX_NUM_DESC, INTELXL_TX_NUM_DESC, intelxl_nic::intr, iounmap(), net_device::max_pkt_len, pci_device::membase, memset(), netdev, netdev_init(), netdev_nullify(), netdev_put(), NULL, PCI_CAP_ID_EXP, pci_find_capability(), pci_ioremap(), pci_reset(), pci_set_drvdata(), intelxl_nic::pf, intelxl_nic::port, net_device::priv, rc, readl(), intelxl_ring::reg, register_netdev(), intelxl_nic::regs, intelxl_ring::rx, intelxl_nic::rx, intelxl_ring::tail, intelxl_ring::tx, intelxl_nic::tx, unregister_netdev(), and writel().
|
static |
Remove PCI device.
pci | PCI device |
Definition at line 929 of file ice.c.
References intelxl_nic::exp, intelxl_close_admin(), intelxl_msix_disable(), INTELXL_MSIX_VECTOR, iounmap(), netdev, netdev_nullify(), netdev_put(), pci_get_drvdata(), pci_reset(), net_device::priv, intelxl_nic::regs, and unregister_netdev().
Magic MAC address.
Used as the source address and promiscuous unicast destination address in the "add switch rules" command.
Definition at line 50 of file ice.c.
Referenced by ice_admin_rules(), and ice_probe().
|
static |
Network device operations.
Definition at line 750 of file ice.c.
Referenced by ice_probe().
|
static |
PCI device IDs.
struct pci_driver ice_driver __pci_driver |
PCI driver.