public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"thomas.petazzoni@bootlin.com" <thomas.petazzoni@bootlin.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Luka Perkov <luka.perkov@sartura.hr>,
	Robert Marko <robert.marko@sartura.hr>
Subject: Re: [PATCH net-next v4 2/5] net: dsa: add out-of-band tagging protocol
Date: Sat, 17 Sep 2022 00:15:22 +0000	[thread overview]
Message-ID: <20220917001521.wskocisy53vozska@skbuf> (raw)
In-Reply-To: <20220909152454.7462-3-maxime.chevallier@bootlin.com>

Hi Maxime,

On Fri, Sep 09, 2022 at 05:24:51PM +0200, Maxime Chevallier wrote:
> +int dsa_oob_tag_push(struct sk_buff *skb, struct dsa_oob_tag_info *ti)
> +{
> +	struct dsa_oob_tag_info *tag_info;
> +
> +	tag_info = (struct dsa_oob_tag_info *)skb->head;
> +
> +	tag_info->proto = ti->proto;
> +	tag_info->dp = ti->dp;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(dsa_oob_tag_push);
> +
> +int dsa_oob_tag_pop(struct sk_buff *skb, struct dsa_oob_tag_info *ti)
> +{
> +	struct dsa_oob_tag_info *tag_info;
> +
> +	tag_info = (struct dsa_oob_tag_info *)skb->head;
> +
> +	if (tag_info->proto != DSA_TAG_PROTO_OOB)
> +		return -EINVAL;
> +
> +	ti->proto = tag_info->proto;
> +	ti->dp = tag_info->dp;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(dsa_oob_tag_pop);
> +
> +static struct sk_buff *oob_tag_xmit(struct sk_buff *skb,
> +				    struct net_device *dev)
> +{
> +	struct dsa_port *dp = dsa_slave_to_port(dev);
> +	struct dsa_oob_tag_info tag_info;
> +
> +	tag_info.dp = dp->index;
> +	tag_info.proto = DSA_TAG_PROTO_OOB;
> +
> +	if (dsa_oob_tag_push(skb, &tag_info))
> +		return NULL;
> +
> +	return skb;
> +}

I don't have too many comments on this patch set, except for a very
fundamental one. It is impossible to pass a DSA out of band header
between the switch tagging protocol driver and the host Ethernet
controller via the beginning of skb->head, and just putting some magic
bytes there and hoping that no random junk in the buffer will have the
same value (and that skb_push() calls will not eat into your tag_info
structure which isn't accounted for in any way by skb->data).

Please create an skb extension for this, it is the only unambiguous way
to deal with the given hardware, which will not give lots of headaches
in the future.

  reply	other threads:[~2022-09-17  0:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09 15:24 [PATCH net-next v4 0/5] net: ipqess: introduce Qualcomm IPQESS driver Maxime Chevallier
2022-09-09 15:24 ` [PATCH net-next v4 1/5] net: ipqess: introduce the " Maxime Chevallier
2022-09-09 15:39   ` Krzysztof Kozlowski
2022-09-11 22:11   ` kernel test robot
2022-09-09 15:24 ` [PATCH net-next v4 2/5] net: dsa: add out-of-band tagging protocol Maxime Chevallier
2022-09-17  0:15   ` Vladimir Oltean [this message]
2022-09-17  9:00     ` Maxime Chevallier
2022-09-09 15:24 ` [PATCH net-next v4 3/5] net: ipqess: Add out-of-band DSA tagging support Maxime Chevallier
2022-09-09 15:24 ` [PATCH net-next v4 4/5] net: dt-bindings: Introduce the Qualcomm IPQESS Ethernet controller Maxime Chevallier
2022-09-09 15:35   ` Krzysztof Kozlowski
2022-09-09 15:24 ` [PATCH net-next v4 5/5] ARM: dts: qcom: ipq4019: Add description for the " Maxime Chevallier
2022-09-09 15:36   ` Krzysztof Kozlowski
2022-09-17  0:20 ` [PATCH net-next v4 0/5] net: ipqess: introduce Qualcomm IPQESS driver Vladimir Oltean
2022-09-17  9:02   ` Maxime Chevallier

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=20220917001521.wskocisy53vozska@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=luka.perkov@sartura.hr \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=robert.marko@sartura.hr \
    --cc=robh+dt@kernel.org \
    --cc=thomas.petazzoni@bootlin.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