diff mbox series

[v2,1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic

Message ID 20230323130815.7753-1-nbd@nbd.name (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [v2,1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Felix Fietkau March 23, 2023, 1:08 p.m. UTC
Since we call flow_block_cb_decref on FLOW_BLOCK_UNBIND, we also need to
call flow_block_cb_incref for a newly allocated cb.
Also fix the accidentally inverted refcount check on unbind.

Fixes: 502e84e2382d ("net: ethernet: mtk_eth_soc: add flow offloading support")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
v2: fix description, simplify refcounting change

 drivers/net/ethernet/mediatek/mtk_ppe_offload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Simon Horman March 24, 2023, 12:21 p.m. UTC | #1
On Thu, Mar 23, 2023 at 02:08:13PM +0100, Felix Fietkau wrote:
> Since we call flow_block_cb_decref on FLOW_BLOCK_UNBIND, we also need to
> call flow_block_cb_incref for a newly allocated cb.
> Also fix the accidentally inverted refcount check on unbind.
> 
> Fixes: 502e84e2382d ("net: ethernet: mtk_eth_soc: add flow offloading support")
> Signed-off-by: Felix Fietkau <nbd@nbd.name>

Reviewed-by: Simon Horman <simon.horman@corigine.com>

I'm guessing that this series is for 'net'.
But it seems that patchwork had a tough time figuring that out
and gave up. So CI type things haven't run there.

https://patchwork.kernel.org/project/netdevbpf/patch/20230323130815.7753-1-nbd@nbd.name/

Also, there is a merge conflict when merging net-next into net
with this series applied.

momiji ~/projects/linux/linux git diff drivers/net/ethernet/mediatek/mtk_ppe.c
diff --cc drivers/net/ethernet/mediatek/mtk_ppe.c
index fd07d6e14273,c099e8736716..000000000000
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@@ -459,7 -500,13 +501,17 @@@ __mtk_foe_entry_clear(struct mtk_ppe *p
                hwe->ib1 &= ~MTK_FOE_IB1_STATE;
                hwe->ib1 |= FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_INVALID);
                dma_wmb();
++<<<<<<< HEAD
 +              mtk_ppe_cache_clear(ppe);
++=======
+               if (ppe->accounting) {
+                       struct mtk_foe_accounting *acct;
+ 
+                       acct = ppe->acct_table + entry->hash * sizeof(*acct);
+                       acct->packets = 0;
+                       acct->bytes = 0;
+               }
++>>>>>>> net-next/main
        }
        entry->hash = 0xffff;
Jakub Kicinski March 24, 2023, 10:09 p.m. UTC | #2
On Fri, 24 Mar 2023 13:21:02 +0100 Simon Horman wrote:
> I'm guessing that this series is for 'net'.
> But it seems that patchwork had a tough time figuring that out
> and gave up. So CI type things haven't run there.

Indeed, a resend with [PATCH net] in the subject would be appreciated.
patchwork does a lot more build testing than we can handle manually.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
index 81afd5ee3fbf..161751bb36c9 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
@@ -576,6 +576,7 @@  mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
 		if (IS_ERR(block_cb))
 			return PTR_ERR(block_cb);
 
+		flow_block_cb_incref(block_cb);
 		flow_block_cb_add(block_cb, f);
 		list_add_tail(&block_cb->driver_list, &block_cb_list);
 		return 0;
@@ -584,7 +585,7 @@  mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
 		if (!block_cb)
 			return -ENOENT;
 
-		if (flow_block_cb_decref(block_cb)) {
+		if (!flow_block_cb_decref(block_cb)) {
 			flow_block_cb_remove(block_cb, f);
 			list_del(&block_cb->driver_list);
 		}