Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel 6.7-6.13 build support and other fixes #275

Open
wants to merge 13 commits into
base: v5.3.9
Choose a base branch
from
Open
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ 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
EXTRA_CFLAGS += -Wno-enum-conversion
EXTRA_CFLAGS += -Wno-vla
EXTRA_CFLAGS += -Wno-date-time
EXTRA_CFLAGS += -Wno-empty-body
EXTRA_CFLAGS += -Wno-restrict



GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
Expand Down Expand Up @@ -1041,8 +1046,10 @@ EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
SUBARCH := $(shell uname -m | sed -e "s/i.86/i386/; s/ppc64le/powerpc/; s/ppc/powerpc/; s/armv.l/arm/; s/aarch64/arm64/;")
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=
ifeq ($(strip $(KSRC)),)
KVER := $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
endif
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX :=
STAGINGMODDIR := /lib/modules/$(KVER)/kernel/drivers/staging
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
* MESH Support
* Monitor mode
* Frame injection
* Up to kernel v6.5+
* Up to kernel v6.9+
... And a bunch of various wifi chipsets

# Note

Driver `rtl8xxxu` coming with newer kernels supports **monitor** mode so use it before trying this one


# Howto build/install
1. Compile and install the driver:
```
Expand Down
4 changes: 2 additions & 2 deletions hal/phydm/phydm_phystatus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion include/ieee80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ typedef struct ieee_param {
u8 idx;
u8 seq[8]; /* sequence counter (set: RX, get: TX) */
u16 key_len;
u8 key[0];
u8 key[];
} crypt;
#ifdef CONFIG_AP_MODE
struct {
Expand Down
4 changes: 2 additions & 2 deletions include/wlan_bssdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down Expand Up @@ -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;


Expand Down
21 changes: 20 additions & 1 deletion os_dep/linux/ioctl_cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,9 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8
if (ret != _SUCCESS)
goto exit;

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 9, 0))

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, it's stated in topic:
Kernel 6.7-6.10 build support and other fixes

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);
Expand Down Expand Up @@ -4895,6 +4897,19 @@ static int cfg80211_rtw_start_ap(struct wiphy *wiphy, struct net_device *ndev,
return ret;
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0))
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)
{
Expand All @@ -4907,6 +4922,7 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd

return ret;
}
#endif

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0))
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id)
Expand Down Expand Up @@ -5650,6 +5666,9 @@ static int cfg80211_rtw_set_channel(struct wiphy *wiphy
}

static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0))
, struct net_device *dev
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
, struct cfg80211_chan_def *chandef
#else
Expand Down
2 changes: 1 addition & 1 deletion os_dep/linux/usb_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down