From: Dan Carpenter <dan.carpenter@linaro.org>
To: Simon Horman <simon.horman@corigine.com>
Cc: Pawel Dembicki <paweldembicki@gmail.com>,
netdev@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 4/7] net: dsa: vsc73xx: Add dsa tagging based on 8021q
Date: Mon, 26 Jun 2023 13:37:41 +0300 [thread overview]
Message-ID: <8b34df96-daed-4b71-9281-3a7b8a315c90@kadam.mountain> (raw)
In-Reply-To: <ZJg2M+Qvg3Fv73CH@corigine.com>
On Sun, Jun 25, 2023 at 02:42:27PM +0200, Simon Horman wrote:
> + Dan Carpenter
>
> On Sun, Jun 25, 2023 at 01:53:39PM +0200, Pawel Dembicki wrote:
> > This patch is simple implementation of 8021q tagging in vsc73xx driver.
> > At this moment devices with DSA_TAG_PROTO_NONE are useless. VSC73XX
> > family doesn't provide any tag support for external ethernet ports.
> >
> > The only way is vlan-based tagging. It require constant hardware vlan
> > filtering. VSC73XX family support provider bridging but QinQ only without
> > fully implemented 802.1AD. It allow only doubled 0x8100 TPID.
> >
> > In simple port mode QinQ is enabled to preserve forwarding vlan tagged
> > frames.
> >
> > Tag driver introduce most simple funcionality required for proper taging
> > support.
> >
> > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> > Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
>
> ...
>
> > +static void vsc73xx_vlan_rcv(struct sk_buff *skb, int *source_port,
> > + int *switch_id, int *vbid, u16 *vid)
> > +{
> > + if (vid_is_dsa_8021q(skb_vlan_tag_get(skb) & VLAN_VID_MASK))
> > + return dsa_8021q_rcv(skb, source_port, switch_id, vbid);
> > +
> > + /* Try our best with imprecise RX */
> > + *vid = skb_vlan_tag_get(skb) & VLAN_VID_MASK;
> > +}
> > +
> > +static struct sk_buff *vsc73xx_rcv(struct sk_buff *skb,
> > + struct net_device *netdev)
> > +{
> > + int src_port = -1, switch_id = -1, vbid = -1;
> > + u16 vid;
> > +
> > + if (skb_vlan_tag_present(skb))
> > + /* Normal traffic path. */
> > + vsc73xx_vlan_rcv(skb, &src_port, &switch_id, &vbid, &vid);
> > +
> > + if (vbid >= 1)
> > + skb->dev = dsa_tag_8021q_find_port_by_vbid(netdev, vbid);
> > + else if (src_port == -1 || switch_id == -1)
> > + skb->dev = dsa_find_designated_bridge_port_by_vid(netdev, vid);
>
> Hi Pawel,
>
> Smatch warns that vid may be used uninitialised here.
> And it's not clear to me why that cannot be the case.
>
The problem is only when skb_vlan_tag_present() is false.
If vsc73xx_vlan_rcv() is called then actually it's fine. Either vbid,
src_port and switch_id will be set or vid will be initialized. Smatch
thinks the vbid is set to 0-7, src_port is set to 0-15 and
switch_id is set to 0-7. Smatch kind of ignores the switch_id == -1
condition because it's known to be false given that we already checked
src_port == -1.
But the concern again is the skb_vlan_tag_present() is false and then
vbid, src_port and switch_id would all be set to -1.
regards,
dan carpenter
next prev parent reply other threads:[~2023-06-26 10:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-25 11:53 [PATCH net-next v2 1/7] net: dsa: vsc73xx: use read_poll_timeout instead delay loop Pawel Dembicki
2023-06-25 11:53 ` [PATCH net-next v2 2/7] net: dsa: vsc73xx: convert to PHYLINK Pawel Dembicki
2023-06-25 11:53 ` [PATCH net-next v2 3/7] net: dsa: vsc73xx: add port_stp_state_set function Pawel Dembicki
2023-06-25 12:09 ` Vladimir Oltean
2023-06-25 11:53 ` [PATCH net-next v2 4/7] net: dsa: vsc73xx: Add dsa tagging based on 8021q Pawel Dembicki
2023-06-25 12:42 ` Simon Horman
2023-06-26 10:37 ` Dan Carpenter [this message]
2023-06-25 12:47 ` Vladimir Oltean
2023-06-29 21:00 ` Paweł Dembicki
2023-07-03 16:16 ` Vladimir Oltean
2023-06-25 11:53 ` [PATCH net-next v2 5/7] net: dsa: vsc73xx: Add bridge support Pawel Dembicki
2023-06-25 11:53 ` [PATCH net-next v2 6/7] net: dsa: vsc73xx: Add vlan filtering Pawel Dembicki
2023-06-25 15:05 ` Vladimir Oltean
2023-06-29 20:18 ` Paweł Dembicki
2023-07-03 16:55 ` Vladimir Oltean
2023-06-25 11:53 ` [PATCH net-next v2 7/7] net: dsa: vsc73xx: fix MTU configuration Pawel Dembicki
2023-06-25 14:54 ` Vladimir Oltean
2023-06-28 20:04 ` Paweł Dembicki
2023-06-25 11:53 ` [PATCH net-next v2 0/7] net: dsa: vsc73xx: Make vsc73xx usable Pawel Dembicki
2023-06-25 14:42 ` Vladimir Oltean
2023-06-25 15:07 ` [PATCH net-next v2 1/7] net: dsa: vsc73xx: use read_poll_timeout instead delay loop Andrew Lunn
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=8b34df96-daed-4b71-9281-3a7b8a315c90@kadam.mountain \
--to=dan.carpenter@linaro.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=paweldembicki@gmail.com \
--cc=simon.horman@corigine.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