diff options
author | Neel Patel <neepatel@cisco.com> | 2013-08-16 18:47:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-20 16:41:01 -0400 |
commit | 92e2b4696202934b4cbf1d6b8fb8729e8d7202e1 (patch) | |
tree | 8aee9354285fe445a86e4e21822851aaf9ae87d7 /drivers/net/ethernet/cisco | |
parent | 89d5e23210f53ab53b7ff64843bce62a106d454f (diff) |
drivers/net: enic: Adding support for Cisco Low Latency NIC
This patch,
- Adds new firmware commands for the new Cisco Low Latency NIC
(aka. USNIC).
Signed-off-by: Neel Patel <neepatel@cisco.com>
Signed-off-by: Nishank Trivedi <nistrive@cisco.com>
Signed-off-by: Christian Benvenuti <benve@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cisco')
-rw-r--r-- | drivers/net/ethernet/cisco/enic/enic.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/cisco/enic/enic_res.h | 9 | ||||
-rw-r--r-- | drivers/net/ethernet/cisco/enic/vnic_devcmd.h | 176 | ||||
-rw-r--r-- | drivers/net/ethernet/cisco/enic/vnic_rq.c | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/cisco/enic/vnic_rq.h | 5 | ||||
-rw-r--r-- | drivers/net/ethernet/cisco/enic/vnic_wq.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/cisco/enic/vnic_wq.h | 14 |
7 files changed, 197 insertions, 17 deletions
diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h index 2e37c63981c1..75e842d6cfe7 100644 --- a/drivers/net/ethernet/cisco/enic/enic.h +++ b/drivers/net/ethernet/cisco/enic/enic.h | |||
@@ -33,7 +33,7 @@ | |||
33 | #define DRV_NAME "enic" | 33 | #define DRV_NAME "enic" |
34 | #define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" | 34 | #define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" |
35 | #define DRV_VERSION "2.1.1.39" | 35 | #define DRV_VERSION "2.1.1.39" |
36 | #define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc" | 36 | #define DRV_COPYRIGHT "Copyright 2008-2013 Cisco Systems, Inc" |
37 | 37 | ||
38 | #define ENIC_BARS_MAX 6 | 38 | #define ENIC_BARS_MAX 6 |
39 | 39 | ||
diff --git a/drivers/net/ethernet/cisco/enic/enic_res.h b/drivers/net/ethernet/cisco/enic/enic_res.h index 25be2734c3fe..69f60afd6577 100644 --- a/drivers/net/ethernet/cisco/enic/enic_res.h +++ b/drivers/net/ethernet/cisco/enic/enic_res.h | |||
@@ -47,6 +47,9 @@ static inline void enic_queue_wq_desc_ex(struct vnic_wq *wq, | |||
47 | int offload_mode, int cq_entry, int sop, int eop, int loopback) | 47 | int offload_mode, int cq_entry, int sop, int eop, int loopback) |
48 | { | 48 | { |
49 | struct wq_enet_desc *desc = vnic_wq_next_desc(wq); | 49 | struct wq_enet_desc *desc = vnic_wq_next_desc(wq); |
50 | u8 desc_skip_cnt = 1; | ||
51 | u8 compressed_send = 0; | ||
52 | u64 wrid = 0; | ||
50 | 53 | ||
51 | wq_enet_desc_enc(desc, | 54 | wq_enet_desc_enc(desc, |
52 | (u64)dma_addr | VNIC_PADDR_TARGET, | 55 | (u64)dma_addr | VNIC_PADDR_TARGET, |
@@ -59,7 +62,8 @@ static inline void enic_queue_wq_desc_ex(struct vnic_wq *wq, | |||
59 | (u16)vlan_tag, | 62 | (u16)vlan_tag, |
60 | (u8)loopback); | 63 | (u8)loopback); |
61 | 64 | ||
62 | vnic_wq_post(wq, os_buf, dma_addr, len, sop, eop); | 65 | vnic_wq_post(wq, os_buf, dma_addr, len, sop, eop, desc_skip_cnt, |
66 | (u8)cq_entry, compressed_send, wrid); | ||
63 | } | 67 | } |
64 | 68 | ||
65 | static inline void enic_queue_wq_desc_cont(struct vnic_wq *wq, | 69 | static inline void enic_queue_wq_desc_cont(struct vnic_wq *wq, |
@@ -120,6 +124,7 @@ static inline void enic_queue_rq_desc(struct vnic_rq *rq, | |||
120 | dma_addr_t dma_addr, unsigned int len) | 124 | dma_addr_t dma_addr, unsigned int len) |
121 | { | 125 | { |
122 | struct rq_enet_desc *desc = vnic_rq_next_desc(rq); | 126 | struct rq_enet_desc *desc = vnic_rq_next_desc(rq); |
127 | u64 wrid = 0; | ||
123 | u8 type = os_buf_index ? | 128 | u8 type = os_buf_index ? |
124 | RQ_ENET_TYPE_NOT_SOP : RQ_ENET_TYPE_ONLY_SOP; | 129 | RQ_ENET_TYPE_NOT_SOP : RQ_ENET_TYPE_ONLY_SOP; |
125 | 130 | ||
@@ -127,7 +132,7 @@ static inline void enic_queue_rq_desc(struct vnic_rq *rq, | |||
127 | (u64)dma_addr | VNIC_PADDR_TARGET, | 132 | (u64)dma_addr | VNIC_PADDR_TARGET, |
128 | type, (u16)len); | 133 | type, (u16)len); |
129 | 134 | ||
130 | vnic_rq_post(rq, os_buf, os_buf_index, dma_addr, len); | 135 | vnic_rq_post(rq, os_buf, os_buf_index, dma_addr, len, wrid); |
131 | } | 136 | } |
132 | 137 | ||
133 | struct enic; | 138 | struct enic; |
diff --git a/drivers/net/ethernet/cisco/enic/vnic_devcmd.h b/drivers/net/ethernet/cisco/enic/vnic_devcmd.h index 23d555255cf8..b9a0d78fd639 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_devcmd.h +++ b/drivers/net/ethernet/cisco/enic/vnic_devcmd.h | |||
@@ -281,11 +281,25 @@ enum vnic_devcmd_cmd { | |||
281 | * 0 if no VIF-CONFIG-INFO TLV was ever received. */ | 281 | * 0 if no VIF-CONFIG-INFO TLV was ever received. */ |
282 | CMD_CONFIG_INFO_GET = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 44), | 282 | CMD_CONFIG_INFO_GET = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 44), |
283 | 283 | ||
284 | /* INT13 API: (u64)a0=paddr to vnic_int13_params struct | ||
285 | * (u32)a1=INT13_CMD_xxx | ||
286 | */ | ||
287 | CMD_INT13_ALL = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ALL, 45), | ||
288 | |||
289 | /* Set default vlan: | ||
290 | * in: (u16)a0=new default vlan | ||
291 | * (u16)a1=zero for overriding vlan with param a0, | ||
292 | * non-zero for resetting vlan to the default | ||
293 | * out: (u16)a0=old default vlan | ||
294 | */ | ||
295 | CMD_SET_DEFAULT_VLAN = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 46), | ||
296 | |||
284 | /* init_prov_info2: | 297 | /* init_prov_info2: |
285 | * Variant of CMD_INIT_PROV_INFO, where it will not try to enable | 298 | * Variant of CMD_INIT_PROV_INFO, where it will not try to enable |
286 | * the vnic until CMD_ENABLE2 is issued. | 299 | * the vnic until CMD_ENABLE2 is issued. |
287 | * (u64)a0=paddr of vnic_devcmd_provinfo | 300 | * (u64)a0=paddr of vnic_devcmd_provinfo |
288 | * (u32)a1=sizeof provision info */ | 301 | * (u32)a1=sizeof provision info |
302 | */ | ||
289 | CMD_INIT_PROV_INFO2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 47), | 303 | CMD_INIT_PROV_INFO2 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 47), |
290 | 304 | ||
291 | /* enable2: | 305 | /* enable2: |
@@ -339,16 +353,57 @@ enum vnic_devcmd_cmd { | |||
339 | CMD_INTR_COAL_CONVERT = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 50), | 353 | CMD_INTR_COAL_CONVERT = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 50), |
340 | 354 | ||
341 | /* | 355 | /* |
342 | * cmd_set_mac_addr | 356 | * Set the predefined mac address as default |
343 | * set mac address | ||
344 | * in: | 357 | * in: |
345 | * (u48)a0 = mac addr | 358 | * (u48)a0 = mac addr |
346 | * | ||
347 | */ | 359 | */ |
348 | CMD_SET_MAC_ADDR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 55), | 360 | CMD_SET_MAC_ADDR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 55), |
361 | |||
362 | /* Update the provisioning info of the given VIF | ||
363 | * (u64)a0=paddr of vnic_devcmd_provinfo | ||
364 | * (u32)a1=sizeof provision info | ||
365 | */ | ||
366 | CMD_PROV_INFO_UPDATE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 56), | ||
367 | |||
368 | /* Add a filter. | ||
369 | * in: (u64) a0= filter address | ||
370 | * (u32) a1= size of filter | ||
371 | * out: (u32) a0=filter identifier | ||
372 | */ | ||
373 | CMD_ADD_FILTER = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ENET, 58), | ||
374 | |||
375 | /* Delete a filter. | ||
376 | * in: (u32) a0=filter identifier | ||
377 | */ | ||
378 | CMD_DEL_FILTER = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 59), | ||
379 | |||
380 | /* Enable a Queue Pair in User space NIC | ||
381 | * in: (u32) a0=Queue Pair number | ||
382 | * (u32) a1= command | ||
383 | */ | ||
384 | CMD_QP_ENABLE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 60), | ||
385 | |||
386 | /* Disable a Queue Pair in User space NIC | ||
387 | * in: (u32) a0=Queue Pair number | ||
388 | * (u32) a1= command | ||
389 | */ | ||
390 | CMD_QP_DISABLE = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 61), | ||
391 | |||
392 | /* Stats dump Queue Pair in User space NIC | ||
393 | * in: (u32) a0=Queue Pair number | ||
394 | * (u64) a1=host buffer addr for status dump | ||
395 | * (u32) a2=length of the buffer | ||
396 | */ | ||
397 | CMD_QP_STATS_DUMP = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 62), | ||
398 | |||
399 | /* Clear stats for Queue Pair in User space NIC | ||
400 | * in: (u32) a0=Queue Pair number | ||
401 | */ | ||
402 | CMD_QP_STATS_CLEAR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 63), | ||
349 | }; | 403 | }; |
350 | 404 | ||
351 | /* CMD_ENABLE2 flags */ | 405 | /* CMD_ENABLE2 flags */ |
406 | #define CMD_ENABLE2_STANDBY 0x0 | ||
352 | #define CMD_ENABLE2_ACTIVE 0x1 | 407 | #define CMD_ENABLE2_ACTIVE 0x1 |
353 | 408 | ||
354 | /* flags for CMD_OPEN */ | 409 | /* flags for CMD_OPEN */ |
@@ -364,6 +419,9 @@ enum vnic_devcmd_cmd { | |||
364 | #define CMD_PFILTER_PROMISCUOUS 0x08 | 419 | #define CMD_PFILTER_PROMISCUOUS 0x08 |
365 | #define CMD_PFILTER_ALL_MULTICAST 0x10 | 420 | #define CMD_PFILTER_ALL_MULTICAST 0x10 |
366 | 421 | ||
422 | /* Commands for CMD_QP_ENABLE/CM_QP_DISABLE */ | ||
423 | #define CMD_QP_RQWQ 0x0 | ||
424 | |||
367 | /* rewrite modes for CMD_IG_VLAN_REWRITE_MODE */ | 425 | /* rewrite modes for CMD_IG_VLAN_REWRITE_MODE */ |
368 | #define IG_VLAN_REWRITE_MODE_DEFAULT_TRUNK 0 | 426 | #define IG_VLAN_REWRITE_MODE_DEFAULT_TRUNK 0 |
369 | #define IG_VLAN_REWRITE_MODE_UNTAG_DEFAULT_VLAN 1 | 427 | #define IG_VLAN_REWRITE_MODE_UNTAG_DEFAULT_VLAN 1 |
@@ -390,6 +448,7 @@ enum vnic_devcmd_error { | |||
390 | ERR_EMAXRES = 10, | 448 | ERR_EMAXRES = 10, |
391 | ERR_ENOTSUPPORTED = 11, | 449 | ERR_ENOTSUPPORTED = 11, |
392 | ERR_EINPROGRESS = 12, | 450 | ERR_EINPROGRESS = 12, |
451 | ERR_MAX | ||
393 | }; | 452 | }; |
394 | 453 | ||
395 | /* | 454 | /* |
@@ -435,6 +494,115 @@ struct vnic_devcmd_provinfo { | |||
435 | u8 data[0]; | 494 | u8 data[0]; |
436 | }; | 495 | }; |
437 | 496 | ||
497 | /* These are used in flags field of different filters to denote | ||
498 | * valid fields used. | ||
499 | */ | ||
500 | #define FILTER_FIELD_VALID(fld) (1 << (fld - 1)) | ||
501 | |||
502 | #define FILTER_FIELDS_USNIC ( \ | ||
503 | FILTER_FIELD_VALID(1) | \ | ||
504 | FILTER_FIELD_VALID(2) | \ | ||
505 | FILTER_FIELD_VALID(3) | \ | ||
506 | FILTER_FIELD_VALID(4)) | ||
507 | |||
508 | #define FILTER_FIELDS_IPV4_5TUPLE ( \ | ||
509 | FILTER_FIELD_VALID(1) | \ | ||
510 | FILTER_FIELD_VALID(2) | \ | ||
511 | FILTER_FIELD_VALID(3) | \ | ||
512 | FILTER_FIELD_VALID(4) | \ | ||
513 | FILTER_FIELD_VALID(5)) | ||
514 | |||
515 | #define FILTER_FIELDS_MAC_VLAN ( \ | ||
516 | FILTER_FIELD_VALID(1) | \ | ||
517 | FILTER_FIELD_VALID(2)) | ||
518 | |||
519 | #define FILTER_FIELD_USNIC_VLAN FILTER_FIELD_VALID(1) | ||
520 | #define FILTER_FIELD_USNIC_ETHTYPE FILTER_FIELD_VALID(2) | ||
521 | #define FILTER_FIELD_USNIC_PROTO FILTER_FIELD_VALID(3) | ||
522 | #define FILTER_FIELD_USNIC_ID FILTER_FIELD_VALID(4) | ||
523 | |||
524 | struct filter_usnic_id { | ||
525 | u32 flags; | ||
526 | u16 vlan; | ||
527 | u16 ethtype; | ||
528 | u8 proto_version; | ||
529 | u32 usnic_id; | ||
530 | } __packed; | ||
531 | |||
532 | #define FILTER_FIELD_5TUP_PROTO FILTER_FIELD_VALID(1) | ||
533 | #define FILTER_FIELD_5TUP_SRC_AD FILTER_FIELD_VALID(2) | ||
534 | #define FILTER_FIELD_5TUP_DST_AD FILTER_FIELD_VALID(3) | ||
535 | #define FILTER_FIELD_5TUP_SRC_PT FILTER_FIELD_VALID(4) | ||
536 | #define FILTER_FIELD_5TUP_DST_PT FILTER_FIELD_VALID(5) | ||
537 | |||
538 | /* Enums for the protocol field. */ | ||
539 | enum protocol_e { | ||
540 | PROTO_UDP = 0, | ||
541 | PROTO_TCP = 1, | ||
542 | }; | ||
543 | |||
544 | struct filter_ipv4_5tuple { | ||
545 | u32 flags; | ||
546 | u32 protocol; | ||
547 | u32 src_addr; | ||
548 | u32 dst_addr; | ||
549 | u16 src_port; | ||
550 | u16 dst_port; | ||
551 | } __packed; | ||
552 | |||
553 | #define FILTER_FIELD_VMQ_VLAN FILTER_FIELD_VALID(1) | ||
554 | #define FILTER_FIELD_VMQ_MAC FILTER_FIELD_VALID(2) | ||
555 | |||
556 | struct filter_mac_vlan { | ||
557 | u32 flags; | ||
558 | u16 vlan; | ||
559 | u8 mac_addr[6]; | ||
560 | } __packed; | ||
561 | |||
562 | /* Specifies the filter_action type. */ | ||
563 | enum { | ||
564 | FILTER_ACTION_RQ_STEERING = 0, | ||
565 | FILTER_ACTION_MAX | ||
566 | }; | ||
567 | |||
568 | struct filter_action { | ||
569 | u32 type; | ||
570 | union { | ||
571 | u32 rq_idx; | ||
572 | } u; | ||
573 | } __packed; | ||
574 | |||
575 | /* Specifies the filter type. */ | ||
576 | enum filter_type { | ||
577 | FILTER_USNIC_ID = 0, | ||
578 | FILTER_IPV4_5TUPLE = 1, | ||
579 | FILTER_MAC_VLAN = 2, | ||
580 | FILTER_MAX | ||
581 | }; | ||
582 | |||
583 | struct filter { | ||
584 | u32 type; | ||
585 | union { | ||
586 | struct filter_usnic_id usnic; | ||
587 | struct filter_ipv4_5tuple ipv4; | ||
588 | struct filter_mac_vlan mac_vlan; | ||
589 | } u; | ||
590 | } __packed; | ||
591 | |||
592 | enum { | ||
593 | CLSF_TLV_FILTER = 0, | ||
594 | CLSF_TLV_ACTION = 1, | ||
595 | }; | ||
596 | |||
597 | /* Maximum size of buffer to CMD_ADD_FILTER */ | ||
598 | #define FILTER_MAX_BUF_SIZE 100 | ||
599 | |||
600 | struct filter_tlv { | ||
601 | u_int32_t type; | ||
602 | u_int32_t length; | ||
603 | u_int32_t val[0]; | ||
604 | }; | ||
605 | |||
438 | /* | 606 | /* |
439 | * Writing cmd register causes STAT_BUSY to get set in status register. | 607 | * Writing cmd register causes STAT_BUSY to get set in status register. |
440 | * When cmd completes, STAT_BUSY will be cleared. | 608 | * When cmd completes, STAT_BUSY will be cleared. |
diff --git a/drivers/net/ethernet/cisco/enic/vnic_rq.c b/drivers/net/ethernet/cisco/enic/vnic_rq.c index 7e1488fc8ab2..36a2ed606c91 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_rq.c +++ b/drivers/net/ethernet/cisco/enic/vnic_rq.c | |||
@@ -30,12 +30,9 @@ | |||
30 | static int vnic_rq_alloc_bufs(struct vnic_rq *rq) | 30 | static int vnic_rq_alloc_bufs(struct vnic_rq *rq) |
31 | { | 31 | { |
32 | struct vnic_rq_buf *buf; | 32 | struct vnic_rq_buf *buf; |
33 | struct vnic_dev *vdev; | ||
34 | unsigned int i, j, count = rq->ring.desc_count; | 33 | unsigned int i, j, count = rq->ring.desc_count; |
35 | unsigned int blks = VNIC_RQ_BUF_BLKS_NEEDED(count); | 34 | unsigned int blks = VNIC_RQ_BUF_BLKS_NEEDED(count); |
36 | 35 | ||
37 | vdev = rq->vdev; | ||
38 | |||
39 | for (i = 0; i < blks; i++) { | 36 | for (i = 0; i < blks; i++) { |
40 | rq->bufs[i] = kzalloc(VNIC_RQ_BUF_BLK_SZ(count), GFP_ATOMIC); | 37 | rq->bufs[i] = kzalloc(VNIC_RQ_BUF_BLK_SZ(count), GFP_ATOMIC); |
41 | if (!rq->bufs[i]) | 38 | if (!rq->bufs[i]) |
@@ -141,7 +138,7 @@ void vnic_rq_init(struct vnic_rq *rq, unsigned int cq_index, | |||
141 | unsigned int error_interrupt_enable, | 138 | unsigned int error_interrupt_enable, |
142 | unsigned int error_interrupt_offset) | 139 | unsigned int error_interrupt_offset) |
143 | { | 140 | { |
144 | u32 fetch_index; | 141 | u32 fetch_index = 0; |
145 | 142 | ||
146 | /* Use current fetch_index as the ring starting point */ | 143 | /* Use current fetch_index as the ring starting point */ |
147 | fetch_index = ioread32(&rq->ctrl->fetch_index); | 144 | fetch_index = ioread32(&rq->ctrl->fetch_index); |
diff --git a/drivers/net/ethernet/cisco/enic/vnic_rq.h b/drivers/net/ethernet/cisco/enic/vnic_rq.h index 2056586f4d4b..ee7bc95af278 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_rq.h +++ b/drivers/net/ethernet/cisco/enic/vnic_rq.h | |||
@@ -72,6 +72,7 @@ struct vnic_rq_buf { | |||
72 | unsigned int len; | 72 | unsigned int len; |
73 | unsigned int index; | 73 | unsigned int index; |
74 | void *desc; | 74 | void *desc; |
75 | uint64_t wr_id; | ||
75 | }; | 76 | }; |
76 | 77 | ||
77 | struct vnic_rq { | 78 | struct vnic_rq { |
@@ -110,7 +111,8 @@ static inline unsigned int vnic_rq_next_index(struct vnic_rq *rq) | |||
110 | 111 | ||
111 | static inline void vnic_rq_post(struct vnic_rq *rq, | 112 | static inline void vnic_rq_post(struct vnic_rq *rq, |
112 | void *os_buf, unsigned int os_buf_index, | 113 | void *os_buf, unsigned int os_buf_index, |
113 | dma_addr_t dma_addr, unsigned int len) | 114 | dma_addr_t dma_addr, unsigned int len, |
115 | uint64_t wrid) | ||
114 | { | 116 | { |
115 | struct vnic_rq_buf *buf = rq->to_use; | 117 | struct vnic_rq_buf *buf = rq->to_use; |
116 | 118 | ||
@@ -118,6 +120,7 @@ static inline void vnic_rq_post(struct vnic_rq *rq, | |||
118 | buf->os_buf_index = os_buf_index; | 120 | buf->os_buf_index = os_buf_index; |
119 | buf->dma_addr = dma_addr; | 121 | buf->dma_addr = dma_addr; |
120 | buf->len = len; | 122 | buf->len = len; |
123 | buf->wr_id = wrid; | ||
121 | 124 | ||
122 | buf = buf->next; | 125 | buf = buf->next; |
123 | rq->to_use = buf; | 126 | rq->to_use = buf; |
diff --git a/drivers/net/ethernet/cisco/enic/vnic_wq.c b/drivers/net/ethernet/cisco/enic/vnic_wq.c index 5e0d7a2be9bc..3e6b8d54dafc 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_wq.c +++ b/drivers/net/ethernet/cisco/enic/vnic_wq.c | |||
@@ -30,12 +30,9 @@ | |||
30 | static int vnic_wq_alloc_bufs(struct vnic_wq *wq) | 30 | static int vnic_wq_alloc_bufs(struct vnic_wq *wq) |
31 | { | 31 | { |
32 | struct vnic_wq_buf *buf; | 32 | struct vnic_wq_buf *buf; |
33 | struct vnic_dev *vdev; | ||
34 | unsigned int i, j, count = wq->ring.desc_count; | 33 | unsigned int i, j, count = wq->ring.desc_count; |
35 | unsigned int blks = VNIC_WQ_BUF_BLKS_NEEDED(count); | 34 | unsigned int blks = VNIC_WQ_BUF_BLKS_NEEDED(count); |
36 | 35 | ||
37 | vdev = wq->vdev; | ||
38 | |||
39 | for (i = 0; i < blks; i++) { | 36 | for (i = 0; i < blks; i++) { |
40 | wq->bufs[i] = kzalloc(VNIC_WQ_BUF_BLK_SZ(count), GFP_ATOMIC); | 37 | wq->bufs[i] = kzalloc(VNIC_WQ_BUF_BLK_SZ(count), GFP_ATOMIC); |
41 | if (!wq->bufs[i]) | 38 | if (!wq->bufs[i]) |
diff --git a/drivers/net/ethernet/cisco/enic/vnic_wq.h b/drivers/net/ethernet/cisco/enic/vnic_wq.h index 7dd937ac11c2..2c6c70804a39 100644 --- a/drivers/net/ethernet/cisco/enic/vnic_wq.h +++ b/drivers/net/ethernet/cisco/enic/vnic_wq.h | |||
@@ -58,6 +58,10 @@ struct vnic_wq_buf { | |||
58 | unsigned int index; | 58 | unsigned int index; |
59 | int sop; | 59 | int sop; |
60 | void *desc; | 60 | void *desc; |
61 | uint64_t wr_id; /* Cookie */ | ||
62 | uint8_t cq_entry; /* Gets completion event from hw */ | ||
63 | uint8_t desc_skip_cnt; /* Num descs to occupy */ | ||
64 | uint8_t compressed_send; /* Both hdr and payload in one desc */ | ||
61 | }; | 65 | }; |
62 | 66 | ||
63 | /* Break the vnic_wq_buf allocations into blocks of 32/64 entries */ | 67 | /* Break the vnic_wq_buf allocations into blocks of 32/64 entries */ |
@@ -102,14 +106,20 @@ static inline void *vnic_wq_next_desc(struct vnic_wq *wq) | |||
102 | 106 | ||
103 | static inline void vnic_wq_post(struct vnic_wq *wq, | 107 | static inline void vnic_wq_post(struct vnic_wq *wq, |
104 | void *os_buf, dma_addr_t dma_addr, | 108 | void *os_buf, dma_addr_t dma_addr, |
105 | unsigned int len, int sop, int eop) | 109 | unsigned int len, int sop, int eop, |
110 | uint8_t desc_skip_cnt, uint8_t cq_entry, | ||
111 | uint8_t compressed_send, uint64_t wrid) | ||
106 | { | 112 | { |
107 | struct vnic_wq_buf *buf = wq->to_use; | 113 | struct vnic_wq_buf *buf = wq->to_use; |
108 | 114 | ||
109 | buf->sop = sop; | 115 | buf->sop = sop; |
116 | buf->cq_entry = cq_entry; | ||
117 | buf->compressed_send = compressed_send; | ||
118 | buf->desc_skip_cnt = desc_skip_cnt; | ||
110 | buf->os_buf = eop ? os_buf : NULL; | 119 | buf->os_buf = eop ? os_buf : NULL; |
111 | buf->dma_addr = dma_addr; | 120 | buf->dma_addr = dma_addr; |
112 | buf->len = len; | 121 | buf->len = len; |
122 | buf->wr_id = wrid; | ||
113 | 123 | ||
114 | buf = buf->next; | 124 | buf = buf->next; |
115 | if (eop) { | 125 | if (eop) { |
@@ -123,7 +133,7 @@ static inline void vnic_wq_post(struct vnic_wq *wq, | |||
123 | } | 133 | } |
124 | wq->to_use = buf; | 134 | wq->to_use = buf; |
125 | 135 | ||
126 | wq->ring.desc_avail--; | 136 | wq->ring.desc_avail -= desc_skip_cnt; |
127 | } | 137 | } |
128 | 138 | ||
129 | static inline void vnic_wq_service(struct vnic_wq *wq, | 139 | static inline void vnic_wq_service(struct vnic_wq *wq, |