ipro1000 knows when its link state changes (notified by interrupt). Use ETHER_SET_LINK_STATE_SEM to wake the ethernet device link state notifier sooner.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20559 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos 2007-04-04 15:54:50 +00:00
parent 8df968341a
commit 183071cab3
3 changed files with 24 additions and 1 deletions

View File

@ -110,6 +110,10 @@ ipro1000_open(const char *name, uint32 flags, void** cookie)
device->pciFunc = device->pciInfo->function;
device->adapter = 0;
device->maxframesize = 1514; // XXX is MAXIMUM_ETHERNET_FRAME_SIZE = 1518 too much?
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
device->linkChangeSem = -1;
#endif
ipro1000_read_settings(device);
@ -363,6 +367,15 @@ ipro1000_control(void *cookie, uint32 op, void *arg, size_t len)
return user_memcpy(arg, &state, sizeof(ether_link_state_t));
}
case ETHER_SET_LINK_STATE_SEM:
{
if (user_memcpy(&device->linkChangeSem, arg, sizeof(sem_id *)) < B_OK) {
device->linkChangeSem = -1;
return B_BAD_ADDRESS;
}
return B_OK;
}
#endif
default:

View File

@ -48,6 +48,10 @@ typedef struct device {
uint32 maxframesize; // 14 bytes header + MTU
uint8 macaddr[6];
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
sem_id linkChangeSem;
#endif
} ipro1000_device;
#endif

View File

@ -52,7 +52,7 @@ static int em_ioctl(struct ifnet *, u_long, caddr_t);
static void em_watchdog(struct ifnet *);
static void em_init(void *);
static void em_stop(void *);
//static void em_media_status(struct ifnet *, struct ifmediareq *);
void em_media_status(struct ifnet *, struct ifmediareq *);
//static int em_media_change(struct ifnet *);
static void em_identify_hardware(struct adapter *);
static int em_allocate_pci_resources(struct adapter *);
@ -808,6 +808,12 @@ event_handler(void *cookie)
em_check_for_link(&adapter->hw);
em_print_link_status(adapter);
adapter->timer_handle = timeout(em_local_timer, adapter, 2*hz);
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
if (adapter->osdep.dev->linkChangeSem != -1)
release_sem_etc(adapter->osdep.dev->linkChangeSem, 1,
B_DO_NOT_RESCHEDULE);
#endif
}
}