/* called by /proc/net/wireless */
struct iw_statistics *p80211wext_get_wireless_stats(netdevice_t *dev)
{
	p80211msg_lnxreq_commsquality_t quality;
	wlandevice_t *wlandev = dev->ml_priv;
	struct iw_statistics *wstats = &wlandev->wstats;
	int retval;

	/* Check */
	if ((wlandev == NULL) || (wlandev->msdstate != WLAN_MSD_RUNNING))
		return NULL;

	/* XXX Only valid in station mode */
	wstats->status = 0;

	/* build request message */
	quality.msgcode = DIDmsg_lnxreq_commsquality;
	quality.dbm.data = P80211ENUM_truth_true;
	quality.dbm.status = P80211ENUM_msgitem_status_data_ok;

	/* send message to nsd */
	if (wlandev->mlmerequest == NULL)
		return NULL;

	retval = wlandev->mlmerequest(wlandev, (p80211msg_t *) &quality);

	wstats->qual.qual = qual_as_percent(quality.link.data);	/* overall link quality */
	wstats->qual.level = quality.level.data;	/* instant signal level */
	wstats->qual.noise = quality.noise.data;	/* instant noise level */

	wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
	wstats->discard.code = wlandev->rx.decrypt_err;
	wstats->discard.nwid = 0;
	wstats->discard.misc = 0;

	wstats->discard.fragment = 0;	/* incomplete fragments */
	wstats->discard.retries = 0;	/* tx retries. */
	wstats->miss.beacon = 0;

	return wstats;
}
Beispiel #2
0
struct iw_statistics *p80211wext_get_wireless_stats(netdevice_t *dev)
{
	p80211msg_lnxreq_commsquality_t quality;
	wlandevice_t *wlandev = dev->ml_priv;
	struct iw_statistics *wstats = &wlandev->wstats;
	int retval;

	
	if ((wlandev == NULL) || (wlandev->msdstate != WLAN_MSD_RUNNING))
		return NULL;

	
	wstats->status = 0;

	
	quality.msgcode = DIDmsg_lnxreq_commsquality;
	quality.dbm.data = P80211ENUM_truth_true;
	quality.dbm.status = P80211ENUM_msgitem_status_data_ok;

	
	if (wlandev->mlmerequest == NULL)
		return NULL;

	retval = wlandev->mlmerequest(wlandev, (p80211msg_t *) & quality);

	wstats->qual.qual = qual_as_percent(quality.link.data);	
	wstats->qual.level = quality.level.data;	
	wstats->qual.noise = quality.noise.data;	

	wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
	wstats->discard.code = wlandev->rx.decrypt_err;
	wstats->discard.nwid = 0;
	wstats->discard.misc = 0;

	wstats->discard.fragment = 0;	
	wstats->discard.retries = 0;	
	wstats->miss.beacon = 0;

	return wstats;
}