]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/sfc/net_driver.h
sfc: Reduce the size of struct efx_tx_buffer
[linux-2.6-omap-h63xx.git] / drivers / net / sfc / net_driver.h
index 5e20e7551daeda8e9642d8bd300623d8ee321a11..6369f9253c7bd8584c614ff416c47baa3ae2e3a0 100644 (file)
 #include <linux/highmem.h>
 #include <linux/workqueue.h>
 #include <linux/inet_lro.h>
+#include <linux/i2c.h>
 
 #include "enum.h"
 #include "bitfield.h"
-#include "i2c-direct.h"
 
 #define EFX_MAX_LRO_DESCRIPTORS 8
 #define EFX_MAX_LRO_AGGR MAX_SKB_FRAGS
@@ -88,9 +88,12 @@ do {if (net_ratelimit()) EFX_LOG(efx, fmt, ##args); } while (0)
  **************************************************************************/
 
 #define EFX_MAX_CHANNELS 32
-#define EFX_MAX_TX_QUEUES 1
 #define EFX_MAX_RX_QUEUES EFX_MAX_CHANNELS
 
+#define EFX_TX_QUEUE_OFFLOAD_CSUM      0
+#define EFX_TX_QUEUE_NO_CSUM           1
+#define EFX_TX_QUEUE_COUNT             2
+
 /**
  * struct efx_special_buffer - An Efx special buffer
  * @addr: CPU base address of the buffer
@@ -127,7 +130,6 @@ struct efx_special_buffer {
  *     This field is zero when the queue slot is empty.
  * @continuation: True if this fragment is not the end of a packet.
  * @unmap_single: True if pci_unmap_single should be used.
- * @unmap_addr: DMA address to unmap
  * @unmap_len: Length of this fragment to unmap
  */
 struct efx_tx_buffer {
@@ -137,7 +139,6 @@ struct efx_tx_buffer {
        unsigned short len;
        unsigned char continuation;
        unsigned char unmap_single;
-       dma_addr_t unmap_addr;
        unsigned short unmap_len;
 };
 
@@ -156,7 +157,6 @@ struct efx_tx_buffer {
  *
  * @efx: The associated Efx NIC
  * @queue: DMA queue number
- * @used: Queue is used by net driver
  * @channel: The associated channel
  * @buffer: The software buffer ring
  * @txd: The hardware descriptor ring
@@ -188,7 +188,6 @@ struct efx_tx_queue {
        /* Members which don't change on the fast path */
        struct efx_nic *efx ____cacheline_aligned_in_smp;
        int queue;
-       int used;
        struct efx_channel *channel;
        struct efx_nic *nic;
        struct efx_tx_buffer *buffer;
@@ -366,7 +365,6 @@ struct efx_channel {
        unsigned int irq_moderation;
        struct net_device *napi_dev;
        struct napi_struct napi_str;
-       struct work_struct reset_work;
        int work_pending;
        struct efx_special_buffer eventq;
        unsigned int eventq_read_ptr;
@@ -418,7 +416,10 @@ struct efx_blinker {
  * @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;
@@ -431,7 +432,9 @@ struct efx_board {
        int (*init_leds)(struct efx_nic *efx);
        void (*set_fault_led) (struct efx_nic *efx, int state);
        void (*blink) (struct efx_nic *efx, int start);
+       void (*fini) (struct efx_nic *nic);
        struct efx_blinker blinker;
+       struct i2c_client *hwmon_client, *ioexp_client;
 };
 
 #define STRING_TABLE_LOOKUP(val, member)       \
@@ -611,14 +614,16 @@ union efx_multicast_hash {
  * @pci_dev: The PCI device
  * @type: Controller type attributes
  * @legacy_irq: IRQ number
- * @workqueue: Workqueue for resets, port reconfigures and the HW monitor
+ * @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.
  * @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: I2C interface
+ * @i2c_adap: I2C adapter
  * @board_info: Board-level information
  * @state: Device state flag. Serialised by the rtnl_lock.
  * @reset_pending: Pending reset method (normally RESET_TYPE_NONE)
@@ -679,6 +684,7 @@ struct efx_nic {
        const struct efx_nic_type *type;
        int legacy_irq;
        struct workqueue_struct *workqueue;
+       struct workqueue_struct *reset_workqueue;
        struct work_struct reset_work;
        struct delayed_work monitor_work;
        resource_size_t membase_phys;
@@ -686,13 +692,13 @@ struct efx_nic {
        spinlock_t biu_lock;
        enum efx_int_mode interrupt_mode;
 
-       struct efx_i2c_interface i2c;
+       struct i2c_adapter i2c_adap;
        struct efx_board board_info;
 
        enum nic_state state;
        enum reset_type reset_pending;
 
-       struct efx_tx_queue tx_queue[EFX_MAX_TX_QUEUES];
+       struct efx_tx_queue tx_queue[EFX_TX_QUEUE_COUNT];
        struct efx_rx_queue rx_queue[EFX_MAX_RX_QUEUES];
        struct efx_channel channel[EFX_MAX_CHANNELS];
 
@@ -833,19 +839,15 @@ struct efx_nic_type {
 /* Iterate over all used TX queues */
 #define efx_for_each_tx_queue(_tx_queue, _efx)                         \
        for (_tx_queue = &_efx->tx_queue[0];                            \
-            _tx_queue < &_efx->tx_queue[EFX_MAX_TX_QUEUES];            \
-            _tx_queue++)                                               \
-               if (!_tx_queue->used)                                   \
-                       continue;                                       \
-               else
+            _tx_queue < &_efx->tx_queue[EFX_TX_QUEUE_COUNT];           \
+            _tx_queue++)
 
 /* Iterate over all TX queues belonging to a channel */
 #define efx_for_each_channel_tx_queue(_tx_queue, _channel)             \
        for (_tx_queue = &_channel->efx->tx_queue[0];                   \
-            _tx_queue < &_channel->efx->tx_queue[EFX_MAX_TX_QUEUES];   \
+            _tx_queue < &_channel->efx->tx_queue[EFX_TX_QUEUE_COUNT];  \
             _tx_queue++)                                               \
-               if ((!_tx_queue->used) ||                               \
-                   (_tx_queue->channel != _channel))                   \
+               if (_tx_queue->channel != _channel)                     \
                        continue;                                       \
                else
 
@@ -878,13 +880,13 @@ static inline struct efx_rx_buffer *efx_rx_buffer(struct efx_rx_queue *rx_queue,
 }
 
 /* Set bit in a little-endian bitfield */
-static inline void set_bit_le(int nr, unsigned char *addr)
+static inline void set_bit_le(unsigned nr, unsigned char *addr)
 {
        addr[nr / 8] |= (1 << (nr % 8));
 }
 
 /* Clear bit in a little-endian bitfield */
-static inline void clear_bit_le(int nr, unsigned char *addr)
+static inline void clear_bit_le(unsigned nr, unsigned char *addr)
 {
        addr[nr / 8] &= ~(1 << (nr % 8));
 }