Module Name: src Committed By: skrll Date: Thu Mar 25 08:18:03 UTC 2021
Modified Files: src/sys/net: pktqueue.c Log Message: Remove strange padding #define and replace with anonymous struct/union To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/net/pktqueue.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/pktqueue.c diff -u src/sys/net/pktqueue.c:1.12 src/sys/net/pktqueue.c:1.13 --- src/sys/net/pktqueue.c:1.12 Fri Sep 11 14:29:00 2020 +++ src/sys/net/pktqueue.c Thu Mar 25 08:18:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pktqueue.c,v 1.12 2020/09/11 14:29:00 riastradh Exp $ */ +/* $NetBSD: pktqueue.c,v 1.13 2021/03/25 08:18:03 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pktqueue.c,v 1.12 2020/09/11 14:29:00 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pktqueue.c,v 1.13 2021/03/25 08:18:03 skrll Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -52,21 +52,19 @@ __KERNEL_RCSID(0, "$NetBSD: pktqueue.c,v #include <net/pktqueue.h> -/* - * WARNING: update this if struct pktqueue changes. - */ -#define PKTQ_CLPAD \ - MAX(COHERENCY_UNIT, COHERENCY_UNIT - sizeof(kmutex_t) - sizeof(u_int)) - struct pktqueue { /* * The lock used for a barrier mechanism. The barrier counter, * as well as the drop counter, are managed atomically though. * Ensure this group is in a separate cache line. */ - kmutex_t pq_lock; - volatile u_int pq_barrier; - uint8_t _pad[PKTQ_CLPAD]; + union { + struct { + kmutex_t pq_lock; + volatile u_int pq_barrier; + }; + uint8_t _pad[COHERENCY_UNIT]; + }; /* The size of the queue, counters and the interrupt handler. */ u_int pq_maxlen;