From: Felix Fietkau <nbd@nbd.name>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 1/4] net: dsa: add support for DSA rx offloading via metadata dst
Date: Sat, 12 Nov 2022 01:05:10 +0100 [thread overview]
Message-ID: <b2420602-8d64-a75b-2296-059ac0ba26ef@nbd.name> (raw)
In-Reply-To: <20221111233714.pmbc5qvq3g3hemhr@skbuf>
On 12.11.22 00:37, Vladimir Oltean wrote:
> On Thu, Nov 10, 2022 at 10:22:08PM +0100, Felix Fietkau wrote:
>> If a metadata dst is present with the type METADATA_HW_PORT_MUX on a dsa cpu
>> port netdev, assume that it carries the port number and that there is no DSA
>> tag present in the skb data.
>>
>> Signed-off-by: Felix Fietkau <nbd@nbd.name>
>> else
>> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
>> index 64b14f655b23..0b67622cf905 100644
>> --- a/net/dsa/dsa.c
>> +++ b/net/dsa/dsa.c
>> @@ -11,6 +11,7 @@
>> #include <linux/netdevice.h>
>> #include <linux/sysfs.h>
>> #include <linux/ptp_classify.h>
>> +#include <net/dst_metadata.h>
>>
>> #include "dsa_priv.h"
>>
>> @@ -216,6 +217,7 @@ static bool dsa_skb_defer_rx_timestamp(struct dsa_slave_priv *p,
>> static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
>> struct packet_type *pt, struct net_device *unused)
>> {
>> + struct metadata_dst *md_dst = skb_metadata_dst(skb);
>> struct dsa_port *cpu_dp = dev->dsa_ptr;
>> struct sk_buff *nskb = NULL;
>> struct dsa_slave_priv *p;
>> @@ -229,7 +231,22 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
>> if (!skb)
>> return 0;
>>
>> - nskb = cpu_dp->rcv(skb, dev);
>> + if (md_dst && md_dst->type == METADATA_HW_PORT_MUX) {
>> + unsigned int port = md_dst->u.port_info.port_id;
>> +
>> + skb_dst_set(skb, NULL);
>
> If you insist on not using the refcounting feature and free your
> metadata_dst in the master's remove() function, that's going to
> invalidate absolutely any point I'm trying to make. Normally I'd leave
> you alone, however I really don't like that this is also forcing DSA to
> not use the refcount, and therefore, that it's forcing any other driver
> to do the same as mtk_eth_soc. Not sure how that's gonna scale in the
> hypothetical future when there will be a DSA master which can offload
> RX DSA tags, *and* the switch can change tagging protocols dynamically
> (which will force the master to allocate/free its metadata dst's at
> runtime too). I guess that will be for me to figure out, which I don't
> like.
>
> Jakub, what do you think? Refcounting or no refcounting?
If think that refcounting for the metadata dst is useful in this case, I
can replace the skb_dst_set call with skb_dst_drop() in v4, so it would
work for both cases.
- Felix
next prev parent reply other threads:[~2022-11-12 0:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221110212212.96825-1-nbd@nbd.name>
2022-11-10 21:22 ` [PATCH net-next v3 1/4] net: dsa: add support for DSA rx offloading via metadata dst Felix Fietkau
2022-11-11 23:37 ` Vladimir Oltean
2022-11-12 0:05 ` Felix Fietkau [this message]
2022-11-12 4:40 ` Jakub Kicinski
2022-11-12 11:13 ` Felix Fietkau
2022-11-14 11:55 ` Vladimir Oltean
2022-11-14 12:06 ` Felix Fietkau
2022-11-14 12:17 ` Vladimir Oltean
2022-11-14 13:18 ` Dave Taht
2022-11-14 13:33 ` Felix Fietkau
2022-11-14 12:15 ` Vladimir Oltean
2022-11-10 21:22 ` [PATCH net-next v3 2/4] net: ethernet: mtk_eth_soc: pass correct VLAN protocol ID to the network stack Felix Fietkau
2022-11-10 21:22 ` [PATCH net-next v3 3/4] net: ethernet: mtk_eth_soc: add support for configuring vlan rx offload Felix Fietkau
2022-11-10 21:22 ` [PATCH net-next v3 4/4] net: ethernet: mtk_eth_soc: enable hardware DSA untagging Felix Fietkau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b2420602-8d64-a75b-2296-059ac0ba26ef@nbd.name \
--to=nbd@nbd.name \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).