Sfoglia il codice sorgente

Legacy drivers cannot cope with multiple active devices.

tags/v0.9.3
Michael Brown 19 anni fa
parent
commit
1697c78848
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 7
    0
      src/drivers/net/legacy.c

+ 7
- 0
src/drivers/net/legacy.c Vedi File

18
 
18
 
19
 struct nic nic;
19
 struct nic nic;
20
 
20
 
21
+static int legacy_registered = 0;
22
+
21
 static int legacy_transmit ( struct net_device *netdev, struct pk_buff *pkb ) {
23
 static int legacy_transmit ( struct net_device *netdev, struct pk_buff *pkb ) {
22
 	struct nic *nic = netdev->priv;
24
 	struct nic *nic = netdev->priv;
23
 	struct ethhdr *ethhdr = pkb->data;
25
 	struct ethhdr *ethhdr = pkb->data;
58
 		   void ( * disable ) ( struct nic *nic ) ) {
60
 		   void ( * disable ) ( struct nic *nic ) ) {
59
 	struct net_device *netdev;
61
 	struct net_device *netdev;
60
 	int rc;
62
 	int rc;
63
+
64
+	if ( legacy_registered )
65
+		return -EBUSY;
61
 	
66
 	
62
 	netdev = alloc_etherdev ( 0 );
67
 	netdev = alloc_etherdev ( 0 );
63
 	if ( ! netdev )
68
 	if ( ! netdev )
84
 	/* Do not remove this message */
89
 	/* Do not remove this message */
85
 	printf ( "WARNING: Using legacy NIC wrapper\n" );
90
 	printf ( "WARNING: Using legacy NIC wrapper\n" );
86
 
91
 
92
+	legacy_registered = 1;
87
 	return 0;
93
 	return 0;
88
 }
94
 }
89
 
95
 
95
 	unregister_netdev ( netdev );
101
 	unregister_netdev ( netdev );
96
 	disable ( nic );
102
 	disable ( nic );
97
 	free_netdev ( netdev );
103
 	free_netdev ( netdev );
104
+	legacy_registered = 0;
98
 }
105
 }
99
 
106
 
100
 void pci_fill_nic ( struct nic *nic, struct pci_device *pci ) {
107
 void pci_fill_nic ( struct nic *nic, struct pci_device *pci ) {

Loading…
Annulla
Salva