eventdev: check error in default Rx conf callback
authorNikhil Rao <nikhil.rao@intel.com>
Sun, 4 Feb 2018 18:18:31 +0000 (23:48 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 6 Feb 2018 21:09:17 +0000 (22:09 +0100)
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.

Coverity issue: 257000
Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
lib/librte_eventdev/rte_event_eth_rx_adapter.c
lib/librte_eventdev/rte_event_eth_rx_adapter.h

index 90106e6..9aece9f 100644 (file)
@@ -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;
 }
index 6a9e7ed..c20507b 100644 (file)
@@ -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,