Tianling Shen 18b94111a0
rtl8188eu: fix build with recent mac80211 update
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-11-01 03:06:38 +08:00

191 lines
6.8 KiB
Diff

--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,8 @@ EXTRA_CFLAGS += -Wno-unused-function
EXTRA_CFLAGS += -Wno-unused
EXTRA_CFLAGS += -Wno-address
EXTRA_CFLAGS += -Wno-cast-function-type
+EXTRA_CFLAGS += -Wno-missing-declarations
+EXTRA_CFLAGS += -Wno-missing-prototypes
#EXTRA_CFLAGS += -Wno-discarded-qualifiers
EXTRA_CFLAGS += -Wno-uninitialized
EXTRA_CFLAGS += -Wno-sometimes-uninitialized
--- a/hal/phydm/phydm_phystatus.c
+++ b/hal/phydm/phydm_phystatus.c
@@ -1710,7 +1710,7 @@ phydm_process_rssi_for_dm(
}
}
if (sta->rssi_stat.ofdm_pkt_cnt != 64) {
- i = 63;
+ i = 7;
sta->rssi_stat.ofdm_pkt_cnt -= (u8)(((sta->rssi_stat.packet_map >> i) & BIT(0)) - 1);
}
sta->rssi_stat.packet_map = (sta->rssi_stat.packet_map << 1) | BIT(0);
@@ -1747,7 +1747,7 @@ phydm_process_rssi_for_dm(
PHYDM_DBG(dm, DBG_RSSI_MNTR, "CCK_2: (( %d ))\n", undecorated_smoothed_cck);
}
}
- i = 63;
+ i = 7;
sta->rssi_stat.ofdm_pkt_cnt -= (u8)((sta->rssi_stat.packet_map >> i) & BIT(0));
sta->rssi_stat.packet_map = sta->rssi_stat.packet_map << 1;
}
--- a/include/ieee80211.h
+++ b/include/ieee80211.h
@@ -1529,7 +1529,7 @@ enum ieee80211_state {
(((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \
(((Addr[5]) & 0xff) == 0xff))
#else
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 00))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 00)) && !defined(BUILD_OPENWRT)
extern __inline int is_multicast_mac_addr(const u8 *addr)
{
return (addr[0] != 0xff) && (0x01 & addr[0]);
--- a/include/wlan_bssdef.h
+++ b/include/wlan_bssdef.h
@@ -95,7 +95,7 @@ typedef struct _NDIS_802_11_FIXED_IEs {
typedef struct _NDIS_802_11_VARIABLE_IEs {
UCHAR ElementID;
UCHAR Length;
- UCHAR data[1];
+ UCHAR data[];
} NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs;
@@ -343,7 +343,7 @@ typedef struct _NDIS_802_11_FIXED_IEs {
typedef struct _NDIS_802_11_VARIABLE_IEs {
UCHAR ElementID;
UCHAR Length;
- UCHAR data[1];
+ UCHAR data[];
} NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs;
--- a/os_dep/linux/ioctl_cfg80211.c
+++ b/os_dep/linux/ioctl_cfg80211.c
@@ -417,7 +417,9 @@ u8 rtw_cfg80211_ch_switch_notify(_adapte
if (ret != _SUCCESS)
goto exit;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0)) || defined(BUILD_OPENWRT)
+ cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0))
cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0, 0);
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0))
cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0);
@@ -1105,7 +1107,7 @@ check_bss:
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || defined(RHEL79))
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0))
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || defined(BUILD_OPENWRT)
roam_info.links[0].channel = notify_channel;
roam_info.links[0].bssid = cur_network->network.MacAddress;
#else
@@ -1667,7 +1669,7 @@ exit:
}
static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) || defined(BUILD_OPENWRT)
, int link_id
#endif
, u8 key_index
@@ -1814,7 +1816,7 @@ addkey_end:
}
static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) || defined(BUILD_OPENWRT)
, int link_id
#endif
, u8 keyid
@@ -1982,7 +1984,7 @@ exit:
}
static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) || defined(BUILD_OPENWRT)
int link_id,
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
@@ -2006,7 +2008,7 @@ static int cfg80211_rtw_del_key(struct w
static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
struct net_device *ndev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) || defined(BUILD_OPENWRT)
int link_id,
#endif
u8 key_index
@@ -2058,7 +2060,7 @@ static int cfg80211_rtw_set_default_key(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30))
int cfg80211_rtw_set_default_mgmt_key(struct wiphy *wiphy,
struct net_device *ndev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) || defined(BUILD_OPENWRT)
int link_id,
#endif
u8 key_index)
@@ -4895,6 +4897,19 @@ exit:
return ret;
}
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)) || defined(BUILD_OPENWRT)
+static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
+ struct cfg80211_ap_update *info)
+{
+ _adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
+
+ RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
+
+ return rtw_add_beacon(adapter, info->beacon.head,
+ info->beacon.head_len, info->beacon.tail,
+ info->beacon.tail_len);
+}
+#else
static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_beacon_data *info)
{
@@ -4907,8 +4922,9 @@ static int cfg80211_rtw_change_beacon(st
return ret;
}
+#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)) || defined(BUILD_OPENWRT)
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id)
#else
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
@@ -5650,6 +5666,9 @@ static int cfg80211_rtw_set_channel(stru
}
static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy
+#ifdef BUILD_OPENWRT
+ , struct net_device *dev
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
, struct cfg80211_chan_def *chandef
#else
@@ -9670,7 +9689,7 @@ void rtw_wdev_unregister(struct wireless
rtw_cfg80211_indicate_scan_done(adapter, _TRUE);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE)
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0))
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0)) || defined(BUILD_OPENWRT)
if (wdev->connected) {
#else
if (wdev->current_bss) {
--- a/os_dep/linux/usb_intf.c
+++ b/os_dep/linux/usb_intf.c
@@ -306,7 +306,7 @@ struct rtw_usb_drv usb_drv = {
.usbdrv.supports_autosuspend = 1,
#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0))
.usbdrv.drvwrap.driver.shutdown = rtw_dev_shutdown,
#else
.usbdrv.driver.shutdown = rtw_dev_shutdown,