From: Jakub Kicinski <kuba@kernel.org>
To: "Álvaro Fernández Rojas" <noltari@gmail.com>
Cc: jonas.gorski@gmail.com, florian.fainelli@broadcom.com,
andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com, horms@kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
dgcbueu@gmail.com
Subject: Re: [PATCH net-next v2 2/3] net: dsa: tag_brcm: add support for legacy FCS tags
Date: Wed, 11 Jun 2025 14:46:35 -0700 [thread overview]
Message-ID: <20250611144635.37207d22@kernel.org> (raw)
In-Reply-To: <20250610163154.281454-3-noltari@gmail.com>
On Tue, 10 Jun 2025 18:31:53 +0200 Álvaro Fernández Rojas wrote:
> + struct dsa_port *dp = dsa_user_to_port(dev);
> + unsigned int fcs_len;
> + u32 fcs_val;
> + u8 *brcm_tag;
nit: please reorder the variable declaration lines longest to shortest
> + /* The Ethernet switch we are interfaced with needs packets to be at
> + * least 64 bytes (including FCS) otherwise they will be discarded when
> + * they enter the switch port logic. When Broadcom tags are enabled, we
> + * need to make sure that packets are at least 70 bytes
> + * (including FCS and tag) because the length verification is done after
> + * the Broadcom tag is stripped off the ingress packet.
> + *
> + * Let dsa_user_xmit() free the SKB
> + */
> + if (__skb_put_padto(skb, ETH_ZLEN + BRCM_LEG_TAG_LEN, false))
> + return NULL;
> +
> + fcs_len = skb->len;
> + fcs_val = cpu_to_le32(crc32(~0, skb->data, fcs_len) ^ ~0);
sparse (C=1 build flag) complains about the loss of type annotation:
net/dsa/tag_brcm.c:327:17: warning: incorrect type in assignment (different base types)
net/dsa/tag_brcm.c:327:17: expected unsigned int [usertype] fcs_val
net/dsa/tag_brcm.c:327:17: got restricted __le32 [usertype]
> + skb_push(skb, BRCM_LEG_TAG_LEN);
> +
> + dsa_alloc_etype_header(skb, BRCM_LEG_TAG_LEN);
> +
> + brcm_tag = skb->data + 2 * ETH_ALEN;
> +
> + /* Broadcom tag type */
> + brcm_tag[0] = BRCM_LEG_TYPE_HI;
> + brcm_tag[1] = BRCM_LEG_TYPE_LO;
> +
> + /* Broadcom tag value */
> + brcm_tag[2] = BRCM_LEG_EGRESS | BRCM_LEG_LEN_HI(fcs_len);
> + brcm_tag[3] = BRCM_LEG_LEN_LO(fcs_len);
> + brcm_tag[4] = 0;
> + brcm_tag[5] = dp->index & BRCM_LEG_PORT_ID;
> +
> + /* Original FCS value */
> + if (__skb_pad(skb, ETH_FCS_LEN, false))
> + return NULL;
> + skb_put_data(skb, &fcs_val, ETH_FCS_LEN);
--
pw-bot: cr
next prev parent reply other threads:[~2025-06-11 21:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-10 16:31 [PATCH net-next v2 0/3] net: dsa: brcm: add legacy FCS tag Álvaro Fernández Rojas
2025-06-10 16:31 ` [PATCH net-next v2 1/3] net: dsa: tag_brcm: legacy: reorganize functions Álvaro Fernández Rojas
2025-06-10 16:38 ` Florian Fainelli
2025-06-10 16:31 ` [PATCH net-next v2 2/3] net: dsa: tag_brcm: add support for legacy FCS tags Álvaro Fernández Rojas
2025-06-11 21:46 ` Jakub Kicinski [this message]
2025-06-10 16:31 ` [PATCH net-next v2 3/3] net: dsa: b53: support " Álvaro Fernández Rojas
2025-06-10 16:40 ` Florian Fainelli
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=20250611144635.37207d22@kernel.org \
--to=kuba@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=dgcbueu@gmail.com \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=horms@kernel.org \
--cc=jonas.gorski@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=noltari@gmail.com \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.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
all inboxes | Powered by JetHome®