netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: Christian Eggers <ceggers@arri.de>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Krzysztof Halasa <khalasa@piap.pl>,
	Vishal Kulkarni <vishal@chelsio.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: ptp: get rid of IPV4_HLEN() and OFF_IHL macros
Date: Wed, 14 Oct 2020 20:36:48 -0700	[thread overview]
Message-ID: <20201015033648.GA24901@hoboy> (raw)
In-Reply-To: <20201014115805.23905-1-ceggers@arri.de>

On Wed, Oct 14, 2020 at 01:58:05PM +0200, Christian Eggers wrote:
> Both macros are already marked for removal.

I'm not sure what Daniel Borkmann meant by that comment, but ...

>  	switch (type & PTP_CLASS_PMASK) {
>  	case PTP_CLASS_IPV4:
> -		ptr += IPV4_HLEN(ptr) + UDP_HLEN;
> +		ptr += (((struct iphdr *)ptr)->ihl << 2) + UDP_HLEN;

to my eyes

	IPV4_HLEN(ptr)

is way more readable than

	(((struct iphdr *)ptr)->ihl << 2)

and this

	(struct udphdr *)((char *)ih + (ih->ihl << 2))

is really baroque.

I don't see any improvement here.

Thanks,
Richard


  reply	other threads:[~2020-10-15  3:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 11:58 [PATCH net-next] net: ptp: get rid of IPV4_HLEN() and OFF_IHL macros Christian Eggers
2020-10-15  3:36 ` Richard Cochran [this message]
2020-10-15 16:56   ` Florian Fainelli
2020-10-16  7:04     ` Christian Eggers
2020-10-16 12:52       ` Richard Cochran

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=20201015033648.GA24901@hoboy \
    --to=richardcochran@gmail.com \
    --cc=ceggers@arri.de \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=khalasa@piap.pl \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vishal@chelsio.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).