From: Stephen Hemminger <stephen@networkplumber.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: yuan linyu <cugyly@163.com>,
netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Subject: Re: [PATCH net-next 01/11] ipv6: skb_put_zero() used to optimize code
Date: Wed, 14 Jun 2017 12:14:16 -0700 [thread overview]
Message-ID: <20170614121416.63a78b0d@xeon-e3> (raw)
In-Reply-To: <1497466892.9377.5.camel@sipsolutions.net>
On Wed, 14 Jun 2017 21:01:32 +0200
Johannes Berg <johannes@sipsolutions.net> wrote:
> On Wed, 2017-06-14 at 08:44 -0700, Stephen Hemminger wrote:
> >
> > > memcpy(skb_put(skb, sizeof(ra)), ra, sizeof(ra));
> > >
> > > - hdr = (struct mld_msg *) skb_put(skb, sizeof(struct
> > > mld_msg));
> > > - memset(hdr, 0, sizeof(struct mld_msg));
> > > + hdr = (struct mld_msg *) skb_put_zero(skb, sizeof(struct
> > > mld_msg));
> >
> > Why does skb_put_zero return char * instead of void *?
> > If returned void * it would save having to add lots of casts.
> >
> > One could even go farther by making skb_put_zero a macro and
> > use typeof().
>
> I just copied it from skb_put() - you could ask the same there? :)
My taste is to have less casts. Never understood why so many skb_
functions returned char *, probably a leftover from older Unix style.
next prev parent reply other threads:[~2017-06-14 19:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-14 14:37 [PATCH net-next 01/11] ipv6: skb_put_zero() used to optimize code yuan linyu
2017-06-14 15:44 ` Stephen Hemminger
2017-06-14 19:01 ` Johannes Berg
2017-06-14 19:14 ` Stephen Hemminger [this message]
2017-06-14 19:51 ` Johannes Berg
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=20170614121416.63a78b0d@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=Linyu.Yuan@alcatel-sbell.com.cn \
--cc=cugyly@163.com \
--cc=davem@davemloft.net \
--cc=johannes@sipsolutions.net \
--cc=netdev@vger.kernel.org \
/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).