aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/rx.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-08 15:04:36 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:06:19 -0500
commitaa21c004f80bdf943736c62dccf0c0398d7824f3 (patch)
tree6815328775d3b5ec46bb342c4c256cde0f223863 /drivers/net/wireless/libertas/rx.c
parentf86a93e1b2d05a7a38a48c91f8fb8fc7e8f1c734 (diff)
libertas: kill struct lbs_adapter
There seems to be no reason for a separate structure; move it all into struct lbs_private. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/rx.c')
-rw-r--r--drivers/net/wireless/libertas/rx.c78
1 files changed, 36 insertions, 42 deletions
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index a252a8f74bec..58e831108120 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -48,12 +48,11 @@ static u8 lbs_getavgsnr(struct lbs_private *priv)
48{ 48{
49 u8 i; 49 u8 i;
50 u16 temp = 0; 50 u16 temp = 0;
51 struct lbs_adapter *adapter = priv->adapter; 51 if (priv->numSNRNF == 0)
52 if (adapter->numSNRNF == 0)
53 return 0; 52 return 0;
54 for (i = 0; i < adapter->numSNRNF; i++) 53 for (i = 0; i < priv->numSNRNF; i++)
55 temp += adapter->rawSNR[i]; 54 temp += priv->rawSNR[i];
56 return (u8) (temp / adapter->numSNRNF); 55 return (u8) (temp / priv->numSNRNF);
57 56
58} 57}
59 58
@@ -67,12 +66,11 @@ static u8 lbs_getavgnf(struct lbs_private *priv)
67{ 66{
68 u8 i; 67 u8 i;
69 u16 temp = 0; 68 u16 temp = 0;
70 struct lbs_adapter *adapter = priv->adapter; 69 if (priv->numSNRNF == 0)
71 if (adapter->numSNRNF == 0)
72 return 0; 70 return 0;
73 for (i = 0; i < adapter->numSNRNF; i++) 71 for (i = 0; i < priv->numSNRNF; i++)
74 temp += adapter->rawNF[i]; 72 temp += priv->rawNF[i];
75 return (u8) (temp / adapter->numSNRNF); 73 return (u8) (temp / priv->numSNRNF);
76 74
77} 75}
78 76
@@ -85,14 +83,13 @@ static u8 lbs_getavgnf(struct lbs_private *priv)
85 */ 83 */
86static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd) 84static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd)
87{ 85{
88 struct lbs_adapter *adapter = priv->adapter; 86 if (priv->numSNRNF < DEFAULT_DATA_AVG_FACTOR)
89 if (adapter->numSNRNF < DEFAULT_DATA_AVG_FACTOR) 87 priv->numSNRNF++;
90 adapter->numSNRNF++; 88 priv->rawSNR[priv->nextSNRNF] = p_rx_pd->snr;
91 adapter->rawSNR[adapter->nextSNRNF] = p_rx_pd->snr; 89 priv->rawNF[priv->nextSNRNF] = p_rx_pd->nf;
92 adapter->rawNF[adapter->nextSNRNF] = p_rx_pd->nf; 90 priv->nextSNRNF++;
93 adapter->nextSNRNF++; 91 if (priv->nextSNRNF >= DEFAULT_DATA_AVG_FACTOR)
94 if (adapter->nextSNRNF >= DEFAULT_DATA_AVG_FACTOR) 92 priv->nextSNRNF = 0;
95 adapter->nextSNRNF = 0;
96 return; 93 return;
97} 94}
98 95
@@ -105,32 +102,31 @@ static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd)
105 */ 102 */
106static void lbs_compute_rssi(struct lbs_private *priv, struct rxpd *p_rx_pd) 103static void lbs_compute_rssi(struct lbs_private *priv, struct rxpd *p_rx_pd)
107{ 104{
108 struct lbs_adapter *adapter = priv->adapter;
109 105
110 lbs_deb_enter(LBS_DEB_RX); 106 lbs_deb_enter(LBS_DEB_RX);
111 107
112 lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf); 108 lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf);
113 lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n", 109 lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n",
114 adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, 110 priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
115 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); 111 priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
116 112
117 adapter->SNR[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->snr; 113 priv->SNR[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->snr;
118 adapter->NF[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->nf; 114 priv->NF[TYPE_RXPD][TYPE_NOAVG] = p_rx_pd->nf;
119 lbs_save_rawSNRNF(priv, p_rx_pd); 115 lbs_save_rawSNRNF(priv, p_rx_pd);
120 116
121 adapter->SNR[TYPE_RXPD][TYPE_AVG] = lbs_getavgsnr(priv) * AVG_SCALE; 117 priv->SNR[TYPE_RXPD][TYPE_AVG] = lbs_getavgsnr(priv) * AVG_SCALE;
122 adapter->NF[TYPE_RXPD][TYPE_AVG] = lbs_getavgnf(priv) * AVG_SCALE; 118 priv->NF[TYPE_RXPD][TYPE_AVG] = lbs_getavgnf(priv) * AVG_SCALE;
123 lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n", 119 lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n",
124 adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, 120 priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
125 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); 121 priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
126 122
127 adapter->RSSI[TYPE_RXPD][TYPE_NOAVG] = 123 priv->RSSI[TYPE_RXPD][TYPE_NOAVG] =
128 CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_NOAVG], 124 CAL_RSSI(priv->SNR[TYPE_RXPD][TYPE_NOAVG],
129 adapter->NF[TYPE_RXPD][TYPE_NOAVG]); 125 priv->NF[TYPE_RXPD][TYPE_NOAVG]);
130 126
131 adapter->RSSI[TYPE_RXPD][TYPE_AVG] = 127 priv->RSSI[TYPE_RXPD][TYPE_AVG] =
132 CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, 128 CAL_RSSI(priv->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
133 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); 129 priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
134 130
135 lbs_deb_leave(LBS_DEB_RX); 131 lbs_deb_leave(LBS_DEB_RX);
136} 132}
@@ -139,7 +135,7 @@ void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb)
139{ 135{
140 lbs_deb_rx("skb->data %p\n", skb->data); 136 lbs_deb_rx("skb->data %p\n", skb->data);
141 137
142 if (priv->adapter->monitormode != LBS_MONITOR_OFF) { 138 if (priv->monitormode != LBS_MONITOR_OFF) {
143 skb->protocol = eth_type_trans(skb, priv->rtap_net_dev); 139 skb->protocol = eth_type_trans(skb, priv->rtap_net_dev);
144 } else { 140 } else {
145 if (priv->mesh_dev && IS_MESH_FRAME(skb)) 141 if (priv->mesh_dev && IS_MESH_FRAME(skb))
@@ -161,7 +157,6 @@ void lbs_upload_rx_packet(struct lbs_private *priv, struct sk_buff *skb)
161 */ 157 */
162int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb) 158int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
163{ 159{
164 struct lbs_adapter *adapter = priv->adapter;
165 int ret = 0; 160 int ret = 0;
166 161
167 struct rxpackethdr *p_rx_pkt; 162 struct rxpackethdr *p_rx_pkt;
@@ -174,7 +169,7 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
174 169
175 lbs_deb_enter(LBS_DEB_RX); 170 lbs_deb_enter(LBS_DEB_RX);
176 171
177 if (priv->adapter->monitormode != LBS_MONITOR_OFF) 172 if (priv->monitormode != LBS_MONITOR_OFF)
178 return process_rxed_802_11_packet(priv, skb); 173 return process_rxed_802_11_packet(priv, skb);
179 174
180 p_rx_pkt = (struct rxpackethdr *) skb->data; 175 p_rx_pkt = (struct rxpackethdr *) skb->data;
@@ -258,8 +253,8 @@ int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *skb)
258 /* Take the data rate from the rxpd structure 253 /* Take the data rate from the rxpd structure
259 * only if the rate is auto 254 * only if the rate is auto
260 */ 255 */
261 if (adapter->auto_rate) 256 if (priv->auto_rate)
262 adapter->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate); 257 priv->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate);
263 258
264 lbs_compute_rssi(priv, p_rx_pd); 259 lbs_compute_rssi(priv, p_rx_pd);
265 260
@@ -327,7 +322,6 @@ static u8 convert_mv_rate_to_radiotap(u8 rate)
327static int process_rxed_802_11_packet(struct lbs_private *priv, 322static int process_rxed_802_11_packet(struct lbs_private *priv,
328 struct sk_buff *skb) 323 struct sk_buff *skb)
329{ 324{
330 struct lbs_adapter *adapter = priv->adapter;
331 int ret = 0; 325 int ret = 0;
332 326
333 struct rx80211packethdr *p_rx_pkt; 327 struct rx80211packethdr *p_rx_pkt;
@@ -361,7 +355,7 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
361 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); 355 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
362 356
363 /* create the exported radio header */ 357 /* create the exported radio header */
364 if (priv->adapter->monitormode == LBS_MONITOR_OFF) { 358 if (priv->monitormode == LBS_MONITOR_OFF) {
365 /* no radio header */ 359 /* no radio header */
366 /* chop the rxpd */ 360 /* chop the rxpd */
367 skb_pull(skb, sizeof(struct rxpd)); 361 skb_pull(skb, sizeof(struct rxpd));
@@ -410,8 +404,8 @@ static int process_rxed_802_11_packet(struct lbs_private *priv,
410 /* Take the data rate from the rxpd structure 404 /* Take the data rate from the rxpd structure
411 * only if the rate is auto 405 * only if the rate is auto
412 */ 406 */
413 if (adapter->auto_rate) 407 if (priv->auto_rate)
414 adapter->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate); 408 priv->cur_rate = lbs_fw_index_to_data_rate(prxpd->rx_rate);
415 409
416 lbs_compute_rssi(priv, prxpd); 410 lbs_compute_rssi(priv, prxpd);
417 411