blob: d581702d47abf3c871a4a92ab0c7d64e726cc500 [file] [log] [blame]
John Lo55bf5c92016-07-04 23:23:32 -04001From 658069b0c5994e260cd7d0a7dfc7f03d78dd4f5a Mon Sep 17 00:00:00 2001
2From: Nelson Escobar <neescoba@cisco.com>
3Date: Tue, 28 Jun 2016 11:49:11 -0700
4Subject: [PATCH 24/25] net/enic: fix Rx scatter with multiple queues
5
6The Rx scatter patch failed to make a few changes and resulted in
7problems when using multiple receive queues (RQs) in DPDK (ie RSS)
8since the wrong adapter resources were being used.
9
10- get and use the correct completion queue index associated with a
11 receive queue.
12- set the correct receive queue index when using RSS
13
14Fixes: 856d7ba7ed22 ("net/enic: support scattered Rx")
15
16Signed-off-by: Nelson Escobar <neescoba@cisco.com>
17Reviewed-by: John Daley <johndale@cisco.com>
18---
19 drivers/net/enic/enic.h | 6 +++++-
20 drivers/net/enic/enic_main.c | 10 ++++++----
21 2 files changed, 11 insertions(+), 5 deletions(-)
22
23diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
24index 175adb8..8b0fa05 100644
25--- a/drivers/net/enic/enic.h
26+++ b/drivers/net/enic/enic.h
27@@ -165,7 +165,11 @@ static inline unsigned int enic_data_rq(__rte_unused struct enic *enic, unsigned
28
29 static inline unsigned int enic_cq_rq(__rte_unused struct enic *enic, unsigned int rq)
30 {
31- return rq;
32+ /* Scatter rx uses two receive queues together with one
33+ * completion queue, so the completion queue number is no
34+ * longer the same as the rq number.
35+ */
36+ return rq / 2;
37 }
38
39 static inline unsigned int enic_cq_wq(struct enic *enic, unsigned int wq)
40diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
41index 0547f3b..976c9da 100644
42--- a/drivers/net/enic/enic_main.c
43+++ b/drivers/net/enic/enic_main.c
44@@ -252,19 +252,20 @@ void enic_init_vnic_resources(struct enic *enic)
45 vnic_dev_stats_clear(enic->vdev);
46
47 for (index = 0; index < enic->rq_count; index++) {
48+ cq_idx = enic_cq_rq(enic, enic_sop_rq(enic, index));
49+
50 vnic_rq_init(&enic->rq[enic_sop_rq(enic, index)],
51- enic_cq_rq(enic, index),
52+ cq_idx,
53 error_interrupt_enable,
54 error_interrupt_offset);
55
56 data_rq = &enic->rq[enic_data_rq(enic, index)];
57 if (data_rq->in_use)
58 vnic_rq_init(data_rq,
59- enic_cq_rq(enic, index),
60+ cq_idx,
61 error_interrupt_enable,
62 error_interrupt_offset);
63
64- cq_idx = enic_cq_rq(enic, index);
65 vnic_cq_init(&enic->cq[cq_idx],
66 0 /* flow_control_enable */,
67 1 /* color_enable */,
68@@ -896,7 +897,8 @@ static int enic_set_rsscpu(struct enic *enic, u8 rss_hash_bits)
69 return -ENOMEM;
70
71 for (i = 0; i < (1 << rss_hash_bits); i++)
72- (*rss_cpu_buf_va).cpu[i/4].b[i%4] = i % enic->rq_count;
73+ (*rss_cpu_buf_va).cpu[i / 4].b[i % 4] =
74+ enic_sop_rq(enic, i % enic->rq_count);
75
76 err = enic_set_rss_cpu(enic,
77 rss_cpu_buf_pa,
78--
792.7.0
80