* [PATCH v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic
@ 2023-03-23 13:08 Felix Fietkau
2023-03-23 13:08 ` [PATCH v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload Felix Fietkau
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Felix Fietkau @ 2023-03-23 13: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")
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(-)
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] 7+ messages in thread
* [PATCH v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload
2023-03-23 13:08 [PATCH v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Felix Fietkau
@ 2023-03-23 13:08 ` Felix Fietkau
2023-03-24 12:13 ` Simon Horman
2023-03-23 13:08 ` [PATCH v2 3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow Felix Fietkau
2023-03-24 12:21 ` [PATCH v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Simon Horman
2 siblings, 1 reply; 7+ messages in thread
From: Felix Fietkau @ 2023-03-23 13: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")
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 3cb43623d3db..a94aa08515af 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2059,9 +2059,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) {
@@ -2089,6 +2086,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] 7+ messages in thread
* [PATCH v2 3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow
2023-03-23 13:08 [PATCH v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Felix Fietkau
2023-03-23 13:08 ` [PATCH v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload Felix Fietkau
@ 2023-03-23 13:08 ` Felix Fietkau
2023-03-24 12:12 ` Simon Horman
2023-03-24 12:21 ` [PATCH v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Simon Horman
2 siblings, 1 reply; 7+ messages in thread
From: Felix Fietkau @ 2023-03-23 13:08 UTC (permalink / raw)
To: netdev
The cache needs to be flushed to ensure that the hardware stops offloading
the flow immediately.
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] 7+ messages in thread
* Re: [PATCH v2 3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow
2023-03-23 13:08 ` [PATCH v2 3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow Felix Fietkau
@ 2023-03-24 12:12 ` Simon Horman
0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2023-03-24 12:12 UTC (permalink / raw)
To: Felix Fietkau; +Cc: netdev
On Thu, Mar 23, 2023 at 02:08:15PM +0100, Felix Fietkau wrote:
> The cache needs to be flushed to ensure that the hardware stops offloading
> the flow immediately.
I wonder if a fixes tag is appropriate, and if so perhaps it should be:
Fixes: 33fc42de3327 ("net: ethernet: mtk_eth_soc: support creating mac address based offload entries")
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
In any case,
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload
2023-03-23 13:08 ` [PATCH v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload Felix Fietkau
@ 2023-03-24 12:13 ` Simon Horman
0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2023-03-24 12:13 UTC (permalink / raw)
To: Felix Fietkau; +Cc: netdev
On Thu, Mar 23, 2023 at 02:08:14PM +0100, 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")
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic
2023-03-23 13:08 [PATCH v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Felix Fietkau
2023-03-23 13:08 ` [PATCH v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload Felix Fietkau
2023-03-23 13:08 ` [PATCH v2 3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow Felix Fietkau
@ 2023-03-24 12:21 ` Simon Horman
2023-03-24 22:09 ` Jakub Kicinski
2 siblings, 1 reply; 7+ messages in thread
From: Simon Horman @ 2023-03-24 12:21 UTC (permalink / raw)
To: Felix Fietkau; +Cc: netdev
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;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic
2023-03-24 12:21 ` [PATCH v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Simon Horman
@ 2023-03-24 22:09 ` Jakub Kicinski
0 siblings, 0 replies; 7+ messages in thread
From: Jakub Kicinski @ 2023-03-24 22:09 UTC (permalink / raw)
To: Simon Horman, Felix Fietkau; +Cc: netdev
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-03-24 22:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-23 13:08 [PATCH v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Felix Fietkau
2023-03-23 13:08 ` [PATCH v2 2/3] net: ethernet: mtk_eth_soc: fix L2 offloading with DSA untag offload Felix Fietkau
2023-03-24 12:13 ` Simon Horman
2023-03-23 13:08 ` [PATCH v2 3/3] net: ethernet: mtk_eth_soc: add missing ppe cache flush when deleting a flow Felix Fietkau
2023-03-24 12:12 ` Simon Horman
2023-03-24 12:21 ` [PATCH v2 1/3] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Simon Horman
2023-03-24 22:09 ` Jakub Kicinski
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).