Changeset 639 for Whitix/branches
- Timestamp:
- 06/24/08 14:02:21 (5 months ago)
- Files:
-
- 1 modified
-
Whitix/branches/network/net/device.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/branches/network/net/device.c
r316 r639 21 21 #include <init.h> 22 22 #include <net/network.h> 23 #include <net/socket.h> 23 24 #include <slab.h> 24 25 … … 33 34 { 34 35 return (struct NetDevice*)MemCacheAlloc(netDeviceCache); 36 } 37 38 /* Public API */ 39 40 int NetDeviceSend(struct NetDevice* device, struct SocketBuffer* buffer) 41 { 42 if (!device->ops || !device->ops->send) 43 return -ENOTIMPL; 44 45 if (device-> state & NET_DEVICE_QUEUE_RUNNING) 46 return device->ops->send(device, buffer); 47 else{ 48 /* Add the packet onto the queue, and wait for the device to pick 49 * it up once it has finished an event like a send interrupt. 50 */ 51 ListAddTail(&buffer->next, &device->sendList); 52 } 35 53 } 36 54 … … 66 84 67 85 DevAddDevice(buf, NETWORK_MAJOR, 0, DEVICE_CHAR, &netFileOps); 86 INIT_LIST_HEAD(&device->sendList); 87 device->state = NET_DEVICE_UP | NET_DEVICE_QUEUE_RUNNING; 68 88 69 89 return 0;