netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Woojung.Huh@microchip.com
Cc: f.fainelli@gmail.com, vivien.didelot@savoirfairelinux.com,
	netdev@vger.kernel.org, davem@davemloft.net,
	UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next 1/5] dsa: add support for Microchip KSZ tail tagging
Date: Sat, 6 May 2017 05:38:43 +0200	[thread overview]
Message-ID: <20170506033843.GA14749@lunn.ch> (raw)
In-Reply-To: <9235D6609DB808459E95D78E17F2E43D40A5BFEC@CHN-SV-EXMX02.mchp-main.com>

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

      parent reply	other threads:[~2017-05-06  3:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-05 23:17 [PATCH net-next 1/5] dsa: add support for Microchip KSZ tail tagging Woojung.Huh
2017-05-05 23:34 ` Florian Fainelli
2017-05-06  0:35   ` Woojung.Huh
2017-05-06  3:38 ` Andrew Lunn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170506033843.GA14749@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).