/* NB: various calculations are based on the orinoco/wavelan drivers for compatibility  */
static void set_quality(struct rt_rtmp_adapter *pAdapter, struct iw_quality *iq, signed char rssi)
/* NB: various calculations are based on the orinoco/wavelan drivers for compatibility  */
static void set_quality(struct rt_rtmp_adapter *pAdapter, struct iw_quality *iq, signed char rssi)
{
	__u8 ChannelQuality;
	if (rssi >= -50)
		ChannelQuality = 100;
	else if (rssi >= -80)
		ChannelQuality = (__u8) (24 + ((rssi + 80) * 26) / 10);
	else if (rssi >= -90)
		ChannelQuality = (__u8) ((rssi + 90) * 26) / 10;
	else
		ChannelQuality = 0;
	iq->qual = (__u8) ChannelQuality;
	iq->level = (__u8) (rssi);
	iq->noise = (pAdapter->BbpWriteLatch[66] > pAdapter->BbpTuning.FalseCcaUpperThreshold) ? ((__u8) pAdapter->BbpTuning.FalseCcaUpperThreshold) : ((__u8) pAdapter->BbpWriteLatch[66]);
	iq->noise += 256 - 143;
	iq->updated = pAdapter->iw_stats.qual.updated;
}