kernel: update flow offload fix based on upstream suggestions
authorFelix Fietkau <nbd@nbd.name>
Thu, 23 Mar 2023 09:08:51 +0000 (10:08 +0100)
committerFelix Fietkau <nbd@nbd.name>
Thu, 23 Mar 2023 16:54:18 +0000 (17:54 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
target/linux/generic/pending-5.15/735-net-ethernet-mtk_eth_soc-fix-flow_offload-related-re.patch

index acbdec2159a7c7ec1c96ddc3b118ff1210da55f4..b7304906c05f1ea92e6a3aea25aedd89f99c2e47 100644 (file)
@@ -14,43 +14,15 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
 +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-@@ -561,6 +561,7 @@ mtk_eth_setup_tc_block(struct net_device
-       struct mtk_eth *eth = mac->hw;
-       static LIST_HEAD(block_cb_list);
-       struct flow_block_cb *block_cb;
-+      bool register_block = false;
-       flow_setup_cb_t *cb;
+@@ -583,6 +583,7 @@ mtk_eth_setup_tc_block(struct net_device
+               if (IS_ERR(block_cb))
+                       return PTR_ERR(block_cb);
  
-       if (!eth->soc->offload_version)
-@@ -575,23 +576,27 @@ mtk_eth_setup_tc_block(struct net_device
-       switch (f->command) {
-       case FLOW_BLOCK_BIND:
-               block_cb = flow_block_cb_lookup(f->block, cb, dev);
--              if (block_cb) {
--                      flow_block_cb_incref(block_cb);
--                      return 0;
-+              if (!block_cb) {
-+                      block_cb = flow_block_cb_alloc(cb, dev, dev, NULL);
-+                      if (IS_ERR(block_cb))
-+                              return PTR_ERR(block_cb);
-+
-+                      register_block = true;
-               }
--              block_cb = flow_block_cb_alloc(cb, dev, dev, NULL);
--              if (IS_ERR(block_cb))
--                      return PTR_ERR(block_cb);
--              flow_block_cb_add(block_cb, f);
--              list_add_tail(&block_cb->driver_list, &block_cb_list);
 +              flow_block_cb_incref(block_cb);
-+
-+              if (register_block) {
-+                      flow_block_cb_add(block_cb, f);
-+                      list_add_tail(&block_cb->driver_list, &block_cb_list);
-+              }
+               flow_block_cb_add(block_cb, f);
+               list_add_tail(&block_cb->driver_list, &block_cb_list);
                return 0;
-       case FLOW_BLOCK_UNBIND:
-               block_cb = flow_block_cb_lookup(f->block, cb, dev);
+@@ -591,7 +592,7 @@ mtk_eth_setup_tc_block(struct net_device
                if (!block_cb)
                        return -ENOENT;