Subject: Re: [PATCH net-next 1/5] dsa: add support for Microchip KSZ tail tagging

From: Andrew Lunn <[email-masked]>
Date: Sat, 6 May 2017 05:38:43 +0200

> +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