sfc: Make queue flushes more reliable
[pandora-kernel.git] / drivers / net / sfc / net_driver.h
index df863bc..868ad1e 100644 (file)
@@ -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;
+       bool 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;
+       bool flushed;
 };
 
 /**
@@ -459,8 +463,7 @@ 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,
 };
 
@@ -504,7 +507,6 @@ enum efx_fc_type {
  * @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
  */
@@ -514,7 +516,7 @@ struct efx_phy_operations {
        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;
 };
@@ -533,7 +535,7 @@ enum efx_phy_mode {
 
 static inline bool efx_phy_mode_disabled(enum efx_phy_mode mode)
 {
-       return (mode & ~PHY_MODE_TX_DISABLED) != 0;
+       return !!(mode & ~PHY_MODE_TX_DISABLED);
 }
 
 /*
@@ -655,13 +657,14 @@ union efx_multicast_hash {
  *     This field will be %NULL if no EEPROM device is present.
  * @n_rx_nodesc_drop_cnt: RX no descriptor drop count
  * @nic_data: Hardware dependant state
- * @mac_lock: MAC access lock. Protects @port_enabled, efx_monitor() and
- *     efx_reconfigure_port()
+ * @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
  *     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
  * @port_initialized: Port initialized?
  * @net_dev: Operating system network device. Consider holding the rtnl lock
  * @rx_checksum_enabled: RX checksumming enabled
@@ -671,14 +674,16 @@ union efx_multicast_hash {
  *     can provide.  Generic code converts these into a standard
  *     &struct net_device_stats.
  * @stats_buffer: DMA buffer for statistics
- * @stats_lock: Statistics update lock
+ * @stats_lock: Statistics update lock. Serialises statistics fetches
+ * @stats_enabled: Temporarily disable statistics fetches.
+ *     Serialised by @stats_lock
  * @mac_address: Permanent MAC address
  * @phy_type: PHY type
  * @phy_lock: PHY access lock
  * @phy_op: PHY interface
  * @phy_data: PHY private data (including PHY-specific stats)
  * @mii: PHY interface
- * @phy_mode: PHY operating mode
+ * @phy_mode: PHY operating mode. Serialised by @mac_lock.
  * @link_up: Link status
  * @link_options: Link options (MII/GMII format)
  * @n_link_state_changes: Number of times the link has changed state
@@ -733,6 +738,7 @@ struct efx_nic {
 
        struct mutex mac_lock;
        bool port_enabled;
+       bool port_inhibited;
 
        bool port_initialized;
        struct net_device *net_dev;
@@ -744,6 +750,7 @@ struct efx_nic {
        struct efx_mac_stats mac_stats;
        struct efx_buffer stats_buffer;
        spinlock_t stats_lock;
+       bool stats_enabled;
 
        unsigned char mac_address[ETH_ALEN];