summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2020-01-19 12:02:56 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-22 09:52:38 +0100
commit8902ecd70b3e3f13370af9f9e0134ad16e46fb50 (patch)
tree338459791acedb4680aece02b2e5e322deb2234e /drivers/staging
parent743b2b7e08c76d3090373e9cd354edef6a0822b7 (diff)
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 <tvboxspy@gmail.com> Link: https://lore.kernel.org/r/094ee227-b114-ee75-67f7-bf07f8de099f@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/vt6656/device.h7
-rw-r--r--drivers/staging/vt6656/dpc.c29
2 files changed, 19 insertions, 17 deletions
diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 2f6567d92b83..84d170420c8a 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -206,6 +206,13 @@ enum {
CONTEXT_BEACON_PACKET
};
+struct vnt_rx_header {
+ u32 wbk_status;
+ u8 rx_sts;
+ u8 rx_rate;
+ u16 pay_load_len;
+} __packed;
+
/* RCB (Receive Control Block) */
struct vnt_rcb {
void *priv;
diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
index a55e2f6b09e3..8fbb911144c6 100644
--- a/drivers/staging/vt6656/dpc.c
+++ b/drivers/staging/vt6656/dpc.c
@@ -31,15 +31,14 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
struct sk_buff *skb;
struct ieee80211_rx_status *rx_status;
struct ieee80211_hdr *hdr;
+ struct vnt_rx_header *head;
__le16 fc;
u8 *rsr, *new_rsr, *rssi;
__le64 *tsf_time;
u32 frame_size;
int ii;
u8 *sq, *sq_3;
- u32 wbk_status;
u8 *skb_data;
- u16 *pay_load_len;
u16 rx_bitrate, pay_load_with_padding;
u8 rate_idx = 0;
long rx_dbm;
@@ -48,8 +47,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
rx_status = IEEE80211_SKB_RXCB(skb);
/* [31:16]RcvByteCount ( not include 4-byte Status ) */
- wbk_status = *((u32 *)(skb->data));
- frame_size = wbk_status >> 16;
+ head = (struct vnt_rx_header *)skb->data;
+ frame_size = head->wbk_status >> 16;
frame_size += 4;
if (bytes_received != frame_size) {
@@ -70,19 +69,17 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
/* if SQ3 the range is 24~27, if no SQ3 the range is 20~23 */
- pay_load_len = (u16 *)(skb_data + 6);
-
/*Fix hardware bug => PLCP_Length error */
- if (((bytes_received - (*pay_load_len)) > 27) ||
- ((bytes_received - (*pay_load_len)) < 24) ||
- (bytes_received < (*pay_load_len))) {
+ if (((bytes_received - head->pay_load_len) > 27) ||
+ ((bytes_received - head->pay_load_len) < 24) ||
+ (bytes_received < head->pay_load_len)) {
dev_dbg(&priv->usb->dev, "Wrong PLCP Length %x\n",
- *pay_load_len);
+ head->pay_load_len);
return false;
}
sband = hw->wiphy->bands[hw->conf.chandef.chan->band];
- rx_bitrate = *(skb_data + 5) * 5; /* rx_rate * 5 */
+ rx_bitrate = head->rx_rate * 5; /* rx_rate * 5 */
for (ii = 0; ii < sband->n_bitrates; ii++) {
if (sband->bitrates[ii].bitrate == rx_bitrate) {
@@ -96,8 +93,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
return false;
}
- pay_load_with_padding = ((*pay_load_len / 4) +
- ((*pay_load_len % 4) ? 1 : 0)) * 4;
+ pay_load_with_padding = ((head->pay_load_len / 4) +
+ ((head->pay_load_len % 4) ? 1 : 0)) * 4;
tsf_time = (__le64 *)(skb_data + 8 + pay_load_with_padding);
@@ -118,15 +115,13 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
if (*rsr & (RSR_IVLDTYP | RSR_IVLDLEN))
return false;
- frame_size = *pay_load_len;
-
vnt_rf_rssi_to_dbm(priv, *rssi, &rx_dbm);
priv->bb_pre_ed_rssi = (u8)rx_dbm + 1;
priv->current_rssi = priv->bb_pre_ed_rssi;
- skb_pull(skb, 8);
- skb_trim(skb, frame_size);
+ skb_pull(skb, sizeof(*head));
+ skb_trim(skb, head->pay_load_len);
rx_status->mactime = priv->tsf_time;
rx_status->band = hw->conf.chandef.chan->band;