Skip to contentSkip to conversation

ice: return proper error code in ice_add_adv_rule

PATCH New Wojciech Drewek 3 participants 4 messages Apr 1, 2022 – Apr 20, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ice: return proper error code in ice_add_adv_rule

When number of words exceeds ICE_MAX_CHAIN_WORDS, -ENOSPC should be returned not -EINVAL. Do not overwrite this error code in ice_add_tc_flower_adv_fltr.

---
 drivers/net/ethernet/intel/ice/ice_switch.c | 5 ++++-
 drivers/net/ethernet/intel/ice/ice_tc_lib.c | 1 -
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_switch.c +4 -1
index ed7130b7abfe..01f7029ec22f 100644
@@ -5992,9 +5992,12 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
 				word_cnt++;
 	}
 
-	if (!word_cnt || word_cnt > ICE_MAX_CHAIN_WORDS)
+	if (!word_cnt)
 		return -EINVAL;
 
+	if (word_cnt > ICE_MAX_CHAIN_WORDS)
+		return -ENOSPC;
+
 	/* locate a dummy packet */
 	profile = ice_find_dummy_packet(lkups, lkups_cnt, rinfo->tun_type);
 
drivers/net/ethernet/intel/ice/ice_tc_lib.c +0 -1
index f3a51597f7f6..4cee0fcf91d1 100644
@@ -748,7 +748,6 @@ ice_add_tc_flower_adv_fltr(struct ice_vsi *vsi,
 	} else if (ret) {
 		NL_SET_ERR_MSG_MOD(tc_fltr->extack,
 				   "Unable to add filter due to error");
-		ret = -EIO;
 		goto exit;
 	}
 
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/1 ice: return proper error code in ice_add_adv_rule

Quoted 4 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Wojciech Drewek
Sent: Friday, April 1, 2022 3:30 PM

To: [email protected]

Quoted 7 lines

Subject: [Intel-wired-lan] [PATCH net-next] ice: return proper error code in ice_add_adv_rule

When number of words exceeds ICE_MAX_CHAIN_WORDS, -ENOSPC should be returned not -EINVAL. Do not overwrite this error code in ice_add_tc_flower_adv_fltr.

Quoted 8 lines

---
drivers/net/ethernet/intel/ice/ice_switch.c | 5 ++++- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 1 -

2 files changed, 4 insertions(+), 2 deletions(-)
#2 lore raw

PATCH 1/1 ice: return proper error code in ice_add_adv_rule

In reply to Wojciech Drewek

Dear Wojciech,

Thank you for your patch.

Am 01.04.22 um 11:59 schrieb Wojciech Drewek:

Quoted 3 lines

When number of words exceeds ICE_MAX_CHAIN_WORDS, -ENOSPC should be returned not -EINVAL. Do not overwrite this error code in ice_add_tc_flower_adv_fltr.

Maybe make that two commits?

Also for the subject, instead of ?proper error code?, just name it. Maybe:

Quoted 1 line

ice: ice_add_adv_rule: return ENOSPC when exceeding ICE_MAX_CHAIN_WORDS

Kind regards,

Paul

Quoted 38 lines
---
  drivers/net/ethernet/intel/ice/ice_switch.c | 5 ++++-
  drivers/net/ethernet/intel/ice/ice_tc_lib.c | 1 -
  2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_switch.c +4 -1
index ed7130b7abfe..01f7029ec22f 100644
@@ -5992,9 +5992,12 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
  				word_cnt++;
  	}
 
-	if (!word_cnt || word_cnt > ICE_MAX_CHAIN_WORDS)
+	if (!word_cnt)
  		return -EINVAL;
 
+	if (word_cnt > ICE_MAX_CHAIN_WORDS)
+		return -ENOSPC;
+
  	/* locate a dummy packet */
  	profile = ice_find_dummy_packet(lkups, lkups_cnt, rinfo->tun_type);
 
drivers/net/ethernet/intel/ice/ice_tc_lib.c +0 -1
index f3a51597f7f6..4cee0fcf91d1 100644
@@ -748,7 +748,6 @@ ice_add_tc_flower_adv_fltr(struct ice_vsi *vsi,
  	} else if (ret) {
  		NL_SET_ERR_MSG_MOD(tc_fltr->extack,
  				   "Unable to add filter due to error");
-		ret = -EIO;
  		goto exit;
  	}
 
#3 lore raw

PATCH 1/1 ice: return proper error code in ice_add_adv_rule

Hi Paul,

Thanks for the review!

Quoted 10 lines

-----Original Message-----
From: Paul Menzel <[email protected]>
Sent: ?roda, 20 kwietnia 2022 12:16
To: Drewek, Wojciech <[email protected]>
Cc: intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH net-next] ice: return proper error code in ice_add_adv_rule

Dear Wojciech,

Quoted 8 lines

Thank you for your patch.

Am 01.04.22 um 11:59 schrieb Wojciech Drewek:

Quoted 3 lines

When number of words exceeds ICE_MAX_CHAIN_WORDS, -ENOSPC should be returned not -EINVAL. Do not overwrite this error code in ice_add_tc_flower_adv_fltr.

Maybe make that two commits?

IMO there is no need for that. Those changes are logically connected, why bother changing error code when it?s overwritten later.

Quoted 4 lines

Also for the subject, instead of ?proper error code?, just name it. Maybe:

Quoted 1 line

ice: ice_add_adv_rule: return ENOSPC when exceeding ICE_MAX_CHAIN_WORDS

Yea, I think it sounds better, will send v2.

Regards,
Wojtek

Quoted 45 lines

Kind regards,

Paul

Quoted 38 lines
---
  drivers/net/ethernet/intel/ice/ice_switch.c | 5 ++++-
  drivers/net/ethernet/intel/ice/ice_tc_lib.c | 1 -
  2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_switch.c +4 -1
index ed7130b7abfe..01f7029ec22f 100644
@@ -5992,9 +5992,12 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
  				word_cnt++;
  	}
 
-	if (!word_cnt || word_cnt > ICE_MAX_CHAIN_WORDS)
+	if (!word_cnt)
  		return -EINVAL;
 
+	if (word_cnt > ICE_MAX_CHAIN_WORDS)
+		return -ENOSPC;
+
  	/* locate a dummy packet */
  	profile = ice_find_dummy_packet(lkups, lkups_cnt, rinfo->tun_type);
 
drivers/net/ethernet/intel/ice/ice_tc_lib.c +0 -1
index f3a51597f7f6..4cee0fcf91d1 100644
@@ -748,7 +748,6 @@ ice_add_tc_flower_adv_fltr(struct ice_vsi *vsi,
  	} else if (ret) {
  		NL_SET_ERR_MSG_MOD(tc_fltr->extack,
  				   "Unable to add filter due to error");
-		ret = -EIO;
  		goto exit;
  	}