Skip to contentSkip to conversation

net/i40e: fix missing error handling for QinQ filter

PATCH In review Bruce Richardson 2 participants 3 messages Sep 11 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/i40e: fix missing error handling for QinQ filter

When installing a QinQ tunnel filter, errors were not properly caught leading to the situation where the app got a successful return code even though the filter was not properly installed. Add an appropriate log message and error return code on error to fix.

Fixes 116b7910d641 ("net/i40e: add QinQ filter create function")
---
 drivers/net/intel/i40e/i40e_ethdev.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/intel/i40e/i40e_ethdev.c +5 -3
index b6b2d291ee..c91abe7626 100644
@@ -8597,9 +8597,11 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
 	case I40E_TUNNEL_TYPE_QINQ:
 		if (!pf->qinq_replace_flag) {
 			ret = i40e_cloud_filter_qinq_create(pf);
-			if (ret < 0)
-				PMD_DRV_LOG(DEBUG,
-					    "QinQ tunnel filter already created.");
+			if (ret < 0) {
+				PMD_DRV_LOG(ERR, "Failed to create QinQ tunnel filter.");
+				/* ret is a raw i40e_status_code, not an errno */
+				return -ENOTSUP;
+			}
 			pf->qinq_replace_flag = 1;
 		}
 		/*	Add in the General fields the values of
Signature · 1 line
2.53.0
Acked-by on v1 1/1
#1 lore raw
Quoted 22 lines · Bruce Richardson

When installing a QinQ tunnel filter, errors were not properly caught leading to the situation where the app got a successful return code even though the filter was not properly installed. Add an appropriate log message and error return code on error to fix.

Fixes 116b7910d641 ("net/i40e: add QinQ filter create function")
---
  drivers/net/intel/i40e/i40e_ethdev.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/intel/i40e/i40e_ethdev.c +0 -1
index b6b2d291ee..c91abe7626 100644
@@ -8597,9 +8597,11 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
  	case I40E_TUNNEL_TYPE_QINQ:
  		if (!pf->qinq_replace_flag) {
  			ret = i40e_cloud_filter_qinq_create(pf);
-			if (ret < 0)

drivers/net/intel/i40e/i40e_ethdev.c i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, · line 8607

Quoted 10 lines
drivers/net/intel/i40e/i40e_ethdev.c +5 -2
-				PMD_DRV_LOG(DEBUG,
-					    "QinQ tunnel filter already created.");
+			if (ret < 0) {
+				PMD_DRV_LOG(ERR, "Failed to create QinQ tunnel filter.");
+				/* ret is a raw i40e_status_code, not an errno */
+				return -ENOTSUP;
+			}
  			pf->qinq_replace_flag = 1;
  		}
  		/*	Add in the General fields the values of

Returning ENOTSUP unconditionally seemed unwarranted to me, so I dug into the code to see what sort of errors we might see. The function in question actually mixes return values (default value is -ENOTSUP which is -95, but most errors from that codepath return I40E_NOT_SUPPORTED which is -64), but most of them indeed boil down to ENOTSUP (except for status returned from call into AQ command).

So, although not ideal, this is probably consistent with current implementation

Signature · 2 lines
Thanks,
Anatoly
author Applied
#2 lore raw
Quoted 41 lines · Anatoly
Quoted 22 lines · Bruce Richardson

When installing a QinQ tunnel filter, errors were not properly caught leading to the situation where the app got a successful return code even though the filter was not properly installed. Add an appropriate log message and error return code on error to fix.

Fixes 116b7910d641 ("net/i40e: add QinQ filter create function")
---
  drivers/net/intel/i40e/i40e_ethdev.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/intel/i40e/i40e_ethdev.c +0 -1
index b6b2d291ee..c91abe7626 100644
@@ -8597,9 +8597,11 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
  	case I40E_TUNNEL_TYPE_QINQ:
  		if (!pf->qinq_replace_flag) {
  			ret = i40e_cloud_filter_qinq_create(pf);
-			if (ret < 0)

drivers/net/intel/i40e/i40e_ethdev.c i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, · line 8607

Quoted 10 lines
drivers/net/intel/i40e/i40e_ethdev.c +5 -2
-				PMD_DRV_LOG(DEBUG,
-					    "QinQ tunnel filter already created.");
+			if (ret < 0) {
+				PMD_DRV_LOG(ERR, "Failed to create QinQ tunnel filter.");
+				/* ret is a raw i40e_status_code, not an errno */
+				return -ENOTSUP;
+			}
  			pf->qinq_replace_flag = 1;
  		}
  		/*	Add in the General fields the values of

Returning ENOTSUP unconditionally seemed unwarranted to me, so I dug into the code to see what sort of errors we might see. The function in question actually mixes return values (default value is -ENOTSUP which is -95, but most errors from that codepath return I40E_NOT_SUPPORTED which is -64), but most of them indeed boil down to ENOTSUP (except for status returned from call into AQ command).

Quoted 5 lines

So, although not ideal, this is probably consistent with current implementation

Applied to dpdk-next-net-intel.

/Bruce