From: Vladimir Oltean <olteanv@gmail.com>
To: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Cc: netdev@vger.kernel.org, linus.walleij@linaro.org, andrew@lunn.ch,
vivien.didelot@gmail.com, f.fainelli@gmail.com,
davem@davemloft.net, kuba@kernel.org, alsi@bang-olufsen.dk,
arinc.unal@arinc9.com
Subject: Re: [PATCH net-next 1/2] net: dsa: tag_rtl8_4: add rtl8_4t tailing variant
Date: Wed, 9 Feb 2022 23:51:58 +0200 [thread overview]
Message-ID: <20220209215158.qdjg7ko4epylwuv7@skbuf> (raw)
In-Reply-To: <20220209211312.7242-2-luizluca@gmail.com>
Re: title. Tail or trailing?
On Wed, Feb 09, 2022 at 06:13:11PM -0300, Luiz Angelo Daros de Luca wrote:
> +static inline void rtl8_4_write_tag(struct sk_buff *skb, struct net_device *dev,
> + char *tag)
> {
> struct dsa_port *dp = dsa_slave_to_port(dev);
> - __be16 *tag;
> -
> - skb_push(skb, RTL8_4_TAG_LEN);
> -
> - dsa_alloc_etype_header(skb, RTL8_4_TAG_LEN);
> - tag = dsa_etype_header_pos_tx(skb);
> + __be16 *tag16 = (__be16 *)tag;
Can the tail tag be aligned to an odd offset? In that case, should you
access byte by byte, maybe? I'm not sure how arches handle this.
>
> /* Set Realtek EtherType */
> - tag[0] = htons(ETH_P_REALTEK);
> + tag16[0] = htons(ETH_P_REALTEK);
>
> /* Set Protocol; zero REASON */
> - tag[1] = htons(FIELD_PREP(RTL8_4_PROTOCOL, RTL8_4_PROTOCOL_RTL8365MB));
> + tag16[1] = htons(FIELD_PREP(RTL8_4_PROTOCOL, RTL8_4_PROTOCOL_RTL8365MB));
>
> /* Zero FID_EN, FID, PRI_EN, PRI, KEEP; set LEARN_DIS */
> - tag[2] = htons(FIELD_PREP(RTL8_4_LEARN_DIS, 1));
> + tag16[2] = htons(FIELD_PREP(RTL8_4_LEARN_DIS, 1));
>
> /* Zero ALLOW; set RX (CPU->switch) forwarding port mask */
> - tag[3] = htons(FIELD_PREP(RTL8_4_RX, BIT(dp->index)));
> + tag16[3] = htons(FIELD_PREP(RTL8_4_RX, BIT(dp->index)));
> +}
> +
> +static struct sk_buff *rtl8_4_tag_xmit(struct sk_buff *skb,
> + struct net_device *dev)
> +{
> + skb_push(skb, RTL8_4_TAG_LEN);
> +
> + dsa_alloc_etype_header(skb, RTL8_4_TAG_LEN);
> +
> + rtl8_4_write_tag(skb, dev, dsa_etype_header_pos_tx(skb));
>
> return skb;
> }
>
> -static struct sk_buff *rtl8_4_tag_rcv(struct sk_buff *skb,
> - struct net_device *dev)
> +static struct sk_buff *rtl8_4t_tag_xmit(struct sk_buff *skb,
> + struct net_device *dev)
> +{
Why don't you want to add:
if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb))
return NULL;
and then you'll make this tagging protocol useful in production too.
> + rtl8_4_write_tag(skb, dev, skb_put(skb, RTL8_4_TAG_LEN));
> +
> + return skb;
> +}
next prev parent reply other threads:[~2022-02-09 21:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 21:13 [PATCH net-next 0/2] net: dsa: realtek: add rtl8_4t tag Luiz Angelo Daros de Luca
2022-02-09 21:13 ` [PATCH net-next 1/2] net: dsa: tag_rtl8_4: add rtl8_4t tailing variant Luiz Angelo Daros de Luca
2022-02-09 21:51 ` Vladimir Oltean [this message]
2022-02-11 19:39 ` Andrew Lunn
2022-02-18 5:29 ` Luiz Angelo Daros de Luca
2022-02-09 21:13 ` [PATCH net-next 2/2] net: dsa: realtek: rtl8365mb: add support for rtl8_4t Luiz Angelo Daros de Luca
2022-02-09 21:57 ` Vladimir Oltean
2022-02-18 5:38 ` Luiz Angelo Daros de Luca
2022-02-09 21:34 ` [PATCH net-next 0/2] net: dsa: realtek: add rtl8_4t tag 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=20220209215158.qdjg7ko4epylwuv7@skbuf \
--to=olteanv@gmail.com \
--cc=alsi@bang-olufsen.dk \
--cc=andrew@lunn.ch \
--cc=arinc.unal@arinc9.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=luizluca@gmail.com \
--cc=netdev@vger.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