[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170506033843.GA14749@lunn.ch>
Date: Sat, 6 May 2017 05:38:43 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Woojung.Huh@...rochip.com
Cc: f.fainelli@...il.com, vivien.didelot@...oirfairelinux.com,
netdev@...r.kernel.org, davem@...emloft.net,
UNGLinuxDriver@...rochip.com
Subject: Re: [PATCH net-next 1/5] dsa: add support for Microchip KSZ tail
tagging
> +static struct sk_buff *ksz_xmit(struct sk_buff *skb, struct net_device *dev)
> +{
> + struct dsa_slave_priv *p = netdev_priv(dev);
> + struct sk_buff *nskb;
> + int padlen;
> + u8 *tag;
> +
> + padlen = 0;
> + if (skb->len < 60)
> + padlen = 60 - skb->len;
> +
> + nskb = alloc_skb(NET_IP_ALIGN + skb->len + padlen + 2, GFP_ATOMIC);
> + if (!nskb) {
> + kfree_skb(skb);
> + return NULL;
> + }
> + skb_reserve(nskb, NET_IP_ALIGN);
> +
> + skb_reset_mac_header(nskb);
> + skb_set_network_header(nskb, skb_network_header(skb) - skb->head);
> + skb_set_transport_header(nskb, skb_transport_header(skb) - skb->head);
> + skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len));
> + kfree_skb(skb);
Hi Woojung
Is there really no way to add data to the end of an existing skb?
skb_put(), once you have checked there is space? Only do the copy if
there is no space.
Andrew
Powered by blists - more mailing lists