Browse Source

Use hotplug support to notify persistent reference holders when a

net_device is unregistered.
tags/v0.9.3
Michael Brown 18 years ago
parent
commit
bdf79ec8dc
2 changed files with 9 additions and 0 deletions
  1. 5
    0
      src/include/gpxe/netdevice.h
  2. 4
    0
      src/net/netdevice.c

+ 5
- 0
src/include/gpxe/netdevice.h View File

10
 #include <stdint.h>
10
 #include <stdint.h>
11
 #include <gpxe/list.h>
11
 #include <gpxe/list.h>
12
 #include <gpxe/tables.h>
12
 #include <gpxe/tables.h>
13
+#include <gpxe/hotplug.h>
13
 
14
 
14
 struct pk_buff;
15
 struct pk_buff;
15
 struct net_device;
16
 struct net_device;
137
 struct net_device {
138
 struct net_device {
138
 	/** List of network devices */
139
 	/** List of network devices */
139
 	struct list_head list;
140
 	struct list_head list;
141
+
142
+	/** List of persistent reference holders */
143
+	struct list_head references;
144
+
140
 	/** Transmit packet
145
 	/** Transmit packet
141
 	 *
146
 	 *
142
 	 * @v netdev	Network device
147
 	 * @v netdev	Network device

+ 4
- 0
src/net/netdevice.c View File

161
 
161
 
162
 	netdev = calloc ( 1, sizeof ( *netdev ) + priv_size );
162
 	netdev = calloc ( 1, sizeof ( *netdev ) + priv_size );
163
 	if ( netdev ) {
163
 	if ( netdev ) {
164
+		INIT_LIST_HEAD ( &netdev->references );
164
 		INIT_LIST_HEAD ( &netdev->rx_queue );
165
 		INIT_LIST_HEAD ( &netdev->rx_queue );
165
 		netdev->priv = ( ( ( void * ) netdev ) + sizeof ( *netdev ) );
166
 		netdev->priv = ( ( ( void * ) netdev ) + sizeof ( *netdev ) );
166
 	}
167
 	}
201
 		free_pkb ( pkb );
202
 		free_pkb ( pkb );
202
 	}
203
 	}
203
 
204
 
205
+	/* Kill off any persistent references to this device */
206
+	forget_references ( &netdev->references );
207
+
204
 	/* Remove from device list */
208
 	/* Remove from device list */
205
 	list_del ( &netdev->list );
209
 	list_del ( &netdev->list );
206
 	DBG ( "%s unregistered\n", netdev_name ( netdev ) );
210
 	DBG ( "%s unregistered\n", netdev_name ( netdev ) );

Loading…
Cancel
Save