mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Xie He <xie.he.0141@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Krzysztof Halasa <khc@pm.waw.pl>
Subject: Re: [PATCH net-next] drivers/net/wan/hdlc_fr: Reduce indentation in pvc_xmit
Date: Sat, 3 Oct 2020 11:09:58 -0700	[thread overview]
Message-ID: <20201003110958.5b748feb@hermes.local> (raw)
In-Reply-To: <20201003173528.41404-1-xie.he.0141@gmail.com>

On Sat,  3 Oct 2020 10:35:28 -0700
Xie He <xie.he.0141@gmail.com> wrote:

> +	if (dev->type == ARPHRD_ETHER) {
> +		int pad = ETH_ZLEN - skb->len;
> +
> +		if (pad > 0) { /* Pad the frame with zeros */
> +			int len = skb->len;
> +
> +			if (skb_tailroom(skb) < pad)
> +				if (pskb_expand_head(skb, 0, pad, GFP_ATOMIC))
> +					goto drop;
> +			skb_put(skb, pad);
> +			memset(skb->data + len, 0, pad);
>  		}
>  	}

This code snippet is basically an version of skb_pad().
Probably it is very old and pre-dates that.
Could the code use skb_pad?

  reply	other threads:[~2020-10-03 18:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03 17:35 Xie He
2020-10-03 18:09 ` Stephen Hemminger [this message]
2020-10-03 21:27   ` Xie He

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=20201003110958.5b748feb@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=davem@davemloft.net \
    --cc=khc@pm.waw.pl \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xie.he.0141@gmail.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

all inboxes | Powered by JetHome®