Re: [PATCH v3 4/5] net: dsa: add support for Atheros AR9331 TAG format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 21, 2019 at 05:49:00PM +0200, Andrew Lunn wrote:
> > +static struct sk_buff *ar9331_tag_rcv(struct sk_buff *skb,
> > +				      struct net_device *ndev,
> > +				      struct packet_type *pt)
> > +{
> > +	u8 ver, port;
> > +	u16 hdr;
> > +
> > +	if (unlikely(!pskb_may_pull(skb, AR9331_HDR_LEN)))
> > +		return NULL;
> > +
> > +	hdr = le16_to_cpu(*(__le16 *)skb_mac_header(skb));
> > +
> > +	ver = FIELD_GET(AR9331_HDR_VERSION_MASK, hdr);
> > +	if (unlikely(ver != AR9331_HDR_VERSION)) {
> > +		netdev_warn_once(ndev, "%s:%i wrong header version 0x%2x\n",
> > +				 __func__, __LINE__, hdr);
> > +		return NULL;
> > +	}
> > +
> > +	if (unlikely(hdr & AR9331_HDR_FROM_CPU)) {
> > +		netdev_warn_once(ndev, "%s:%i packet should not be from cpu 0x%2x\n",
> > +				 __func__, __LINE__, hdr);
> > +		return NULL;
> > +	}
> > +
> > +	skb_pull(skb, AR9331_HDR_LEN);
> > +	skb_set_mac_header(skb, -ETH_HLEN);
> 
> No other tag driver calls skb_set_mac_header().  Also, the -ETH_HLEN
> looks odd, give you have just pulled off AR9331_HDR_LEN?

Hm.. is it corrected somewhere else? Any way, B.T.M.A.N need a proper
value ant it seems to work correctly. So I remove it.

> What other tag drivers use is skb_pull_rcsum().

It is build in switch and internal Ethernet controller do not set csum. There is
nothing to recalculate... on other hand, it adds no overhead. So, I have
nothing against it. Are there other arguments?

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux