Module Name:    src
Committed By:   thorpej
Date:           Mon Aug 22 17:07:40 UTC 2022

Modified Files:
        src/sys/dev/pci: if_ipw.c if_iwi.c

Log Message:
We come into our if_start routine via ether_output(), therefore there is
no need to check-and-pullup to sizeof(struct ether_header).  Instead, we
can simply assert it.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/pci/if_ipw.c
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/pci/if_iwi.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/dev/pci/if_ipw.c
diff -u src/sys/dev/pci/if_ipw.c:1.74 src/sys/dev/pci/if_ipw.c:1.75
--- src/sys/dev/pci/if_ipw.c:1.74	Wed Jun 16 00:21:18 2021
+++ src/sys/dev/pci/if_ipw.c	Mon Aug 22 17:07:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipw.c,v 1.74 2021/06/16 00:21:18 riastradh Exp $	*/
+/*	$NetBSD: if_ipw.c,v 1.75 2022/08/22 17:07:40 thorpej Exp $	*/
 /*	FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp 	*/
 
 /*-
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.74 2021/06/16 00:21:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.75 2022/08/22 17:07:40 thorpej Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -1530,9 +1530,7 @@ ipw_start(struct ifnet *ifp)
 			break;
 		}
 
-		if (m0->m_len < sizeof (struct ether_header) &&
-		    (m0 = m_pullup(m0, sizeof (struct ether_header))) == NULL)
-			continue;
+		KASSERT(m0->m_len >= sizeof(struct ether_header));
 
 		eh = mtod(m0, struct ether_header *);
 		ni = ieee80211_find_txnode(ic, eh->ether_dhost);

Index: src/sys/dev/pci/if_iwi.c
diff -u src/sys/dev/pci/if_iwi.c:1.118 src/sys/dev/pci/if_iwi.c:1.119
--- src/sys/dev/pci/if_iwi.c:1.118	Mon May 23 13:53:37 2022
+++ src/sys/dev/pci/if_iwi.c	Mon Aug 22 17:07:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwi.c,v 1.118 2022/05/23 13:53:37 rin Exp $  */
+/*	$NetBSD: if_iwi.c,v 1.119 2022/08/22 17:07:40 thorpej Exp $  */
 /*	$OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $	*/
 
 /*-
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.118 2022/05/23 13:53:37 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.119 2022/08/22 17:07:40 thorpej Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -1785,11 +1785,7 @@ iwi_start(struct ifnet *ifp)
 		if (m0 == NULL)
 			break;
 
-		if (m0->m_len < sizeof (struct ether_header) &&
-		    (m0 = m_pullup(m0, sizeof (struct ether_header))) == NULL) {
-			if_statinc(ifp, if_oerrors);
-			continue;
-		}
+		KASSERT(m0->m_len >= sizeof(struct ether_header));
 
 		eh = mtod(m0, struct ether_header *);
 		ni = ieee80211_find_txnode(ic, eh->ether_dhost);

Reply via email to