From: Nikhil Rao <nikhil.rao@intel.com>
To: dev@dpdk.org
Cc: nikhil.rao@intel.com, vipin.varghese@intel.com,
deepak.k.jain@intel.com, jerin.jacob@caviumnetworks.com
Subject: [dpdk-dev] [PATCH v2] eventdev: fix unchecked return in default Rx adapter conf cb
Date: Sun, 4 Feb 2018 23:48:31 +0530 [thread overview]
Message-ID: <1517768311-827-1-git-send-email-nikhil.rao@intel.com> (raw)
In-Reply-To: <1517352989-11720-1-git-send-email-vipin.varghese@intel.com>
The default adapter configuration callback is invoked when a Rx
queue is added to the adapter and the adapter detects that a SW
service is needed. The adapter needs to re-configure the device
with an additional port and to do do, it needs to stop the
device and restart it after it is done reconfiguring it. This
patch adds code to check the return code of
rte_event_dev_start() for both when the reconfiguration fails
and when it succeeds and introduces a new error code (-EIO)
for the first case.
Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
Coverity issue: 257000
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
---
lib/librte_eventdev/rte_event_eth_rx_adapter.h | 6 ++++++
lib/librte_eventdev/rte_event_eth_rx_adapter.c | 8 +++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.h b/lib/librte_eventdev/rte_event_eth_rx_adapter.h
index 6a9e7ed..c20507b 100644
--- a/lib/librte_eventdev/rte_event_eth_rx_adapter.h
+++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.h
@@ -321,6 +321,12 @@ int rte_event_eth_rx_adapter_free(uint8_t id);
* @return
* - 0: Success, Receive queue added correctly.
* - <0: Error code on failure.
+ * - (-EIO) device reconfiguration and restart error. The adapter reconfigures
+ * the event device with an additional port if it is required to use a service
+ * function for packet transfer from the ethernet device to the event device.
+ * If the device had been started before this call, this error code indicates
+ * an error in restart following an error in reconfiguration, i.e., a
+ * combination of the two error codes.
*/
int rte_event_eth_rx_adapter_queue_add(uint8_t id,
uint8_t eth_dev_id,
diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
index 90106e6..9aece9f 100644
--- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
@@ -602,8 +602,10 @@ default_conf_cb(uint8_t id, uint8_t dev_id,
if (ret) {
RTE_EDEV_LOG_ERR("failed to configure event dev %u\n",
dev_id);
- if (started)
- rte_event_dev_start(dev_id);
+ if (started) {
+ if (rte_event_dev_start(dev_id))
+ return -EIO;
+ }
return ret;
}
@@ -617,7 +619,7 @@ default_conf_cb(uint8_t id, uint8_t dev_id,
conf->event_port_id = port_id;
conf->max_nb_rx = 128;
if (started)
- rte_event_dev_start(dev_id);
+ ret = rte_event_dev_start(dev_id);
rx_adapter->default_cb_arg = 1;
return ret;
}
--
2.7.4
next prev parent reply other threads:[~2018-02-04 18:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-30 22:56 [dpdk-dev] [PATCH] event/rx_adapter: fix ignore return of event start Vipin Varghese
2018-01-31 5:32 ` Rao, Nikhil
2018-01-31 6:54 ` Jerin Jacob
2018-02-02 8:08 ` Varghese, Vipin
2018-02-02 10:04 ` Rao, Nikhil
2018-02-02 12:12 ` Jerin Jacob
2018-02-04 18:18 ` Nikhil Rao [this message]
2018-02-06 19:01 ` [dpdk-dev] [PATCH v2] eventdev: fix unchecked return in default Rx adapter conf cb Jerin Jacob
2018-02-06 20:24 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1517768311-827-1-git-send-email-nikhil.rao@intel.com \
--to=nikhil.rao@intel.com \
--cc=deepak.k.jain@intel.com \
--cc=dev@dpdk.org \
--cc=jerin.jacob@caviumnetworks.com \
--cc=vipin.varghese@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).