All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Pawel Dembicki <paweldembicki@gmail.com>
Cc: 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,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH net-next v2 4/7] net: dsa: vsc73xx: Add dsa tagging based on 8021q
Date: Sun, 25 Jun 2023 14:42:27 +0200	[thread overview]
Message-ID: <ZJg2M+Qvg3Fv73CH@corigine.com> (raw)
In-Reply-To: <20230625115343.1603330-4-paweldembicki@gmail.com>

+ 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.

> +	else
> +		skb->dev = dsa_master_find_slave(netdev, switch_id, src_port);
> +	if (!skb->dev) {
> +		netdev_warn(netdev, "Couldn't decode source port\n");
> +		return NULL;
> +	}
> +
> +	dsa_default_offload_fwd_mark(skb);
> +
> +	if (dsa_port_is_vlan_filtering(dsa_slave_to_port(skb->dev)) &&
> +	    eth_hdr(skb)->h_proto == htons(ETH_P_8021Q))
> +		__vlan_hwaccel_clear_tag(skb);
> +
> +	return skb;
> +}

...

  reply	other threads:[~2023-06-25 12:42 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 [this message]
2023-06-26 10:37     ` Dan Carpenter
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=ZJg2M+Qvg3Fv73CH@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=andrew@lunn.ch \
    --cc=dan.carpenter@linaro.org \
    --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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.