blob: db2ac64612c6d9d2c9a023385b085541749e0447 [file] [log] [blame]
Todd Foggoaa292c8c2016-04-06 09:57:01 -04001From ce6badc60736f5e78a295f30fe84c3e40ad0c330 Mon Sep 17 00:00:00 2001
2From: Nelson Escobar <neescoba@cisco.com>
3Date: Fri, 18 Mar 2016 11:33:34 -0700
4Subject: [PATCH 20/22] enic: fix Rx descriptor limit
John Lo23650e62016-03-29 16:14:35 -04005
John Lo23650e62016-03-29 16:14:35 -04006 On initialization, the rq descriptor count was set to the limit
7 of the vic. When the requested number of rx descriptors was
8 less than this count, enic_alloc_rq() was incorrectly setting
9 the count to the lower value. This results in later calls to
10 enic_alloc_rq() incorrectly using the lower value as the adapter
11 limit.
Todd Foggoaa292c8c2016-04-06 09:57:01 -040012
John Lo23650e62016-03-29 16:14:35 -040013 Fixes: fefed3d1e62c ("enic: new driver")
Todd Foggoaa292c8c2016-04-06 09:57:01 -040014
John Lo23650e62016-03-29 16:14:35 -040015 Signed-off-by: Nelson Escobar <neescoba@cisco.com>
16 Reviewed-by: John Daley <johndale@cisco.com>
Todd Foggoaa292c8c2016-04-06 09:57:01 -040017---
18 drivers/net/enic/enic_main.c | 14 ++++++--------
19 1 file changed, 6 insertions(+), 8 deletions(-)
John Lo23650e62016-03-29 16:14:35 -040020
21diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
22index e30672c..2f79cf0 100644
23--- a/drivers/net/enic/enic_main.c
24+++ b/drivers/net/enic/enic_main.c
25@@ -524,24 +524,22 @@ int enic_alloc_rq(struct enic *enic, uint16_t queue_idx,
26 "policy. Applying the value in the adapter "\
27 "policy (%d).\n",
28 queue_idx, nb_desc, enic->config.rq_desc_count);
29- } else if (nb_desc != enic->config.rq_desc_count) {
30- enic->config.rq_desc_count = nb_desc;
31- dev_info(enic,
32- "RX Queues - effective number of descs:%d\n",
33- nb_desc);
34+ nb_desc = enic->config.rq_desc_count;
35 }
36+ dev_info(enic, "RX Queues - effective number of descs:%d\n",
37+ nb_desc);
38 }
39
40 /* Allocate queue resources */
41 rc = vnic_rq_alloc(enic->vdev, rq, queue_idx,
42- enic->config.rq_desc_count, sizeof(struct rq_enet_desc));
43+ nb_desc, sizeof(struct rq_enet_desc));
44 if (rc) {
45 dev_err(enic, "error in allocation of rq\n");
46 goto err_exit;
47 }
48
49 rc = vnic_cq_alloc(enic->vdev, &enic->cq[queue_idx], queue_idx,
50- socket_id, enic->config.rq_desc_count,
51+ socket_id, nb_desc,
52 sizeof(struct cq_enet_rq_desc));
53 if (rc) {
54 dev_err(enic, "error in allocation of cq for rq\n");
55@@ -550,7 +548,7 @@ int enic_alloc_rq(struct enic *enic, uint16_t queue_idx,
56
57 /* Allocate the mbuf ring */
58 rq->mbuf_ring = (struct rte_mbuf **)rte_zmalloc_socket("rq->mbuf_ring",
59- sizeof(struct rte_mbuf *) * enic->config.rq_desc_count,
60+ sizeof(struct rte_mbuf *) * nb_desc,
61 RTE_CACHE_LINE_SIZE, rq->socket_id);
62
63 if (rq->mbuf_ring != NULL)
Todd Foggoaa292c8c2016-04-06 09:57:01 -040064--
651.9.1
66