diff options
author | Tobias Regnery <tobias.regnery@gmail.com> | 2016-11-15 06:43:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-15 22:46:30 -0500 |
commit | bccffcf7154420c1cbd9e3c2702e2ec4ff0bc319 (patch) | |
tree | 07c7465ec759f781a43b53c0a6b77f9b8c70883c | |
parent | 8c2a4c8efb0c22cb68fcecf84f3ac7af25ebf542 (diff) |
alx: extend data structures for multi queue support
Extend the driver data structures to be able to handle multiple queues.
Based on the downstream driver at github.com/qca/alx
Signed-off-by: Tobias Regnery <tobias.regnery@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/atheros/alx/alx.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/ethernet/atheros/alx/alx.h b/drivers/net/ethernet/atheros/alx/alx.h index 6cac919272ea..0859053525de 100644 --- a/drivers/net/ethernet/atheros/alx/alx.h +++ b/drivers/net/ethernet/atheros/alx/alx.h | |||
@@ -50,6 +50,10 @@ struct alx_buffer { | |||
50 | }; | 50 | }; |
51 | 51 | ||
52 | struct alx_rx_queue { | 52 | struct alx_rx_queue { |
53 | struct net_device *netdev; | ||
54 | struct device *dev; | ||
55 | struct alx_napi *np; | ||
56 | |||
53 | struct alx_rrd *rrd; | 57 | struct alx_rrd *rrd; |
54 | dma_addr_t rrd_dma; | 58 | dma_addr_t rrd_dma; |
55 | 59 | ||
@@ -58,16 +62,26 @@ struct alx_rx_queue { | |||
58 | 62 | ||
59 | struct alx_buffer *bufs; | 63 | struct alx_buffer *bufs; |
60 | 64 | ||
65 | u16 count; | ||
61 | u16 write_idx, read_idx; | 66 | u16 write_idx, read_idx; |
62 | u16 rrd_read_idx; | 67 | u16 rrd_read_idx; |
68 | u16 queue_idx; | ||
63 | }; | 69 | }; |
64 | #define ALX_RX_ALLOC_THRESH 32 | 70 | #define ALX_RX_ALLOC_THRESH 32 |
65 | 71 | ||
66 | struct alx_tx_queue { | 72 | struct alx_tx_queue { |
73 | struct net_device *netdev; | ||
74 | struct device *dev; | ||
75 | |||
67 | struct alx_txd *tpd; | 76 | struct alx_txd *tpd; |
68 | dma_addr_t tpd_dma; | 77 | dma_addr_t tpd_dma; |
78 | |||
69 | struct alx_buffer *bufs; | 79 | struct alx_buffer *bufs; |
80 | |||
81 | u16 count; | ||
70 | u16 write_idx, read_idx; | 82 | u16 write_idx, read_idx; |
83 | u16 queue_idx; | ||
84 | u16 p_reg, c_reg; | ||
71 | }; | 85 | }; |
72 | 86 | ||
73 | #define ALX_DEFAULT_TX_WORK 128 | 87 | #define ALX_DEFAULT_TX_WORK 128 |
@@ -76,6 +90,18 @@ enum alx_device_quirks { | |||
76 | ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG = BIT(0), | 90 | ALX_DEV_QUIRK_MSI_INTX_DISABLE_BUG = BIT(0), |
77 | }; | 91 | }; |
78 | 92 | ||
93 | struct alx_napi { | ||
94 | struct napi_struct napi; | ||
95 | struct alx_priv *alx; | ||
96 | struct alx_rx_queue *rxq; | ||
97 | struct alx_tx_queue *txq; | ||
98 | int vec_idx; | ||
99 | u32 vec_mask; | ||
100 | char irq_lbl[IFNAMSIZ + 8]; | ||
101 | }; | ||
102 | |||
103 | #define ALX_MAX_NAPIS 8 | ||
104 | |||
79 | #define ALX_FLAG_USING_MSIX BIT(0) | 105 | #define ALX_FLAG_USING_MSIX BIT(0) |
80 | #define ALX_FLAG_USING_MSI BIT(1) | 106 | #define ALX_FLAG_USING_MSI BIT(1) |
81 | 107 | ||
@@ -96,6 +122,11 @@ struct alx_priv { | |||
96 | unsigned int size; | 122 | unsigned int size; |
97 | } descmem; | 123 | } descmem; |
98 | 124 | ||
125 | struct alx_napi *qnapi[ALX_MAX_NAPIS]; | ||
126 | int num_txq; | ||
127 | int num_rxq; | ||
128 | int num_napi; | ||
129 | |||
99 | /* protect int_mask updates */ | 130 | /* protect int_mask updates */ |
100 | spinlock_t irq_lock; | 131 | spinlock_t irq_lock; |
101 | u32 int_mask; | 132 | u32 int_mask; |