Skip to contentSkip to conversation

iavf: use tc_cls_can_offload_and_chain0() instead of chain check

PATCH Applied Jiri Pirko 2 participants 2 messages Feb 26, 2020

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

PATCH v2 1/1 iavf: use tc_cls_can_offload_and_chain0() instead of chain check

From: Jiri Pirko <[email protected]>

Looks like the iavf code actually experienced a race condition, when a developer took code before the check for chain 0 was put to helper. So use tc_cls_can_offload_and_chain0() helper instead of direct check and move the check to _cb() so this is similar to i40e code.

---
v1->v2:
- rebased on top of net-next (using the correct helper name)

---
 drivers/net/ethernet/intel/iavf/iavf_main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +5 -3
index 62fe56ddcb6e..76361bd468db 100644
@@ -3061,9 +3061,6 @@ static int iavf_delete_clsflower(struct iavf_adapter *adapter,
 static int iavf_setup_tc_cls_flower(struct iavf_adapter *adapter,
 				    struct flow_cls_offload *cls_flower)
 {
-	if (cls_flower->common.chain_index)
-		return -EOPNOTSUPP;
-
 	switch (cls_flower->command) {
 	case FLOW_CLS_REPLACE:
 		return iavf_configure_clsflower(adapter, cls_flower);
@@ -3087,6 +3084,11 @@ static int iavf_setup_tc_cls_flower(struct iavf_adapter *adapter,
 static int iavf_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
 				  void *cb_priv)
 {
+	struct iavf_adapter *adapter = cb_priv;
+
+	if (!tc_cls_can_offload_and_chain0(adapter->netdev, type_data))
+		return -EOPNOTSUPP;
+
 	switch (type) {
 	case TC_SETUP_CLSFLOWER:
 		return iavf_setup_tc_cls_flower(cb_priv, type_data);
Signature · 1 line
2.21.1
maintainer Applied
#1 lore raw

From: Jiri Pirko <[email protected]>
Date: Wed, 26 Feb 2020 09:21:57 +0100

Quoted 11 lines

From: Jiri Pirko <[email protected]>

Looks like the iavf code actually experienced a race condition, when a developer took code before the check for chain 0 was put to helper. So use tc_cls_can_offload_and_chain0() helper instead of direct check and move the check to _cb() so this is similar to i40e code.

---
v1->v2:
- rebased on top of net-next (using the correct helper name)

Applied, thanks Jiri.