sfc: Fix some incorrect or redundant comments
[safe/jmp/linux-2.6] / drivers / net / sfc / net_driver.h
index 531d939..ac77a25 100644 (file)
@@ -1,7 +1,7 @@
 /****************************************************************************
  * Driver for Solarflare Solarstorm network controllers and boards
  * Copyright 2005-2006 Fen Systems Ltd.
- * Copyright 2005-2008 Solarflare Communications Inc.
+ * Copyright 2005-2009 Solarflare Communications Inc.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published
 #include <linux/ethtool.h>
 #include <linux/if_vlan.h>
 #include <linux/timer.h>
-#include <linux/mii.h>
+#include <linux/mdio.h>
 #include <linux/list.h>
 #include <linux/pci.h>
 #include <linux/device.h>
 #include <linux/highmem.h>
 #include <linux/workqueue.h>
-#include <linux/inet_lro.h>
 #include <linux/i2c.h>
 
 #include "enum.h"
 #include "bitfield.h"
 
-#define EFX_MAX_LRO_DESCRIPTORS 8
-#define EFX_MAX_LRO_AGGR MAX_SKB_FRAGS
-
 /**************************************************************************
  *
  * Build definitions
@@ -42,7 +38,7 @@
 #ifndef EFX_DRIVER_NAME
 #define EFX_DRIVER_NAME        "sfc"
 #endif
-#define EFX_DRIVER_VERSION     "2.2"
+#define EFX_DRIVER_VERSION     "3.0"
 
 #ifdef EFX_ENABLE_DEBUG
 #define EFX_BUG_ON_PARANOID(x) BUG_ON(x)
@@ -105,9 +101,6 @@ do {if (net_ratelimit()) EFX_LOG(efx, fmt, ##args); } while (0)
  * Special buffers are used for the event queues and the TX and RX
  * descriptor queues for each channel.  They are *not* used for the
  * actual transmit and receive buffers.
- *
- * Note that for Falcon, TX and RX descriptor queues live in host memory.
- * Allocation and freeing procedures must take this into account.
  */
 struct efx_special_buffer {
        void *addr;
@@ -117,6 +110,13 @@ struct efx_special_buffer {
        int entries;
 };
 
+enum efx_flush_state {
+       FLUSH_NONE,
+       FLUSH_PENDING,
+       FLUSH_FAILED,
+       FLUSH_DONE,
+};
+
 /**
  * struct efx_tx_buffer - An Efx TX buffer
  * @skb: The associated socket buffer.
@@ -160,6 +160,7 @@ struct efx_tx_buffer {
  * @channel: The associated channel
  * @buffer: The software buffer ring
  * @txd: The hardware descriptor ring
+ * @flushed: Used when handling queue flushing
  * @read_count: Current read pointer.
  *     This is the number of buffers that have been removed from both rings.
  * @stopped: Stopped count.
@@ -192,6 +193,7 @@ struct efx_tx_queue {
        struct efx_nic *nic;
        struct efx_tx_buffer *buffer;
        struct efx_special_buffer txd;
+       enum efx_flush_state flushed;
 
        /* Members used mainly on the completion path */
        unsigned int read_count ____cacheline_aligned_in_smp;
@@ -260,6 +262,7 @@ struct efx_rx_buffer {
  *     the remaining space in the allocation.
  * @buf_dma_addr: Page's DMA address.
  * @buf_data: Page's host address.
+ * @flushed: Use when handling queue flushing
  */
 struct efx_rx_queue {
        struct efx_nic *efx;
@@ -285,6 +288,7 @@ struct efx_rx_queue {
        struct page *buf_page;
        dma_addr_t buf_dma_addr;
        char *buf_data;
+       enum efx_flush_state flushed;
 };
 
 /**
@@ -293,7 +297,7 @@ struct efx_rx_queue {
  * @dma_addr: DMA base address of the buffer
  * @len: Buffer length, in bytes
  *
- * Falcon uses these buffers for its interrupt status registers and
+ * The NIC uses these buffers for its interrupt status registers and
  * MAC stats dumps.
  */
 struct efx_buffer {
@@ -323,10 +327,11 @@ enum efx_rx_alloc_method {
  *
  * @efx: Associated Efx NIC
  * @channel: Channel instance number
+ * @name: Name for channel and IRQ
  * @used_flags: Channel is used by net driver
  * @enabled: Channel enabled indicator
  * @irq: IRQ number (MSI and MSI-X only)
- * @irq_moderation: IRQ moderation value (in us)
+ * @irq_moderation: IRQ moderation value (in hardware ticks)
  * @napi_dev: Net device used with NAPI
  * @napi_str: NAPI control structure
  * @reset_work: Scheduled reset work thread
@@ -335,17 +340,16 @@ enum efx_rx_alloc_method {
  * @eventq_read_ptr: Event queue read pointer
  * @last_eventq_read_ptr: Last event queue read pointer value.
  * @eventq_magic: Event queue magic value for driver-generated test events
- * @lro_mgr: LRO state
+ * @irq_count: Number of IRQs since last adaptive moderation decision
+ * @irq_mod_score: IRQ moderation score
  * @rx_alloc_level: Watermark based heuristic counter for pushing descriptors
  *     and diagnostic counters
  * @rx_alloc_push_pages: RX allocation method currently in use for pushing
  *     descriptors
- * @rx_alloc_pop_pages: RX allocation method currently in use for popping
- *     descriptors
  * @n_rx_tobe_disc: Count of RX_TOBE_DISC errors
- * @n_rx_ip_frag_err: Count of RX IP fragment errors
  * @n_rx_ip_hdr_chksum_err: Count of RX IP header checksum errors
  * @n_rx_tcp_udp_chksum_err: Count of RX TCP and UDP checksum errors
+ * @n_rx_mcast_mismatch: Count of unmatched multicast frames
  * @n_rx_frm_trunc: Count of RX_FRM_TRUNC errors
  * @n_rx_overlength: Count of RX_OVERLENGTH errors
  * @n_skbuff_leaks: Count of skbuffs leaked due to RX overrun
@@ -353,6 +357,7 @@ enum efx_rx_alloc_method {
 struct efx_channel {
        struct efx_nic *efx;
        int channel;
+       char name[IFNAMSIZ + 6];
        int used_flags;
        bool enabled;
        int irq;
@@ -365,15 +370,16 @@ struct efx_channel {
        unsigned int last_eventq_read_ptr;
        unsigned int eventq_magic;
 
-       struct net_lro_mgr lro_mgr;
+       unsigned int irq_count;
+       unsigned int irq_mod_score;
+
        int rx_alloc_level;
        int rx_alloc_push_pages;
-       int rx_alloc_pop_pages;
 
        unsigned n_rx_tobe_disc;
-       unsigned n_rx_ip_frag_err;
        unsigned n_rx_ip_hdr_chksum_err;
        unsigned n_rx_tcp_udp_chksum_err;
+       unsigned n_rx_mcast_mismatch;
        unsigned n_rx_frm_trunc;
        unsigned n_rx_overlength;
        unsigned n_skbuff_leaks;
@@ -386,53 +392,29 @@ struct efx_channel {
 
 };
 
-/**
- * struct efx_blinker - S/W LED blinking context
- * @led_num: LED ID (board-specific meaning)
- * @state: Current state - on or off
- * @resubmit: Timer resubmission flag
- * @timer: Control timer for blinking
- */
-struct efx_blinker {
-       int led_num;
-       bool state;
-       bool resubmit;
-       struct timer_list timer;
+enum efx_led_mode {
+       EFX_LED_OFF     = 0,
+       EFX_LED_ON      = 1,
+       EFX_LED_DEFAULT = 2
 };
 
+#define STRING_TABLE_LOOKUP(val, member) \
+       ((val) < member ## _max) ? member ## _names[val] : "(invalid)"
 
-/**
- * struct efx_board - board information
- * @type: Board model type
- * @major: Major rev. ('A', 'B' ...)
- * @minor: Minor rev. (0, 1, ...)
- * @init: Initialisation function
- * @init_leds: Sets up board LEDs
- * @set_fault_led: Turns the fault LED on or off
- * @blink: Starts/stops blinking
- * @fini: Cleanup function
- * @blinker: used to blink LEDs in software
- * @hwmon_client: I2C client for hardware monitor
- * @ioexp_client: I2C client for power/port control
- */
-struct efx_board {
-       int type;
-       int major;
-       int minor;
-       int (*init) (struct efx_nic *nic);
-       /* As the LEDs are typically attached to the PHY, LEDs
-        * have a separate init callback that happens later than
-        * board init. */
-       int (*init_leds)(struct efx_nic *efx);
-       void (*set_fault_led) (struct efx_nic *efx, bool state);
-       void (*blink) (struct efx_nic *efx, bool start);
-       void (*fini) (struct efx_nic *nic);
-       struct efx_blinker blinker;
-       struct i2c_client *hwmon_client, *ioexp_client;
-};
+extern const char *efx_loopback_mode_names[];
+extern const unsigned int efx_loopback_mode_max;
+#define LOOPBACK_MODE(efx) \
+       STRING_TABLE_LOOKUP((efx)->loopback_mode, efx_loopback_mode)
 
-#define STRING_TABLE_LOOKUP(val, member)       \
-       member ## _names[val]
+extern const char *efx_interrupt_mode_names[];
+extern const unsigned int efx_interrupt_mode_max;
+#define INT_MODE(efx) \
+       STRING_TABLE_LOOKUP(efx->interrupt_mode, efx_interrupt_mode)
+
+extern const char *efx_reset_type_names[];
+extern const unsigned int efx_reset_type_max;
+#define RESET_TYPE(type) \
+       STRING_TABLE_LOOKUP(type, efx_reset_type)
 
 enum efx_int_mode {
        /* Be careful if altering to correct macro below */
@@ -443,24 +425,13 @@ enum efx_int_mode {
 };
 #define EFX_INT_MODE_USE_MSI(x) (((x)->interrupt_mode) <= EFX_INT_MODE_MSI)
 
-enum phy_type {
-       PHY_TYPE_NONE = 0,
-       PHY_TYPE_CX4_RTMR = 1,
-       PHY_TYPE_1G_ALASKA = 2,
-       PHY_TYPE_10XPRESS = 3,
-       PHY_TYPE_XFP = 4,
-       PHY_TYPE_PM8358 = 6,
-       PHY_TYPE_MAX    /* Insert any new items before this */
-};
-
-#define PHY_ADDR_INVALID 0xff
+#define EFX_IS10G(efx) ((efx)->link_state.speed == 10000)
 
 enum nic_state {
        STATE_INIT = 0,
        STATE_RUNNING = 1,
        STATE_FINI = 2,
-       STATE_RESETTING = 3, /* rtnl_lock always held */
-       STATE_DISABLED = 4,
+       STATE_DISABLED = 3,
        STATE_MAX,
 };
 
@@ -471,7 +442,7 @@ enum nic_state {
  * This is the equivalent of NET_IP_ALIGN [which controls the alignment
  * of the skb->head for hardware DMA].
  */
-#if defined(__i386__) || defined(__x86_64__)
+#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
 #define EFX_PAGE_IP_ALIGN 0
 #else
 #define EFX_PAGE_IP_ALIGN NET_IP_ALIGN
@@ -491,44 +462,92 @@ struct efx_nic;
 
 /* Pseudo bit-mask flow control field */
 enum efx_fc_type {
-       EFX_FC_RX = 1,
-       EFX_FC_TX = 2,
+       EFX_FC_RX = FLOW_CTRL_RX,
+       EFX_FC_TX = FLOW_CTRL_TX,
        EFX_FC_AUTO = 4,
 };
 
 /**
+ * struct efx_link_state - Current state of the link
+ * @up: Link is up
+ * @fd: Link is full-duplex
+ * @fc: Actual flow control flags
+ * @speed: Link speed (Mbps)
+ */
+struct efx_link_state {
+       bool up;
+       bool fd;
+       enum efx_fc_type fc;
+       unsigned int speed;
+};
+
+static inline bool efx_link_state_equal(const struct efx_link_state *left,
+                                       const struct efx_link_state *right)
+{
+       return left->up == right->up && left->fd == right->fd &&
+               left->fc == right->fc && left->speed == right->speed;
+}
+
+/**
+ * struct efx_mac_operations - Efx MAC operations table
+ * @reconfigure: Reconfigure MAC. Serialised by the mac_lock
+ * @update_stats: Update statistics
+ * @check_fault: Check fault state. True if fault present.
+ */
+struct efx_mac_operations {
+       int (*reconfigure) (struct efx_nic *efx);
+       void (*update_stats) (struct efx_nic *efx);
+       bool (*check_fault)(struct efx_nic *efx);
+};
+
+/**
  * struct efx_phy_operations - Efx PHY operations table
+ * @probe: Probe PHY and initialise efx->mdio.mode_support, efx->mdio.mmds,
+ *     efx->loopback_modes.
  * @init: Initialise PHY
  * @fini: Shut down PHY
  * @reconfigure: Reconfigure PHY (e.g. for new link parameters)
- * @clear_interrupt: Clear down interrupt
- * @blink: Blink LEDs
- * @check_hw: Check hardware
- * @reset_xaui: Reset XAUI side of PHY for (software sequenced reset)
- * @mmds: MMD presence mask
- * @loopbacks: Supported loopback modes mask
+ * @poll: Update @link_state and report whether it changed.
+ *     Serialised by the mac_lock.
+ * @get_settings: Get ethtool settings. Serialised by the mac_lock.
+ * @set_settings: Set ethtool settings. Serialised by the mac_lock.
+ * @set_npage_adv: Set abilities advertised in (Extended) Next Page
+ *     (only needed where AN bit is set in mmds)
+ * @test_alive: Test that PHY is 'alive' (online)
+ * @test_name: Get the name of a PHY-specific test/result
+ * @run_tests: Run tests and record results as appropriate (offline).
+ *     Flags are the ethtool tests flags.
  */
 struct efx_phy_operations {
+       int (*probe) (struct efx_nic *efx);
        int (*init) (struct efx_nic *efx);
        void (*fini) (struct efx_nic *efx);
-       void (*reconfigure) (struct efx_nic *efx);
-       void (*clear_interrupt) (struct efx_nic *efx);
-       int (*check_hw) (struct efx_nic *efx);
-       void (*reset_xaui) (struct efx_nic *efx);
-       int (*test) (struct efx_nic *efx);
-       int mmds;
-       unsigned loopbacks;
+       void (*remove) (struct efx_nic *efx);
+       int (*reconfigure) (struct efx_nic *efx);
+       bool (*poll) (struct efx_nic *efx);
+       void (*get_settings) (struct efx_nic *efx,
+                             struct ethtool_cmd *ecmd);
+       int (*set_settings) (struct efx_nic *efx,
+                            struct ethtool_cmd *ecmd);
+       void (*set_npage_adv) (struct efx_nic *efx, u32);
+       int (*test_alive) (struct efx_nic *efx);
+       const char *(*test_name) (struct efx_nic *efx, unsigned int index);
+       int (*run_tests) (struct efx_nic *efx, int *results, unsigned flags);
 };
 
 /**
  * @enum efx_phy_mode - PHY operating mode flags
  * @PHY_MODE_NORMAL: on and should pass traffic
  * @PHY_MODE_TX_DISABLED: on with TX disabled
+ * @PHY_MODE_LOW_POWER: set to low power through MDIO
+ * @PHY_MODE_OFF: switched off through external control
  * @PHY_MODE_SPECIAL: on but will not pass traffic
  */
 enum efx_phy_mode {
        PHY_MODE_NORMAL         = 0,
        PHY_MODE_TX_DISABLED    = 1,
+       PHY_MODE_LOW_POWER      = 2,
+       PHY_MODE_OFF            = 4,
        PHY_MODE_SPECIAL        = 8,
 };
 
@@ -628,39 +647,45 @@ union efx_multicast_hash {
  * @legacy_irq: IRQ number
  * @workqueue: Workqueue for port reconfigures and the HW monitor.
  *     Work items do not hold and must not acquire RTNL.
- * @reset_workqueue: Workqueue for resets.  Work item will acquire RTNL.
+ * @workqueue_name: Name of workqueue
  * @reset_work: Scheduled reset workitem
  * @monitor_work: Hardware monitor workitem
  * @membase_phys: Memory BAR value as physical address
  * @membase: Memory BAR value
  * @biu_lock: BIU (bus interface unit) lock
  * @interrupt_mode: Interrupt mode
- * @i2c_adap: I2C adapter
- * @board_info: Board-level information
+ * @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues
+ * @irq_rx_moderation: IRQ moderation time for RX event queues
  * @state: Device state flag. Serialised by the rtnl_lock.
  * @reset_pending: Pending reset method (normally RESET_TYPE_NONE)
  * @tx_queue: TX DMA queues
  * @rx_queue: RX DMA queues
  * @channel: Channels
+ * @next_buffer_table: First available buffer table id
  * @n_rx_queues: Number of RX queues
+ * @n_channels: Number of channels in use
  * @rx_buffer_len: RX buffer length
  * @rx_buffer_order: Order (log2) of number of pages for each RX buffer
+ * @int_error_count: Number of internal errors seen recently
+ * @int_error_expire: Time at which error count will be expired
  * @irq_status: Interrupt status buffer
  * @last_irq_cpu: Last CPU to handle interrupt.
  *     This register is written with the SMP processor ID whenever an
- *     interrupt is handled.  It is used by falcon_test_interrupt()
+ *     interrupt is handled.  It is used by efx_nic_test_interrupt()
  *     to verify that an interrupt has occurred.
  * @spi_flash: SPI flash device
- *     This field will be %NULL if no flash device is present.
+ *     This field will be %NULL if no flash device is present (or for Siena).
  * @spi_eeprom: SPI EEPROM device
- *     This field will be %NULL if no EEPROM device is present.
+ *     This field will be %NULL if no EEPROM device is present (or for Siena).
+ * @spi_lock: SPI bus lock
+ * @mtd_list: List of MTDs attached to the NIC
  * @n_rx_nodesc_drop_cnt: RX no descriptor drop count
  * @nic_data: Hardware dependant state
  * @mac_lock: MAC access lock. Protects @port_enabled, @phy_mode,
  *     @port_inhibited, efx_monitor() and efx_reconfigure_port()
  * @port_enabled: Port enabled indicator.
- *     Serialises efx_stop_all(), efx_start_all() and efx_monitor() and
- *     efx_reconfigure_work with kernel interfaces. Safe to read under any
+ *     Serialises efx_stop_all(), efx_start_all(), efx_monitor() and
+ *     efx_mac_work() with kernel interfaces. Safe to read under any
  *     one of the rtnl_lock, mac_lock, or netif_tx_lock, but all three must
  *     be held to modify it.
  * @port_inhibited: If set, the netif_carrier is always off. Hold the mac_lock
@@ -674,28 +699,28 @@ union efx_multicast_hash {
  *     &struct net_device_stats.
  * @stats_buffer: DMA buffer for statistics
  * @stats_lock: Statistics update lock. Serialises statistics fetches
- * @stats_enabled: Temporarily disable statistics fetches.
- *     Serialised by @stats_lock
+ * @mac_op: MAC interface
  * @mac_address: Permanent MAC address
  * @phy_type: PHY type
- * @phy_lock: PHY access lock
+ * @mdio_lock: MDIO lock
  * @phy_op: PHY interface
  * @phy_data: PHY private data (including PHY-specific stats)
- * @mii: PHY interface
+ * @mdio: PHY MDIO interface
+ * @mdio_bus: PHY MDIO bus ID (only used by Siena)
  * @phy_mode: PHY operating mode. Serialised by @mac_lock.
- * @link_up: Link status
- * @link_options: Link options (MII/GMII format)
+ * @xmac_poll_required: XMAC link state needs polling
+ * @link_advertising: Autonegotiation advertising flags
+ * @link_state: Current state of the link
  * @n_link_state_changes: Number of times the link has changed state
  * @promiscuous: Promiscuous flag. Protected by netif_tx_lock.
  * @multicast_hash: Multicast hash table
- * @flow_control: Flow control flags - separate RX/TX so can't use link_options
- * @reconfigure_work: work item for dealing with PHY events
+ * @wanted_fc: Wanted flow control flags
+ * @mac_work: Work item for changing MAC promiscuity and multicast hash
  * @loopback_mode: Loopback status
  * @loopback_modes: Supported loopback mode bitmask
  * @loopback_selftest: Offline self-test private state
  *
- * The @priv field of the corresponding &struct net_device points to
- * this.
+ * This is stored in the private area of the &struct net_device.
  */
 struct efx_nic {
        char name[IFNAMSIZ];
@@ -703,16 +728,15 @@ struct efx_nic {
        const struct efx_nic_type *type;
        int legacy_irq;
        struct workqueue_struct *workqueue;
-       struct workqueue_struct *reset_workqueue;
+       char workqueue_name[16];
        struct work_struct reset_work;
        struct delayed_work monitor_work;
        resource_size_t membase_phys;
        void __iomem *membase;
        spinlock_t biu_lock;
        enum efx_int_mode interrupt_mode;
-
-       struct i2c_adapter i2c_adap;
-       struct efx_board board_info;
+       bool irq_rx_adaptive;
+       unsigned int irq_rx_moderation;
 
        enum nic_state state;
        enum reset_type reset_pending;
@@ -721,21 +745,32 @@ struct efx_nic {
        struct efx_rx_queue rx_queue[EFX_MAX_RX_QUEUES];
        struct efx_channel channel[EFX_MAX_CHANNELS];
 
+       unsigned next_buffer_table;
        int n_rx_queues;
+       int n_channels;
        unsigned int rx_buffer_len;
        unsigned int rx_buffer_order;
 
+       unsigned int_error_count;
+       unsigned long int_error_expire;
+
        struct efx_buffer irq_status;
        volatile signed int last_irq_cpu;
+       unsigned long irq_zero_count;
 
        struct efx_spi_device *spi_flash;
        struct efx_spi_device *spi_eeprom;
+       struct mutex spi_lock;
+#ifdef CONFIG_SFC_MTD
+       struct list_head mtd_list;
+#endif
 
        unsigned n_rx_nodesc_drop_cnt;
 
-       struct falcon_nic_data *nic_data;
+       void *nic_data;
 
        struct mutex mac_lock;
+       struct work_struct mac_work;
        bool port_enabled;
        bool port_inhibited;
 
@@ -749,29 +784,30 @@ struct efx_nic {
        struct efx_mac_stats mac_stats;
        struct efx_buffer stats_buffer;
        spinlock_t stats_lock;
-       bool stats_enabled;
 
+       struct efx_mac_operations *mac_op;
        unsigned char mac_address[ETH_ALEN];
 
-       enum phy_type phy_type;
-       spinlock_t phy_lock;
+       unsigned int phy_type;
+       struct mutex mdio_lock;
        struct efx_phy_operations *phy_op;
        void *phy_data;
-       struct mii_if_info mii;
+       struct mdio_if_info mdio;
+       unsigned int mdio_bus;
        enum efx_phy_mode phy_mode;
 
-       bool link_up;
-       unsigned int link_options;
+       bool xmac_poll_required;
+       u32 link_advertising;
+       struct efx_link_state link_state;
        unsigned int n_link_state_changes;
 
        bool promiscuous;
        union efx_multicast_hash multicast_hash;
-       enum efx_fc_type flow_control;
-       struct work_struct reconfigure_work;
+       enum efx_fc_type wanted_fc;
 
        atomic_t rx_reset;
        enum efx_loopback_mode loopback_mode;
-       unsigned int loopback_modes;
+       u64 loopback_modes;
 
        void *loopback_selftest;
 };
@@ -790,50 +826,95 @@ static inline const char *efx_dev_name(struct efx_nic *efx)
        return efx_dev_registered(efx) ? efx->name : "";
 }
 
+static inline unsigned int efx_port_num(struct efx_nic *efx)
+{
+       return PCI_FUNC(efx->pci_dev->devfn);
+}
+
 /**
  * struct efx_nic_type - Efx device type definition
- * @mem_bar: Memory BAR number
+ * @probe: Probe the controller
+ * @remove: Free resources allocated by probe()
+ * @init: Initialise the controller
+ * @fini: Shut down the controller
+ * @monitor: Periodic function for polling link state and hardware monitor
+ * @reset: Reset the controller hardware and possibly the PHY.  This will
+ *     be called while the controller is uninitialised.
+ * @probe_port: Probe the MAC and PHY
+ * @remove_port: Free resources allocated by probe_port()
+ * @prepare_flush: Prepare the hardware for flushing the DMA queues
+ * @update_stats: Update statistics not provided by event handling
+ * @start_stats: Start the regular fetching of statistics
+ * @stop_stats: Stop the regular fetching of statistics
+ * @set_id_led: Set state of identifying LED or revert to automatic function
+ * @push_irq_moderation: Apply interrupt moderation value
+ * @push_multicast_hash: Apply multicast hash table
+ * @reconfigure_port: Push loopback/power/txdis changes to the MAC and PHY
+ * @get_wol: Get WoL configuration from driver state
+ * @set_wol: Push WoL configuration to the NIC
+ * @resume_wol: Synchronise WoL state between driver and MC (e.g. after resume)
+ * @test_registers: Test read/write functionality of control registers
+ * @test_nvram: Test validity of NVRAM contents
+ * @default_mac_ops: efx_mac_operations to set at startup
+ * @revision: Hardware architecture revision
  * @mem_map_size: Memory BAR mapped size
  * @txd_ptr_tbl_base: TX descriptor ring base address
  * @rxd_ptr_tbl_base: RX descriptor ring base address
  * @buf_tbl_base: Buffer table base address
  * @evq_ptr_tbl_base: Event queue pointer table base address
  * @evq_rptr_tbl_base: Event queue read-pointer table base address
- * @txd_ring_mask: TX descriptor ring size - 1 (must be a power of two - 1)
- * @rxd_ring_mask: RX descriptor ring size - 1 (must be a power of two - 1)
- * @evq_size: Event queue size (must be a power of two)
  * @max_dma_mask: Maximum possible DMA mask
- * @tx_dma_mask: TX DMA mask
- * @bug5391_mask: Address mask for bug 5391 workaround
- * @rx_xoff_thresh: RX FIFO XOFF watermark (bytes)
- * @rx_xon_thresh: RX FIFO XON watermark (bytes)
  * @rx_buffer_padding: Padding added to each RX buffer
  * @max_interrupt_mode: Highest capability interrupt mode supported
  *     from &enum efx_init_mode.
  * @phys_addr_channels: Number of channels with physically addressed
  *     descriptors
+ * @tx_dc_base: Base address in SRAM of TX queue descriptor caches
+ * @rx_dc_base: Base address in SRAM of RX queue descriptor caches
+ * @offload_features: net_device feature flags for protocol offload
+ *     features implemented in hardware
+ * @reset_world_flags: Flags for additional components covered by
+ *     reset method RESET_TYPE_WORLD
  */
 struct efx_nic_type {
-       unsigned int mem_bar;
+       int (*probe)(struct efx_nic *efx);
+       void (*remove)(struct efx_nic *efx);
+       int (*init)(struct efx_nic *efx);
+       void (*fini)(struct efx_nic *efx);
+       void (*monitor)(struct efx_nic *efx);
+       int (*reset)(struct efx_nic *efx, enum reset_type method);
+       int (*probe_port)(struct efx_nic *efx);
+       void (*remove_port)(struct efx_nic *efx);
+       void (*prepare_flush)(struct efx_nic *efx);
+       void (*update_stats)(struct efx_nic *efx);
+       void (*start_stats)(struct efx_nic *efx);
+       void (*stop_stats)(struct efx_nic *efx);
+       void (*set_id_led)(struct efx_nic *efx, enum efx_led_mode mode);
+       void (*push_irq_moderation)(struct efx_channel *channel);
+       void (*push_multicast_hash)(struct efx_nic *efx);
+       int (*reconfigure_port)(struct efx_nic *efx);
+       void (*get_wol)(struct efx_nic *efx, struct ethtool_wolinfo *wol);
+       int (*set_wol)(struct efx_nic *efx, u32 type);
+       void (*resume_wol)(struct efx_nic *efx);
+       int (*test_registers)(struct efx_nic *efx);
+       int (*test_nvram)(struct efx_nic *efx);
+       struct efx_mac_operations *default_mac_ops;
+
+       int revision;
        unsigned int mem_map_size;
        unsigned int txd_ptr_tbl_base;
        unsigned int rxd_ptr_tbl_base;
        unsigned int buf_tbl_base;
        unsigned int evq_ptr_tbl_base;
        unsigned int evq_rptr_tbl_base;
-
-       unsigned int txd_ring_mask;
-       unsigned int rxd_ring_mask;
-       unsigned int evq_size;
        u64 max_dma_mask;
-       unsigned int tx_dma_mask;
-       unsigned bug5391_mask;
-
-       int rx_xoff_thresh;
-       int rx_xon_thresh;
        unsigned int rx_buffer_padding;
        unsigned int max_interrupt_mode;
        unsigned int phys_addr_channels;
+       unsigned int tx_dc_base;
+       unsigned int rx_dc_base;
+       unsigned long offload_features;
+       u32 reset_world_flags;
 };
 
 /**************************************************************************
@@ -912,11 +993,16 @@ static inline void clear_bit_le(unsigned nr, unsigned char *addr)
  * that the net driver will program into the MAC as the maximum frame
  * length.
  *
- * The 10G MAC used in Falcon requires 8-byte alignment on the frame
+ * The 10G MAC requires 8-byte alignment on the frame
  * length, so we round up to the nearest 8.
+ *
+ * Re-clocking by the XGXS on RX can reduce an IPG to 32 bits (half an
+ * XGMII cycle).  If the frame length reaches the maximum value in the
+ * same cycle, the XMAC can miss the IPG altogether.  We work around
+ * this by adding a further 16 bytes.
  */
 #define EFX_MAX_FRAME_LEN(mtu) \
-       ((((mtu) + ETH_HLEN + VLAN_HLEN + 4/* FCS */) + 7) & ~7)
+       ((((mtu) + ETH_HLEN + VLAN_HLEN + 4/* FCS */ + 7) & ~7) + 16)
 
 
 #endif /* EFX_NET_DRIVER_H */