forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/staging/vt6655/rxtx.c
....@@ -21,7 +21,7 @@
2121 * s_uGetDataDuration - get tx data required duration
2222 * s_uFillDataHead- fulfill tx data duration header
2323 * s_uGetRTSCTSDuration- get rtx/cts required duration
24
- * s_uGetRTSCTSRsvTime- get rts/cts reserved time
24
+ * get_rtscts_time- get rts/cts reserved time
2525 * s_uGetTxRsvTime- get frame reserved time
2626 * s_vFillCTSHead- fulfill CTS ctl header
2727 * s_vFillFragParameter- Set fragment ctl parameter.
....@@ -65,6 +65,7 @@
6565 {RATE_12M, RATE_18M, RATE_24M, RATE_36M, RATE_48M}, /* fallback_rate0 */
6666 {RATE_12M, RATE_12M, RATE_18M, RATE_24M, RATE_36M}, /* fallback_rate1 */
6767 };
68
+
6869 static const unsigned short wFB_Opt1[2][5] = {
6970 {RATE_12M, RATE_18M, RATE_24M, RATE_24M, RATE_36M}, /* fallback_rate0 */
7071 {RATE_6M, RATE_6M, RATE_12M, RATE_12M, RATE_18M}, /* fallback_rate1 */
....@@ -164,16 +165,21 @@
164165 {
165166 unsigned int uDataTime, uAckTime;
166167
167
- uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wRate);
168
- if (byPktType == PK_TYPE_11B) /* llb,CCK mode */
169
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (unsigned short)pDevice->byTopCCKBasicRate);
170
- else /* 11g 2.4G OFDM mode & 11a 5G OFDM mode */
171
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (unsigned short)pDevice->byTopOFDMBasicRate);
168
+ uDataTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, cbFrameLength, wRate);
172169
173
- if (bNeedAck)
174
- return uDataTime + pDevice->uSIFS + uAckTime;
175
- else
170
+ if (!bNeedAck)
176171 return uDataTime;
172
+
173
+ /*
174
+ * CCK mode - 11b
175
+ * OFDM mode - 11g 2.4G & 11a 5G
176
+ */
177
+ uAckTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14,
178
+ byPktType == PK_TYPE_11B ?
179
+ pDevice->byTopCCKBasicRate :
180
+ pDevice->byTopOFDMBasicRate);
181
+
182
+ return uDataTime + pDevice->uSIFS + uAckTime;
177183 }
178184
179185 static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type,
....@@ -184,41 +190,41 @@
184190 }
185191
186192 /* byFreqType: 0=>5GHZ 1=>2.4GHZ */
187
-static
188
-__le16
189
-s_uGetRTSCTSRsvTime(
190
- struct vnt_private *pDevice,
191
- unsigned char byRTSRsvType,
192
- unsigned char byPktType,
193
- unsigned int cbFrameLength,
194
- unsigned short wCurrentRate
195
-)
193
+static __le16 get_rtscts_time(struct vnt_private *priv,
194
+ unsigned char rts_rsvtype,
195
+ unsigned char pkt_type,
196
+ unsigned int frame_length,
197
+ unsigned short current_rate)
196198 {
197
- unsigned int uRrvTime, uRTSTime, uCTSTime, uAckTime, uDataTime;
199
+ unsigned int rrv_time = 0;
200
+ unsigned int rts_time = 0;
201
+ unsigned int cts_time = 0;
202
+ unsigned int ack_time = 0;
203
+ unsigned int data_time = 0;
198204
199
- uRrvTime = uRTSTime = uCTSTime = uAckTime = uDataTime = 0;
200
-
201
- uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wCurrentRate);
202
- if (byRTSRsvType == 0) { /* RTSTxRrvTime_bb */
203
- uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate);
204
- uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
205
- } else if (byRTSRsvType == 1) { /* RTSTxRrvTime_ba, only in 2.4GHZ */
206
- uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate);
207
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
208
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
209
- } else if (byRTSRsvType == 2) { /* RTSTxRrvTime_aa */
210
- uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopOFDMBasicRate);
211
- uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
212
- } else if (byRTSRsvType == 3) { /* CTSTxRrvTime_ba, only in 2.4GHZ */
213
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
214
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
215
- uRrvTime = uCTSTime + uAckTime + uDataTime + 2*pDevice->uSIFS;
216
- return cpu_to_le16((u16)uRrvTime);
205
+ data_time = bb_get_frame_time(priv->byPreambleType, pkt_type, frame_length, current_rate);
206
+ if (rts_rsvtype == 0) { /* RTSTxRrvTime_bb */
207
+ rts_time = bb_get_frame_time(priv->byPreambleType, pkt_type, 20, priv->byTopCCKBasicRate);
208
+ ack_time = bb_get_frame_time(priv->byPreambleType, pkt_type, 14, priv->byTopCCKBasicRate);
209
+ cts_time = ack_time;
210
+ } else if (rts_rsvtype == 1) { /* RTSTxRrvTime_ba, only in 2.4GHZ */
211
+ rts_time = bb_get_frame_time(priv->byPreambleType, pkt_type, 20, priv->byTopCCKBasicRate);
212
+ cts_time = bb_get_frame_time(priv->byPreambleType, pkt_type, 14, priv->byTopCCKBasicRate);
213
+ ack_time = bb_get_frame_time(priv->byPreambleType, pkt_type, 14, priv->byTopOFDMBasicRate);
214
+ } else if (rts_rsvtype == 2) { /* RTSTxRrvTime_aa */
215
+ rts_time = bb_get_frame_time(priv->byPreambleType, pkt_type, 20, priv->byTopOFDMBasicRate);
216
+ ack_time = bb_get_frame_time(priv->byPreambleType, pkt_type, 14, priv->byTopOFDMBasicRate);
217
+ cts_time = ack_time;
218
+ } else if (rts_rsvtype == 3) { /* CTSTxRrvTime_ba, only in 2.4GHZ */
219
+ cts_time = bb_get_frame_time(priv->byPreambleType, pkt_type, 14, priv->byTopCCKBasicRate);
220
+ ack_time = bb_get_frame_time(priv->byPreambleType, pkt_type, 14, priv->byTopOFDMBasicRate);
221
+ rrv_time = cts_time + ack_time + data_time + 2 * priv->uSIFS;
222
+ return cpu_to_le16((u16)rrv_time);
217223 }
218224
219225 /* RTSRrvTime */
220
- uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime + 3*pDevice->uSIFS;
221
- return cpu_to_le16((u16)uRrvTime);
226
+ rrv_time = rts_time + cts_time + ack_time + data_time + 3 * priv->uSIFS;
227
+ return cpu_to_le16((u16)rrv_time);
222228 }
223229
224230 /* byFreqType 0: 5GHz, 1:2.4Ghz */
....@@ -238,138 +244,83 @@
238244 )
239245 {
240246 bool bLastFrag = false;
241
- unsigned int uAckTime = 0, uNextPktTime = 0;
247
+ unsigned int uAckTime = 0, uNextPktTime = 0, len;
242248
243
- if (uFragIdx == (uMACfragNum-1))
249
+ if (uFragIdx == (uMACfragNum - 1))
244250 bLastFrag = true;
251
+
252
+ if (uFragIdx == (uMACfragNum - 2))
253
+ len = cbLastFragmentSize;
254
+ else
255
+ len = cbFrameLength;
245256
246257 switch (byDurType) {
247258 case DATADUR_B: /* DATADUR_B */
248
- if (((uMACfragNum == 1)) || bLastFrag) {/* Non Frag or Last Frag */
249
- if (bNeedAck) {
250
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
251
- return pDevice->uSIFS + uAckTime;
252
- } else {
253
- return 0;
254
- }
255
- } else {/* First Frag or Mid Frag */
256
- if (uFragIdx == (uMACfragNum-2))
257
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck);
258
- else
259
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
260
-
261
- if (bNeedAck) {
262
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
263
- return pDevice->uSIFS + uAckTime + uNextPktTime;
264
- } else {
265
- return pDevice->uSIFS + uNextPktTime;
266
- }
259
+ if (bNeedAck) {
260
+ uAckTime = bb_get_frame_time(pDevice->byPreambleType,
261
+ byPktType, 14,
262
+ pDevice->byTopCCKBasicRate);
267263 }
268
- break;
264
+ /* Non Frag or Last Frag */
265
+ if ((uMACfragNum == 1) || bLastFrag) {
266
+ if (!bNeedAck)
267
+ return 0;
268
+ } else {
269
+ /* First Frag or Mid Frag */
270
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType,
271
+ len, wRate, bNeedAck);
272
+ }
273
+
274
+ return pDevice->uSIFS + uAckTime + uNextPktTime;
269275
270276 case DATADUR_A: /* DATADUR_A */
271
- if (((uMACfragNum == 1)) || bLastFrag) {/* Non Frag or Last Frag */
272
- if (bNeedAck) {
273
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
274
- return pDevice->uSIFS + uAckTime;
275
- } else {
276
- return 0;
277
- }
278
- } else {/* First Frag or Mid Frag */
279
- if (uFragIdx == (uMACfragNum-2))
280
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck);
281
- else
282
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
283
-
284
- if (bNeedAck) {
285
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
286
- return pDevice->uSIFS + uAckTime + uNextPktTime;
287
- } else {
288
- return pDevice->uSIFS + uNextPktTime;
289
- }
277
+ if (bNeedAck) {
278
+ uAckTime = bb_get_frame_time(pDevice->byPreambleType,
279
+ byPktType, 14,
280
+ pDevice->byTopOFDMBasicRate);
290281 }
291
- break;
282
+ /* Non Frag or Last Frag */
283
+ if ((uMACfragNum == 1) || bLastFrag) {
284
+ if (!bNeedAck)
285
+ return 0;
286
+ } else {
287
+ /* First Frag or Mid Frag */
288
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType,
289
+ len, wRate, bNeedAck);
290
+ }
291
+
292
+ return pDevice->uSIFS + uAckTime + uNextPktTime;
292293
293294 case DATADUR_A_F0: /* DATADUR_A_F0 */
294
- if (((uMACfragNum == 1)) || bLastFrag) {/* Non Frag or Last Frag */
295
- if (bNeedAck) {
296
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
297
- return pDevice->uSIFS + uAckTime;
298
- } else {
299
- return 0;
300
- }
301
- } else { /* First Frag or Mid Frag */
302
- if (byFBOption == AUTO_FB_0) {
303
- if (wRate < RATE_18M)
304
- wRate = RATE_18M;
305
- else if (wRate > RATE_54M)
306
- wRate = RATE_54M;
307
-
308
- if (uFragIdx == (uMACfragNum-2))
309
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
310
- else
311
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
312
-
313
- } else { /* (byFBOption == AUTO_FB_1) */
314
- if (wRate < RATE_18M)
315
- wRate = RATE_18M;
316
- else if (wRate > RATE_54M)
317
- wRate = RATE_54M;
318
-
319
- if (uFragIdx == (uMACfragNum-2))
320
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
321
- else
322
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
323
- }
324
-
325
- if (bNeedAck) {
326
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
327
- return pDevice->uSIFS + uAckTime + uNextPktTime;
328
- } else {
329
- return pDevice->uSIFS + uNextPktTime;
330
- }
331
- }
332
- break;
333
-
334295 case DATADUR_A_F1: /* DATADUR_A_F1 */
335
- if (((uMACfragNum == 1)) || bLastFrag) { /* Non Frag or Last Frag */
336
- if (bNeedAck) {
337
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
338
- return pDevice->uSIFS + uAckTime;
339
- } else {
340
- return 0;
341
- }
342
- } else { /* First Frag or Mid Frag */
343
- if (byFBOption == AUTO_FB_0) {
344
- if (wRate < RATE_18M)
345
- wRate = RATE_18M;
346
- else if (wRate > RATE_54M)
347
- wRate = RATE_54M;
348
-
349
- if (uFragIdx == (uMACfragNum-2))
350
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
351
- else
352
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
353
-
354
- } else { /* (byFBOption == AUTO_FB_1) */
355
- if (wRate < RATE_18M)
356
- wRate = RATE_18M;
357
- else if (wRate > RATE_54M)
358
- wRate = RATE_54M;
359
-
360
- if (uFragIdx == (uMACfragNum-2))
361
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
362
- else
363
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
364
- }
365
- if (bNeedAck) {
366
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
367
- return pDevice->uSIFS + uAckTime + uNextPktTime;
368
- } else {
369
- return pDevice->uSIFS + uNextPktTime;
370
- }
296
+ if (bNeedAck) {
297
+ uAckTime = bb_get_frame_time(pDevice->byPreambleType,
298
+ byPktType, 14,
299
+ pDevice->byTopOFDMBasicRate);
371300 }
372
- break;
301
+ /* Non Frag or Last Frag */
302
+ if ((uMACfragNum == 1) || bLastFrag) {
303
+ if (!bNeedAck)
304
+ return 0;
305
+ } else {
306
+ /* First Frag or Mid Frag */
307
+ if (wRate < RATE_18M)
308
+ wRate = RATE_18M;
309
+ else if (wRate > RATE_54M)
310
+ wRate = RATE_54M;
311
+
312
+ wRate -= RATE_18M;
313
+
314
+ if (byFBOption == AUTO_FB_0)
315
+ wRate = wFB_Opt0[FB_RATE0][wRate];
316
+ else
317
+ wRate = wFB_Opt1[FB_RATE0][wRate];
318
+
319
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType,
320
+ len, wRate, bNeedAck);
321
+ }
322
+
323
+ return pDevice->uSIFS + uAckTime + uNextPktTime;
373324
374325 default:
375326 break;
....@@ -395,18 +346,18 @@
395346
396347 switch (byDurType) {
397348 case RTSDUR_BB: /* RTSDuration_bb */
398
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
399
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
349
+ uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
350
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
400351 break;
401352
402353 case RTSDUR_BA: /* RTSDuration_ba */
403
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
404
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
354
+ uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
355
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
405356 break;
406357
407358 case RTSDUR_AA: /* RTSDuration_aa */
408
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
409
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
359
+ uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
360
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
410361 break;
411362
412363 case CTSDUR_BA: /* CTSDuration_ba */
....@@ -414,54 +365,54 @@
414365 break;
415366
416367 case RTSDUR_BA_F0: /* RTSDuration_ba_f0 */
417
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
368
+ uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
418369 if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
419
- uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
370
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate - RATE_18M], bNeedAck);
420371 else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
421
- uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
372
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate - RATE_18M], bNeedAck);
422373
423374 break;
424375
425376 case RTSDUR_AA_F0: /* RTSDuration_aa_f0 */
426
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
377
+ uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
427378 if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
428
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
379
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate - RATE_18M], bNeedAck);
429380 else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
430
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
381
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate - RATE_18M], bNeedAck);
431382
432383 break;
433384
434385 case RTSDUR_BA_F1: /* RTSDuration_ba_f1 */
435
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
386
+ uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
436387 if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
437
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
388
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate - RATE_18M], bNeedAck);
438389 else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
439
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
390
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate - RATE_18M], bNeedAck);
440391
441392 break;
442393
443394 case RTSDUR_AA_F1: /* RTSDuration_aa_f1 */
444
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
395
+ uCTSTime = bb_get_frame_time(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
445396 if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
446
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
397
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate - RATE_18M], bNeedAck);
447398 else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
448
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
399
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate - RATE_18M], bNeedAck);
449400
450401 break;
451402
452403 case CTSDUR_BA_F0: /* CTSDuration_ba_f0 */
453404 if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
454
- uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
405
+ uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate - RATE_18M], bNeedAck);
455406 else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
456
- uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
407
+ uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate - RATE_18M], bNeedAck);
457408
458409 break;
459410
460411 case CTSDUR_BA_F1: /* CTSDuration_ba_f1 */
461412 if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
462
- uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
413
+ uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate - RATE_18M], bNeedAck);
463414 else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M))
464
- uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
415
+ uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate - RATE_18M], bNeedAck);
465416
466417 break;
467418
....@@ -966,9 +917,9 @@
966917 /* Fill RsvTime */
967918 struct vnt_rrv_time_rts *buf = pvRrvTime;
968919
969
- buf->rts_rrv_time_aa = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate);
970
- buf->rts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate);
971
- buf->rts_rrv_time_bb = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate);
920
+ buf->rts_rrv_time_aa = get_rtscts_time(pDevice, 2, byPktType, cbFrameSize, wCurrentRate);
921
+ buf->rts_rrv_time_ba = get_rtscts_time(pDevice, 1, byPktType, cbFrameSize, wCurrentRate);
922
+ buf->rts_rrv_time_bb = get_rtscts_time(pDevice, 0, byPktType, cbFrameSize, wCurrentRate);
972923 buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
973924 buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK);
974925
....@@ -978,7 +929,7 @@
978929
979930 buf->rrv_time_a = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
980931 buf->rrv_time_b = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK);
981
- buf->cts_rrv_time_ba = s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate);
932
+ buf->cts_rrv_time_ba = get_rtscts_time(pDevice, 3, byPktType, cbFrameSize, wCurrentRate);
982933
983934 /* Fill CTS */
984935 s_vFillCTSHead(pDevice, uDMAIdx, byPktType, pvCTS, cbFrameSize, bNeedACK, bDisCRC, wCurrentRate, byFBOption);
....@@ -987,7 +938,7 @@
987938 if (pvRTS) {/* RTS_need, non PCF mode */
988939 struct vnt_rrv_time_ab *buf = pvRrvTime;
989940
990
- buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate);
941
+ buf->rts_rrv_time = get_rtscts_time(pDevice, 2, byPktType, cbFrameSize, wCurrentRate);
991942 buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK);
992943
993944 /* Fill RTS */
....@@ -1001,7 +952,7 @@
1001952 if (pvRTS) {/* RTS_need, non PCF mode */
1002953 struct vnt_rrv_time_ab *buf = pvRrvTime;
1003954
1004
- buf->rts_rrv_time = s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate);
955
+ buf->rts_rrv_time = get_rtscts_time(pDevice, 0, byPktType, cbFrameSize, wCurrentRate);
1005956 buf->rrv_time = vnt_rxtx_rsvtime_le16(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK);
1006957
1007958 /* Fill RTS */
....@@ -1039,15 +990,13 @@
1039990 bool bRTS = (bool)(fifo_ctl & FIFOCTL_RTS);
1040991 struct vnt_tx_desc *ptdCurr;
1041992 unsigned int cbHeaderLength = 0;
1042
- void *pvRrvTime;
1043
- struct vnt_mic_hdr *pMICHDR;
1044
- void *pvRTS;
1045
- void *pvCTS;
1046
- void *pvTxDataHd;
993
+ void *pvRrvTime = NULL;
994
+ struct vnt_mic_hdr *pMICHDR = NULL;
995
+ void *pvRTS = NULL;
996
+ void *pvCTS = NULL;
997
+ void *pvTxDataHd = NULL;
1047998 unsigned short wTxBufSize; /* FFinfo size */
1048999 unsigned char byFBOption = AUTO_FB_NONE;
1049
-
1050
- pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
10511000
10521001 cbFrameSize = skb->len + 4;
10531002
....@@ -1093,7 +1042,7 @@
10931042 sizeof(struct vnt_tx_datahead_g);
10941043 } else { /* RTS_needless */
10951044 pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
1096
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts));
1045
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts));
10971046 pvRTS = NULL;
10981047 pvCTS = (void *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
10991048 pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize +
....@@ -1105,7 +1054,7 @@
11051054 /* Auto Fall Back */
11061055 if (bRTS) {/* RTS_need */
11071056 pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
1108
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts));
1057
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts));
11091058 pvRTS = (void *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR);
11101059 pvCTS = NULL;
11111060 pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) +
....@@ -1114,7 +1063,7 @@
11141063 cbMICHDR + sizeof(struct vnt_rts_g_fb) + sizeof(struct vnt_tx_datahead_g_fb);
11151064 } else { /* RTS_needless */
11161065 pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
1117
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts));
1066
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts));
11181067 pvRTS = NULL;
11191068 pvCTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) + cbMICHDR);
11201069 pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_cts) +
....@@ -1128,7 +1077,7 @@
11281077 if (byFBOption == AUTO_FB_NONE) {
11291078 if (bRTS) {
11301079 pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
1131
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
1080
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
11321081 pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
11331082 pvCTS = NULL;
11341083 pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize +
....@@ -1137,7 +1086,7 @@
11371086 cbMICHDR + sizeof(struct vnt_rts_ab) + sizeof(struct vnt_tx_datahead_ab);
11381087 } else { /* RTS_needless, need MICHDR */
11391088 pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
1140
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
1089
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
11411090 pvRTS = NULL;
11421091 pvCTS = NULL;
11431092 pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
....@@ -1148,7 +1097,7 @@
11481097 /* Auto Fall Back */
11491098 if (bRTS) { /* RTS_need */
11501099 pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize);
1151
- pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
1100
+ pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab));
11521101 pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR);
11531102 pvCTS = NULL;
11541103 pvTxDataHd = (void *)(pbyTxBufferAddr + wTxBufSize +
....@@ -1288,7 +1237,7 @@
12881237
12891238 current_rate = rate->hw_value;
12901239 if (priv->wCurrentRate != current_rate &&
1291
- !(priv->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) {
1240
+ !(priv->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) {
12921241 priv->wCurrentRate = current_rate;
12931242
12941243 RFbSetPower(priv, priv->wCurrentRate,
....@@ -1395,7 +1344,8 @@
13951344 tx_key = info->control.hw_key;
13961345 if (tx_key->keylen > 0)
13971346 vnt_fill_txkey(hdr, tx_buffer_head->tx_key,
1398
- tx_key, skb, tx_body_size, td_info->mic_hdr);
1347
+ tx_key, skb, tx_body_size,
1348
+ td_info->mic_hdr);
13991349 }
14001350
14011351 return 0;