From: DENG Qingfang <dqfext@gmail.com>
To: "Alvin Šipraga" <alvin@pqrs.dk>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
"Andrew Lunn" <andrew@lunn.ch>,
"Vivien Didelot" <vivien.didelot@gmail.com>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Vladimir Oltean" <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"Alvin Šipraga" <alsi@bang-olufsen.dk>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 4/6] net: dsa: tag_rtl8_4: add realtek 8 byte protocol 4 tag
Date: Wed, 13 Oct 2021 17:45:16 +0800 [thread overview]
Message-ID: <20211013094516.55722-1-dqfext@gmail.com> (raw)
In-Reply-To: <20211012123557.3547280-5-alvin@pqrs.dk>
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.
> +
> + return skb;
> +}
next prev parent reply other threads:[~2021-10-13 9:45 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 12:35 [PATCH net-next 0/6] net: dsa: add support for RTL8365MB-VC Alvin Šipraga
2021-10-12 12:35 ` [PATCH net-next 1/6] ether: add EtherType for proprietary Realtek protocols Alvin Šipraga
2021-10-12 13:09 ` Vladimir Oltean
2021-10-12 12:35 ` [PATCH net-next 2/6] net: dsa: move NET_DSA_TAG_RTL4_A to right place in Kconfig/Makefile Alvin Šipraga
2021-10-12 12:42 ` Vladimir Oltean
2021-10-13 10:50 ` Linus Walleij
2021-10-12 12:35 ` [PATCH net-next 3/6] dt-bindings: net: dsa: realtek-smi: document new compatible rtl8365mb Alvin Šipraga
2021-10-12 12:35 ` [PATCH net-next 4/6] net: dsa: tag_rtl8_4: add realtek 8 byte protocol 4 tag Alvin Šipraga
2021-10-12 12:50 ` Vladimir Oltean
2021-10-12 12:56 ` Alvin Šipraga
2021-10-13 9:45 ` DENG Qingfang [this message]
2021-10-13 9:52 ` Alvin Šipraga
2021-10-13 11:02 ` Linus Walleij
2021-10-12 12:35 ` [PATCH net-next 5/6] net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC Alvin Šipraga
2021-10-12 13:04 ` Vladimir Oltean
2021-10-12 13:22 ` Alvin Šipraga
2021-10-12 13:50 ` Alvin Šipraga
2021-10-12 14:03 ` Vladimir Oltean
2021-10-12 14:30 ` Alvin Šipraga
2021-10-12 15:27 ` Jakub Kicinski
2021-10-13 8:33 ` Alvin Šipraga
2021-10-13 15:13 ` Jakub Kicinski
2021-10-14 12:44 ` Alvin Šipraga
2021-10-14 14:08 ` Jakub Kicinski
2021-10-13 9:55 ` DENG Qingfang
2021-10-13 10:05 ` Alvin Šipraga
2021-10-13 10:10 ` Vladimir Oltean
2021-10-13 10:13 ` DENG Qingfang
2021-10-13 15:12 ` Linus Walleij
2021-10-14 12:11 ` Alvin Šipraga
2021-10-12 12:35 ` [PATCH net-next 6/6] net: phy: realtek: add support for RTL8365MB-VC internal PHYs Alvin Šipraga
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=20211013094516.55722-1-dqfext@gmail.com \
--to=dqfext@gmail.com \
--cc=alsi@bang-olufsen.dk \
--cc=alvin@pqrs.dk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=robh+dt@kernel.org \
--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).