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