diff options
author | Martin Kaiser <martin@kaiser.cx> | 2022-02-27 17:41:41 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-03-01 22:34:15 +0100 |
commit | d7e168c76f16c280f7ad8a09b8ecddd53c208a3f (patch) | |
tree | f32adebcc3ebfda388e5b706b7747c644b4c9826 /drivers/staging/r8188eu | |
parent | e9f3ac5edb25e47d6cc2b6fd2f4e1542ec7150e6 (diff) | |
download | linux-stable-d7e168c76f16c280f7ad8a09b8ecddd53c208a3f.tar.gz linux-stable-d7e168c76f16c280f7ad8a09b8ecddd53c208a3f.tar.bz2 linux-stable-d7e168c76f16c280f7ad8a09b8ecddd53c208a3f.zip |
staging: r8188eu: use ieee80211 helpers to check the frame type
Use the ieee80211_is_... helper functions to check the frame type in
the validate_recv_frame function. Add a temporary variable for the
16-bit frame control field.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220227164147.1168847-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/r8188eu')
-rw-r--r-- | drivers/staging/r8188eu/core/rtw_recv.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index 1133239f29bc..e95c9a47dcac 100644 --- a/drivers/staging/r8188eu/core/rtw_recv.c +++ b/drivers/staging/r8188eu/core/rtw_recv.c @@ -3,6 +3,7 @@ #define _RTW_RECV_C_ +#include <linux/ieee80211.h> #include "../include/osdep_service.h" #include "../include/drv_types.h" #include "../include/recv_osdep.h" @@ -1056,12 +1057,12 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv /* then call check if rx seq/frag. duplicated. */ - u8 type; u8 subtype; int retval = _SUCCESS; u8 bDumpRxPkt; struct rx_pkt_attrib *pattrib = &precv_frame->attrib; u8 *ptr = precv_frame->rx_data; + __le16 fc = *(__le16 *)ptr; u8 ver = (unsigned char)(*ptr) & 0x3; struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; @@ -1077,7 +1078,6 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv goto exit; } - type = GetFrameType(ptr); subtype = GetFrameSubType(ptr); /* bit(7)~bit(2) */ pattrib->to_fr_ds = get_tofr_ds(ptr); @@ -1093,16 +1093,14 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv /* Dump rx packets */ GetHalDefVar8188EUsb(adapter, HAL_DEF_DBG_DUMP_RXPKT, &bDumpRxPkt); - switch (type) { - case IEEE80211_FTYPE_MGMT: + + if (ieee80211_is_mgmt(fc)) { validate_recv_mgnt_frame(adapter, precv_frame); retval = _FAIL; /* only data frame return _SUCCESS */ - break; - case WIFI_CTRL_TYPE: /* ctrl */ + } else if (ieee80211_is_ctl(fc)) { validate_recv_ctrl_frame(adapter, precv_frame); retval = _FAIL; /* only data frame return _SUCCESS */ - break; - case WIFI_DATA_TYPE: /* data */ + } else if (ieee80211_is_data(fc)) { rtw_led_control(adapter, LED_CTL_RX); pattrib->qos = (subtype & BIT(7)) ? 1 : 0; retval = validate_recv_data_frame(adapter, precv_frame); @@ -1110,11 +1108,8 @@ static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv struct recv_priv *precvpriv = &adapter->recvpriv; precvpriv->rx_drop++; } - break; - default: + } else retval = _FAIL; - break; - } exit: |