Permalink
Browse files

cfg80211: Update for newest mac80211 API

And require kernel 4.0. Older kernels will compile, but fail to work
as the enumerations have different values:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=319090bf6c75e3ad42a8c74973be5e78ae4f948f

Closes #13
  • Loading branch information...
1 parent d1f9d96 commit 86fe2db84ba7b9a83b60323cd805198ff43136ec @hadess committed Mar 20, 2015
Showing with 8 additions and 28 deletions.
  1. +3 −6 include/ioctl_cfg80211.h
  2. +5 −22 os_dep/ioctl_cfg80211.c
View
@@ -20,6 +20,9 @@
#ifndef __IOCTL_CFG80211_H__
#define __IOCTL_CFG80211_H__
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0))
+#error This driver only works with kernel 4.0
+#endif
struct rtw_wdev_invit_info {
u8 state; /* 0: req, 1:rep */
@@ -129,13 +132,7 @@ int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len, i
bool rtw_cfg80211_pwr_mgmt(_adapter *adapter);
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0))
-#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->rtw_wdev, freq, sig_dbm, buf, len,0,gfp)
-#else
#define rtw_cfg80211_rx_mgmt(adapter, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt((adapter)->rtw_wdev, freq, sig_dbm, buf, len,0)
-#endif /* KERNEL_VERSION(3,18,0) and newer */
-
#define rtw_cfg80211_send_rx_assoc(adapter, bss, buf, len) cfg80211_send_rx_assoc((adapter)->pnetdev, bss, buf, len)
#define rtw_cfg80211_mgmt_tx_status(adapter, cookie, buf, len, ack, gfp) cfg80211_mgmt_tx_status((adapter)->rtw_wdev, cookie, buf, len, ack, gfp)
#define rtw_cfg80211_ready_on_channel(adapter, cookie, chan, channel_type, duration, gfp) cfg80211_ready_on_channel((adapter)->rtw_wdev, cookie, chan, duration, gfp)
View
@@ -1412,16 +1412,16 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
goto exit;
}
- sinfo->filled |= STATION_INFO_SIGNAL;
+ sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv.signal_strength);
- sinfo->filled |= STATION_INFO_TX_BITRATE;
+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter);
- sinfo->filled |= STATION_INFO_RX_PACKETS;
+ sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
sinfo->rx_packets = sta_rx_data_pkts(psta);
- sinfo->filled |= STATION_INFO_TX_PACKETS;
+ sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
sinfo->tx_packets = psta->sta_stats.tx_pkts;
}
@@ -2634,7 +2634,6 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f
ie_offset = _REASOCREQ_IE_OFFSET_;
sinfo.filled = 0;
- sinfo.filled = STATION_INFO_ASSOC_REQ_IES;
sinfo.assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset;
sinfo.assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset;
cfg80211_new_sta(ndev, GetAddr2Ptr(pmgmt_frame), &sinfo, GFP_ATOMIC);
@@ -3112,16 +3111,8 @@ static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev
return 0;
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev,
struct station_del_parameters *params)
-#elif (LINUX_VERSION_CODE > KERNEL_VERSION(3, 14, 0))
-static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev,
- const u8 *mac)
-#else
-static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev,
- u8 *mac)
-#endif
{
int ret=0;
_irqL irqL;
@@ -3131,9 +3122,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct sta_priv *pstapriv = &padapter->stapriv;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0))
const u8 *mac = params->mac;
-#endif
DBG_871X("+"FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
@@ -3214,13 +3203,8 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev
}
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 14, 0))
static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *ndev,
const u8 *mac, struct station_parameters *params)
-#else
-static int cfg80211_rtw_change_station(struct wiphy *wiphy, struct net_device *ndev,
- u8 *mac, struct station_parameters *params)
-#endif
{
DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
@@ -3268,8 +3252,7 @@ static int cfg80211_rtw_dump_station(struct wiphy *wiphy, struct net_device *nde
goto exit;
}
memcpy(mac, psta->hwaddr, ETH_ALEN);
- sinfo->filled = 0;
- sinfo->filled |= STATION_INFO_SIGNAL;
+ sinfo->filled = BIT(NL80211_STA_INFO_SIGNAL);
sinfo->signal = psta->rssi;
exit:

0 comments on commit 86fe2db

Please sign in to comment.