[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201015033648.GA24901@hoboy>
Date: Wed, 14 Oct 2020 20:36:48 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Christian Eggers <ceggers@...i.de>
Cc: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Krzysztof Halasa <khalasa@...p.pl>,
Vishal Kulkarni <vishal@...lsio.com>,
Florian Fainelli <f.fainelli@...il.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] net: ptp: get rid of IPV4_HLEN() and OFF_IHL
macros
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
Powered by blists - more mailing lists