[PATCH net-next v5 05/15] net: airoha: Move DSA tag in DMA descriptor
Lorenzo Bianconi
lorenzo at kernel.org
Fri Feb 21 02:20:58 PST 2025
> On Mon, 17 Feb 2025 14:01:09 +0100 Lorenzo Bianconi wrote:
> > +static u32 airoha_get_dsa_tag(struct sk_buff *skb, struct net_device *dev)
> > +{
> > +#if IS_ENABLED(CONFIG_NET_DSA)
> > + struct ethhdr *ehdr;
> > + struct dsa_port *dp;
> > + u8 xmit_tpid;
> > + u16 tag;
> > +
> > + if (!netdev_uses_dsa(dev))
> > + return 0;
> > +
> > + dp = dev->dsa_ptr;
> > + if (IS_ERR(dp))
> > + return 0;
> > +
> > + if (dp->tag_ops->proto != DSA_TAG_PROTO_MTK)
> > + return 0;
> > +
> > + if (skb_ensure_writable(skb, ETH_HLEN))
> > + return 0;
>
> skb_cow_head() is a lot cheaper (for TCP)
ack, I will fix it in v6
>
> > + ehdr = (struct ethhdr *)skb->data;
> > + tag = be16_to_cpu(ehdr->h_proto);
> > + xmit_tpid = tag >> 8;
>
> > @@ -2390,8 +2498,10 @@ static int airoha_probe(struct platform_device *pdev)
> > for (i = 0; i < ARRAY_SIZE(eth->ports); i++) {
> > struct airoha_gdm_port *port = eth->ports[i];
> >
> > - if (port && port->dev->reg_state == NETREG_REGISTERED)
> > + if (port && port->dev->reg_state == NETREG_REGISTERED) {
> > + airoha_metadata_dst_free(port);
> > unregister_netdev(port->dev);
>
> Looks a tiny bit reversed, isn't it?
> First unregister the netdev, then free its metadata.
ack, I will fix it in v6
>
> > + }
> > }
> > free_netdev(eth->napi_dev);
> > platform_set_drvdata(pdev, NULL);
> > @@ -2416,6 +2526,7 @@ static void airoha_remove(struct platform_device *pdev)
> > continue;
> >
> > airoha_dev_stop(port->dev);
> > + airoha_metadata_dst_free(port);
> > unregister_netdev(port->dev);
>
> same here
ack, I will fix it in v6
Regards,
Lorenzo
>
> > }
> > free_netdev(eth->napi_dev);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20250221/7631038c/attachment.sig>
More information about the linux-arm-kernel
mailing list