iPXE
Functions | Variables
intelxl.c File Reference

Intel 40 Gigabit Ethernet network card driver. More...

#include <stdint.h>
#include <string.h>
#include <stdio.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/malloc.h>
#include <ipxe/pci.h>
#include <ipxe/version.h>
#include "intelxl.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static int intelxl_reset (struct intelxl_nic *intelxl)
 Reset hardware.
static int intelxl_fetch_mac (struct intelxl_nic *intelxl, struct net_device *netdev)
 Fetch initial MAC address and maximum frame size.
static int intelxl_create_admin (struct intelxl_nic *intelxl, struct intelxl_admin *admin)
 Create admin queue.
static void intelxl_destroy_admin (struct intelxl_nic *intelxl, struct intelxl_admin *admin)
 Destroy admin queue.
static int intelxl_admin_command (struct intelxl_nic *intelxl, struct intelxl_admin_descriptor *cmd)
 Issue admin queue command.
static int intelxl_admin_version (struct intelxl_nic *intelxl)
 Get firmware version.
static int intelxl_admin_driver (struct intelxl_nic *intelxl)
 Report driver version.
static int intelxl_admin_shutdown (struct intelxl_nic *intelxl)
 Shutdown admin queues.
static int intelxl_admin_switch (struct intelxl_nic *intelxl)
 Get switch configuration.
static int intelxl_admin_vsi (struct intelxl_nic *intelxl)
 Get VSI parameters.
static int intelxl_admin_promisc (struct intelxl_nic *intelxl)
 Set VSI promiscuous modes.
static int intelxl_admin_autoneg (struct intelxl_nic *intelxl)
 Restart autonegotiation.
static int intelxl_admin_link (struct net_device *netdev)
 Get link status.
static void intelxl_refill_admin (struct intelxl_nic *intelxl)
 Refill admin event queue.
static void intelxl_poll_admin (struct net_device *netdev)
 Poll admin event queue.
static int intelxl_open_admin (struct intelxl_nic *intelxl)
 Open admin queues.
static void intelxl_close_admin (struct intelxl_nic *intelxl)
 Close admin queues.
static void intelxl_context_dump (struct intelxl_nic *intelxl, uint32_t op, size_t len)
 Dump queue context (for debugging)
static int intelxl_context_line (struct intelxl_nic *intelxl, struct intelxl_context_line *line, unsigned int index, uint32_t op)
 Program queue context line.
static int intelxl_context (struct intelxl_nic *intelxl, struct intelxl_context_line *line, size_t len, uint32_t op)
 Program queue context.
static int intelxl_context_tx (struct intelxl_nic *intelxl, physaddr_t address)
 Program transmit queue context.
static int intelxl_context_rx (struct intelxl_nic *intelxl, physaddr_t address)
 Program receive queue context.
static int intelxl_enable_ring (struct intelxl_nic *intelxl, struct intelxl_ring *ring)
 Enable descriptor ring.
static int intelxl_disable_ring (struct intelxl_nic *intelxl, struct intelxl_ring *ring)
 Disable descriptor ring.
static int intelxl_create_ring (struct intelxl_nic *intelxl, struct intelxl_ring *ring)
 Create descriptor ring.
static void intelxl_destroy_ring (struct intelxl_nic *intelxl, struct intelxl_ring *ring)
 Destroy descriptor ring.
static void intelxl_refill_rx (struct intelxl_nic *intelxl)
 Refill receive descriptor ring.
static int intelxl_open (struct net_device *netdev)
 Open network device.
static void intelxl_close (struct net_device *netdev)
 Close network device.
static int intelxl_transmit (struct net_device *netdev, struct io_buffer *iobuf)
 Transmit packet.
static void intelxl_poll_tx (struct net_device *netdev)
 Poll for completed packets.
static void intelxl_poll_rx (struct net_device *netdev)
 Poll for received packets.
static void intelxl_poll (struct net_device *netdev)
 Poll for completed and received packets.
static void intelxl_irq (struct net_device *netdev, int enable)
 Enable or disable interrupts.
static int intelxl_probe (struct pci_device *pci)
 Probe PCI device.
static void intelxl_remove (struct pci_device *pci)
 Remove PCI device.

Variables

static struct net_device_operations intelxl_operations
 Network device operations.
static struct pci_device_id intelxl_nics []
 PCI device IDs.
struct pci_driver intelxl_driver __pci_driver
 PCI driver.

Detailed Description

Intel 40 Gigabit Ethernet network card driver.

Definition in file intelxl.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static int intelxl_reset ( struct intelxl_nic intelxl) [static]

Reset hardware.

Parameters:
intelxlIntel device
Return values:
rcReturn status code

Definition at line 60 of file intelxl.c.

References INTELXL_PFGEN_CTRL, INTELXL_PFGEN_CTRL_PFSWR, INTELXL_RESET_DELAY_MS, mdelay(), readl(), intelxl_nic::regs, and writel().

Referenced by intelxl_probe(), and intelxl_remove().

                                                         {
        uint32_t pfgen_ctrl;

        /* Perform a global software reset */
        pfgen_ctrl = readl ( intelxl->regs + INTELXL_PFGEN_CTRL );
        writel ( ( pfgen_ctrl | INTELXL_PFGEN_CTRL_PFSWR ),
                 intelxl->regs + INTELXL_PFGEN_CTRL );
        mdelay ( INTELXL_RESET_DELAY_MS );

        return 0;
}
static int intelxl_fetch_mac ( struct intelxl_nic intelxl,
struct net_device netdev 
) [static]

Fetch initial MAC address and maximum frame size.

Parameters:
intelxlIntel device
netdevNetwork device
Return values:
rcReturn status code

Definition at line 86 of file intelxl.c.

References cpu_to_le32, DBGC, ENOENT, ETH_ALEN, eth_ntoa(), intelxl_receive_address::high, net_device::hw_addr, INTELXL_PRTGL_SAH, INTELXL_PRTGL_SAH_MFS_GET, INTELXL_PRTGL_SAL, is_valid_ether_addr(), intelxl_receive_address::low, net_device::max_pkt_len, memcpy(), mfs, intelxl_receive_address::raw, readl(), and intelxl_nic::regs.

Referenced by intelxl_probe().

                                                           {
        union intelxl_receive_address mac;
        uint32_t prtgl_sal;
        uint32_t prtgl_sah;
        size_t mfs;

        /* Read NVM-loaded address */
        prtgl_sal = readl ( intelxl->regs + INTELXL_PRTGL_SAL );
        prtgl_sah = readl ( intelxl->regs + INTELXL_PRTGL_SAH );
        mac.reg.low = cpu_to_le32 ( prtgl_sal );
        mac.reg.high = cpu_to_le32 ( prtgl_sah );

        /* Check that address is valid */
        if ( ! is_valid_ether_addr ( mac.raw ) ) {
                DBGC ( intelxl, "INTELXL %p has invalid MAC address (%s)\n",
                       intelxl, eth_ntoa ( mac.raw ) );
                return -ENOENT;
        }

        /* Copy MAC address */
        DBGC ( intelxl, "INTELXL %p has autoloaded MAC address %s\n",
               intelxl, eth_ntoa ( mac.raw ) );
        memcpy ( netdev->hw_addr, mac.raw, ETH_ALEN );

        /* Get maximum frame size */
        mfs = INTELXL_PRTGL_SAH_MFS_GET ( prtgl_sah );
        netdev->max_pkt_len = ( mfs - 4 /* CRC */ );

        return 0;
}
static int intelxl_create_admin ( struct intelxl_nic intelxl,
struct intelxl_admin admin 
) [static]

Create admin queue.

Parameters:
intelxlIntel device
adminAdmin queue
Return values:
rcReturn status code

Definition at line 132 of file intelxl.c.

References address, intelxl_admin::buffer, DBGC, intelxl_admin::desc, ENOMEM, intelxl_admin::index, INTELXL_ADMIN_BAH, INTELXL_ADMIN_BAL, INTELXL_ADMIN_CMD, INTELXL_ADMIN_HEAD, INTELXL_ADMIN_LEN, INTELXL_ADMIN_LEN_ENABLE, INTELXL_ADMIN_LEN_LEN, INTELXL_ADMIN_NUM_DESC, INTELXL_ADMIN_TAIL, INTELXL_ALIGN, len, malloc_dma(), memset(), intelxl_admin::reg, intelxl_nic::regs, virt_to_bus(), and writel().

Referenced by intelxl_open_admin().

                                                                {
        size_t len = ( sizeof ( admin->desc[0] ) * INTELXL_ADMIN_NUM_DESC );
        void *admin_regs = ( intelxl->regs + admin->reg );
        physaddr_t address;

        /* Allocate admin queue */
        admin->desc = malloc_dma ( ( len + sizeof ( *admin->buffer ) ),
                                   INTELXL_ALIGN );
        if ( ! admin->desc )
                return -ENOMEM;
        admin->buffer = ( ( ( void * ) admin->desc ) + len );

        /* Initialise admin queue */
        memset ( admin->desc, 0, len );

        /* Reset head and tail registers */
        writel ( 0, admin_regs + INTELXL_ADMIN_HEAD );
        writel ( 0, admin_regs + INTELXL_ADMIN_TAIL );

        /* Reset queue index */
        admin->index = 0;

        /* Program queue address */
        address = virt_to_bus ( admin->desc );
        writel ( ( address & 0xffffffffUL ), admin_regs + INTELXL_ADMIN_BAL );
        if ( sizeof ( physaddr_t ) > sizeof ( uint32_t ) ) {
                writel ( ( ( ( uint64_t ) address ) >> 32 ),
                         admin_regs + INTELXL_ADMIN_BAH );
        } else {
                writel ( 0, admin_regs + INTELXL_ADMIN_BAH );
        }

        /* Program queue length and enable queue */
        writel ( ( INTELXL_ADMIN_LEN_LEN ( INTELXL_ADMIN_NUM_DESC ) |
                   INTELXL_ADMIN_LEN_ENABLE ),
                 admin_regs + INTELXL_ADMIN_LEN );

        DBGC ( intelxl, "INTELXL %p A%cQ is at [%08llx,%08llx) buf "
               "[%08llx,%08llx)\n", intelxl,
               ( ( admin->reg == INTELXL_ADMIN_CMD ) ? 'T' : 'R' ),
               ( ( unsigned long long ) address ),
               ( ( unsigned long long ) address + len ),
               ( ( unsigned long long ) virt_to_bus ( admin->buffer ) ),
               ( ( unsigned long long ) ( virt_to_bus ( admin->buffer ) +
                                          sizeof ( admin->buffer[0] ) ) ) );
        return 0;
}
static void intelxl_destroy_admin ( struct intelxl_nic intelxl,
struct intelxl_admin admin 
) [static]

Destroy admin queue.

Parameters:
intelxlIntel device
adminAdmin queue

Definition at line 187 of file intelxl.c.

References intelxl_admin::buffer, intelxl_admin::desc, free_dma(), INTELXL_ADMIN_LEN, INTELXL_ADMIN_NUM_DESC, len, intelxl_admin::reg, intelxl_nic::regs, and writel().

Referenced by intelxl_close_admin(), and intelxl_open_admin().

                                                                  {
        size_t len = ( sizeof ( admin->desc[0] ) * INTELXL_ADMIN_NUM_DESC );
        void *admin_regs = ( intelxl->regs + admin->reg );

        /* Disable queue */
        writel ( 0, admin_regs + INTELXL_ADMIN_LEN );

        /* Free queue */
        free_dma ( admin->desc, ( len + sizeof ( *admin->buffer ) ) );
}
static int intelxl_admin_command ( struct intelxl_nic intelxl,
struct intelxl_admin_descriptor cmd 
) [static]

Issue admin queue command.

Parameters:
intelxlIntel device
cmdCommand descriptor
Return values:
rcReturn status code

Definition at line 206 of file intelxl.c.

References intelxl_admin_params::buffer, buffer, intelxl_admin::buffer, intelxl_nic::command, intelxl_admin_descriptor::cookie, cpu_to_le16, cpu_to_le32, DBGC, DBGC2, DBGC2_HDA, DBGC_HDA, intelxl_admin::desc, EIO, EPROTO, ETIMEDOUT, intelxl_admin_descriptor::flags, intelxl_admin_buffer_params::high, index, intelxl_admin::index, INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_FL_CMP, INTELXL_ADMIN_FL_DD, INTELXL_ADMIN_FL_ERR, INTELXL_ADMIN_MAX_WAIT_MS, INTELXL_ADMIN_NUM_DESC, INTELXL_ADMIN_TAIL, le16_to_cpu, le32_to_cpu, intelxl_admin_buffer_params::low, mdelay(), memcpy(), intelxl_admin_descriptor::params, rc, intelxl_admin::reg, intelxl_nic::regs, intelxl_admin_descriptor::ret, virt_to_bus(), virt_to_phys(), wmb, and writel().

Referenced by intelxl_admin_autoneg(), intelxl_admin_driver(), intelxl_admin_link(), intelxl_admin_promisc(), intelxl_admin_shutdown(), intelxl_admin_switch(), intelxl_admin_version(), and intelxl_admin_vsi().

                                                                          {
        struct intelxl_admin *admin = &intelxl->command;
        void *admin_regs = ( intelxl->regs + admin->reg );
        struct intelxl_admin_descriptor *desc;
        uint64_t buffer;
        unsigned int index;
        unsigned int tail;
        unsigned int i;
        int rc;

        /* Get next queue entry */
        index = admin->index++;
        tail = ( admin->index % INTELXL_ADMIN_NUM_DESC );
        desc = &admin->desc[index % INTELXL_ADMIN_NUM_DESC];

        /* Clear must-be-zero flags */
        cmd->flags &= ~cpu_to_le16 ( INTELXL_ADMIN_FL_DD |
                                     INTELXL_ADMIN_FL_CMP |
                                     INTELXL_ADMIN_FL_ERR );

        /* Clear return value */
        cmd->ret = 0;

        /* Populate cookie */
        cmd->cookie = cpu_to_le32 ( index );

        /* Populate data buffer address if applicable */
        if ( cmd->flags & cpu_to_le16 ( INTELXL_ADMIN_FL_BUF ) ) {
                buffer = virt_to_bus ( admin->buffer );
                cmd->params.buffer.high = cpu_to_le32 ( buffer >> 32 );
                cmd->params.buffer.low = cpu_to_le32 ( buffer & 0xffffffffUL );
        }

        /* Copy command descriptor to queue entry */
        memcpy ( desc, cmd, sizeof ( *desc ) );
        DBGC2 ( intelxl, "INTELXL %p admin command %#x:\n", intelxl, index );
        DBGC2_HDA ( intelxl, virt_to_phys ( desc ), desc, sizeof ( *desc ) );

        /* Post command descriptor */
        wmb();
        writel ( tail, admin_regs + INTELXL_ADMIN_TAIL );

        /* Wait for completion */
        for ( i = 0 ; i < INTELXL_ADMIN_MAX_WAIT_MS ; i++ ) {

                /* If response is not complete, delay 1ms and retry */
                if ( ! ( desc->flags & INTELXL_ADMIN_FL_DD ) ) {
                        mdelay ( 1 );
                        continue;
                }
                DBGC2 ( intelxl, "INTELXL %p admin command %#x response:\n",
                        intelxl, index );
                DBGC2_HDA ( intelxl, virt_to_phys ( desc ), desc,
                            sizeof ( *desc ) );

                /* Check for cookie mismatch */
                if ( desc->cookie != cmd->cookie ) {
                        DBGC ( intelxl, "INTELXL %p admin command %#x bad "
                               "cookie %#x\n", intelxl, index,
                               le32_to_cpu ( desc->cookie ) );
                        rc = -EPROTO;
                        goto err;
                }

                /* Check for errors */
                if ( desc->ret != 0 ) {
                        DBGC ( intelxl, "INTELXL %p admin command %#x error "
                               "%d\n", intelxl, index,
                               le16_to_cpu ( desc->ret ) );
                        rc = -EIO;
                        goto err;
                }

                /* Copy response back to command descriptor */
                memcpy ( cmd, desc, sizeof ( *cmd ) );

                /* Success */
                return 0;
        }

        rc = -ETIMEDOUT;
        DBGC ( intelxl, "INTELXL %p timed out waiting for admin command %#x:\n",
               intelxl, index );
 err:
        DBGC_HDA ( intelxl, virt_to_phys ( desc ), cmd, sizeof ( *cmd ) );
        DBGC_HDA ( intelxl, virt_to_phys ( desc ), desc, sizeof ( *desc ) );
        return rc;
}
static int intelxl_admin_version ( struct intelxl_nic intelxl) [static]

Get firmware version.

Parameters:
intelxlIntel device
Return values:
rcReturn status code

Definition at line 302 of file intelxl.c.

References intelxl_admin_version_params::api, api, cpu_to_le16, DBGC, ENOTSUP, intelxl_admin_version_params::firmware, INTELXL_ADMIN_API_MAJOR, intelxl_admin_command(), INTELXL_ADMIN_VERSION, le16_to_cpu, intelxl_admin_version::major, memset(), intelxl_admin_version::minor, intelxl_admin_descriptor::opcode, intelxl_admin_descriptor::params, rc, intelxl_admin_params::version, and version.

                                                                 {
        struct intelxl_admin_descriptor cmd;
        struct intelxl_admin_version_params *version = &cmd.params.version;
        unsigned int api;
        int rc;

        /* Populate descriptor */
        memset ( &cmd, 0, sizeof ( cmd ) );
        cmd.opcode = cpu_to_le16 ( INTELXL_ADMIN_VERSION );

        /* Issue command */
        if ( ( rc = intelxl_admin_command ( intelxl, &cmd ) ) != 0 )
                return rc;
        api = le16_to_cpu ( version->api.major );
        DBGC ( intelxl, "INTELXL %p firmware v%d.%d API v%d.%d\n",
               intelxl, le16_to_cpu ( version->firmware.major ),
               le16_to_cpu ( version->firmware.minor ),
               api, le16_to_cpu ( version->api.minor ) );

        /* Check for API compatibility */
        if ( api > INTELXL_ADMIN_API_MAJOR ) {
                DBGC ( intelxl, "INTELXL %p unsupported API v%d\n",
                       intelxl, api );
                return -ENOTSUP;
        }

        return 0;
}
static int intelxl_admin_driver ( struct intelxl_nic intelxl) [static]
static int intelxl_admin_shutdown ( struct intelxl_nic intelxl) [static]

Shutdown admin queues.

Parameters:
intelxlIntel device
Return values:
rcReturn status code

Definition at line 367 of file intelxl.c.

References cpu_to_le16, intelxl_admin_command(), INTELXL_ADMIN_SHUTDOWN, INTELXL_ADMIN_SHUTDOWN_UNLOADING, memset(), intelxl_admin_descriptor::opcode, intelxl_admin_descriptor::params, rc, intelxl_admin_params::shutdown, shutdown, and intelxl_admin_shutdown_params::unloading.

Referenced by intelxl_close_admin().

                                                                  {
        struct intelxl_admin_descriptor cmd;
        struct intelxl_admin_shutdown_params *shutdown = &cmd.params.shutdown;
        int rc;

        /* Populate descriptor */
        memset ( &cmd, 0, sizeof ( cmd ) );
        cmd.opcode = cpu_to_le16 ( INTELXL_ADMIN_SHUTDOWN );
        shutdown->unloading = INTELXL_ADMIN_SHUTDOWN_UNLOADING;

        /* Issue command */
        if ( ( rc = intelxl_admin_command ( intelxl, &cmd ) ) != 0 )
                return rc;

        return 0;
}
static int intelxl_admin_switch ( struct intelxl_nic intelxl) [static]

Get switch configuration.

Parameters:
intelxlIntel device
Return values:
rcReturn status code

Definition at line 390 of file intelxl.c.

References intelxl_admin::buffer, intelxl_admin_switch_buffer::cfg, cfg, intelxl_nic::command, intelxl_admin_switch_config::connection, cpu_to_le16, DBGC, DBGC2, DBGC2_HDA, intelxl_admin_switch_config::downlink, ENOENT, intelxl_admin_descriptor::flags, intelxl_admin_command(), INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_SWITCH, INTELXL_ADMIN_SWITCH_TYPE_VSI, le16_to_cpu, intelxl_admin_descriptor::len, memset(), intelxl_admin_switch_params::next, intelxl_admin_descriptor::opcode, intelxl_admin_descriptor::params, rc, intelxl_admin_switch_config::seid, intelxl_admin_params::sw, intelxl_admin_buffer::sw, sw, intelxl_admin_switch_config::type, intelxl_admin_switch_config::uplink, and intelxl_nic::vsi.

Referenced by intelxl_probe().

                                                                {
        struct intelxl_admin_descriptor cmd;
        struct intelxl_admin_switch_params *sw = &cmd.params.sw;
        struct intelxl_admin_switch_buffer *buf = &intelxl->command.buffer->sw;
        struct intelxl_admin_switch_config *cfg = &buf->cfg;
        int rc;

        /* Populate descriptor */
        memset ( &cmd, 0, sizeof ( cmd ) );
        cmd.opcode = cpu_to_le16 ( INTELXL_ADMIN_SWITCH );
        cmd.flags = cpu_to_le16 ( INTELXL_ADMIN_FL_BUF );
        cmd.len = cpu_to_le16 ( sizeof ( *buf ) );

        /* Get each configuration in turn */
        do {
                /* Issue command */
                if ( ( rc = intelxl_admin_command ( intelxl, &cmd ) ) != 0 )
                        return rc;

                /* Dump raw configuration */
                DBGC2 ( intelxl, "INTELXL %p SEID %#04x:\n",
                        intelxl, le16_to_cpu ( cfg->seid ) );
                DBGC2_HDA ( intelxl, 0, cfg, sizeof ( *cfg ) );

                /* Parse response */
                if ( cfg->type == INTELXL_ADMIN_SWITCH_TYPE_VSI ) {
                        intelxl->vsi = le16_to_cpu ( cfg->seid );
                        DBGC ( intelxl, "INTELXL %p VSI %#04x uplink %#04x "
                               "downlink %#04x conn %#02x\n", intelxl,
                               intelxl->vsi, le16_to_cpu ( cfg->uplink ),
                               le16_to_cpu ( cfg->downlink ), cfg->connection );
                }

        } while ( sw->next );

        /* Check that we found a VSI */
        if ( ! intelxl->vsi ) {
                DBGC ( intelxl, "INTELXL %p has no VSI\n", intelxl );
                return -ENOENT;
        }

        return 0;
}
static int intelxl_admin_vsi ( struct intelxl_nic intelxl) [static]

Get VSI parameters.

Parameters:
intelxlIntel device
Return values:
rcReturn status code

Definition at line 440 of file intelxl.c.

References intelxl_admin::buffer, intelxl_nic::command, cpu_to_le16, DBGC, intelxl_admin_descriptor::flags, intelxl_admin_command(), INTELXL_ADMIN_FL_BUF, INTELXL_ADMIN_VSI, le16_to_cpu, intelxl_admin_descriptor::len, memset(), intelxl_admin_descriptor::opcode, intelxl_admin_descriptor::params, intelxl_admin_vsi_buffer::qset, intelxl_nic::qset, intelxl_admin_vsi_buffer::queue, intelxl_nic::queue, rc, intelxl_admin_vsi_params::vsi, vsi, intelxl_admin_params::vsi, intelxl_admin_buffer::vsi, and intelxl_nic::vsi.

Referenced by intelxl_probe().

                                                             {
        struct intelxl_admin_descriptor cmd;
        struct intelxl_admin_vsi_params *vsi = &cmd.params.vsi;
        struct intelxl_admin_vsi_buffer *buf = &intelxl->command.buffer->vsi;
        int rc;

        /* Populate descriptor */
        memset ( &cmd, 0, sizeof ( cmd ) );
        cmd.opcode = cpu_to_le16 ( INTELXL_ADMIN_VSI );
        cmd.flags = cpu_to_le16 ( INTELXL_ADMIN_FL_BUF );
        cmd.len = cpu_to_le16 ( sizeof ( *buf ) );
        vsi->vsi = cpu_to_le16 ( intelxl->vsi );

        /* Issue command */
        if ( ( rc = intelxl_admin_command ( intelxl, &cmd ) ) != 0 )
                return rc;

        /* Parse response */
        intelxl->queue = le16_to_cpu ( buf->queue[0] );
        intelxl->qset = le16_to_cpu ( buf->qset[0] );
        DBGC ( intelxl, "INTELXL %p VSI %#04x queue %#04x qset %#04x\n",
               intelxl, intelxl->vsi, intelxl->queue, intelxl->qset );

        return 0;
}
static int intelxl_admin_promisc ( struct intelxl_nic intelxl) [static]
static int intelxl_admin_autoneg ( struct intelxl_nic intelxl) [static]

Restart autonegotiation.

Parameters:
intelxlIntel device
Return values:
rcReturn status code

Definition at line 502 of file intelxl.c.

References intelxl_admin_params::autoneg, autoneg, cpu_to_le16, intelxl_admin_autoneg_params::flags, INTELXL_ADMIN_AUTONEG, INTELXL_ADMIN_AUTONEG_FL_ENABLE, INTELXL_ADMIN_AUTONEG_FL_RESTART, intelxl_admin_command(), memset(), intelxl_admin_descriptor::opcode, intelxl_admin_descriptor::params, and rc.

Referenced by intelxl_open().

                                                                 {
        struct intelxl_admin_descriptor cmd;
        struct intelxl_admin_autoneg_params *autoneg = &cmd.params.autoneg;
        int rc;

        /* Populate descriptor */
        memset ( &cmd, 0, sizeof ( cmd ) );
        cmd.opcode = cpu_to_le16 ( INTELXL_ADMIN_AUTONEG );
        autoneg->flags = ( INTELXL_ADMIN_AUTONEG_FL_RESTART |
                           INTELXL_ADMIN_AUTONEG_FL_ENABLE );

        /* Issue command */
        if ( ( rc = intelxl_admin_command ( intelxl, &cmd ) ) != 0 )
                return rc;

        return 0;
}
static int intelxl_admin_link ( struct net_device netdev) [static]

Get link status.

Parameters:
netdevNetwork device
Return values:
rcReturn status code

Definition at line 526 of file intelxl.c.

References cpu_to_le16, DBGC, intelxl_admin_command(), INTELXL_ADMIN_LINK, INTELXL_ADMIN_LINK_NOTIFY, INTELXL_ADMIN_LINK_UP, link, intelxl_admin_params::link, memset(), netdev_link_down(), netdev_link_up(), intelxl_admin_link_params::notify, intelxl_admin_descriptor::opcode, intelxl_admin_descriptor::params, intelxl_admin_link_params::phy, net_device::priv, rc, intelxl_admin_link_params::speed, and intelxl_admin_link_params::status.

Referenced by intelxl_open(), intelxl_poll_admin(), and intelxl_probe().

                                                            {
        struct intelxl_nic *intelxl = netdev->priv;
        struct intelxl_admin_descriptor cmd;
        struct intelxl_admin_link_params *link = &cmd.params.link;
        int rc;

        /* Populate descriptor */
        memset ( &cmd, 0, sizeof ( cmd ) );
        cmd.opcode = cpu_to_le16 ( INTELXL_ADMIN_LINK );
        link->notify = INTELXL_ADMIN_LINK_NOTIFY;

        /* Issue command */
        if ( ( rc = intelxl_admin_command ( intelxl, &cmd ) ) != 0 )
                return rc;
        DBGC ( intelxl, "INTELXL %p PHY %#02x speed %#02x status %#02x\n",
               intelxl, link->phy, link->speed, link->status );

        /* Update network device */
        if ( link->status & INTELXL_ADMIN_LINK_UP ) {
                netdev_link_up ( netdev );
        } else {
                netdev_link_down ( netdev );
        }

        return 0;
}
static void intelxl_refill_admin ( struct intelxl_nic intelxl) [static]

Refill admin event queue.

Parameters:
intelxlIntel device

Definition at line 558 of file intelxl.c.

References intelxl_nic::event, intelxl_admin::index, INTELXL_ADMIN_NUM_DESC, INTELXL_ADMIN_TAIL, intelxl_admin::reg, intelxl_nic::regs, and writel().

Referenced by intelxl_open_admin(), and intelxl_poll_admin().

                                                                 {
        struct intelxl_admin *admin = &intelxl->event;
        void *admin_regs = ( intelxl->regs + admin->reg );
        unsigned int tail;

        /* Update tail pointer */
        tail = ( ( admin->index + INTELXL_ADMIN_NUM_DESC - 1 ) %
                 INTELXL_ADMIN_NUM_DESC );
        writel ( tail, admin_regs + INTELXL_ADMIN_TAIL );
}
static void intelxl_poll_admin ( struct net_device netdev) [static]

Poll admin event queue.

Parameters:
netdevNetwork device

Definition at line 574 of file intelxl.c.

References cpu_to_le16, DBGC, DBGC2, DBGC2_HDA, intelxl_admin::desc, intelxl_nic::event, intelxl_admin_descriptor::flags, intelxl_admin::index, INTELXL_ADMIN_FL_DD, INTELXL_ADMIN_LINK, intelxl_admin_link(), INTELXL_ADMIN_NUM_DESC, intelxl_refill_admin(), le16_to_cpu, intelxl_admin_descriptor::opcode, net_device::priv, virt_to_phys(), and wmb.

Referenced by intelxl_poll().

                                                             {
        struct intelxl_nic *intelxl = netdev->priv;
        struct intelxl_admin *admin = &intelxl->event;
        struct intelxl_admin_descriptor *desc;

        /* Check for events */
        while ( 1 ) {

                /* Get next event descriptor */
                desc = &admin->desc[admin->index % INTELXL_ADMIN_NUM_DESC];

                /* Stop if descriptor is not yet completed */
                if ( ! ( desc->flags & INTELXL_ADMIN_FL_DD ) )
                        return;
                DBGC2 ( intelxl, "INTELXL %p admin event %#x:\n",
                        intelxl, admin->index );
                DBGC2_HDA ( intelxl, virt_to_phys ( desc ), desc,
                            sizeof ( *desc ) );

                /* Handle event */
                switch ( desc->opcode ) {
                case cpu_to_le16 ( INTELXL_ADMIN_LINK ):
                        intelxl_admin_link ( netdev );
                        break;
                default:
                        DBGC ( intelxl, "INTELXL %p admin event %#x "
                               "unrecognised opcode %#04x\n", intelxl,
                               admin->index, le16_to_cpu ( desc->opcode ) );
                        break;
                }

                /* Clear event completion flag */
                desc->flags = 0;
                wmb();

                /* Update index and refill queue */
                admin->index++;
                intelxl_refill_admin ( intelxl );
        }
}
static int intelxl_open_admin ( struct intelxl_nic intelxl) [static]

Open admin queues.

Parameters:
intelxlIntel device
Return values:
rcReturn status code

Definition at line 621 of file intelxl.c.

References intelxl_nic::command, intelxl_nic::event, intelxl_admin_driver(), intelxl_create_admin(), intelxl_destroy_admin(), intelxl_refill_admin(), and rc.

Referenced by intelxl_probe().

                                                              {
        int rc;

        /* Create admin event queue */
        if ( ( rc = intelxl_create_admin ( intelxl, &intelxl->event ) ) != 0 )
                goto err_create_event;

        /* Create admin command queue */
        if ( ( rc = intelxl_create_admin ( intelxl, &intelxl->command ) ) != 0 )
                goto err_create_command;

        /* Post all descriptors to event queue */
        intelxl_refill_admin ( intelxl );

        /* Get firmware version */
        if ( ( rc = intelxl_admin_version ( intelxl ) ) != 0 )
                goto err_version;

        /* Report driver version */
        if ( ( rc = intelxl_admin_driver ( intelxl ) ) != 0 )
                goto err_driver;

        return 0;

 err_driver:
 err_version:
        intelxl_destroy_admin ( intelxl, &intelxl->command );
 err_create_command:
        intelxl_destroy_admin ( intelxl, &intelxl->event );
 err_create_event:
        return rc;
}
static void intelxl_close_admin ( struct intelxl_nic intelxl) [static]

Close admin queues.

Parameters:
intelxlIntel device

Definition at line 659 of file intelxl.c.

References intelxl_nic::command, intelxl_nic::event, intelxl_admin_shutdown(), and intelxl_destroy_admin().

Referenced by intelxl_probe(), and intelxl_remove().

                                                                {

        /* Shut down admin queues */
        intelxl_admin_shutdown ( intelxl );

        /* Destroy admin command queue */
        intelxl_destroy_admin ( intelxl, &intelxl->command );

        /* Destroy admin event queue */
        intelxl_destroy_admin ( intelxl, &intelxl->event );
}
static void intelxl_context_dump ( struct intelxl_nic intelxl,
uint32_t  op,
size_t  len 
) [static]

Dump queue context (for debugging)

Parameters:
intelxlIntel device
opContext operation
lenSize of context

Definition at line 686 of file intelxl.c.

References DBG_EXTRA, DBGC2, DBGC2_HDA, index, intelxl_context_line(), INTELXL_CTX_MAX_WAIT_MS, INTELXL_PFCM_LANCTXCTL, INTELXL_PFCM_LANCTXCTL_OP_CODE_READ, INTELXL_PFCM_LANCTXCTL_QUEUE_NUM, INTELXL_PFCM_LANCTXCTL_SUB_LINE, INTELXL_PFCM_LANCTXDATA, INTELXL_PFCM_LANCTXSTAT, INTELXL_PFCM_LANCTXSTAT_DONE, len, mdelay(), op, queue, readl(), and writel().

Referenced by intelxl_close().

                                                                              {
        struct intelxl_context_line line;
        uint32_t pfcm_lanctxctl;
        uint32_t pfcm_lanctxstat;
        unsigned int queue;
        unsigned int index;
        unsigned int i;

        /* Do nothing unless debug output is enabled */
        if ( ! DBG_EXTRA )
                return;

        /* Dump context */
        DBGC2 ( intelxl, "INTELXL %p context %#08x:\n", intelxl, op );
        for ( index = 0 ; ( sizeof ( line ) * index ) < len ; index++ ) {

                /* Start context operation */
                queue = ( intelxl->base + intelxl->queue );
                pfcm_lanctxctl =
                        ( INTELXL_PFCM_LANCTXCTL_QUEUE_NUM ( queue ) |
                          INTELXL_PFCM_LANCTXCTL_SUB_LINE ( index ) |
                          INTELXL_PFCM_LANCTXCTL_OP_CODE_READ | op );
                writel ( pfcm_lanctxctl,
                         intelxl->regs + INTELXL_PFCM_LANCTXCTL );

                /* Wait for operation to complete */
                for ( i = 0 ; i < INTELXL_CTX_MAX_WAIT_MS ; i++ ) {

                        /* Check if operation is complete */
                        pfcm_lanctxstat = readl ( intelxl->regs +
                                                  INTELXL_PFCM_LANCTXSTAT );
                        if ( pfcm_lanctxstat & INTELXL_PFCM_LANCTXSTAT_DONE )
                                break;

                        /* Delay */
                        mdelay ( 1 );
                }

                /* Read context data */
                for ( i = 0 ; i < ( sizeof ( line ) /
                                    sizeof ( line.raw[0] ) ) ; i++ ) {
                        line.raw[i] = readl ( intelxl->regs +
                                              INTELXL_PFCM_LANCTXDATA ( i ) );
                }
                DBGC2_HDA ( intelxl, ( sizeof ( line ) * index ),
                            &line, sizeof ( line ) );
        }
}
static int intelxl_context_line ( struct intelxl_nic intelxl,
struct intelxl_context_line line,
unsigned int  index,
uint32_t  op 
) [static]

Program queue context line.

Parameters:
intelxlIntel device
lineQueue context line
indexLine number
opContext operation
Return values:
rcReturn status code

Definition at line 744 of file intelxl.c.

References intelxl_nic::base, DBGC, ETIMEDOUT, INTELXL_CTX_MAX_WAIT_MS, INTELXL_PFCM_LANCTXCTL, INTELXL_PFCM_LANCTXCTL_OP_CODE_WRITE, INTELXL_PFCM_LANCTXCTL_QUEUE_NUM, INTELXL_PFCM_LANCTXCTL_SUB_LINE, INTELXL_PFCM_LANCTXDATA, INTELXL_PFCM_LANCTXSTAT, INTELXL_PFCM_LANCTXSTAT_DONE, le32_to_cpu, mdelay(), op, queue, intelxl_nic::queue, readl(), intelxl_nic::regs, and writel().

Referenced by intelxl_context(), intelxl_context_dump(), intelxl_context_rx(), and intelxl_context_tx().

                                                                    {
        uint32_t pfcm_lanctxctl;
        uint32_t pfcm_lanctxstat;
        unsigned int queue;
        unsigned int i;

        /* Write context data */
        for ( i = 0; i < ( sizeof ( *line ) / sizeof ( line->raw[0] ) ); i++ ) {
                writel ( le32_to_cpu ( line->raw[i] ),
                         intelxl->regs + INTELXL_PFCM_LANCTXDATA ( i ) );
        }

        /* Start context operation */
        queue = ( intelxl->base + intelxl->queue );
        pfcm_lanctxctl = ( INTELXL_PFCM_LANCTXCTL_QUEUE_NUM ( queue ) |
                           INTELXL_PFCM_LANCTXCTL_SUB_LINE ( index ) |
                           INTELXL_PFCM_LANCTXCTL_OP_CODE_WRITE | op );
        writel ( pfcm_lanctxctl, intelxl->regs + INTELXL_PFCM_LANCTXCTL );

        /* Wait for operation to complete */
        for ( i = 0 ; i < INTELXL_CTX_MAX_WAIT_MS ; i++ ) {

                /* Check if operation is complete */
                pfcm_lanctxstat = readl ( intelxl->regs +
                                          INTELXL_PFCM_LANCTXSTAT );
                if ( pfcm_lanctxstat & INTELXL_PFCM_LANCTXSTAT_DONE )
                        return 0;

                /* Delay */
                mdelay ( 1 );
        }

        DBGC ( intelxl, "INTELXL %p timed out waiting for context: %#08x\n",
               intelxl, pfcm_lanctxctl );
        return -ETIMEDOUT;
}
static int intelxl_context ( struct intelxl_nic intelxl,
struct intelxl_context_line line,
size_t  len,
uint32_t  op 
) [static]

Program queue context.

Parameters:
intelxlIntel device
lineQueue context lines
lenSize of context
opContext operation
Return values:
rcReturn status code

Definition at line 792 of file intelxl.c.

References DBGC2, DBGC2_HDA, index, intelxl_context_line(), and rc.

Referenced by intelxl_context_rx(), and intelxl_context_tx().

                                                       {
        unsigned int index;
        int rc;

        DBGC2 ( intelxl, "INTELXL %p context %#08x len %#zx:\n",
                intelxl, op, len );
        DBGC2_HDA ( intelxl, 0, line, len );

        /* Program one line at a time */
        for ( index = 0 ; ( sizeof ( *line ) * index ) < len ; index++ ) {
                if ( ( rc = intelxl_context_line ( intelxl, line++, index,
                                                   op ) ) != 0 )
                        return rc;
        }

        return 0;
}
static int intelxl_context_tx ( struct intelxl_nic intelxl,
physaddr_t  address 
) [static]

Program transmit queue context.

Parameters:
intelxlIntel device
addressDescriptor ring base address
Return values:
rcReturn status code

Definition at line 819 of file intelxl.c.

References cpu_to_le16, cpu_to_le64, ctx, intelxl_context(), intelxl_context_line(), INTELXL_CTX_TX_BASE, INTELXL_CTX_TX_COUNT, INTELXL_CTX_TX_FL_NEW, INTELXL_CTX_TX_QSET, INTELXL_PFCM_LANCTXCTL_TYPE_TX, INTELXL_TX_NUM_DESC, memset(), intelxl_nic::qset, and rc.

                                                     {
        union {
                struct intelxl_context_tx tx;
                struct intelxl_context_line line;
        } ctx;
        int rc;

        /* Initialise context */
        memset ( &ctx, 0, sizeof ( ctx ) );
        ctx.tx.flags = cpu_to_le16 ( INTELXL_CTX_TX_FL_NEW );
        ctx.tx.base = cpu_to_le64 ( INTELXL_CTX_TX_BASE ( address ) );
        ctx.tx.count =
                cpu_to_le16 ( INTELXL_CTX_TX_COUNT ( INTELXL_TX_NUM_DESC ) );
        ctx.tx.qset = INTELXL_CTX_TX_QSET ( intelxl->qset );

        /* Program context */
        if ( ( rc = intelxl_context ( intelxl, &ctx.line, sizeof ( ctx ),
                                      INTELXL_PFCM_LANCTXCTL_TYPE_TX ) ) != 0 )
                return rc;

        return 0;
}
static int intelxl_context_rx ( struct intelxl_nic intelxl,
physaddr_t  address 
) [static]

Program receive queue context.

Parameters:
intelxlIntel device
addressDescriptor ring base address
Return values:
rcReturn status code

Definition at line 850 of file intelxl.c.

References base_count, cpu_to_le16, cpu_to_le64, ctx, intelxl_context(), intelxl_context_line(), INTELXL_CTX_RX_BASE_COUNT, INTELXL_CTX_RX_FL_CRCSTRIP, INTELXL_CTX_RX_LEN, INTELXL_CTX_RX_MFS, INTELXL_PFCM_LANCTXCTL_TYPE_RX, INTELXL_RX_NUM_DESC, memset(), intelxl_nic::mfs, and rc.

                                                     {
        union {
                struct intelxl_context_rx rx;
                struct intelxl_context_line line;
        } ctx;
        uint64_t base_count;
        int rc;

        /* Initialise context */
        memset ( &ctx, 0, sizeof ( ctx ) );
        base_count = INTELXL_CTX_RX_BASE_COUNT ( address, INTELXL_RX_NUM_DESC );
        ctx.rx.base_count = cpu_to_le64 ( base_count );
        ctx.rx.len = cpu_to_le16 ( INTELXL_CTX_RX_LEN ( intelxl->mfs ) );
        ctx.rx.flags = INTELXL_CTX_RX_FL_CRCSTRIP;
        ctx.rx.mfs = cpu_to_le16 ( INTELXL_CTX_RX_MFS ( intelxl->mfs ) );

        /* Program context */
        if ( ( rc = intelxl_context ( intelxl, &ctx.line, sizeof ( ctx ),
                                      INTELXL_PFCM_LANCTXCTL_TYPE_RX ) ) != 0 )
                return rc;

        return 0;
}
static int intelxl_enable_ring ( struct intelxl_nic intelxl,
struct intelxl_ring ring 
) [static]

Enable descriptor ring.

Parameters:
intelxlIntel device
ringDescriptor ring
Return values:
rcReturn status code

Definition at line 882 of file intelxl.c.

References DBGC, EIO, INTELXL_QUEUE_ENABLE_DELAY_US, INTELXL_QXX_ENA, INTELXL_QXX_ENA_REQ, INTELXL_QXX_ENA_STAT, readl(), intelxl_ring::reg, intelxl_nic::regs, udelay(), and writel().

Referenced by intelxl_create_ring().

                                                             {
        void *ring_regs = ( intelxl->regs + ring->reg );
        uint32_t qxx_ena;

        /* Enable ring */
        writel ( INTELXL_QXX_ENA_REQ, ( ring_regs + INTELXL_QXX_ENA ) );
        udelay ( INTELXL_QUEUE_ENABLE_DELAY_US );
        qxx_ena = readl ( ring_regs + INTELXL_QXX_ENA );
        if ( ! ( qxx_ena & INTELXL_QXX_ENA_STAT ) ) {
                DBGC ( intelxl, "INTELXL %p ring %06x failed to enable: "
                       "%#08x\n", intelxl, ring->reg, qxx_ena );
                return -EIO;
        }

        return 0;
}
static int intelxl_disable_ring ( struct intelxl_nic intelxl,
struct intelxl_ring ring 
) [static]

Disable descriptor ring.

Parameters:
intelxlIntel device
ringDescriptor ring
Return values:
rcReturn status code

Definition at line 907 of file intelxl.c.

References DBGC, ETIMEDOUT, INTELXL_QUEUE_DISABLE_MAX_WAIT_MS, INTELXL_QXX_ENA, INTELXL_QXX_ENA_STAT, mdelay(), readl(), intelxl_ring::reg, intelxl_nic::regs, and writel().

Referenced by intelxl_create_ring(), and intelxl_destroy_ring().

                                                              {
        void *ring_regs = ( intelxl->regs + ring->reg );
        uint32_t qxx_ena;
        unsigned int i;

        /* Disable ring */
        writel ( 0, ( ring_regs + INTELXL_QXX_ENA ) );

        /* Wait for ring to be disabled */
        for ( i = 0 ; i < INTELXL_QUEUE_DISABLE_MAX_WAIT_MS ; i++ ) {

                /* Check if ring is disabled */
                qxx_ena = readl ( ring_regs + INTELXL_QXX_ENA );
                if ( ! ( qxx_ena & INTELXL_QXX_ENA_STAT ) )
                        return 0;

                /* Delay */
                mdelay ( 1 );
        }

        DBGC ( intelxl, "INTELXL %p ring %06x timed out waiting for disable: "
               "%#08x\n", intelxl, ring->reg, qxx_ena );
        return -ETIMEDOUT;
}
static int intelxl_create_ring ( struct intelxl_nic intelxl,
struct intelxl_ring ring 
) [static]

Create descriptor ring.

Parameters:
intelxlIntel device
ringDescriptor ring
Return values:
rcReturn status code

Definition at line 940 of file intelxl.c.

References address, intelxl_ring::cons, intelxl_ring::context, DBGC, intelxl_ring::desc, ENOMEM, free_dma(), INTELXL_ALIGN, intelxl_disable_ring(), intelxl_enable_ring(), INTELXL_QXX_TAIL, intelxl_ring::len, malloc_dma(), memset(), intelxl_ring::prod, rc, intelxl_ring::reg, intelxl_nic::regs, virt_to_bus(), and writel().

Referenced by intelxl_open().

                                                             {
        void *ring_regs = ( intelxl->regs + ring->reg );
        physaddr_t address;
        int rc;

        /* Allocate descriptor ring */
        ring->desc = malloc_dma ( ring->len, INTELXL_ALIGN );
        if ( ! ring->desc ) {
                rc = -ENOMEM;
                goto err_alloc;
        }

        /* Initialise descriptor ring */
        memset ( ring->desc, 0, ring->len );

        /* Reset tail pointer */
        writel ( 0, ( ring_regs + INTELXL_QXX_TAIL ) );

        /* Program queue context */
        address = virt_to_bus ( ring->desc );
        if ( ( rc = ring->context ( intelxl, address ) ) != 0 )
                goto err_context;

        /* Enable ring */
        if ( ( rc = intelxl_enable_ring ( intelxl, ring ) ) != 0 )
                goto err_enable;

        /* Reset counters */
        ring->prod = 0;
        ring->cons = 0;

        DBGC ( intelxl, "INTELXL %p ring %06x is at [%08llx,%08llx)\n",
               intelxl, ring->reg, ( ( unsigned long long ) address ),
               ( ( unsigned long long ) address + ring->len ) );

        return 0;

        intelxl_disable_ring ( intelxl, ring );
 err_enable:
 err_context:
        free_dma ( ring->desc, ring->len );
 err_alloc:
        return rc;
}
static void intelxl_destroy_ring ( struct intelxl_nic intelxl,
struct intelxl_ring ring 
) [static]

Destroy descriptor ring.

Parameters:
intelxlIntel device
ringDescriptor ring

Definition at line 992 of file intelxl.c.

References intelxl_ring::desc, free_dma(), intelxl_disable_ring(), intelxl_ring::len, NULL, and rc.

Referenced by intelxl_close(), and intelxl_open().

                                                               {
        int rc;

        /* Disable ring */
        if ( ( rc = intelxl_disable_ring ( intelxl, ring ) ) != 0 ) {
                /* Leak memory; there's nothing else we can do */
                return;
        }

        /* Free descriptor ring */
        free_dma ( ring->desc, ring->len );
        ring->desc = NULL;
}
static void intelxl_refill_rx ( struct intelxl_nic intelxl) [static]

Refill receive descriptor ring.

Parameters:
intelxlIntel device

Definition at line 1012 of file intelxl.c.

References address, intelxl_rx_data_descriptor::address, alloc_iob(), assert, intelxl_ring::cons, cpu_to_le64, io_buffer::data, DBGC2, intelxl_ring::desc, intelxl_rx_data_descriptor::flags, INTELXL_QXX_TAIL, INTELXL_RX_FILL, INTELXL_RX_NUM_DESC, intelxl_nic::mfs, NULL, intelxl_ring::prod, intelxl_ring::reg, intelxl_nic::regs, rx, intelxl_descriptor::rx, intelxl_nic::rx, intelxl_nic::rx_iobuf, virt_to_bus(), wmb, and writel().

Referenced by intelxl_open(), and intelxl_poll().

                                                              {
        struct intelxl_rx_data_descriptor *rx;
        struct io_buffer *iobuf;
        unsigned int rx_idx;
        unsigned int rx_tail;
        physaddr_t address;
        unsigned int refilled = 0;

        /* Refill ring */
        while ( ( intelxl->rx.prod - intelxl->rx.cons ) < INTELXL_RX_FILL ) {

                /* Allocate I/O buffer */
                iobuf = alloc_iob ( intelxl->mfs );
                if ( ! iobuf ) {
                        /* Wait for next refill */
                        break;
                }

                /* Get next receive descriptor */
                rx_idx = ( intelxl->rx.prod++ % INTELXL_RX_NUM_DESC );
                rx = &intelxl->rx.desc[rx_idx].rx;

                /* Populate receive descriptor */
                address = virt_to_bus ( iobuf->data );
                rx->address = cpu_to_le64 ( address );
                rx->flags = 0;

                /* Record I/O buffer */
                assert ( intelxl->rx_iobuf[rx_idx] == NULL );
                intelxl->rx_iobuf[rx_idx] = iobuf;

                DBGC2 ( intelxl, "INTELXL %p RX %d is [%llx,%llx)\n", intelxl,
                        rx_idx, ( ( unsigned long long ) address ),
                        ( ( unsigned long long ) address + intelxl->mfs ) );
                refilled++;
        }

        /* Push descriptors to card, if applicable */
        if ( refilled ) {
                wmb();
                rx_tail = ( intelxl->rx.prod % INTELXL_RX_NUM_DESC );
                writel ( rx_tail,
                         ( intelxl->regs + intelxl->rx.reg + INTELXL_QXX_TAIL));
        }
}
static int intelxl_open ( struct net_device netdev) [static]

Open network device.

Parameters:
netdevNetwork device
Return values:
rcReturn status code

Definition at line 1071 of file intelxl.c.

References intelxl_nic::base, ETH_HLEN, intelxl_receive_address::high, intelxl_admin_autoneg(), intelxl_admin_link(), INTELXL_ALIGN, intelxl_create_ring(), intelxl_destroy_ring(), INTELXL_GLLAN_TXPRE_QDIS, INTELXL_GLLAN_TXPRE_QDIS_CLEAR_QDIS, INTELXL_GLLAN_TXPRE_QDIS_QINDX, INTELXL_GLLAN_TXPRE_QDIS_SET_QDIS, INTELXL_PRTGL_SAH, INTELXL_PRTGL_SAH_MFS_SET, INTELXL_PRTGL_SAL, INTELXL_QTX_HEAD, INTELXL_QUEUE_PRE_DISABLE_DELAY_US, INTELXL_QXX_CTL, INTELXL_QXX_CTL_PFVF_PF_INDX, INTELXL_QXX_CTL_PFVF_Q_PF, intelxl_refill_rx(), le32_to_cpu, net_device::ll_addr, intelxl_receive_address::low, memcpy(), memset(), intelxl_nic::mfs, net_device::mtu, intelxl_nic::pf, net_device::priv, queue, intelxl_nic::queue, intelxl_receive_address::raw, rc, intelxl_ring::reg, intelxl_nic::regs, intelxl_nic::rx, intelxl_nic::tx, udelay(), and writel().

                                                      {
        struct intelxl_nic *intelxl = netdev->priv;
        union intelxl_receive_address mac;
        unsigned int queue;
        uint32_t prtgl_sal;
        uint32_t prtgl_sah;
        int rc;

        /* Calculate maximum frame size */
        intelxl->mfs = ( ( ETH_HLEN + netdev->mtu + 4 /* CRC */ +
                           INTELXL_ALIGN - 1 ) & ~( INTELXL_ALIGN - 1 ) );

        /* Program MAC address and maximum frame size */
        memset ( &mac, 0, sizeof ( mac ) );
        memcpy ( mac.raw, netdev->ll_addr, sizeof ( mac.raw ) );
        prtgl_sal = le32_to_cpu ( mac.reg.low );
        prtgl_sah = ( le32_to_cpu ( mac.reg.high ) |
                      INTELXL_PRTGL_SAH_MFS_SET ( intelxl->mfs ) );
        writel ( prtgl_sal, intelxl->regs + INTELXL_PRTGL_SAL );
        writel ( prtgl_sah, intelxl->regs + INTELXL_PRTGL_SAH );

        /* Associate transmit queue to PF */
        writel ( ( INTELXL_QXX_CTL_PFVF_Q_PF |
                   INTELXL_QXX_CTL_PFVF_PF_INDX ( intelxl->pf ) ),
                 ( intelxl->regs + intelxl->tx.reg + INTELXL_QXX_CTL ) );

        /* Clear transmit pre queue disable */
        queue = ( intelxl->base + intelxl->queue );
        writel ( ( INTELXL_GLLAN_TXPRE_QDIS_CLEAR_QDIS |
                   INTELXL_GLLAN_TXPRE_QDIS_QINDX ( queue ) ),
                 ( intelxl->regs + INTELXL_GLLAN_TXPRE_QDIS ( queue ) ) );

        /* Reset transmit queue head */
        writel ( 0, ( intelxl->regs + INTELXL_QTX_HEAD ( intelxl->queue ) ) );

        /* Create receive descriptor ring */
        if ( ( rc = intelxl_create_ring ( intelxl, &intelxl->rx ) ) != 0 )
                goto err_create_rx;

        /* Create transmit descriptor ring */
        if ( ( rc = intelxl_create_ring ( intelxl, &intelxl->tx ) ) != 0 )
                goto err_create_tx;

        /* Fill receive ring */
        intelxl_refill_rx ( intelxl );

        /* Restart autonegotiation */
        intelxl_admin_autoneg ( intelxl );

        /* Update link state */
        intelxl_admin_link ( netdev );

        return 0;

        writel ( ( INTELXL_GLLAN_TXPRE_QDIS_SET_QDIS |
                   INTELXL_GLLAN_TXPRE_QDIS_QINDX ( queue ) ),
                 ( intelxl->regs + INTELXL_GLLAN_TXPRE_QDIS ( queue ) ) );
        udelay ( INTELXL_QUEUE_PRE_DISABLE_DELAY_US );
        intelxl_destroy_ring ( intelxl, &intelxl->tx );
 err_create_tx:
        intelxl_destroy_ring ( intelxl, &intelxl->rx );
 err_create_rx:
        return rc;
}
static void intelxl_close ( struct net_device netdev) [static]

Close network device.

Parameters:
netdevNetwork device

Definition at line 1141 of file intelxl.c.

References intelxl_nic::base, free_iob(), intelxl_context_dump(), intelxl_destroy_ring(), INTELXL_GLLAN_TXPRE_QDIS, INTELXL_GLLAN_TXPRE_QDIS_QINDX, INTELXL_GLLAN_TXPRE_QDIS_SET_QDIS, INTELXL_PFCM_LANCTXCTL_TYPE_RX, INTELXL_PFCM_LANCTXCTL_TYPE_TX, INTELXL_QUEUE_PRE_DISABLE_DELAY_US, INTELXL_RX_NUM_DESC, NULL, net_device::priv, queue, intelxl_nic::queue, intelxl_nic::regs, intelxl_nic::rx, intelxl_nic::rx_iobuf, intelxl_nic::tx, udelay(), and writel().

                                                        {
        struct intelxl_nic *intelxl = netdev->priv;
        unsigned int queue;
        unsigned int i;

        /* Dump contexts (for debugging) */
        intelxl_context_dump ( intelxl, INTELXL_PFCM_LANCTXCTL_TYPE_TX,
                               sizeof ( struct intelxl_context_tx ) );
        intelxl_context_dump ( intelxl, INTELXL_PFCM_LANCTXCTL_TYPE_RX,
                               sizeof ( struct intelxl_context_rx ) );

        /* Pre-disable transmit queue */
        queue = ( intelxl->base + intelxl->queue );
        writel ( ( INTELXL_GLLAN_TXPRE_QDIS_SET_QDIS |
                   INTELXL_GLLAN_TXPRE_QDIS_QINDX ( queue ) ),
                 ( intelxl->regs + INTELXL_GLLAN_TXPRE_QDIS ( queue ) ) );
        udelay ( INTELXL_QUEUE_PRE_DISABLE_DELAY_US );

        /* Destroy transmit descriptor ring */
        intelxl_destroy_ring ( intelxl, &intelxl->tx );

        /* Destroy receive descriptor ring */
        intelxl_destroy_ring ( intelxl, &intelxl->rx );

        /* Discard any unused receive buffers */
        for ( i = 0 ; i < INTELXL_RX_NUM_DESC ; i++ ) {
                if ( intelxl->rx_iobuf[i] )
                        free_iob ( intelxl->rx_iobuf[i] );
                intelxl->rx_iobuf[i] = NULL;
        }
}
static int intelxl_transmit ( struct net_device netdev,
struct io_buffer iobuf 
) [static]

Transmit packet.

Parameters:
netdevNetwork device
iobufI/O buffer
Return values:
rcReturn status code

Definition at line 1180 of file intelxl.c.

References address, intelxl_tx_data_descriptor::address, intelxl_ring::cons, cpu_to_le32, cpu_to_le64, io_buffer::data, DBGC, DBGC2, intelxl_ring::desc, ENOBUFS, intelxl_tx_data_descriptor::flags, INTELXL_QXX_TAIL, INTELXL_TX_DATA_DTYP, INTELXL_TX_DATA_EOP, INTELXL_TX_DATA_JFDI, INTELXL_TX_DATA_LEN, INTELXL_TX_DATA_RS, INTELXL_TX_FILL, INTELXL_TX_NUM_DESC, iob_len(), len, intelxl_tx_data_descriptor::len, net_device::priv, intelxl_ring::prod, intelxl_ring::reg, intelxl_nic::regs, tx, intelxl_descriptor::tx, intelxl_nic::tx, virt_to_bus(), wmb, and writel().

                                                        {
        struct intelxl_nic *intelxl = netdev->priv;
        struct intelxl_tx_data_descriptor *tx;
        unsigned int tx_idx;
        unsigned int tx_tail;
        physaddr_t address;
        size_t len;

        /* Get next transmit descriptor */
        if ( ( intelxl->tx.prod - intelxl->tx.cons ) >= INTELXL_TX_FILL ) {
                DBGC ( intelxl, "INTELXL %p out of transmit descriptors\n",
                       intelxl );
                return -ENOBUFS;
        }
        tx_idx = ( intelxl->tx.prod++ % INTELXL_TX_NUM_DESC );
        tx_tail = ( intelxl->tx.prod % INTELXL_TX_NUM_DESC );
        tx = &intelxl->tx.desc[tx_idx].tx;

        /* Populate transmit descriptor */
        address = virt_to_bus ( iobuf->data );
        len = iob_len ( iobuf );
        tx->address = cpu_to_le64 ( address );
        tx->len = cpu_to_le32 ( INTELXL_TX_DATA_LEN ( len ) );
        tx->flags = cpu_to_le32 ( INTELXL_TX_DATA_DTYP | INTELXL_TX_DATA_EOP |
                                  INTELXL_TX_DATA_RS | INTELXL_TX_DATA_JFDI );
        wmb();

        /* Notify card that there are packets ready to transmit */
        writel ( tx_tail,
                 ( intelxl->regs + intelxl->tx.reg + INTELXL_QXX_TAIL ) );

        DBGC2 ( intelxl, "INTELXL %p TX %d is [%llx,%llx)\n", intelxl, tx_idx,
                ( ( unsigned long long ) address ),
                ( ( unsigned long long ) address + len ) );
        return 0;
}
static void intelxl_poll_tx ( struct net_device netdev) [static]

Poll for completed packets.

Parameters:
netdevNetwork device

Definition at line 1223 of file intelxl.c.

References intelxl_ring::cons, DBGC2, intelxl_ring::desc, intelxl_tx_writeback_descriptor::flags, INTELXL_TX_NUM_DESC, INTELXL_TX_WB_FL_DD, netdev_tx_complete_next(), net_device::priv, intelxl_ring::prod, intelxl_nic::tx, and intelxl_descriptor::tx_wb.

Referenced by intelxl_poll().

                                                          {
        struct intelxl_nic *intelxl = netdev->priv;
        struct intelxl_tx_writeback_descriptor *tx_wb;
        unsigned int tx_idx;

        /* Check for completed packets */
        while ( intelxl->tx.cons != intelxl->tx.prod ) {

                /* Get next transmit descriptor */
                tx_idx = ( intelxl->tx.cons % INTELXL_TX_NUM_DESC );
                tx_wb = &intelxl->tx.desc[tx_idx].tx_wb;

                /* Stop if descriptor is still in use */
                if ( ! ( tx_wb->flags & INTELXL_TX_WB_FL_DD ) )
                        return;
                DBGC2 ( intelxl, "INTELXL %p TX %d complete\n",
                        intelxl, tx_idx );

                /* Complete TX descriptor */
                netdev_tx_complete_next ( netdev );
                intelxl->tx.cons++;
        }
}
static void intelxl_poll_rx ( struct net_device netdev) [static]

Poll for received packets.

Parameters:
netdevNetwork device

Definition at line 1252 of file intelxl.c.

References intelxl_ring::cons, cpu_to_le32, DBGC, DBGC2, intelxl_ring::desc, EIO, intelxl_rx_writeback_descriptor::flags, INTELXL_RX_NUM_DESC, INTELXL_RX_WB_FL_DD, INTELXL_RX_WB_FL_RXE, INTELXL_RX_WB_LEN, iob_put, le32_to_cpu, len, intelxl_rx_writeback_descriptor::len, netdev_rx(), netdev_rx_err(), NULL, net_device::priv, intelxl_ring::prod, intelxl_nic::rx, intelxl_nic::rx_iobuf, and intelxl_descriptor::rx_wb.

Referenced by intelxl_poll().

                                                          {
        struct intelxl_nic *intelxl = netdev->priv;
        struct intelxl_rx_writeback_descriptor *rx_wb;
        struct io_buffer *iobuf;
        unsigned int rx_idx;
        size_t len;

        /* Check for received packets */
        while ( intelxl->rx.cons != intelxl->rx.prod ) {

                /* Get next receive descriptor */
                rx_idx = ( intelxl->rx.cons % INTELXL_RX_NUM_DESC );
                rx_wb = &intelxl->rx.desc[rx_idx].rx_wb;

                /* Stop if descriptor is still in use */
                if ( ! ( rx_wb->flags & cpu_to_le32 ( INTELXL_RX_WB_FL_DD ) ) )
                        return;

                /* Populate I/O buffer */
                iobuf = intelxl->rx_iobuf[rx_idx];
                intelxl->rx_iobuf[rx_idx] = NULL;
                len = INTELXL_RX_WB_LEN ( le32_to_cpu ( rx_wb->len ) );
                iob_put ( iobuf, len );

                /* Hand off to network stack */
                if ( rx_wb->flags & cpu_to_le32 ( INTELXL_RX_WB_FL_RXE ) ) {
                        DBGC ( intelxl, "INTELXL %p RX %d error (length %zd, "
                               "flags %08x)\n", intelxl, rx_idx, len,
                               le32_to_cpu ( rx_wb->flags ) );
                        netdev_rx_err ( netdev, iobuf, -EIO );
                } else {
                        DBGC2 ( intelxl, "INTELXL %p RX %d complete (length "
                                "%zd)\n", intelxl, rx_idx, len );
                        netdev_rx ( netdev, iobuf );
                }
                intelxl->rx.cons++;
        }
}
static void intelxl_poll ( struct net_device netdev) [static]

Poll for completed and received packets.

Parameters:
netdevNetwork device

Definition at line 1296 of file intelxl.c.

References INTELXL_PFINT_DYN_CTL0, INTELXL_PFINT_DYN_CTL0_CLEARPBA, INTELXL_PFINT_DYN_CTL0_INTENA_MASK, intelxl_poll_admin(), intelxl_poll_rx(), intelxl_poll_tx(), intelxl_refill_rx(), netdev_irq_enabled(), net_device::priv, intelxl_nic::regs, and writel().

                                                       {
        struct intelxl_nic *intelxl = netdev->priv;

        /* Acknowledge interrupts, if applicable */
        if ( netdev_irq_enabled ( netdev ) ) {
                writel ( ( INTELXL_PFINT_DYN_CTL0_CLEARPBA |
                           INTELXL_PFINT_DYN_CTL0_INTENA_MASK ),
                         intelxl->regs + INTELXL_PFINT_DYN_CTL0 );
        }

        /* Poll for completed packets */
        intelxl_poll_tx ( netdev );

        /* Poll for received packets */
        intelxl_poll_rx ( netdev );

        /* Poll for admin events */
        intelxl_poll_admin ( netdev );

        /* Refill RX ring */
        intelxl_refill_rx ( intelxl );
}
static void intelxl_irq ( struct net_device netdev,
int  enable 
) [static]

Enable or disable interrupts.

Parameters:
netdevNetwork device
enableInterrupts should be enabled

Definition at line 1325 of file intelxl.c.

References INTELXL_PFINT_DYN_CTL0, INTELXL_PFINT_DYN_CTL0_INTENA, net_device::priv, intelxl_nic::regs, and writel().

                                                                  {
        struct intelxl_nic *intelxl = netdev->priv;

        if ( enable ) {
                writel ( INTELXL_PFINT_DYN_CTL0_INTENA,
                         intelxl->regs + INTELXL_PFINT_DYN_CTL0 );
        } else {
                writel ( 0, intelxl->regs + INTELXL_PFINT_DYN_CTL0 );
        }
}
static int intelxl_probe ( struct pci_device pci) [static]

Probe PCI device.

Parameters:
pciPCI device
Return values:
rcReturn status code

Definition at line 1358 of file intelxl.c.

References adjust_pci_device(), alloc_etherdev(), intelxl_nic::base, pci_device::busdevfn, intelxl_nic::command, DBGC, pci_device::dev, net_device::dev, ENODEV, ENOMEM, intelxl_nic::event, INTELXL_ADMIN_CMD, INTELXL_ADMIN_EVT, intelxl_admin_link(), intelxl_admin_promisc(), intelxl_admin_switch(), intelxl_admin_vsi(), INTELXL_BAR_SIZE, intelxl_close_admin(), intelxl_fetch_mac(), intelxl_open_admin(), INTELXL_PFGEN_PORTNUM, INTELXL_PFGEN_PORTNUM_PORT_NUM, INTELXL_PFINT_ICR0_ENA, INTELXL_PFINT_ICR0_ENA_ADMINQ, INTELXL_PFINT_LNKLST0, INTELXL_PFINT_LNKLST0_FIRSTQ_INDX, INTELXL_PFINT_LNKLST0_FIRSTQ_TYPE_RX, INTELXL_PFLAN_QALLOC, INTELXL_PFLAN_QALLOC_FIRSTQ, INTELXL_PFLAN_QALLOC_LASTQ, INTELXL_QINT_RQCTL, INTELXL_QINT_RQCTL_CAUSE_ENA, INTELXL_QINT_RQCTL_NEXTQ_INDX, INTELXL_QINT_RQCTL_NEXTQ_TYPE_TX, INTELXL_QINT_TQCTL, INTELXL_QINT_TQCTL_CAUSE_ENA, INTELXL_QINT_TQCTL_NEXTQ_INDX_NONE, INTELXL_QRX, INTELXL_QTX, intelxl_reset(), INTELXL_RX_NUM_DESC, INTELXL_TX_NUM_DESC, ioremap(), iounmap(), pci_device::membase, memset(), netdev, netdev_init(), netdev_nullify(), netdev_put(), PCI_FUNC, pci_set_drvdata(), intelxl_nic::pf, intelxl_nic::port, net_device::priv, intelxl_nic::queue, rc, readl(), intelxl_ring::reg, register_netdev(), intelxl_nic::regs, intelxl_nic::rx, intelxl_nic::tx, unregister_netdev(), and writel().

                                                    {
        struct net_device *netdev;
        struct intelxl_nic *intelxl;
        uint32_t pfgen_portnum;
        uint32_t pflan_qalloc;
        int rc;

        /* Allocate and initialise net device */
        netdev = alloc_etherdev ( sizeof ( *intelxl ) );
        if ( ! netdev ) {
                rc = -ENOMEM;
                goto err_alloc;
        }
        netdev_init ( netdev, &intelxl_operations );
        intelxl = netdev->priv;
        pci_set_drvdata ( pci, netdev );
        netdev->dev = &pci->dev;
        memset ( intelxl, 0, sizeof ( *intelxl ) );
        intelxl->pf = PCI_FUNC ( pci->busdevfn );
        intelxl_init_admin ( &intelxl->command, INTELXL_ADMIN_CMD );
        intelxl_init_admin ( &intelxl->event, INTELXL_ADMIN_EVT );
        intelxl_init_ring ( &intelxl->tx, INTELXL_TX_NUM_DESC,
                            intelxl_context_tx );
        intelxl_init_ring ( &intelxl->rx, INTELXL_RX_NUM_DESC,
                            intelxl_context_rx );

        /* Fix up PCI device */
        adjust_pci_device ( pci );

        /* Map registers */
        intelxl->regs = ioremap ( pci->membase, INTELXL_BAR_SIZE );
        if ( ! intelxl->regs ) {
                rc = -ENODEV;
                goto err_ioremap;
        }

        /* Reset the NIC */
        if ( ( rc = intelxl_reset ( intelxl ) ) != 0 )
                goto err_reset;

        /* Get port number and base queue number */
        pfgen_portnum = readl ( intelxl->regs + INTELXL_PFGEN_PORTNUM );
        intelxl->port = INTELXL_PFGEN_PORTNUM_PORT_NUM ( pfgen_portnum );
        pflan_qalloc = readl ( intelxl->regs + INTELXL_PFLAN_QALLOC );
        intelxl->base = INTELXL_PFLAN_QALLOC_FIRSTQ ( pflan_qalloc );
        DBGC ( intelxl, "INTELXL %p PF %d using port %d queues [%#04x-%#04x]\n",
               intelxl, intelxl->pf, intelxl->port, intelxl->base,
               INTELXL_PFLAN_QALLOC_LASTQ ( pflan_qalloc ) );

        /* Fetch MAC address and maximum frame size */
        if ( ( rc = intelxl_fetch_mac ( intelxl, netdev ) ) != 0 )
                goto err_fetch_mac;

        /* Open admin queues */
        if ( ( rc = intelxl_open_admin ( intelxl ) ) != 0 )
                goto err_open_admin;

        /* Get switch configuration */
        if ( ( rc = intelxl_admin_switch ( intelxl ) ) != 0 )
                goto err_admin_switch;

        /* Get VSI configuration */
        if ( ( rc = intelxl_admin_vsi ( intelxl ) ) != 0 )
                goto err_admin_vsi;

        /* Configure switch for promiscuous mode */
        if ( ( rc = intelxl_admin_promisc ( intelxl ) ) != 0 )
                goto err_admin_promisc;

        /* Configure queue register addresses */
        intelxl->tx.reg = INTELXL_QTX ( intelxl->queue );
        intelxl->rx.reg = INTELXL_QRX ( intelxl->queue );

        /* Configure interrupt causes */
        writel ( ( INTELXL_QINT_TQCTL_NEXTQ_INDX_NONE |
                   INTELXL_QINT_TQCTL_CAUSE_ENA ),
                 intelxl->regs + INTELXL_QINT_TQCTL ( intelxl->queue ) );
        writel ( ( INTELXL_QINT_RQCTL_NEXTQ_INDX ( intelxl->queue ) |
                   INTELXL_QINT_RQCTL_NEXTQ_TYPE_TX |
                   INTELXL_QINT_RQCTL_CAUSE_ENA ),
                 intelxl->regs + INTELXL_QINT_RQCTL ( intelxl->queue ) );
        writel ( ( INTELXL_PFINT_LNKLST0_FIRSTQ_INDX ( intelxl->queue ) |
                   INTELXL_PFINT_LNKLST0_FIRSTQ_TYPE_RX ),
                 intelxl->regs + INTELXL_PFINT_LNKLST0 );
        writel ( INTELXL_PFINT_ICR0_ENA_ADMINQ,
                 intelxl->regs + INTELXL_PFINT_ICR0_ENA );

        /* Register network device */
        if ( ( rc = register_netdev ( netdev ) ) != 0 )
                goto err_register_netdev;

        /* Set initial link state */
        intelxl_admin_link ( netdev );

        return 0;

        unregister_netdev ( netdev );
 err_register_netdev:
 err_admin_promisc:
 err_admin_vsi:
 err_admin_switch:
        intelxl_close_admin ( intelxl );
 err_open_admin:
 err_fetch_mac:
        intelxl_reset ( intelxl );
 err_reset:
        iounmap ( intelxl->regs );
 err_ioremap:
        netdev_nullify ( netdev );
        netdev_put ( netdev );
 err_alloc:
        return rc;
}
static void intelxl_remove ( struct pci_device pci) [static]

Remove PCI device.

Parameters:
pciPCI device

Definition at line 1477 of file intelxl.c.

References intelxl_close_admin(), intelxl_reset(), iounmap(), netdev, netdev_nullify(), netdev_put(), pci_get_drvdata(), net_device::priv, intelxl_nic::regs, and unregister_netdev().

                                                      {
        struct net_device *netdev = pci_get_drvdata ( pci );
        struct intelxl_nic *intelxl = netdev->priv;

        /* Unregister network device */
        unregister_netdev ( netdev );

        /* Close admin queues */
        intelxl_close_admin ( intelxl );

        /* Reset the NIC */
        intelxl_reset ( intelxl );

        /* Free network device */
        iounmap ( intelxl->regs );
        netdev_nullify ( netdev );
        netdev_put ( netdev );
}

Variable Documentation

Initial value:
 {
        .open           = intelxl_open,
        .close          = intelxl_close,
        .transmit       = intelxl_transmit,
        .poll           = intelxl_poll,
        .irq            = intelxl_irq,
}

Network device operations.

Definition at line 1337 of file intelxl.c.

struct pci_device_id intelxl_nics[] [static]
Initial value:
 {
        PCI_ROM ( 0x8086, 0x1572, "x710-sfp", "X710 10GbE SFP+", 0 ),
        PCI_ROM ( 0x8086, 0x1574, "xl710-qemu", "Virtual XL710", 0 ),
        PCI_ROM ( 0x8086, 0x1580, "xl710-kx-b", "XL710 40GbE backplane", 0 ),
        PCI_ROM ( 0x8086, 0x1581, "xl710-kx-c", "XL710 10GbE backplane", 0 ),
        PCI_ROM ( 0x8086, 0x1583, "xl710-qda2", "XL710 40GbE QSFP+", 0 ),
        PCI_ROM ( 0x8086, 0x1584, "xl710-qda1", "XL710 40GbE QSFP+", 0 ),
        PCI_ROM ( 0x8086, 0x1585, "x710-qsfp", "X710 10GbE QSFP+", 0 ),
        PCI_ROM ( 0x8086, 0x1586, "x710-10gt", "X710 10GBASE-T", 0 ),
        PCI_ROM ( 0x8086, 0x1587, "x710-kr2", "XL710 20GbE backplane", 0 ),
        PCI_ROM ( 0x8086, 0x1588, "x710-kr2-a", "XL710 20GbE backplane", 0 ),
        PCI_ROM ( 0x8086, 0x1589, "x710-10gt4", "X710 10GBASE-T4", 0 ),
        PCI_ROM ( 0x8086, 0x158a, "xxv710", "XXV710 25GbE backplane", 0 ),
        PCI_ROM ( 0x8086, 0x158b, "xxv710-sfp28", "XXV710 25GbE SFP28", 0 ),
        PCI_ROM ( 0x8086, 0x37ce, "x722-kx", "X722 10GbE backplane", 0 ),
        PCI_ROM ( 0x8086, 0x37cf, "x722-qsfp", "X722 10GbE QSFP+", 0 ),
        PCI_ROM ( 0x8086, 0x37d0, "x722-sfp", "X722 10GbE SFP+", 0 ),
        PCI_ROM ( 0x8086, 0x37d1, "x722-1gt", "X722 1GBASE-T", 0 ),
        PCI_ROM ( 0x8086, 0x37d2, "x722-10gt", "X722 10GBASE-T", 0 ),
        PCI_ROM ( 0x8086, 0x37d3, "x722-sfp-i", "X722 10GbE SFP+", 0 ),
}

PCI device IDs.

Definition at line 1497 of file intelxl.c.

struct pci_driver intelxl_driver __pci_driver
Initial value:
 {
        .ids = intelxl_nics,
        .id_count = ( sizeof ( intelxl_nics ) / sizeof ( intelxl_nics[0] ) ),
        .probe = intelxl_probe,
        .remove = intelxl_remove,
}

PCI driver.

Definition at line 1520 of file intelxl.c.