[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2dfff5ad-2483-b6bc-16fa-70025acd835a@bang-olufsen.dk>
Date: Wed, 13 Oct 2021 09:52:04 +0000
From: Alvin Šipraga <ALSI@...g-olufsen.dk>
To: DENG Qingfang <dqfext@...il.com>,
Alvin Šipraga <alvin@...s.dk>
CC: Linus Walleij <linus.walleij@...aro.org>,
Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next 4/6] net: dsa: tag_rtl8_4: add realtek 8 byte
protocol 4 tag
On 10/13/21 11:45 AM, DENG Qingfang wrote:
> On Tue, Oct 12, 2021 at 02:35:53PM +0200, Alvin Šipraga wrote:
>> +static struct sk_buff *rtl8_4_tag_rcv(struct sk_buff *skb,
>> + struct net_device *dev)
>> +{
>> + __be16 *tag;
>> + u16 etype;
>> + u8 proto;
>> + u8 port;
>> +
>> + if (unlikely(!pskb_may_pull(skb, RTL8_4_TAG_LEN)))
>> + return NULL;
>> +
>> + tag = dsa_etype_header_pos_rx(skb);
>> +
>> + /* Parse Realtek EtherType */
>> + etype = ntohs(tag[0]);
>> + if (unlikely(etype != ETH_P_REALTEK)) {
>> + dev_warn_ratelimited(&dev->dev,
>> + "non-realtek ethertype 0x%04x\n", etype);
>> + return NULL;
>> + }
>> +
>> + /* Parse Protocol */
>> + proto = ntohs(tag[1]) >> 8;
>> + if (unlikely(proto != RTL8_4_PROTOCOL_RTL8365MB)) {
>> + dev_warn_ratelimited(&dev->dev,
>> + "unknown realtek protocol 0x%02x\n",
>> + proto);
>> + return NULL;
>> + }
>> +
>> + /* Parse TX (switch->CPU) */
>> + port = ntohs(tag[3]) & 0xf; /* Port number is the LSB 4 bits */
>> + skb->dev = dsa_master_find_slave(dev, 0, port);
>> + if (!skb->dev) {
>> + dev_warn_ratelimited(&dev->dev,
>> + "could not find slave for port %d\n",
>> + port);
>> + return NULL;
>> + }
>> +
>> + /* Remove tag and recalculate checksum */
>> + skb_pull_rcsum(skb, RTL8_4_TAG_LEN);
>> +
>> + dsa_strip_etype_header(skb, RTL8_4_TAG_LEN);
>> +
>> + dsa_default_offload_fwd_mark(skb);
>
> This should not be set if the REASON is trapped to CPU.
Thanks, you're right. Although with the current state of the driver,
skb->offload_fwd_mark will never get set, because the bridge is not
offloaded onto the HW. But I will fix this up in v2.
>
>> +
>> + return skb;
>> +}
Powered by blists - more mailing lists