Module Name: src Committed By: msaitoh Date: Wed Oct 2 04:17:16 UTC 2019
Modified Files: src/sys/net: if_ethersubr.c Log Message: Print oversized frame's message only when DIAGNOSTIC is set. The message is not so important because we increment if_iqdrops now. To generate a diff of this commit: cvs rdiff -u -r1.277 -r1.278 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_ethersubr.c diff -u src/sys/net/if_ethersubr.c:1.277 src/sys/net/if_ethersubr.c:1.278 --- src/sys/net/if_ethersubr.c:1.277 Tue Oct 1 08:13:16 2019 +++ src/sys/net/if_ethersubr.c Wed Oct 2 04:17:16 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ethersubr.c,v 1.277 2019/10/01 08:13:16 msaitoh Exp $ */ +/* $NetBSD: if_ethersubr.c,v 1.278 2019/10/02 04:17:16 msaitoh 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.277 2019/10/01 08:13:16 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.278 2019/10/02 04:17:16 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -164,10 +164,12 @@ extern u_char aarp_org_code[3]; #include <netmpls/mpls_var.h> #endif +#ifdef DIAGNOSTIC static struct timeval bigpktppslim_last; static int bigpktppslim = 2; /* XXX */ static int bigpktpps_count; static kmutex_t bigpktpps_lock __cacheline_aligned; +#endif const uint8_t etherbroadcastaddr[ETHER_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; @@ -612,6 +614,7 @@ ether_input(struct ifnet *ifp, struct mb */ if (etype != ETHERTYPE_MPLS && m->m_pkthdr.len > ETHER_MAX_FRAME(ifp, etype, m->m_flags & M_HASFCS)) { +#ifdef DIAGNOSTIC mutex_enter(&bigpktpps_lock); if (ppsratecheck(&bigpktppslim_last, &bigpktpps_count, bigpktppslim)) { @@ -619,6 +622,7 @@ ether_input(struct ifnet *ifp, struct mb ifp->if_xname, m->m_pkthdr.len); } mutex_exit(&bigpktpps_lock); +#endif ifp->if_iqdrops++; m_freem(m); return; @@ -1718,6 +1722,8 @@ void etherinit(void) { +#ifdef DIAGNOSTIC mutex_init(&bigpktpps_lock, MUTEX_DEFAULT, IPL_NET); +#endif ether_sysctl_setup(NULL); }