On 16/02/2021 09:20, Martin Husemann wrote:
On Tue, Feb 16, 2021 at 08:26:40AM +0000, Roy Marples wrote:
Is that because ARP_HDR_ALIGNMENT is forcing 4 byte alignment?
The KASSERT a few lines below triggerd, we need to be consistent.
For the purposes of using just the header we define I'm pretty sure we can
use 2 byte alignment and set ARP_HDR_ALIGNMENT to 1.
I can test (I have an alignment critical machine with non-ETHER_ALIGN'ing
network driver). Send me a patch, I lost track in the ongoing overhaul.
ARP_HDR_ALIGNED_P can now be removed from if_arp.c as well.
Not sure I understand what you mean here.
Index: net/if_arp.h
===================================================================
RCS file: /cvsroot/src/sys/net/if_arp.h,v
retrieving revision 1.40
diff -u -p -r1.40 if_arp.h
--- net/if_arp.h 14 Feb 2021 20:58:34 -0000 1.40
+++ net/if_arp.h 16 Feb 2021 09:26:23 -0000
@@ -72,7 +72,7 @@ struct arphdr {
uint8_t ar_tpa[]; /* target protocol address */
#endif
};
-#define ARP_HDR_ALIGNMENT 3
+#define ARP_HDR_ALIGNMENT 1
static __inline uint8_t *
ar_data(struct arphdr *ap)
Index: netinet/if_arp.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/if_arp.c,v
retrieving revision 1.305
diff -u -p -r1.305 if_arp.c
--- netinet/if_arp.c 16 Feb 2021 05:44:13 -0000 1.305
+++ netinet/if_arp.c 16 Feb 2021 09:26:23 -0000
@@ -133,12 +133,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1
*/
#define ETHERTYPE_IPTRAILERS ETHERTYPE_TRAIL
-#ifdef __NO_STRICT_ALIGNMENT
-#define ARP_HDR_ALIGNED_P(ar) 1
-#else
-#define ARP_HDR_ALIGNED_P(ar) ((((vaddr_t) (ar)) & 1) == 0)
-#endif
-
/* timers */
static int arp_reachable = REACHABLE_TIME;
static int arp_retrans = RETRANS_TIMER;
In my testing on aarch64 and octeon (both of which I think are strict alignment)
neither need pullups nor copyups as the mbuf already has enough and arphrd is
aligned correctly already.
Roy