Module Name:    src
Committed By:   msaitoh
Date:           Thu May 15 07:35:38 UTC 2014

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

Log Message:
 Usually schednetisr() is called after enqueueing a packet with IF_ENQUEUE().
In some functions, they do it in reverse order. It's not a bug because
the pair is protected with splnet()/splx(s). It's not good for readability
and someone might mistake when modifing a code. Yes, I'm one of the person :-(

 Save a NETISR_* value in a variable and call schednetisr() after enqueue
a packet for readability and future modification.


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 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.197 src/sys/net/if_ethersubr.c:1.198
--- src/sys/net/if_ethersubr.c:1.197	Tue May 13 19:36:16 2014
+++ src/sys/net/if_ethersubr.c	Thu May 15 07:35:38 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.197 2014/05/13 19:36:16 bouyer Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.198 2014/05/15 07:35:38 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.197 2014/05/13 19:36:16 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.198 2014/05/15 07:35:38 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_atalk.h"
@@ -579,6 +579,7 @@ ether_input(struct ifnet *ifp, struct mb
 	uint16_t etype;
 	struct ether_header *eh;
 	size_t ehlen;
+	int isr = 0;
 #if defined (LLC) || defined(NETATALK)
 	struct llc *l;
 #endif
@@ -839,12 +840,12 @@ ether_input(struct ifnet *ifp, struct mb
 			if (ipflow_fastforward(m))
 				return;
 #endif
-			schednetisr(NETISR_IP);
+			isr = NETISR_IP;
 			inq = &ipintrq;
 			break;
 
 		case ETHERTYPE_ARP:
-			schednetisr(NETISR_ARP);
+			isr = NETISR_ARP;
 			inq = &arpintrq;
 			break;
 
@@ -862,19 +863,19 @@ ether_input(struct ifnet *ifp, struct mb
 			if (ip6flow_fastforward(&m))
 				return;
 #endif
-			schednetisr(NETISR_IPV6);
+			isr = NETISR_IPV6;
 			inq = &ip6intrq;
 			break;
 #endif
 #ifdef IPX
 		case ETHERTYPE_IPX:
-			schednetisr(NETISR_IPX);
+			isr = NETISR_IPX;
 			inq = &ipxintrq;
 			break;
 #endif
 #ifdef NETATALK
 		case ETHERTYPE_ATALK:
-			schednetisr(NETISR_ATALK);
+			isr = NETISR_ATALK;
 			inq = &atintrq1;
 			break;
 		case ETHERTYPE_AARP:
@@ -884,7 +885,7 @@ ether_input(struct ifnet *ifp, struct mb
 #endif /* NETATALK */
 #ifdef MPLS
 		case ETHERTYPE_MPLS:
-			schednetisr(NETISR_MPLS);
+			isr = NETISR_MPLS;
 			inq = &mplsintrq;
 			break;
 #endif
@@ -911,7 +912,7 @@ ether_input(struct ifnet *ifp, struct mb
 					inq = &atintrq2;
 					m_adj(m, sizeof(struct ether_header)
 					    + sizeof(struct llc));
-					schednetisr(NETISR_ATALK);
+					isr = NETISR_ATALK;
 					break;
 				}
 
@@ -945,8 +946,10 @@ ether_input(struct ifnet *ifp, struct mb
 	if (IF_QFULL(inq)) {
 		IF_DROP(inq);
 		m_freem(m);
-	} else
+	} else {
 		IF_ENQUEUE(inq, m);
+		schednetisr(isr);
+	}
 }
 
 /*

Reply via email to