patch-2.2.4 linux/net/core/dev.c

Next file: linux/net/core/dev_mcast.c
Previous file: linux/net/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.3/linux/net/core/dev.c linux/net/core/dev.c
@@ -232,7 +232,9 @@
 	{
 		if(pt==(*pt1))
 		{
+			net_serialize_enter();
 			*pt1=pt->next;
+			net_serialize_leave();
 #ifdef CONFIG_NET_FASTROUTE
 			if (pt->data)
 				netdev_fastroute_obstacles--;
@@ -328,6 +330,12 @@
 	return dev;
 }
 
+void netdev_state_change(struct device *dev)
+{
+	if (dev->flags&IFF_UP)
+		notifier_call_chain(&netdev_chain, NETDEV_CHANGE, dev);
+}
+
 
 /*
  *	Find and possibly load an interface.
@@ -422,7 +430,7 @@
 		int i;
 
 		for (i=0; i<=NETDEV_FASTROUTE_HMASK; i++)
-			dst_release(xchg(dev->fastpath+i, NULL));
+			dst_release_irqwait(xchg(dev->fastpath+i, NULL));
 	}
 }
 
@@ -895,22 +903,6 @@
 #endif
 
 		/*
-		 * 	Fetch the packet protocol ID. 
-		 */
-		
-		type = skb->protocol;
-
-		
-#ifdef CONFIG_BRIDGE
-		/*
-		 *	If we are bridging then pass the frame up to the
-		 *	bridging code (if this protocol is to be bridged).
-		 *      If it is bridged then move on
-		 */
-		handle_bridge(skb, type); 
-#endif
-		
-		/*
 	 	 *	Bump the pointer to the next structure.
 		 * 
 		 *	On entry to the protocol layer. skb->data and
@@ -927,11 +919,26 @@
 		}
 
 		/*
+		 * 	Fetch the packet protocol ID. 
+		 */
+
+		type = skb->protocol;
+
+#ifdef CONFIG_BRIDGE
+		/*
+		 *	If we are bridging then pass the frame up to the
+		 *	bridging code (if this protocol is to be bridged).
+		 *      If it is bridged then move on
+		 */
+		handle_bridge(skb, type); 
+#endif
+
+		/*
 		 *	We got a packet ID.  Now loop over the "known protocols"
 		 * 	list. There are two lists. The ptype_all list of taps (normally empty)
 		 *	and the main protocol list which is hashed perfectly for normal protocols.
 		 */
-		
+
 		pt_prev = NULL;
 		for (ptype = ptype_all; ptype!=NULL; ptype=ptype->next)
 		{
@@ -1536,8 +1543,7 @@
 			return 0;
 
 		case SIOCSIFTXQLEN:
-			/* Why <2? 0 and 1 are valid values. --ANK (980807) */
-			if(/*ifr->ifr_qlen<2 ||*/ ifr->ifr_qlen>1024)
+			if(ifr->ifr_qlen<0)
 				return -EINVAL;
 			dev->tx_queue_len = ifr->ifr_qlen;
 			return 0;
@@ -1817,8 +1823,11 @@
 	/* And unlink it from device chain. */
 	for (dp = &dev_base; (d=*dp) != NULL; dp=&d->next) {
 		if (d == dev) {
+			net_serialize_enter();
 			*dp = d->next;
+			net_serialize_leave();
 			d->next = NULL;
+
 			if (dev->destructor)
 				dev->destructor(dev);
 			return 0;
@@ -1977,7 +1986,9 @@
 			/*
 			 *	It failed to come up. Unhook it.
 			 */
+			net_serialize_enter();
 			*dp = dev->next;
+			net_serialize_leave();
 		} 
 		else
 		{

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)