mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
staging: rtl8192e: Replace usage of RTLLIB_FCTL_DSTODS with function
Replace usage of RTLLIB_FCTL_DSTODS with function ieee80211_has_a4() to avoid proprietary code and to increase readability. To achieve this goal it was required to change a parameter of function rtllib_rx_data_filter(). Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> Link: https://lore.kernel.org/r/69f72a352b8129bcc6610c1355a41d966abf24d8.1694792595.git.philipp.g.hortmann@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
87f8e11d51
commit
3f48cad549
3 changed files with 8 additions and 10 deletions
|
@ -338,7 +338,6 @@ enum rt_op_mode {
|
|||
#define RTLLIB_FCTL_FRAMETYPE 0x00fc
|
||||
#define RTLLIB_FCTL_TODS 0x0100
|
||||
#define RTLLIB_FCTL_FROMDS 0x0200
|
||||
#define RTLLIB_FCTL_DSTODS 0x0300
|
||||
#define RTLLIB_FCTL_MOREFRAGS 0x0400
|
||||
#define RTLLIB_FCTL_RETRY 0x0800
|
||||
#define RTLLIB_FCTL_PM 0x1000
|
||||
|
|
|
@ -92,8 +92,7 @@ static int ccmp_init_iv_and_aad(struct ieee80211_hdr *hdr,
|
|||
int a4_included, qc_included;
|
||||
|
||||
fc = le16_to_cpu(hdr->frame_control);
|
||||
a4_included = ((fc & (RTLLIB_FCTL_TODS | RTLLIB_FCTL_FROMDS)) ==
|
||||
(RTLLIB_FCTL_TODS | RTLLIB_FCTL_FROMDS));
|
||||
a4_included = ieee80211_has_a4(hdr->frame_control);
|
||||
|
||||
qc_included = ((WLAN_FC_GET_TYPE(fc) == RTLLIB_FTYPE_DATA) &&
|
||||
(WLAN_FC_GET_STYPE(fc) & 0x80));
|
||||
|
|
|
@ -97,7 +97,7 @@ rtllib_frag_cache_get(struct rtllib_device *ieee,
|
|||
struct ieee80211_qos_hdr_4addr *hdr_4addrqos;
|
||||
u8 tid;
|
||||
|
||||
if (((fc & RTLLIB_FCTL_DSTODS) == RTLLIB_FCTL_DSTODS) &&
|
||||
if (ieee80211_has_a4(hdr->frame_control) &&
|
||||
RTLLIB_QOS_HAS_SEQ(fc)) {
|
||||
hdr_4addrqos = (struct ieee80211_qos_hdr_4addr *)hdr;
|
||||
tid = le16_to_cpu(hdr_4addrqos->qos_ctrl) & RTLLIB_QCTL_TID;
|
||||
|
@ -166,7 +166,7 @@ static int rtllib_frag_cache_invalidate(struct rtllib_device *ieee,
|
|||
struct ieee80211_qos_hdr_4addr *hdr_4addrqos;
|
||||
u8 tid;
|
||||
|
||||
if (((fc & RTLLIB_FCTL_DSTODS) == RTLLIB_FCTL_DSTODS) &&
|
||||
if (ieee80211_has_a4(hdr->frame_control) &&
|
||||
RTLLIB_QOS_HAS_SEQ(fc)) {
|
||||
hdr_4addrqos = (struct ieee80211_qos_hdr_4addr *)hdr;
|
||||
tid = le16_to_cpu(hdr_4addrqos->qos_ctrl) & RTLLIB_QCTL_TID;
|
||||
|
@ -359,7 +359,7 @@ static int is_duplicate_packet(struct rtllib_device *ieee,
|
|||
struct ieee80211_qos_hdr_4addr *hdr_4addrqos;
|
||||
u8 tid;
|
||||
|
||||
if (((fc & RTLLIB_FCTL_DSTODS) == RTLLIB_FCTL_DSTODS) &&
|
||||
if (ieee80211_has_a4(header->frame_control) &&
|
||||
RTLLIB_QOS_HAS_SEQ(fc)) {
|
||||
hdr_4addrqos = (struct ieee80211_qos_hdr_4addr *)header;
|
||||
tid = le16_to_cpu(hdr_4addrqos->qos_ctrl) & RTLLIB_QCTL_TID;
|
||||
|
@ -968,16 +968,16 @@ static void rtllib_rx_extract_addr(struct rtllib_device *ieee,
|
|||
}
|
||||
}
|
||||
|
||||
static int rtllib_rx_data_filter(struct rtllib_device *ieee, u16 fc,
|
||||
static int rtllib_rx_data_filter(struct rtllib_device *ieee, struct ieee80211_hdr *hdr,
|
||||
u8 *dst, u8 *src, u8 *bssid, u8 *addr2)
|
||||
{
|
||||
u8 type, stype;
|
||||
|
||||
u16 fc = le16_to_cpu(hdr->frame_control);
|
||||
type = WLAN_FC_GET_TYPE(fc);
|
||||
stype = WLAN_FC_GET_STYPE(fc);
|
||||
|
||||
/* Filter frames from different BSS */
|
||||
if (((fc & RTLLIB_FCTL_DSTODS) != RTLLIB_FCTL_DSTODS) &&
|
||||
if (ieee80211_has_a4(hdr->frame_control) &&
|
||||
!ether_addr_equal(ieee->current_network.bssid, bssid) &&
|
||||
!is_zero_ether_addr(ieee->current_network.bssid)) {
|
||||
return -1;
|
||||
|
@ -1341,7 +1341,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,
|
|||
rtllib_rx_extract_addr(ieee, hdr, dst, src, bssid);
|
||||
|
||||
/* Filter Data frames */
|
||||
ret = rtllib_rx_data_filter(ieee, fc, dst, src, bssid, hdr->addr2);
|
||||
ret = rtllib_rx_data_filter(ieee, hdr, dst, src, bssid, hdr->addr2);
|
||||
if (ret < 0)
|
||||
goto rx_dropped;
|
||||
|
||||
|
|
Loading…
Reference in a new issue