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

Message ID 1526055955-14027-2-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andrew Rybchenko May 11, 2018, 4:25 p.m. UTC
  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@solarflare.com>
---
 lib/librte_ethdev/rte_ethdev.c | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

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. */