[dpdk-dev] [PATCH 1/3] ethdev: fail configure if requested offload is not supported

Andrew Rybchenko arybchenko at solarflare.com
Fri May 11 18:25:53 CEST 2018


Do not allow allow unsupported offload to be passed to PMD since
in can result in inconsistent NIC configuration and processing
in the driver.

All PMDs are converted to the new offload API and must report its
capabilties correctly. Both device and queue offloads are listed
in [rt]x_offload_capa so the check should pass despite of which
level the offload is supported on.

Fixes: d04dd6d4ed67 ("ethdev: new Rx/Tx offloads API")

Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
---
 lib/librte_ethdev/rte_ethdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 3ddf3accb..dd36e6270 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1171,6 +1171,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 				local_conf.rxmode.offloads,
 				dev_info.rx_offload_capa,
 				__func__);
+		return -EINVAL;
 	}
 	if ((local_conf.txmode.offloads & dev_info.tx_offload_capa) !=
 	     local_conf.txmode.offloads) {
@@ -1181,6 +1182,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 				local_conf.txmode.offloads,
 				dev_info.tx_offload_capa,
 				__func__);
+		return -EINVAL;
 	}
 
 	/* Check that device supports requested rss hash functions. */
-- 
2.17.0



More information about the dev mailing list