diff options
author | Shreyas Bhatewara <sbhatewara@vmware.com> | 2010-11-19 05:55:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-11-19 17:22:57 -0500 |
commit | 09c5088e5c5993be217a2c85dca088147ffc9b72 (patch) | |
tree | 40c72370d3f9ee2d113fac2c5feb8708ed1d0093 /drivers/net/vmxnet3/vmxnet3_int.h | |
parent | 24912420e923d56461b400d83f250a31bed8a964 (diff) |
net-next: Add multiqueue support to vmxnet3 driver
Add multiqueue support to vmxnet3 driver
This change adds multiqueue and thus receive side scaling support
to vmxnet3 device driver. Number of rx queues is limited to 1 in cases
where MSI is not configured or one MSIx vector is not available per rx
queue
Signed-off-by: Shreyas Bhatewara <sbhatewara@vmware.com>
Reviewed-by: Bhavesh Davda <bhavesh@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vmxnet3/vmxnet3_int.h')
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_int.h | 73 |
1 files changed, 51 insertions, 22 deletions
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index edf228843afc..7fadeed37f03 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
@@ -68,11 +68,15 @@ | |||
68 | /* | 68 | /* |
69 | * Version numbers | 69 | * Version numbers |
70 | */ | 70 | */ |
71 | #define VMXNET3_DRIVER_VERSION_STRING "1.0.14.0-k" | 71 | #define VMXNET3_DRIVER_VERSION_STRING "1.0.16.0-k" |
72 | 72 | ||
73 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ | 73 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ |
74 | #define VMXNET3_DRIVER_VERSION_NUM 0x01000E00 | 74 | #define VMXNET3_DRIVER_VERSION_NUM 0x01001000 |
75 | 75 | ||
76 | #if defined(CONFIG_PCI_MSI) | ||
77 | /* RSS only makes sense if MSI-X is supported. */ | ||
78 | #define VMXNET3_RSS | ||
79 | #endif | ||
76 | 80 | ||
77 | /* | 81 | /* |
78 | * Capabilities | 82 | * Capabilities |
@@ -218,16 +222,19 @@ struct vmxnet3_tx_ctx { | |||
218 | }; | 222 | }; |
219 | 223 | ||
220 | struct vmxnet3_tx_queue { | 224 | struct vmxnet3_tx_queue { |
225 | char name[IFNAMSIZ+8]; /* To identify interrupt */ | ||
226 | struct vmxnet3_adapter *adapter; | ||
221 | spinlock_t tx_lock; | 227 | spinlock_t tx_lock; |
222 | struct vmxnet3_cmd_ring tx_ring; | 228 | struct vmxnet3_cmd_ring tx_ring; |
223 | struct vmxnet3_tx_buf_info *buf_info; | 229 | struct vmxnet3_tx_buf_info *buf_info; |
224 | struct vmxnet3_tx_data_ring data_ring; | 230 | struct vmxnet3_tx_data_ring data_ring; |
225 | struct vmxnet3_comp_ring comp_ring; | 231 | struct vmxnet3_comp_ring comp_ring; |
226 | struct Vmxnet3_TxQueueCtrl *shared; | 232 | struct Vmxnet3_TxQueueCtrl *shared; |
227 | struct vmxnet3_tq_driver_stats stats; | 233 | struct vmxnet3_tq_driver_stats stats; |
228 | bool stopped; | 234 | bool stopped; |
229 | int num_stop; /* # of times the queue is | 235 | int num_stop; /* # of times the queue is |
230 | * stopped */ | 236 | * stopped */ |
237 | int qid; | ||
231 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); | 238 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); |
232 | 239 | ||
233 | enum vmxnet3_rx_buf_type { | 240 | enum vmxnet3_rx_buf_type { |
@@ -259,6 +266,9 @@ struct vmxnet3_rq_driver_stats { | |||
259 | }; | 266 | }; |
260 | 267 | ||
261 | struct vmxnet3_rx_queue { | 268 | struct vmxnet3_rx_queue { |
269 | char name[IFNAMSIZ + 8]; /* To identify interrupt */ | ||
270 | struct vmxnet3_adapter *adapter; | ||
271 | struct napi_struct napi; | ||
262 | struct vmxnet3_cmd_ring rx_ring[2]; | 272 | struct vmxnet3_cmd_ring rx_ring[2]; |
263 | struct vmxnet3_comp_ring comp_ring; | 273 | struct vmxnet3_comp_ring comp_ring; |
264 | struct vmxnet3_rx_ctx rx_ctx; | 274 | struct vmxnet3_rx_ctx rx_ctx; |
@@ -271,7 +281,16 @@ struct vmxnet3_rx_queue { | |||
271 | struct vmxnet3_rq_driver_stats stats; | 281 | struct vmxnet3_rq_driver_stats stats; |
272 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); | 282 | } __attribute__((__aligned__(SMP_CACHE_BYTES))); |
273 | 283 | ||
274 | #define VMXNET3_LINUX_MAX_MSIX_VECT 1 | 284 | #define VMXNET3_DEVICE_MAX_TX_QUEUES 8 |
285 | #define VMXNET3_DEVICE_MAX_RX_QUEUES 8 /* Keep this value as a power of 2 */ | ||
286 | |||
287 | /* Should be less than UPT1_RSS_MAX_IND_TABLE_SIZE */ | ||
288 | #define VMXNET3_RSS_IND_TABLE_SIZE (VMXNET3_DEVICE_MAX_RX_QUEUES * 4) | ||
289 | |||
290 | #define VMXNET3_LINUX_MAX_MSIX_VECT (VMXNET3_DEVICE_MAX_TX_QUEUES + \ | ||
291 | VMXNET3_DEVICE_MAX_RX_QUEUES + 1) | ||
292 | #define VMXNET3_LINUX_MIN_MSIX_VECT 3 /* 1 for each : tx, rx and event */ | ||
293 | |||
275 | 294 | ||
276 | struct vmxnet3_intr { | 295 | struct vmxnet3_intr { |
277 | enum vmxnet3_intr_mask_mode mask_mode; | 296 | enum vmxnet3_intr_mask_mode mask_mode; |
@@ -279,27 +298,32 @@ struct vmxnet3_intr { | |||
279 | u8 num_intrs; /* # of intr vectors */ | 298 | u8 num_intrs; /* # of intr vectors */ |
280 | u8 event_intr_idx; /* idx of the intr vector for event */ | 299 | u8 event_intr_idx; /* idx of the intr vector for event */ |
281 | u8 mod_levels[VMXNET3_LINUX_MAX_MSIX_VECT]; /* moderation level */ | 300 | u8 mod_levels[VMXNET3_LINUX_MAX_MSIX_VECT]; /* moderation level */ |
301 | char event_msi_vector_name[IFNAMSIZ+11]; | ||
282 | #ifdef CONFIG_PCI_MSI | 302 | #ifdef CONFIG_PCI_MSI |
283 | struct msix_entry msix_entries[VMXNET3_LINUX_MAX_MSIX_VECT]; | 303 | struct msix_entry msix_entries[VMXNET3_LINUX_MAX_MSIX_VECT]; |
284 | #endif | 304 | #endif |
285 | }; | 305 | }; |
286 | 306 | ||
307 | /* Interrupt sharing schemes, share_intr */ | ||
308 | #define VMXNET3_INTR_BUDDYSHARE 0 /* Corresponding tx,rx queues share irq */ | ||
309 | #define VMXNET3_INTR_TXSHARE 1 /* All tx queues share one irq */ | ||
310 | #define VMXNET3_INTR_DONTSHARE 2 /* each queue has its own irq */ | ||
311 | |||
312 | |||
287 | #define VMXNET3_STATE_BIT_RESETTING 0 | 313 | #define VMXNET3_STATE_BIT_RESETTING 0 |
288 | #define VMXNET3_STATE_BIT_QUIESCED 1 | 314 | #define VMXNET3_STATE_BIT_QUIESCED 1 |
289 | struct vmxnet3_adapter { | 315 | struct vmxnet3_adapter { |
290 | struct vmxnet3_tx_queue tx_queue; | 316 | struct vmxnet3_tx_queue tx_queue[VMXNET3_DEVICE_MAX_TX_QUEUES]; |
291 | struct vmxnet3_rx_queue rx_queue; | 317 | struct vmxnet3_rx_queue rx_queue[VMXNET3_DEVICE_MAX_RX_QUEUES]; |
292 | struct napi_struct napi; | 318 | struct vlan_group *vlan_grp; |
293 | struct vlan_group *vlan_grp; | 319 | struct vmxnet3_intr intr; |
294 | 320 | struct Vmxnet3_DriverShared *shared; | |
295 | struct vmxnet3_intr intr; | 321 | struct Vmxnet3_PMConf *pm_conf; |
296 | 322 | struct Vmxnet3_TxQueueDesc *tqd_start; /* all tx queue desc */ | |
297 | struct Vmxnet3_DriverShared *shared; | 323 | struct Vmxnet3_RxQueueDesc *rqd_start; /* all rx queue desc */ |
298 | struct Vmxnet3_PMConf *pm_conf; | 324 | struct net_device *netdev; |
299 | struct Vmxnet3_TxQueueDesc *tqd_start; /* first tx queue desc */ | 325 | struct net_device_stats net_stats; |
300 | struct Vmxnet3_RxQueueDesc *rqd_start; /* first rx queue desc */ | 326 | struct pci_dev *pdev; |
301 | struct net_device *netdev; | ||
302 | struct pci_dev *pdev; | ||
303 | 327 | ||
304 | u8 __iomem *hw_addr0; /* for BAR 0 */ | 328 | u8 __iomem *hw_addr0; /* for BAR 0 */ |
305 | u8 __iomem *hw_addr1; /* for BAR 1 */ | 329 | u8 __iomem *hw_addr1; /* for BAR 1 */ |
@@ -308,6 +332,12 @@ struct vmxnet3_adapter { | |||
308 | bool rxcsum; | 332 | bool rxcsum; |
309 | bool lro; | 333 | bool lro; |
310 | bool jumbo_frame; | 334 | bool jumbo_frame; |
335 | #ifdef VMXNET3_RSS | ||
336 | struct UPT1_RSSConf *rss_conf; | ||
337 | bool rss; | ||
338 | #endif | ||
339 | u32 num_rx_queues; | ||
340 | u32 num_tx_queues; | ||
311 | 341 | ||
312 | /* rx buffer related */ | 342 | /* rx buffer related */ |
313 | unsigned skb_buf_size; | 343 | unsigned skb_buf_size; |
@@ -327,6 +357,7 @@ struct vmxnet3_adapter { | |||
327 | unsigned long state; /* VMXNET3_STATE_BIT_xxx */ | 357 | unsigned long state; /* VMXNET3_STATE_BIT_xxx */ |
328 | 358 | ||
329 | int dev_number; | 359 | int dev_number; |
360 | int share_intr; | ||
330 | }; | 361 | }; |
331 | 362 | ||
332 | #define VMXNET3_WRITE_BAR0_REG(adapter, reg, val) \ | 363 | #define VMXNET3_WRITE_BAR0_REG(adapter, reg, val) \ |
@@ -366,12 +397,10 @@ void | |||
366 | vmxnet3_reset_dev(struct vmxnet3_adapter *adapter); | 397 | vmxnet3_reset_dev(struct vmxnet3_adapter *adapter); |
367 | 398 | ||
368 | void | 399 | void |
369 | vmxnet3_tq_destroy(struct vmxnet3_tx_queue *tq, | 400 | vmxnet3_tq_destroy_all(struct vmxnet3_adapter *adapter); |
370 | struct vmxnet3_adapter *adapter); | ||
371 | 401 | ||
372 | void | 402 | void |
373 | vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq, | 403 | vmxnet3_rq_destroy_all(struct vmxnet3_adapter *adapter); |
374 | struct vmxnet3_adapter *adapter); | ||
375 | 404 | ||
376 | int | 405 | int |
377 | vmxnet3_create_queues(struct vmxnet3_adapter *adapter, | 406 | vmxnet3_create_queues(struct vmxnet3_adapter *adapter, |