While we're modifying ether_driver.h, added in an ioctl for link state detection, and implemented it in the two Broadcom drivers.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9144 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Nathan Whitehorn 2004-10-01 03:01:20 +00:00
parent 57549ff41e
commit d774d9a0a1
3 changed files with 24 additions and 1 deletions

View File

@ -30,7 +30,8 @@ enum {
ETHER_GETFRAMESIZE, /* get frame size */
ETHER_ADDTIMESTAMP, /* (try to) add timestamps to packets (BONE ext) */
ETHER_HASIOVECS, /* does the driver implement readv/writev ? (BONE ext) (bool *) */
ETHER_GETIFTYPE /* get the IFT_ type of the interface (int *) */
ETHER_GETIFTYPE, /* get the IFT_ type of the interface (int *) */
ETHER_GETLINKSTATE /* get line speed, quality, duplex mode, etc. */
};
@ -52,6 +53,16 @@ typedef struct ether_init_params {
unsigned long mem;
} ether_init_params_t;
/*
* info returned from ETHER_GETLINKSTATE
*/
typedef struct ether_link_state {
float link_speed; /* In Mbits per second */
float link_quality; /* Set to zero if not connected */
char duplex_mode; /* Set to 1 for full duplex, 0 for half */
} ether_link_state_t;
#ifdef __cplusplus
}
#endif

View File

@ -188,6 +188,12 @@ status_t b44_ioctl(void *cookie,uint32 op,void *data,size_t len) {
b44_LM_SetReceiveMask(&pUmDevice->lm_dev,
pUmDevice->lm_dev.ReceiveMask & ~LM_PROMISCUOUS_MODE);
return B_OK;
case ETHER_GETLINKSTATE: {
ether_link_state_t *state_buffer = (ether_link_state_t *)(data);
state_buffer->link_speed = (pUmDevice->lm_dev.LineSpeed == LM_LINE_SPEED_10MBPS) ? 10 : 100;
state_buffer->link_quality = (pUmDevice->lm_dev.LinkStatus == LM_STATUS_LINK_DOWN) ? 0.0 : 1.0;
state_buffer->duplex_mode = (pUmDevice->lm_dev.DuplexMode == LM_DUPLEX_MODE_FULL);
} return B_OK;
}
return B_ERROR;
}

View File

@ -438,6 +438,12 @@ status_t b57_ioctl(void *cookie,uint32 op,void *data,size_t len) {
LM_SetReceiveMask(&pUmDevice->lm_dev,
pUmDevice->lm_dev.ReceiveMask & ~LM_PROMISCUOUS_MODE);
return B_OK;
case ETHER_GETLINKSTATE: {
ether_link_state_t *state_buffer = (ether_link_state_t *)(data);
state_buffer->link_speed = pUmDevice->lm_dev.LineSpeed;
state_buffer->link_quality = (pUmDevice->lm_dev.LinkStatus == LM_STATUS_LINK_DOWN) ? 0.0 : 1.0;
state_buffer->duplex_mode = (pUmDevice->lm_dev.DuplexMode == LM_DUPLEX_MODE_FULL);
} return B_OK;
}
return B_ERROR;
}