Yes, I agree. I am going to change that. christos > On Feb 16, 2021, at 1:46 PM, Roy Marples <roy%marples.name@localhost> wrote: > > Hi Christos > > On 14/02/2021 20:58, Christos Zoulas wrote: >> Module Name: src >> Committed By: christos >> Date: Sun Feb 14 20:58:35 UTC 2021 >> Modified Files: >> src/sys/net: if_arp.h if_bridge.c >> src/sys/netinet: icmp_private.h if_arp.c igmp_var.h in_l2tp.c ip_flow.c >> ip_input.c ip_private.h tcp_input.c tcp_private.h udp_private.h >> udp_usrreq.c >> src/sys/netinet6: icmp6.c in6_l2tp.c ip6_flow.c ip6_input.c >> ip6_private.h udp6_usrreq.c >> src/sys/sys: mbuf.h param.h >> Log Message: >> - centralize header align and pullup into a single inline function >> - use a single macro to align pointers and expose the alignment, instead >> of hard-coding 3 in 1/2 the macros. >> - fix an issue in the ipv6 lt2p where it was aligning for ipv4 and pulling >> for ipv6. > > -#ifdef __NO_STRICT_ALIGNMENT > -#define IP_HDR_ALIGNED_P(ip) 1 > -#else > -#define IP_HDR_ALIGNED_P(ip) ((((vaddr_t) (ip)) & 3) == 0) > -#endif > +#define IP_HDR_ALIGNMENT 3 > #endif /* _KERNEL */ > > While this is a like for like change, I feel that the meaning of IP_HDR_ALIGNMENT is no longer clear as 3 without context makes no sense at all. > We know it should be aligned to 4 bytes. > > I suggest we change POINTER_ALIGNED_P to accept the alignment value we want rather than the bitwise test we supply, like so: > > #define POINTER_ALIGNED_P(p, a) (((uintptr_t)(p) & ((a) - 1)) == 0) > > Roy
Attachment:
signature.asc
Description: Message signed with OpenPGP