Todd Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 1 | From ce6badc60736f5e78a295f30fe84c3e40ad0c330 Mon Sep 17 00:00:00 2001 |
| 2 | From: Nelson Escobar <neescoba@cisco.com> |
| 3 | Date: Fri, 18 Mar 2016 11:33:34 -0700 |
| 4 | Subject: [PATCH 20/22] enic: fix Rx descriptor limit |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 5 | |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 6 | 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 Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 12 | |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 13 | Fixes: fefed3d1e62c ("enic: new driver") |
Todd Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 14 | |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 15 | Signed-off-by: Nelson Escobar <neescoba@cisco.com> |
| 16 | Reviewed-by: John Daley <johndale@cisco.com> |
Todd Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 17 | --- |
| 18 | drivers/net/enic/enic_main.c | 14 ++++++-------- |
| 19 | 1 file changed, 6 insertions(+), 8 deletions(-) |
John Lo | 23650e6 | 2016-03-29 16:14:35 -0400 | [diff] [blame] | 20 | |
| 21 | diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c |
| 22 | index 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 Foggoa | a292c8c | 2016-04-06 09:57:01 -0400 | [diff] [blame] | 64 | -- |
| 65 | 1.9.1 |
| 66 | |