* [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic
@ 2023-03-30 12:08 Felix Fietkau
2023-03-30 12:08 ` [PATCH net v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload Felix Fietkau
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Felix Fietkau @ 2023-03-30 12:08 UTC (permalink / raw)
To: netdev
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(-)
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);
}
--
2.39.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload
2023-03-30 12:08 [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Felix Fietkau
@ 2023-03-30 12:08 ` Felix Fietkau
2023-03-30 18:38 ` Leon Romanovsky
2023-03-30 12:08 ` [PATCH net v2 3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow Felix Fietkau
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Felix Fietkau @ 2023-03-30 12:08 UTC (permalink / raw)
To: netdev
Check for skb metadata in order to detect the case where the DSA header
is not present.
Fixes: 2d7605a72906 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging")
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 +++---
drivers/net/ethernet/mediatek/mtk_ppe.c | 5 ++++-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 20d3e5ab1b2a..e14050e17862 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2058,9 +2058,6 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
skb_checksum_none_assert(skb);
skb->protocol = eth_type_trans(skb, netdev);
- if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
- mtk_ppe_check_skb(eth->ppe[0], skb, hash);
-
if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) {
if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) {
if (trxd.rxd3 & RX_DMA_VTAG_V2) {
@@ -2088,6 +2085,9 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
__vlan_hwaccel_put_tag(skb, htons(vlan_proto), vlan_tci);
}
+ if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED)
+ mtk_ppe_check_skb(eth->ppe[0], skb, hash);
+
skb_record_rx_queue(skb, 0);
napi_gro_receive(napi, skb);
diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
index 6883eb34cd8b..a038b99ecbda 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@ -8,6 +8,7 @@
#include <linux/platform_device.h>
#include <linux/if_ether.h>
#include <linux/if_vlan.h>
+#include <net/dst_metadata.h>
#include <net/dsa.h>
#include "mtk_eth_soc.h"
#include "mtk_ppe.h"
@@ -699,7 +700,9 @@ void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
skb->dev->dsa_ptr->tag_ops->proto != DSA_TAG_PROTO_MTK)
goto out;
- tag += 4;
+ if (!skb_metadata_dst(skb))
+ tag += 4;
+
if (get_unaligned_be16(tag) != ETH_P_8021Q)
break;
--
2.39.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH net v2 3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow
2023-03-30 12:08 [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Felix Fietkau
2023-03-30 12:08 ` [PATCH net v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload Felix Fietkau
@ 2023-03-30 12:08 ` Felix Fietkau
2023-03-30 18:38 ` Leon Romanovsky
2023-03-30 12:13 ` [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Leon Romanovsky
` (2 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: Felix Fietkau @ 2023-03-30 12:08 UTC (permalink / raw)
To: netdev
The cache needs to be flushed to ensure that the hardware stops offloading
the flow immediately.
Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries")
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
drivers/net/ethernet/mediatek/mtk_ppe.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
index a038b99ecbda..fd07d6e14273 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@ -459,6 +459,7 @@ __mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry)
hwe->ib1 &= ~MTK_FOE_IB1_STATE;
hwe->ib1 |= FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_INVALID);
dma_wmb();
+ mtk_ppe_cache_clear(ppe);
}
entry->hash = 0xffff;
--
2.39.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic
2023-03-30 12:08 [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Felix Fietkau
2023-03-30 12:08 ` [PATCH net v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload Felix Fietkau
2023-03-30 12:08 ` [PATCH net v2 3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow Felix Fietkau
@ 2023-03-30 12:13 ` Leon Romanovsky
2023-03-30 12:22 ` Felix Fietkau
2023-03-30 18:38 ` Leon Romanovsky
2023-03-30 18:50 ` patchwork-bot+netdevbpf
4 siblings, 1 reply; 9+ messages in thread
From: Leon Romanovsky @ 2023-03-30 12:13 UTC (permalink / raw)
To: Felix Fietkau; +Cc: netdev
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic
2023-03-30 12:13 ` [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Leon Romanovsky
@ 2023-03-30 12:22 ` Felix Fietkau
0 siblings, 0 replies; 9+ messages in thread
From: Felix Fietkau @ 2023-03-30 12:22 UTC (permalink / raw)
To: Leon Romanovsky; +Cc: netdev
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic
2023-03-30 12:08 [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Felix Fietkau
` (2 preceding siblings ...)
2023-03-30 12:13 ` [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Leon Romanovsky
@ 2023-03-30 18:38 ` Leon Romanovsky
2023-03-30 18:50 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 9+ messages in thread
From: Leon Romanovsky @ 2023-03-30 18:38 UTC (permalink / raw)
To: Felix Fietkau; +Cc: netdev
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>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload
2023-03-30 12:08 ` [PATCH net v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload Felix Fietkau
@ 2023-03-30 18:38 ` Leon Romanovsky
0 siblings, 0 replies; 9+ messages in thread
From: Leon Romanovsky @ 2023-03-30 18:38 UTC (permalink / raw)
To: Felix Fietkau; +Cc: netdev
On Thu, Mar 30, 2023 at 02:08:39PM +0200, Felix Fietkau wrote:
> Check for skb metadata in order to detect the case where the DSA header
> is not present.
>
> Fixes: 2d7605a72906 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging")
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> ---
> drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 +++---
> drivers/net/ethernet/mediatek/mtk_ppe.c | 5 ++++-
> 2 files changed, 7 insertions(+), 4 deletions(-)
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net v2 3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow
2023-03-30 12:08 ` [PATCH net v2 3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow Felix Fietkau
@ 2023-03-30 18:38 ` Leon Romanovsky
0 siblings, 0 replies; 9+ messages in thread
From: Leon Romanovsky @ 2023-03-30 18:38 UTC (permalink / raw)
To: Felix Fietkau; +Cc: netdev
On Thu, Mar 30, 2023 at 02:08:40PM +0200, Felix Fietkau wrote:
> The cache needs to be flushed to ensure that the hardware stops offloading
> the flow immediately.
>
> Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries")
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> ---
> drivers/net/ethernet/mediatek/mtk_ppe.c | 1 +
> 1 file changed, 1 insertion(+)
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic
2023-03-30 12:08 [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Felix Fietkau
` (3 preceding siblings ...)
2023-03-30 18:38 ` Leon Romanovsky
@ 2023-03-30 18:50 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-30 18:50 UTC (permalink / raw)
To: Felix Fietkau; +Cc: netdev
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-03-30 18:50 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-30 12:08 [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Felix Fietkau
2023-03-30 12:08 ` [PATCH net v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload Felix Fietkau
2023-03-30 18:38 ` Leon Romanovsky
2023-03-30 12:08 ` [PATCH net v2 3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow Felix Fietkau
2023-03-30 18:38 ` Leon Romanovsky
2023-03-30 12:13 ` [PATCH net v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Leon Romanovsky
2023-03-30 12:22 ` Felix Fietkau
2023-03-30 18:38 ` Leon Romanovsky
2023-03-30 18:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).