lkml.org 
[lkml]   [2020]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2020-10-15 05:37    [W:0.113 / U:0.852 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site