blob: bf6df8113faad4190804bf6a8582ea766c873b2e [file] [log] [blame]
John Lo55bf5c92016-07-04 23:23:32 -04001From db0a30a2e61a3bf2f6cb8e74203dab84280b0419 Mon Sep 17 00:00:00 2001
2From: John Daley <johndale@cisco.com>
3Date: Sat, 11 Jun 2016 10:27:05 -0700
4Subject: [PATCH 22/25] net/enic: improve out of resources error handling
5
6If configuration fails due to lack of resources, be more specific
7about which resources are lacking - work queues, read queues or
8completion queues. Return -EINVAL instead of -1 if more queeues
9are requested than are available.
10
11Fixes: fefed3d1e62c ("enic: new driver")
12
13Signed-off-by: John Daley <johndale@cisco.com>
14---
15 drivers/net/enic/enic_main.c | 30 ++++++++++++++++++++----------
16 1 file changed, 20 insertions(+), 10 deletions(-)
17
18diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
19index 4e5594f..43e4af1 100644
20--- a/drivers/net/enic/enic_main.c
21+++ b/drivers/net/enic/enic_main.c
22@@ -970,22 +970,32 @@ static void enic_dev_deinit(struct enic *enic)
23 int enic_set_vnic_res(struct enic *enic)
24 {
25 struct rte_eth_dev *eth_dev = enic->rte_dev;
26+ int rc = 0;
27
28- if ((enic->rq_count < eth_dev->data->nb_rx_queues) ||
29- (enic->wq_count < eth_dev->data->nb_tx_queues)) {
30- dev_err(dev, "Not enough resources configured, aborting\n");
31- return -1;
32+ if (enic->rq_count < eth_dev->data->nb_rx_queues) {
33+ dev_err(dev, "Not enough Receive queues. Requested:%u, Configured:%u\n",
34+ eth_dev->data->nb_rx_queues, enic->rq_count);
35+ rc = -EINVAL;
36+ }
37+ if (enic->wq_count < eth_dev->data->nb_tx_queues) {
38+ dev_err(dev, "Not enough Transmit queues. Requested:%u, Configured:%u\n",
39+ eth_dev->data->nb_tx_queues, enic->wq_count);
40+ rc = -EINVAL;
41 }
42
43- enic->rq_count = eth_dev->data->nb_rx_queues;
44- enic->wq_count = eth_dev->data->nb_tx_queues;
45 if (enic->cq_count < (enic->rq_count + enic->wq_count)) {
46- dev_err(dev, "Not enough resources configured, aborting\n");
47- return -1;
48+ dev_err(dev, "Not enough Completion queues. Required:%u, Configured:%u\n",
49+ enic->rq_count + enic->wq_count, enic->cq_count);
50+ rc = -EINVAL;
51 }
52
53- enic->cq_count = enic->rq_count + enic->wq_count;
54- return 0;
55+ if (rc == 0) {
56+ enic->rq_count = eth_dev->data->nb_rx_queues;
57+ enic->wq_count = eth_dev->data->nb_tx_queues;
58+ enic->cq_count = enic->rq_count + enic->wq_count;
59+ }
60+
61+ return rc;
62 }
63
64 static int enic_dev_init(struct enic *enic)
65--
662.7.0
67