diff mbox series

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

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

Checks

Context Check Description
netdev/series_format warning Series does not have a cover letter
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 20 this patch: 20
netdev/cc_maintainers fail 2 blamed authors not CCed: pablo@netfilter.org davem@davemloft.net; 13 maintainers not CCed: angelogioacchino.delregno@collabora.com lorenzo@kernel.org pabeni@redhat.com sean.wang@mediatek.com pablo@netfilter.org kuba@kernel.org edumazet@google.com linux-mediatek@lists.infradead.org Mark-MC.Lee@mediatek.com john@phrozen.org linux-arm-kernel@lists.infradead.org matthias.bgg@gmail.com davem@davemloft.net
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 20 this patch: 20
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Felix Fietkau March 30, 2023, 12: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")
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/ethernet/mediatek/mtk_ppe_offload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Leon Romanovsky March 30, 2023, 12:13 p.m. UTC | #1
On Thu, Mar 30, 2023 at 02:08:38PM +0200, 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")
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> ---
>  drivers/net/ethernet/mediatek/mtk_ppe_offload.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

So what was changed between version 1 and 2?
It is expected to send cover letter too for series with more than 2 patches.

Thanks
Felix Fietkau March 30, 2023, 12:22 p.m. UTC | #2
On 30.03.23 14:13, Leon Romanovsky wrote:
> On Thu, Mar 30, 2023 at 02:08:38PM +0200, 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")
>> Reviewed-by: Simon Horman <simon.horman@corigine.com>
>> Signed-off-by: Felix Fietkau <nbd@nbd.name>
>> ---
>>  drivers/net/ethernet/mediatek/mtk_ppe_offload.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> So what was changed between version 1 and 2?
> It is expected to send cover letter too for series with more than 2 patches.
I had already sent v2 without the net prefix, this was just a resend 
without any further code changes.
Unfortunately I forgot to copy the changelog as well. Here it is:
   v2: fix description, simplify refcounting change

Sorry about that.

- Felix
Leon Romanovsky March 30, 2023, 6:38 p.m. UTC | #3
On Thu, Mar 30, 2023 at 02:08:38PM +0200, 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")
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> ---
>  drivers/net/ethernet/mediatek/mtk_ppe_offload.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
patchwork-bot+netdevbpf@kernel.org March 30, 2023, 6:50 p.m. UTC | #4
Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 30 Mar 2023 14:08:38 +0200 you 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")
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> 
> [...]

Here is the summary with links:
  - [net,v2,1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic
    https://git.kernel.org/netdev/net/c/8c1cb87c2a5c
  - [net,v2,2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload
    https://git.kernel.org/netdev/net/c/5f36ca1b841f
  - [net,v2,3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow
    https://git.kernel.org/netdev/net/c/924531326e2d

You are awesome, thank you!
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);
 		}