| 
				
			 | 
			
			
				
				@@ -50,6 +50,9 @@ struct list_head net_devices = LIST_HEAD_INIT ( net_devices ); 
			 | 
		
		
	
		
			
			| 
				50
			 | 
			
				50
			 | 
			
			
				
				 /** List of open network devices, in reverse order of opening */ 
			 | 
		
		
	
		
			
			| 
				51
			 | 
			
				51
			 | 
			
			
				
				 static struct list_head open_net_devices = LIST_HEAD_INIT ( open_net_devices ); 
			 | 
		
		
	
		
			
			| 
				52
			 | 
			
				52
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				53
			 | 
			
			
				
				+/** Network device index */ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				54
			 | 
			
			
				
				+static unsigned int netdev_index = 0; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				55
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				53
			 | 
			
				56
			 | 
			
			
				
				 /** Network polling profiler */ 
			 | 
		
		
	
		
			
			| 
				54
			 | 
			
				57
			 | 
			
			
				
				 static struct profiler net_poll_profiler __profiler = { .name = "net.poll" }; 
			 | 
		
		
	
		
			
			| 
				55
			 | 
			
				58
			 | 
			
			
				
				  
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -597,14 +600,13 @@ struct net_device * alloc_netdev ( size_t priv_len ) { 
			 | 
		
		
	
		
			
			| 
				597
			 | 
			
				600
			 | 
			
			
				
				  * devices. 
			 | 
		
		
	
		
			
			| 
				598
			 | 
			
				601
			 | 
			
			
				
				  */ 
			 | 
		
		
	
		
			
			| 
				599
			 | 
			
				602
			 | 
			
			
				
				 int register_netdev ( struct net_device *netdev ) { 
			 | 
		
		
	
		
			
			| 
				600
			 | 
			
				
			 | 
			
			
				
				-	static unsigned int ifindex = 0; 
			 | 
		
		
	
		
			
			| 
				601
			 | 
			
				603
			 | 
			
			
				
				 	struct ll_protocol *ll_protocol = netdev->ll_protocol; 
			 | 
		
		
	
		
			
			| 
				602
			 | 
			
				604
			 | 
			
			
				
				 	struct net_driver *driver; 
			 | 
		
		
	
		
			
			| 
				603
			 | 
			
				605
			 | 
			
			
				
				 	uint32_t seed; 
			 | 
		
		
	
		
			
			| 
				604
			 | 
			
				606
			 | 
			
			
				
				 	int rc; 
			 | 
		
		
	
		
			
			| 
				605
			 | 
			
				607
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				606
			 | 
			
				608
			 | 
			
			
				
				 	/* Record device index and create device name */ 
			 | 
		
		
	
		
			
			| 
				607
			 | 
			
				
			 | 
			
			
				
				-	netdev->index = ifindex++; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				609
			 | 
			
			
				
				+	netdev->index = netdev_index++; 
			 | 
		
		
	
		
			
			| 
				608
			 | 
			
				610
			 | 
			
			
				
				 	if ( netdev->name[0] == '\0' ) { 
			 | 
		
		
	
		
			
			| 
				609
			 | 
			
				611
			 | 
			
			
				
				 		snprintf ( netdev->name, sizeof ( netdev->name ), "net%d", 
			 | 
		
		
	
		
			
			| 
				610
			 | 
			
				612
			 | 
			
			
				
				 			   netdev->index ); 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -764,6 +766,10 @@ void unregister_netdev ( struct net_device *netdev ) { 
			 | 
		
		
	
		
			
			| 
				764
			 | 
			
				766
			 | 
			
			
				
				 	DBGC ( netdev, "NETDEV %s unregistered\n", netdev->name ); 
			 | 
		
		
	
		
			
			| 
				765
			 | 
			
				767
			 | 
			
			
				
				 	list_del ( &netdev->list ); 
			 | 
		
		
	
		
			
			| 
				766
			 | 
			
				768
			 | 
			
			
				
				 	netdev_put ( netdev ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				769
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				770
			 | 
			
			
				
				+	/* Reset network device index if no devices remain */ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				771
			 | 
			
			
				
				+	if ( list_empty ( &net_devices ) ) 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				772
			 | 
			
			
				
				+		netdev_index = 0; 
			 | 
		
		
	
		
			
			| 
				767
			 | 
			
				773
			 | 
			
			
				
				 } 
			 | 
		
		
	
		
			
			| 
				768
			 | 
			
				774
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				769
			 | 
			
				775
			 | 
			
			
				
				 /** Enable or disable interrupts 
			 |