[dpdk-dev,v2,1/2] net/dpaa: non supported offloads are ignored with warning

Message ID 20180423123337.5653-2-sunil.kori@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail apply patch file failure

Commit Message

Sunil Kumar Kori April 23, 2018, 12:33 p.m. UTC
  Fixes: 16e2c27f4fc7 ("net/dpaa: support new ethdev offload APIs")
Cc: shreyansh.jain@nxp.com

Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>
---
 drivers/net/dpaa/dpaa_ethdev.c | 34 +++++++++++++++++++++++++++-------
 1 file changed, 27 insertions(+), 7 deletions(-)
  

Comments

Ferruh Yigit April 23, 2018, 2:57 p.m. UTC | #1
On 4/23/2018 1:33 PM, Sunil Kumar Kori wrote:
> Fixes: 16e2c27f4fc7 ("net/dpaa: support new ethdev offload APIs")
> Cc: shreyansh.jain@nxp.com
> 
> Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>
> ---
>  drivers/net/dpaa/dpaa_ethdev.c | 34 +++++++++++++++++++++++++++-------
>  1 file changed, 27 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
> index b2740b4..81001cb 100644
> --- a/drivers/net/dpaa/dpaa_ethdev.c
> +++ b/drivers/net/dpaa/dpaa_ethdev.c
> @@ -45,6 +45,25 @@
>  #include <fsl_bman.h>
>  #include <fsl_fman.h>
>  
> +/* Non-Supported Rx offloads */
> +static uint64_t dev_rx_offloads_not_supported =
> +		DEV_RX_OFFLOAD_TCP_LRO |
> +		DEV_RX_OFFLOAD_MACSEC_STRIP |
> +		DEV_RX_OFFLOAD_HEADER_SPLIT |
> +		DEV_RX_OFFLOAD_VLAN_EXTEND |
> +		DEV_RX_OFFLOAD_SECURITY;
> +
> +/* Non-Supported Tx offloads */
> +static uint64_t dev_tx_offloads_not_supported =
> +		DEV_TX_OFFLOAD_TCP_TSO |
> +		DEV_TX_OFFLOAD_UDP_TSO |
> +		DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
> +		DEV_TX_OFFLOAD_GRE_TNL_TSO |
> +		DEV_TX_OFFLOAD_IPIP_TNL_TSO |
> +		DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
> +		DEV_TX_OFFLOAD_MACSEC_INSERT |
> +		DEV_TX_OFFLOAD_SECURITY;
> +
>  /* Keep track of whether QMAN and BMAN have been globally initialized */
>  static int is_global_init;
>  /* At present we only allow up to 4 push mode queues - as each of this queue
> @@ -150,16 +169,17 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
>  	PMD_INIT_FUNC_TRACE();
>  
>  	dpaa_eth_dev_info(dev, &dev_info);
> -	if (((~(dev_info.rx_offload_capa) & rx_offloads) != 0)) {
> -		DPAA_PMD_ERR("Some Rx offloads are not supported "
> -			"requested 0x%" PRIx64 " supported 0x%" PRIx64,
> +	/* Rx offloads validation */
> +	if (dev_rx_offloads_not_supported & rx_offloads) {
> +		DPAA_PMD_ERR(
> +		"Rx offloads not supported - Requested 0x%" PRIx64 " supported 0x%" PRIx64,
>  			rx_offloads, dev_info.rx_offload_capa);
>  		return -ENOTSUP;
>  	}

There are three group of offloads from PMD point of view:
- Supported, reported via rx_offload_capa, setting these will work fine
- Not supported, listed in dev_rx_offloads_not_supported, application setting
this will get an error with and error log.
- Not configurable, supported by hardware but not configurable by application,
these goes silently, can you print a warning for this case?
And it can be easier to keep list of these offloads, otherwise you will need to
update your unsupported list when a new type of offloading introduced. And
developers may more interested to see the list of not configurable, and leaving
rest as unsupported.
  

Patch

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index b2740b4..81001cb 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -45,6 +45,25 @@ 
 #include <fsl_bman.h>
 #include <fsl_fman.h>
 
+/* Non-Supported Rx offloads */
+static uint64_t dev_rx_offloads_not_supported =
+		DEV_RX_OFFLOAD_TCP_LRO |
+		DEV_RX_OFFLOAD_MACSEC_STRIP |
+		DEV_RX_OFFLOAD_HEADER_SPLIT |
+		DEV_RX_OFFLOAD_VLAN_EXTEND |
+		DEV_RX_OFFLOAD_SECURITY;
+
+/* Non-Supported Tx offloads */
+static uint64_t dev_tx_offloads_not_supported =
+		DEV_TX_OFFLOAD_TCP_TSO |
+		DEV_TX_OFFLOAD_UDP_TSO |
+		DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+		DEV_TX_OFFLOAD_GRE_TNL_TSO |
+		DEV_TX_OFFLOAD_IPIP_TNL_TSO |
+		DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
+		DEV_TX_OFFLOAD_MACSEC_INSERT |
+		DEV_TX_OFFLOAD_SECURITY;
+
 /* Keep track of whether QMAN and BMAN have been globally initialized */
 static int is_global_init;
 /* At present we only allow up to 4 push mode queues - as each of this queue
@@ -150,16 +169,17 @@  dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	PMD_INIT_FUNC_TRACE();
 
 	dpaa_eth_dev_info(dev, &dev_info);
-	if (((~(dev_info.rx_offload_capa) & rx_offloads) != 0)) {
-		DPAA_PMD_ERR("Some Rx offloads are not supported "
-			"requested 0x%" PRIx64 " supported 0x%" PRIx64,
+	/* Rx offloads validation */
+	if (dev_rx_offloads_not_supported & rx_offloads) {
+		DPAA_PMD_ERR(
+		"Rx offloads not supported - Requested 0x%" PRIx64 " supported 0x%" PRIx64,
 			rx_offloads, dev_info.rx_offload_capa);
 		return -ENOTSUP;
 	}
-
-	if (((~(dev_info.tx_offload_capa) & tx_offloads) != 0)) {
-		DPAA_PMD_ERR("Some Tx offloads are not supported "
-			"requested 0x%" PRIx64 " supported 0x%" PRIx64,
+	/* Tx offloads validation */
+	if (dev_tx_offloads_not_supported & tx_offloads) {
+		DPAA_PMD_ERR(
+		"Tx offloads not supported - Requested 0x%" PRIx64 " Supported 0x%" PRIx64,
 			tx_offloads, dev_info.tx_offload_capa);
 		return -ENOTSUP;
 	}