Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net if_ether: revert prior alignment checks
details: https://anonhg.NetBSD.org/src/rev/358b34e90363
branches: trunk
changeset: 980677:358b34e90363
user: roy <roy%NetBSD.org@localhost>
date: Sun Feb 14 19:35:37 2021 +0000
description:
if_ether: revert prior alignment checks
Apparently not needed as our drivers ensure this.
diffstat:
sys/net/if_ether.h | 11 +----------
sys/net/if_ethersubr.c | 13 ++++++-------
2 files changed, 7 insertions(+), 17 deletions(-)
diffs (66 lines):
diff -r 594817313be7 -r 358b34e90363 sys/net/if_ether.h
--- a/sys/net/if_ether.h Sun Feb 14 19:33:29 2021 +0000
+++ b/sys/net/if_ether.h Sun Feb 14 19:35:37 2021 +0000
@@ -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 @@
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>
diff -r 594817313be7 -r 358b34e90363 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c Sun Feb 14 19:33:29 2021 +0000
+++ b/sys/net/if_ethersubr.c Sun Feb 14 19:35:37 2021 +0000
@@ -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 @@
#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 @@
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;
}
Home |
Main Index |
Thread Index |
Old Index