Module Name:    src
Committed By:   roy
Date:           Sun Feb 14 19:35:38 UTC 2021

Modified Files:
        src/sys/net: if_ether.h if_ethersubr.c

Log Message:
if_ether: revert prior alignment checks

Apparently not needed as our drivers ensure this.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/net/if_ether.h
cvs rdiff -u -r1.291 -r1.292 src/sys/net/if_ethersubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_ether.h
diff -u src/sys/net/if_ether.h:1.85 src/sys/net/if_ether.h:1.86
--- src/sys/net/if_ether.h:1.85	Sat Feb 13 07:28:04 2021
+++ src/sys/net/if_ether.h	Sun Feb 14 19:35:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.85 2021/02/13 07:28:04 roy Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.86 2021/02/14 19:35:37 roy Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -89,15 +89,6 @@ struct ether_header {
 	uint8_t  ether_shost[ETHER_ADDR_LEN];
 	uint16_t ether_type;
 };
-#ifdef __NO_STRICT_ALIGNMENT
-#define	ETHER_HDR_ALIGNED_P(eh)	1
-#else
-#define	ETHER_HDR_ALIGNED_P(eh)	((((vaddr_t) (eh)) & 3) == 0)
-#endif
-#ifdef __CTASSERT
-__CTASSERT(sizeof(struct ether_addr) == 6);
-__CTASSERT(sizeof(struct ether_header) == 14);
-#endif
 
 #include <net/ethertypes.h>
 

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.291 src/sys/net/if_ethersubr.c:1.292
--- src/sys/net/if_ethersubr.c:1.291	Sat Feb 13 13:00:16 2021
+++ src/sys/net/if_ethersubr.c	Sun Feb 14 19:35:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.291 2021/02/13 13:00:16 roy Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.292 2021/02/14 19:35:37 roy Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.291 2021/02/13 13:00:16 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.292 2021/02/14 19:35:37 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -164,6 +164,9 @@ extern u_char	aarp_org_code[3];
 #include <netmpls/mpls_var.h>
 #endif
 
+CTASSERT(sizeof(struct ether_addr) == 6);
+CTASSERT(sizeof(struct ether_header) == 14);
+
 #ifdef DIAGNOSTIC
 static struct timeval bigpktppslim_last;
 static int bigpktppslim = 2;	/* XXX */
@@ -653,11 +656,7 @@ ether_input(struct ifnet *ifp, struct mb
 	m_claimm(m, &ec->ec_rx_mowner);
 #endif
 
-	/* Enforce alignement */
-	if (ETHER_HDR_ALIGNED_P(mtod(m, void *)) == 0) {
-		if ((m = m_copyup(m, sizeof(*eh), 0)) == NULL)
-			goto dropped;
-	} else if (__predict_false(m->m_len < sizeof(*eh))) {
+	if (__predict_false(m->m_len < sizeof(*eh))) {
 		if ((m = m_pullup(m, sizeof(*eh))) == NULL)
 			goto dropped;
 	}

Reply via email to