Skip to content

Commit 8902ecd

Browse files
Malcolm Priestleygregkh
authored andcommitted
staging: vt6656: create vnt rx header for sk_buff.
vnt_rx_header contains the structure of the original variables wbk_status, rx_sts, rx_rate and pay_load_len packed. Replace all the old variables for the ones in this. Signed-off-by: Malcolm Priestley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 743b2b7 commit 8902ecd

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

drivers/staging/vt6656/device.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@ enum {
206206
CONTEXT_BEACON_PACKET
207207
};
208208

209+
struct vnt_rx_header {
210+
u32 wbk_status;
211+
u8 rx_sts;
212+
u8 rx_rate;
213+
u16 pay_load_len;
214+
} __packed;
215+
209216
/* RCB (Receive Control Block) */
210217
struct vnt_rcb {
211218
void *priv;

drivers/staging/vt6656/dpc.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,14 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
3131
struct sk_buff *skb;
3232
struct ieee80211_rx_status *rx_status;
3333
struct ieee80211_hdr *hdr;
34+
struct vnt_rx_header *head;
3435
__le16 fc;
3536
u8 *rsr, *new_rsr, *rssi;
3637
__le64 *tsf_time;
3738
u32 frame_size;
3839
int ii;
3940
u8 *sq, *sq_3;
40-
u32 wbk_status;
4141
u8 *skb_data;
42-
u16 *pay_load_len;
4342
u16 rx_bitrate, pay_load_with_padding;
4443
u8 rate_idx = 0;
4544
long rx_dbm;
@@ -48,8 +47,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
4847
rx_status = IEEE80211_SKB_RXCB(skb);
4948

5049
/* [31:16]RcvByteCount ( not include 4-byte Status ) */
51-
wbk_status = *((u32 *)(skb->data));
52-
frame_size = wbk_status >> 16;
50+
head = (struct vnt_rx_header *)skb->data;
51+
frame_size = head->wbk_status >> 16;
5352
frame_size += 4;
5453

5554
if (bytes_received != frame_size) {
@@ -70,19 +69,17 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
7069

7170
/* if SQ3 the range is 24~27, if no SQ3 the range is 20~23 */
7271

73-
pay_load_len = (u16 *)(skb_data + 6);
74-
7572
/*Fix hardware bug => PLCP_Length error */
76-
if (((bytes_received - (*pay_load_len)) > 27) ||
77-
((bytes_received - (*pay_load_len)) < 24) ||
78-
(bytes_received < (*pay_load_len))) {
73+
if (((bytes_received - head->pay_load_len) > 27) ||
74+
((bytes_received - head->pay_load_len) < 24) ||
75+
(bytes_received < head->pay_load_len)) {
7976
dev_dbg(&priv->usb->dev, "Wrong PLCP Length %x\n",
80-
*pay_load_len);
77+
head->pay_load_len);
8178
return false;
8279
}
8380

8481
sband = hw->wiphy->bands[hw->conf.chandef.chan->band];
85-
rx_bitrate = *(skb_data + 5) * 5; /* rx_rate * 5 */
82+
rx_bitrate = head->rx_rate * 5; /* rx_rate * 5 */
8683

8784
for (ii = 0; ii < sband->n_bitrates; ii++) {
8885
if (sband->bitrates[ii].bitrate == rx_bitrate) {
@@ -96,8 +93,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
9693
return false;
9794
}
9895

99-
pay_load_with_padding = ((*pay_load_len / 4) +
100-
((*pay_load_len % 4) ? 1 : 0)) * 4;
96+
pay_load_with_padding = ((head->pay_load_len / 4) +
97+
((head->pay_load_len % 4) ? 1 : 0)) * 4;
10198

10299
tsf_time = (__le64 *)(skb_data + 8 + pay_load_with_padding);
103100

@@ -118,15 +115,13 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
118115
if (*rsr & (RSR_IVLDTYP | RSR_IVLDLEN))
119116
return false;
120117

121-
frame_size = *pay_load_len;
122-
123118
vnt_rf_rssi_to_dbm(priv, *rssi, &rx_dbm);
124119

125120
priv->bb_pre_ed_rssi = (u8)rx_dbm + 1;
126121
priv->current_rssi = priv->bb_pre_ed_rssi;
127122

128-
skb_pull(skb, 8);
129-
skb_trim(skb, frame_size);
123+
skb_pull(skb, sizeof(*head));
124+
skb_trim(skb, head->pay_load_len);
130125

131126
rx_status->mactime = priv->tsf_time;
132127
rx_status->band = hw->conf.chandef.chan->band;

0 commit comments

Comments
 (0)