[PATCH net-next v4 2/5] net: dsa: add out-of-band tagging protocol
Maxime Chevallier
maxime.chevallier at bootlin.com
Sat Sep 17 02:00:13 PDT 2022
Hello Vladimir,
Thanks for the comment :)
On Sat, 17 Sep 2022 00:15:22 +0000
Vladimir Oltean <vladimir.oltean at nxp.com> wrote:
> 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.
I have no problem with the skb extension approach, my goal from the
start was to find the correct way to approach this tagging process.
I'll spin a new version with the skb extension approach then, unless
someone else sees a problem with using skb extensions ?
Thanks,
Maxime
More information about the linux-arm-kernel
mailing list