Lines Matching refs:device

44 /*!	A service thread for each device interface. It just reads as many packets
46 device interface.
52 net_device* device = interface->device;
55 while ((device->flags & IFF_UP) != 0) {
57 status = device->module->receive_data(device, &buffer);
59 // feed device monitors
65 if (interface->deframe_func(interface->device, buffer) != B_OK) {
67 atomic_add((int32*)&device->stats.receive.dropped, 1);
74 atomic_add((int32*)&device->stats.receive.packets, 1);
75 atomic_add64((int64*)&device->stats.receive.bytes, packetSize);
78 atomic_add((int32*)&device->stats.receive.dropped, 1);
81 device_removed(device);
84 atomic_add((int32*)&device->stats.receive.errors, 1);
100 net_device* device = interface->device;
124 buffer->index = interface->device->index;
139 && handler->func(handler->cookie, device, buffer) == B_OK)
152 /*! The domain's device receive handler - this will inject the net_buffers into
156 domain_receive_adapter(void* cookie, net_device* device, net_buffer* buffer)
171 if (!strcmp(interface->device->name, name))
180 allocate_device_interface(net_device* device, net_device_module_info* module)
186 recursive_lock_init(&interface->receive_lock, "device interface receive");
187 recursive_lock_init(&interface->monitor_lock, "device interface monitors");
190 snprintf(name, sizeof(name), "%s receive queue", device->name);
195 interface->device = device;
203 snprintf(name, sizeof(name), "%s consumer", device->name);
213 device->index = ++sDeviceIndex;
214 device->module = module;
258 kprintf("device: %p\n", interface->device);
291 kprintf(" %p %s\n", interface, interface->device->name);
301 // #pragma mark - device interfaces
321 address.sdl_index = interface->device->index;
322 address.sdl_type = interface->device->type;
323 address.sdl_nlen = strlen(interface->device->name);
325 memcpy(address.sdl_data, interface->device->name, address.sdl_nlen);
327 address.sdl_alen = interface->device->address.length;
328 memcpy(LLADDR(&address), interface->device->address.data, address.sdl_alen);
365 buffer.Push(interface->device->name, IF_NAMESIZE);
406 net_device* device = interface->device;
407 const char* moduleName = device->module->info.name;
409 device->module->uninit_device(device);
425 // TODO: maintain an array of all device interfaces instead
428 if (interface->device->index == index) {
477 net_device* device;
478 status_t status = module->init_device(name, &device);
480 interface = allocate_device_interface(device, module);
486 module->uninit_device(device);
498 /*! Feeds the device monitors of the \a interface with the specified \a buffer.
520 net_device* device = interface->device;
529 status_t status = device->module->up(device);
533 if (device->module->receive_data != NULL) {
536 snprintf(name, sizeof(name), "%s reader", device->name);
544 device->flags |= IFF_UP;
546 if (device->module->receive_data != NULL)
573 net_device* device = interface->device;
575 device->flags &= ~IFF_UP;
576 device->module->down(device);
580 if (device->module->receive_data != NULL) {
596 unregister_device_deframer(net_device* device)
600 // find device interface for this device
601 net_device_interface* interface = find_device_interface(device->name);
614 /*! Registers the deframer function for the specified \a device.
616 deframer function per device.
622 register_device_deframer(net_device* device, net_deframe_func deframeFunc)
626 // find device interface for this device
627 net_device_interface* interface = find_device_interface(device->name);
643 /*! Registers a domain to receive net_buffers from the specified \a device. */
645 register_domain_device_handler(struct net_device* device, int32 type,
652 return register_device_handler(device, type, &domain_receive_adapter,
657 /*! Registers a receiving function callback for the specified \a device. */
659 register_device_handler(struct net_device* device, int32 type,
664 // find device interface for this device
665 net_device_interface* interface = find_device_interface(device->name);
671 // see if such a handler already for this device
694 /*! Unregisters a previously registered device handler. */
696 unregister_device_handler(struct net_device* device, int32 type)
700 // find device interface for this device
701 net_device_interface* interface = find_device_interface(device->name);
724 /*! Registers a device monitor for the specified device. */
726 register_device_monitor(net_device* device, net_device_monitor* monitor)
733 // find device interface for this device
734 net_device_interface* interface = find_device_interface(device->name);
746 /*! Unregisters a previously registered device monitor. */
748 unregister_device_monitor(net_device* device, net_device_monitor* monitor)
752 // find device interface for this device
753 net_device_interface* interface = find_device_interface(device->name);
775 /*! This function is called by device modules in case their link
780 device_link_changed(net_device* device)
782 notify_link_changed(device);
787 /*! This function is called by device modules once their device got
791 device_removed(net_device* device)
795 net_device_interface* interface = find_device_interface(device->name);
801 // Acquire a reference to the device interface being removed
807 // Propagate the loss of the device throughout the stack.
829 device_enqueue_buffer(net_device* device, net_buffer* buffer)
831 net_device_interface* interface = get_device_interface(device->index);
835 status_t status = interface->deframe_func(interface->device, buffer);
854 mutex_init(&sLock, "net device interfaces");
861 "Dump the given network device interface");
863 "Dump network device interfaces");