Commit 3ee97e22 authored by Pascal Terjan's avatar Pascal Terjan Committed by Greg Kroah-Hartman

staging: rtl8712: switch to common ieee80211 headers

This patch switches to <linux/ieee80211.h> and <net/cfg80211.h> and
deletes a lot of duplicate definitions plus many unused ones.

Non obvious changes:
- struct ieee80211_ht_cap is different enough that I preferred to keep
  (and rename) it for now.
- mcs_rate in translate_scan was not read after being set, so I deleted
  that part rather than using the renamed struct
- WLAN_CAPABILITY_BSS is replaced with WLAN_CAPABILITY_ESS which is the
  corresponding one with same value
Signed-off-by: default avatarPascal Terjan <pterjan@google.com>
Link: https://lore.kernel.org/r/20200609194848.166130-1-pterjan@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ce59858b
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
config R8712U config R8712U
tristate "RealTek RTL8712U (RTL8192SU) Wireless LAN NIC driver" tristate "RealTek RTL8712U (RTL8192SU) Wireless LAN NIC driver"
depends on WLAN && USB depends on WLAN && USB && CFG80211
select WIRELESS_EXT select WIRELESS_EXT
select WEXT_PRIV select WEXT_PRIV
select FW_LOADER select FW_LOADER
......
This diff is collapsed.
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/ip.h> #include <linux/ip.h>
#include <net/cfg80211.h>
#include "osdep_service.h" #include "osdep_service.h"
#include "drv_types.h" #include "drv_types.h"
...@@ -27,12 +28,6 @@ ...@@ -27,12 +28,6 @@
#include "usb_ops.h" #include "usb_ops.h"
#include "wifi.h" #include "wifi.h"
/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */
static u8 bridge_tunnel_header[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8};
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
static u8 rfc1042_header[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
static void recv_tasklet(unsigned long priv); static void recv_tasklet(unsigned long priv);
void r8712_init_recv_priv(struct recv_priv *precvpriv, void r8712_init_recv_priv(struct recv_priv *precvpriv,
......
...@@ -26,7 +26,7 @@ struct ht_priv { ...@@ -26,7 +26,7 @@ struct ht_priv {
unsigned int rx_ampdu_maxlen; /* for rx reordering ctrl win_sz, unsigned int rx_ampdu_maxlen; /* for rx reordering ctrl win_sz,
* updated when join_callback. * updated when join_callback.
*/ */
struct ieee80211_ht_cap ht_cap; struct rtl_ieee80211_ht_cap ht_cap;
}; };
#endif /*_RTL871X_HT_H_ */ #endif /*_RTL871X_HT_H_ */
......
...@@ -211,11 +211,10 @@ static char *translate_scan(struct _adapter *padapter, ...@@ -211,11 +211,10 @@ static char *translate_scan(struct _adapter *padapter,
char *start, char *stop) char *start, char *stop)
{ {
struct iw_event iwe; struct iw_event iwe;
struct ieee80211_ht_cap *pht_capie;
char *current_val; char *current_val;
s8 *p; s8 *p;
u32 i = 0, ht_ielen = 0; u32 i = 0, ht_ielen = 0;
u16 cap, ht_cap = false, mcs_rate; u16 cap, ht_cap = false;
u8 rssi; u8 rssi;
if ((pnetwork->network.Configuration.DSConfig < 1) || if ((pnetwork->network.Configuration.DSConfig < 1) ||
...@@ -241,8 +240,6 @@ static char *translate_scan(struct _adapter *padapter, ...@@ -241,8 +240,6 @@ static char *translate_scan(struct _adapter *padapter,
&ht_ielen, pnetwork->network.IELength - 12); &ht_ielen, pnetwork->network.IELength - 12);
if (p && ht_ielen > 0) { if (p && ht_ielen > 0) {
ht_cap = true; ht_cap = true;
pht_capie = (struct ieee80211_ht_cap *)(p + 2);
memcpy(&mcs_rate, pht_capie->supp_mcs_set, 2);
} }
/* Add the protocol name */ /* Add the protocol name */
iwe.cmd = SIOCGIWNAME; iwe.cmd = SIOCGIWNAME;
...@@ -268,8 +265,8 @@ static char *translate_scan(struct _adapter *padapter, ...@@ -268,8 +265,8 @@ static char *translate_scan(struct _adapter *padapter,
memcpy((u8 *)&cap, r8712_get_capability_from_ie(pnetwork->network.IEs), memcpy((u8 *)&cap, r8712_get_capability_from_ie(pnetwork->network.IEs),
2); 2);
le16_to_cpus(&cap); le16_to_cpus(&cap);
if (cap & (WLAN_CAPABILITY_IBSS | WLAN_CAPABILITY_BSS)) { if (cap & (WLAN_CAPABILITY_IBSS | WLAN_CAPABILITY_ESS)) {
if (cap & WLAN_CAPABILITY_BSS) if (cap & WLAN_CAPABILITY_ESS)
iwe.u.mode = (u32)IW_MODE_MASTER; iwe.u.mode = (u32)IW_MODE_MASTER;
else else
iwe.u.mode = (u32)IW_MODE_ADHOC; iwe.u.mode = (u32)IW_MODE_ADHOC;
...@@ -1395,7 +1392,7 @@ static int r8711_wx_get_rate(struct net_device *dev, ...@@ -1395,7 +1392,7 @@ static int r8711_wx_get_rate(struct net_device *dev,
struct _adapter *padapter = netdev_priv(dev); struct _adapter *padapter = netdev_priv(dev);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
struct ieee80211_ht_cap *pht_capie; struct rtl_ieee80211_ht_cap *pht_capie;
unsigned char rf_type = padapter->registrypriv.rf_config; unsigned char rf_type = padapter->registrypriv.rf_config;
int i; int i;
u8 *p; u8 *p;
...@@ -1411,7 +1408,7 @@ static int r8711_wx_get_rate(struct net_device *dev, ...@@ -1411,7 +1408,7 @@ static int r8711_wx_get_rate(struct net_device *dev,
pcur_bss->IELength - 12); pcur_bss->IELength - 12);
if (p && ht_ielen > 0) { if (p && ht_ielen > 0) {
ht_cap = true; ht_cap = true;
pht_capie = (struct ieee80211_ht_cap *)(p + 2); pht_capie = (struct rtl_ieee80211_ht_cap *)(p + 2);
memcpy(&mcs_rate, pht_capie->supp_mcs_set, 2); memcpy(&mcs_rate, pht_capie->supp_mcs_set, 2);
bw_40MHz = (le16_to_cpu(pht_capie->cap_info) & bw_40MHz = (le16_to_cpu(pht_capie->cap_info) &
IEEE80211_HT_CAP_SUP_WIDTH) ? 1 : 0; IEEE80211_HT_CAP_SUP_WIDTH) ? 1 : 0;
......
...@@ -249,8 +249,8 @@ static int is_same_network(struct wlan_bssid_ex *src, ...@@ -249,8 +249,8 @@ static int is_same_network(struct wlan_bssid_ex *src,
src->Ssid.SsidLength))) && src->Ssid.SsidLength))) &&
((s_cap & WLAN_CAPABILITY_IBSS) == ((s_cap & WLAN_CAPABILITY_IBSS) ==
(d_cap & WLAN_CAPABILITY_IBSS)) && (d_cap & WLAN_CAPABILITY_IBSS)) &&
((s_cap & WLAN_CAPABILITY_BSS) == ((s_cap & WLAN_CAPABILITY_ESS) ==
(d_cap & WLAN_CAPABILITY_BSS)); (d_cap & WLAN_CAPABILITY_ESS));
} }
...@@ -1643,7 +1643,7 @@ unsigned int r8712_restructure_ht_ie(struct _adapter *padapter, u8 *in_ie, ...@@ -1643,7 +1643,7 @@ unsigned int r8712_restructure_ht_ie(struct _adapter *padapter, u8 *in_ie,
{ {
u32 ielen, out_len; u32 ielen, out_len;
unsigned char *p; unsigned char *p;
struct ieee80211_ht_cap ht_capie; struct rtl_ieee80211_ht_cap ht_capie;
unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00}; unsigned char WMM_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x00, 0x01, 0x00};
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct qos_priv *pqospriv = &pmlmepriv->qospriv; struct qos_priv *pqospriv = &pmlmepriv->qospriv;
...@@ -1659,7 +1659,7 @@ unsigned int r8712_restructure_ht_ie(struct _adapter *padapter, u8 *in_ie, ...@@ -1659,7 +1659,7 @@ unsigned int r8712_restructure_ht_ie(struct _adapter *padapter, u8 *in_ie,
pqospriv->qos_option = 1; pqospriv->qos_option = 1;
} }
out_len = *pout_len; out_len = *pout_len;
memset(&ht_capie, 0, sizeof(struct ieee80211_ht_cap)); memset(&ht_capie, 0, sizeof(struct rtl_ieee80211_ht_cap));
ht_capie.cap_info = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH | ht_capie.cap_info = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH |
IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_20 |
IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_40 |
...@@ -1669,7 +1669,7 @@ unsigned int r8712_restructure_ht_ie(struct _adapter *padapter, u8 *in_ie, ...@@ -1669,7 +1669,7 @@ unsigned int r8712_restructure_ht_ie(struct _adapter *padapter, u8 *in_ie,
ht_capie.ampdu_params_info = (IEEE80211_HT_CAP_AMPDU_FACTOR & ht_capie.ampdu_params_info = (IEEE80211_HT_CAP_AMPDU_FACTOR &
0x03) | (IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00); 0x03) | (IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00);
r8712_set_ie(out_ie + out_len, _HT_CAPABILITY_IE_, r8712_set_ie(out_ie + out_len, _HT_CAPABILITY_IE_,
sizeof(struct ieee80211_ht_cap), sizeof(struct rtl_ieee80211_ht_cap),
(unsigned char *)&ht_capie, pout_len); (unsigned char *)&ht_capie, pout_len);
phtpriv->ht_option = 1; phtpriv->ht_option = 1;
} }
...@@ -1683,7 +1683,7 @@ static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len) ...@@ -1683,7 +1683,7 @@ static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len)
int i; int i;
uint len; uint len;
struct sta_info *bmc_sta, *psta; struct sta_info *bmc_sta, *psta;
struct ieee80211_ht_cap *pht_capie; struct rtl_ieee80211_ht_cap *pht_capie;
struct recv_reorder_ctrl *preorder_ctrl; struct recv_reorder_ctrl *preorder_ctrl;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct ht_priv *phtpriv = &pmlmepriv->htpriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv;
...@@ -1703,7 +1703,7 @@ static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len) ...@@ -1703,7 +1703,7 @@ static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len)
&len, ie_len - &len, ie_len -
sizeof(struct NDIS_802_11_FIXED_IEs)); sizeof(struct NDIS_802_11_FIXED_IEs));
if (p && len > 0) { if (p && len > 0) {
pht_capie = (struct ieee80211_ht_cap *)(p + 2); pht_capie = (struct rtl_ieee80211_ht_cap *)(p + 2);
max_ampdu_sz = (pht_capie->ampdu_params_info & max_ampdu_sz = (pht_capie->ampdu_params_info &
IEEE80211_HT_CAP_AMPDU_FACTOR); IEEE80211_HT_CAP_AMPDU_FACTOR);
/* max_ampdu_sz (kbytes); */ /* max_ampdu_sz (kbytes); */
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/kmemleak.h> #include <linux/kmemleak.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <net/cfg80211.h>
#include "osdep_service.h" #include "osdep_service.h"
#include "drv_types.h" #include "drv_types.h"
...@@ -35,12 +36,6 @@ static const u8 SNAP_ETH_TYPE_IPX[2] = {0x81, 0x37}; ...@@ -35,12 +36,6 @@ static const u8 SNAP_ETH_TYPE_IPX[2] = {0x81, 0x37};
/* Datagram Delivery Protocol */ /* Datagram Delivery Protocol */
static const u8 SNAP_ETH_TYPE_APPLETALK_AARP[2] = {0x80, 0xf3}; static const u8 SNAP_ETH_TYPE_APPLETALK_AARP[2] = {0x80, 0xf3};
/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */
static const u8 bridge_tunnel_header[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8};
/* Ethernet-II snap header (RFC1042 for most EtherTypes) */
static const u8 rfc1042_header[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
void _r8712_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv) void _r8712_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)
{ {
memset((u8 *)psta_recvpriv, 0, sizeof(struct sta_recv_priv)); memset((u8 *)psta_recvpriv, 0, sizeof(struct sta_recv_priv));
......
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#define MAX_SUBFRAME_COUNT 64 #define MAX_SUBFRAME_COUNT 64
#define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
/* for Rx reordering buffer control */ /* for Rx reordering buffer control */
struct recv_reorder_ctrl { struct recv_reorder_ctrl {
struct _adapter *padapter; struct _adapter *padapter;
......
...@@ -476,7 +476,7 @@ static int make_wlanhdr(struct _adapter *padapter, u8 *hdr, ...@@ -476,7 +476,7 @@ static int make_wlanhdr(struct _adapter *padapter, u8 *hdr,
struct ieee80211_hdr *pwlanhdr = (struct ieee80211_hdr *)hdr; struct ieee80211_hdr *pwlanhdr = (struct ieee80211_hdr *)hdr;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct qos_priv *pqospriv = &pmlmepriv->qospriv; struct qos_priv *pqospriv = &pmlmepriv->qospriv;
__le16 *fctrl = &pwlanhdr->frame_ctl; __le16 *fctrl = &pwlanhdr->frame_control;
u8 *bssid; u8 *bssid;
memset(hdr, 0, WLANHDR_OFFSET); memset(hdr, 0, WLANHDR_OFFSET);
......
...@@ -451,33 +451,18 @@ static inline unsigned char *get_hdr_bssid(unsigned char *pframe) ...@@ -451,33 +451,18 @@ static inline unsigned char *get_hdr_bssid(unsigned char *pframe)
#define GetOrderBit(pbuf) (((*(__le16 *)(pbuf)) & \ #define GetOrderBit(pbuf) (((*(__le16 *)(pbuf)) & \
le16_to_cpu(_ORDER_)) != 0) le16_to_cpu(_ORDER_)) != 0)
/**
* struct ieee80211_bar - HT Block Ack Request
*
* This structure refers to "HT BlockAckReq" as
* described in 802.11n draft section 7.2.1.7.1
*/
struct ieee80211_bar {
__le16 frame_control;
__le16 duration;
unsigned char ra[6];
unsigned char ta[6];
__le16 control;
__le16 start_seq_num;
} __packed;
/* 802.11 BAR control masks */ /* 802.11 BAR control masks */
#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004 #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
/* /*
* struct ieee80211_ht_cap - HT capabilities * struct rtl_ieee80211_ht_cap - HT capabilities
* *
* This structure refers to "HT capabilities element" as * This structure refers to "HT capabilities element" as
* described in 802.11n draft section 7.3.2.52 * described in 802.11n draft section 7.3.2.52
*/ */
struct ieee80211_ht_cap { struct rtl_ieee80211_ht_cap {
__le16 cap_info; __le16 cap_info;
unsigned char ampdu_params_info; unsigned char ampdu_params_info;
unsigned char supp_mcs_set[16]; unsigned char supp_mcs_set[16];
...@@ -487,7 +472,7 @@ struct ieee80211_ht_cap { ...@@ -487,7 +472,7 @@ struct ieee80211_ht_cap {
} __packed; } __packed;
/** /**
* struct ieee80211_ht_cap - HT additional information * struct ieee80211_ht_addt_info - HT additional information
* *
* This structure refers to "HT information element" as * This structure refers to "HT information element" as
* described in 802.11n draft section 7.3.2.53 * described in 802.11n draft section 7.3.2.53
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment