update for 7.1.x API changes (#6)

* Add IW620 command-timeout recovery patch

* Set fastest moal options: disable power save and deep sleep

* Add kernel 7.1 cfg80211 API compatibility patch

* fix: strip duplicate hunks already present in ps5-iw620.patch
This commit is contained in:
rmux
2026-06-23 19:46:48 +02:00
committed by GitHub
parent 5cfd063449
commit cecdc29706
3 changed files with 388 additions and 1 deletions

View File

@@ -11,13 +11,15 @@ script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd)
BUILD_DIR=$script_dir/build
DRIVER_DIR=$BUILD_DIR/mwifiex
PATCH_FILE=$script_dir/ps5-iw620.patch
RECOVER_PATCH=$script_dir/ps5-iw620-cmd-timeout-recover.patch
KERNEL71_PATCH=$script_dir/ps5-iw620-kernel71-compat.patch
MODULE_DIR=/lib/modules/$KERNEL_RELEASE/extra/ps5-iw620
MODPROBE_CONF=/etc/modprobe.d/ps5-iw620.conf
FW_NAME=nxp/pcieuartiw620_combo_v1.bin
FW_PATH=/lib/firmware/$FW_NAME
MOAL_OPTIONS="fw_name=$FW_NAME pcie_int_mode=1 drv_mode=1 cfg80211_wext=4 sta_name=mlan ext_scan=1 auto_fw_reload=0 wifi_reset_config=0 sched_scan=0 ps_mode=2 auto_ds=2 amsdu_disable=1"
MOAL_OPTIONS="fw_name=$FW_NAME pcie_int_mode=1 drv_mode=1 cfg80211_wext=4 sta_name=mlan ext_scan=1 auto_fw_reload=0 wifi_reset_config=0 sched_scan=0 ps_mode=0 auto_ds=0 amsdu_disable=0"
usage() {
cat <<EOF
@@ -77,6 +79,29 @@ prepare_source() {
else
die "patch does not apply cleanly in $DRIVER_DIR"
fi
[ -f "$RECOVER_PATCH" ] || die "patch file not found: $RECOVER_PATCH"
if git_driver apply --check "$RECOVER_PATCH" >/dev/null 2>&1; then
say "Applying PS5 IW620 command-timeout recovery patch"
git_driver apply "$RECOVER_PATCH"
elif git_driver apply -R --check "$RECOVER_PATCH" >/dev/null 2>&1; then
say "PS5 IW620 command-timeout recovery patch is already applied"
else
die "recovery patch does not apply cleanly in $DRIVER_DIR"
fi
KERNEL_MAJOR=$(uname -r | cut -d. -f1)
if [ "$KERNEL_MAJOR" -ge 7 ]; then
[ -f "$KERNEL71_PATCH" ] || die "patch file not found: $KERNEL71_PATCH"
if git_driver apply --check "$KERNEL71_PATCH" >/dev/null 2>&1; then
say "Applying kernel 7.1 cfg80211 API compatibility patch"
git_driver apply "$KERNEL71_PATCH"
elif git_driver apply -R --check "$KERNEL71_PATCH" >/dev/null 2>&1; then
say "Kernel 7.1 cfg80211 API compatibility patch is already applied"
else
die "kernel71 compat patch does not apply cleanly in $DRIVER_DIR"
fi
fi
}
build_driver() {

View File

@@ -0,0 +1,71 @@
diff --git a/mlan/mlan_cmdevt.c b/mlan/mlan_cmdevt.c
index f433f88..a246c65 100644
--- a/mlan/mlan_cmdevt.c
+++ b/mlan/mlan_cmdevt.c
@@ -2838,6 +2838,22 @@ done:
return ret;
}
+static t_u8 wlan_is_recoverable_cmd_timeout(t_u16 cmd_id)
+{
+ switch (cmd_id) {
+ case HostCmd_CMD_RSSI_INFO:
+ case HostCmd_CMD_802_11_GET_LOG:
+ case HostCmd_CMD_802_11_TX_RATE_QUERY:
+ case HostCmd_CMD_802_11_RF_TX_POWER:
+ case HostCmd_CMD_802_11_SNMP_MIB:
+ return MTRUE;
+ default:
+ return MFALSE;
+ }
+}
+
+#define IW620_MAX_SOFT_CMD_TIMEOUT 3
+
/**
* @brief This function handles the timeout of command sending.
* It will re-send the same command again.
@@ -2914,7 +2930,29 @@ t_void wlan_cmd_timeout_func(t_void *function_context)
if (pmadapter->hw_status == WlanHardwareStatusInitializing ||
pmadapter->hw_status == WlanHardwareStatusGetHwSpec)
wlan_init_fw_complete(pmadapter);
- else {
+ else if (wlan_is_recoverable_cmd_timeout(pmadapter->dbg.timeout_cmd_id) &&
+ pmadapter->num_cmd_timeout < IW620_MAX_SOFT_CMD_TIMEOUT) {
+ PRINTM(MERROR,
+ "IW620: soft-recover benign cmd 0x%x timeout (#%d)\n",
+ pmadapter->dbg.timeout_cmd_id,
+ pmadapter->num_cmd_timeout);
+ wlan_request_cmd_lock(pmadapter);
+ pcmd_node = pmadapter->curr_cmd;
+ pmadapter->curr_cmd = MNULL;
+ pmadapter->cmd_sent = MFALSE;
+ pmadapter->num_cmd_timeout = 0;
+ if (pcmd_node) {
+ if (pcmd_node->pioctl_buf != MNULL) {
+ pioctl_buf =
+ (mlan_ioctl_req *)pcmd_node->pioctl_buf;
+ pioctl_buf->status_code = MLAN_ERROR_CMD_TIMEOUT;
+ }
+ wlan_insert_cmd_to_free_q(pmadapter, pcmd_node);
+ }
+ wlan_release_cmd_lock(pmadapter);
+ wlan_recv_event(wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY),
+ MLAN_EVENT_ID_DRV_DEFER_HANDLING, MNULL);
+ } else {
/* Signal MOAL to perform extra handling for debugging */
if (pmpriv) {
wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_DBG_DUMP,
diff --git a/mlan/mlan_decl.h b/mlan/mlan_decl.h
index ec4bd65..91d4a03 100644
--- a/mlan/mlan_decl.h
+++ b/mlan/mlan_decl.h
@@ -156,7 +156,7 @@ typedef t_s32 t_sval;
#ifdef STA_SUPPORT
/** Default Win size attached during ADDBA request */
-#define MLAN_STA_AMPDU_DEF_TXWINSIZE 64
+#define MLAN_STA_AMPDU_DEF_TXWINSIZE 32
/** Default Win size attached during ADDBA response */
#define MLAN_STA_AMPDU_DEF_RXWINSIZE 64
/** RX winsize for COEX */

View File

@@ -0,0 +1,291 @@
diff --git a/mlinux/moal_cfg80211.c b/mlinux/moal_cfg80211.c
index 207e671..d1308b8 100644
--- a/mlinux/moal_cfg80211.c
+++ b/mlinux/moal_cfg80211.c
@@ -1806,7 +1806,7 @@ fail:
* @return 0 -- success, otherwise fail
*/
#endif
-int woal_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev,
+int woal_cfg80211_add_key(struct wiphy *wiphy, struct wireless_dev *wdev,
#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || \
(defined(ANDROID_SDK_VERSION) && ANDROID_SDK_VERSION >= 33))
int link_id,
@@ -1817,6 +1817,7 @@ int woal_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev,
#endif
const t_u8 *mac_addr, struct key_params *params)
{
+ struct net_device *netdev = wdev->netdev;
moal_private *priv = (moal_private *)woal_get_netdev_priv(netdev);
t_u8 pairwise_key = MFALSE;
@@ -1883,7 +1884,7 @@ int woal_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev,
* @return 0 -- success, otherwise fail
*/
#endif
-int woal_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev,
+int woal_cfg80211_del_key(struct wiphy *wiphy, struct wireless_dev *wdev,
#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || \
(defined(ANDROID_SDK_VERSION) && ANDROID_SDK_VERSION >= 33))
int link_id,
@@ -1894,6 +1895,7 @@ int woal_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev,
#endif
const t_u8 *mac_addr)
{
+ struct net_device *netdev = wdev->netdev;
moal_private *priv = (moal_private *)woal_get_netdev_priv(netdev);
ENTER();
@@ -1979,7 +1981,7 @@ int woal_cfg80211_set_default_key(struct wiphy *wiphy,
#if KERNEL_VERSION(2, 6, 30) <= CFG80211_VERSION_CODE
int woal_cfg80211_set_default_mgmt_key(struct wiphy *wiphy,
- struct net_device *netdev,
+ struct wireless_dev *wdev,
#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || \
(defined(ANDROID_SDK_VERSION) && ANDROID_SDK_VERSION >= 33))
int link_id,
@@ -1994,7 +1996,7 @@ int woal_cfg80211_set_default_mgmt_key(struct wiphy *wiphy,
#if KERNEL_VERSION(5, 10, 0) <= CFG80211_VERSION_CODE
int woal_cfg80211_set_default_beacon_key(struct wiphy *wiphy,
- struct net_device *netdev,
+ struct wireless_dev *wdev,
#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || \
(defined(ANDROID_SDK_VERSION) && ANDROID_SDK_VERSION >= 33))
int link_id,
diff --git a/mlinux/moal_cfg80211.h b/mlinux/moal_cfg80211.h
index 7e98c49..a8a64c5 100644
--- a/mlinux/moal_cfg80211.h
+++ b/mlinux/moal_cfg80211.h
@@ -152,7 +152,7 @@ int woal_cfg80211_set_wiphy_params(struct wiphy *wiphy,
#endif
u32 changed);
-int woal_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
+int woal_cfg80211_add_key(struct wiphy *wiphy, struct wireless_dev *wdev,
#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || \
(defined(ANDROID_SDK_VERSION) && ANDROID_SDK_VERSION >= 33))
int link_id,
@@ -163,7 +163,7 @@ int woal_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
#endif
const t_u8 *mac_addr, struct key_params *params);
-int woal_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
+int woal_cfg80211_del_key(struct wiphy *wiphy, struct wireless_dev *wdev,
#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || \
(defined(ANDROID_SDK_VERSION) && ANDROID_SDK_VERSION >= 33))
int link_id,
@@ -263,7 +263,7 @@ int woal_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *dev,
#if KERNEL_VERSION(2, 6, 30) <= CFG80211_VERSION_CODE
int woal_cfg80211_set_default_mgmt_key(struct wiphy *wiphy,
- struct net_device *netdev,
+ struct wireless_dev *wdev,
#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || \
(defined(ANDROID_SDK_VERSION) && ANDROID_SDK_VERSION >= 33))
int link_id,
@@ -273,7 +273,7 @@ int woal_cfg80211_set_default_mgmt_key(struct wiphy *wiphy,
#if KERNEL_VERSION(5, 10, 0) <= CFG80211_VERSION_CODE
int woal_cfg80211_set_default_beacon_key(struct wiphy *wiphy,
- struct net_device *netdev,
+ struct wireless_dev *wdev,
#if ((KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE) || \
(defined(ANDROID_SDK_VERSION) && ANDROID_SDK_VERSION >= 33))
int link_id,
@@ -503,7 +503,7 @@ int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev,
#else
int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev);
#endif
-int woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
+int woal_cfg80211_del_station(struct wiphy *wiphy, struct wireless_dev *wdev,
#if KERNEL_VERSION(3, 19, 0) <= CFG80211_VERSION_CODE
struct station_del_parameters *param);
#else
diff --git a/mlinux/moal_shim.c b/mlinux/moal_shim.c
index 7aebbdf..7ae4af8 100644
--- a/mlinux/moal_shim.c
+++ b/mlinux/moal_shim.c
@@ -5038,7 +5038,7 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent)
}
#endif /* KERNEL_VERSION */
if (priv->netdev && priv->wdev)
- cfg80211_new_sta(priv->netdev,
+ cfg80211_new_sta(priv->wdev,
(t_u8 *)addr, sinfo,
GFP_KERNEL);
kfree(sinfo);
@@ -5101,7 +5101,7 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent)
} else
#endif
if (priv->netdev && priv->wdev)
- cfg80211_del_sta(priv->netdev,
+ cfg80211_del_sta(priv->wdev,
pmevent->event_buf + 2,
GFP_KERNEL);
diff --git a/mlinux/moal_sta_cfg80211.c b/mlinux/moal_sta_cfg80211.c
index 58d4592..05e820f 100644
--- a/mlinux/moal_sta_cfg80211.c
+++ b/mlinux/moal_sta_cfg80211.c
@@ -176,7 +176,7 @@ static int woal_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
t_u16 reason_code);
static int woal_cfg80211_get_station(struct wiphy *wiphy,
- struct net_device *dev,
+ struct wireless_dev *wdev,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
const u8 *mac,
#else
@@ -185,7 +185,7 @@ static int woal_cfg80211_get_station(struct wiphy *wiphy,
struct station_info *sinfo);
static int woal_cfg80211_dump_station(struct wiphy *wiphy,
- struct net_device *dev, int idx,
+ struct wireless_dev *wdev, int idx,
t_u8 *mac, struct station_info *sinfo);
static int woal_cfg80211_dump_survey(struct wiphy *wiphy,
@@ -335,7 +335,7 @@ void woal_cfg80211_tdls_cancel_channel_switch(struct wiphy *wiphy,
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
static int woal_cfg80211_change_station(struct wiphy *wiphy,
- struct net_device *dev,
+ struct wireless_dev *wdev,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
const u8 *mac,
#else
@@ -372,7 +372,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
#ifdef UAP_SUPPORT
static int woal_cfg80211_add_station(struct wiphy *wiphy,
- struct net_device *dev,
+ struct wireless_dev *wdev,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
const u8 *mac,
#else
@@ -6913,7 +6927,7 @@ static int woal_cfg80211_disassociate(struct wiphy *wiphy,
* @return 0 -- success, otherwise fail
*/
static int woal_cfg80211_get_station(struct wiphy *wiphy,
- struct net_device *dev,
+ struct wireless_dev *wdev,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
const u8 *mac,
#else
@@ -6921,6 +6935,7 @@ static int woal_cfg80211_get_station(struct wiphy *wiphy,
#endif
struct station_info *sinfo)
{
+ struct net_device *dev = wdev->netdev;
mlan_status ret = MLAN_STATUS_SUCCESS;
moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
@@ -6962,9 +6977,10 @@ static int woal_cfg80211_get_station(struct wiphy *wiphy,
* @return 0 -- success, otherwise fail
*/
static int woal_cfg80211_dump_station(struct wiphy *wiphy,
- struct net_device *dev, int idx,
+ struct wireless_dev *wdev, int idx,
t_u8 *mac, struct station_info *sinfo)
{
+ struct net_device *dev = wdev->netdev;
mlan_status ret = MLAN_STATUS_SUCCESS;
moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
@@ -9312,16 +9328,15 @@ static int woal_construct_tdls_action_frame(moal_private *priv,
LEAVE();
return -EFAULT;
}
- skb_put(skb, 1 + sizeof(mgmt->u.action.u.tdls_discover_resp));
+ skb_put(skb, sizeof(mgmt->u.action.action_code) + sizeof(mgmt->u.action.tdls_discover_resp));
mgmt->u.action.category = WLAN_CATEGORY_PUBLIC;
- mgmt->u.action.u.tdls_discover_resp.action_code =
- WLAN_PUB_ACTION_TDLS_DISCOVER_RES;
- mgmt->u.action.u.tdls_discover_resp.dialog_token = dialog_token;
- mgmt->u.action.u.tdls_discover_resp.capability =
+ mgmt->u.action.action_code = WLAN_PUB_ACTION_TDLS_DISCOVER_RES;
+ mgmt->u.action.tdls_discover_resp.dialog_token = dialog_token;
+ mgmt->u.action.tdls_discover_resp.capability =
cpu_to_le16(capability);
/* move back for addr4 */
memmove(pos + ETH_ALEN, &mgmt->u.action,
- 1 + sizeof(mgmt->u.action.u.tdls_discover_resp));
+ sizeof(mgmt->u.action.action_code) + sizeof(mgmt->u.action.tdls_discover_resp));
/** init address 4 */
moal_memcpy_ext(priv->phandle, pos, addr, ETH_ALEN, ETH_ALEN);
@@ -10072,7 +10087,7 @@ done:
* @return 0 -- success, otherwise fail
*/
static int woal_cfg80211_change_station(struct wiphy *wiphy,
- struct net_device *dev,
+ struct wireless_dev *wdev,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
const u8 *mac,
#else
@@ -10080,6 +10095,7 @@ static int woal_cfg80211_change_station(struct wiphy *wiphy,
#endif
struct station_parameters *params)
{
+ struct net_device *dev = wdev->netdev;
int ret = 0;
#ifdef UAP_SUPPORT
moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
@@ -10136,7 +10152,7 @@ static int woal_cfg80211_change_station(struct wiphy *wiphy,
* @return 0 -- success, otherwise fail
*/
static int woal_cfg80211_add_station(struct wiphy *wiphy,
- struct net_device *dev,
+ struct wireless_dev *wdev,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)
const u8 *mac,
#else
@@ -10144,6 +10160,7 @@ static int woal_cfg80211_add_station(struct wiphy *wiphy,
#endif
struct station_parameters *params)
{
+ struct net_device *dev = wdev->netdev;
moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
int ret = 0;
station_node *sta_node = NULL;
@@ -11155,7 +11172,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev,
struct station_info *sinfo = NULL;
sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL);
if (sinfo) {
- cfg80211_new_sta(dev, mac, sinfo, GFP_KERNEL);
+ cfg80211_new_sta(dev->ieee80211_ptr, mac, sinfo, GFP_KERNEL);
kfree(sinfo);
}
}
diff --git a/mlinux/moal_uap_cfg80211.c b/mlinux/moal_uap_cfg80211.c
index 1c31a2a..b69cce6 100644
--- a/mlinux/moal_uap_cfg80211.c
+++ b/mlinux/moal_uap_cfg80211.c
@@ -583,7 +583,7 @@ static int woal_deauth_assoc_station(moal_private *priv, const u8 *mac_addr,
}
#if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE
if (moal_extflg_isset(priv->phandle, EXT_HOST_MLME))
- cfg80211_del_sta(priv->netdev, mac_addr, GFP_KERNEL);
+ cfg80211_del_sta(priv->wdev, mac_addr, GFP_KERNEL);
#endif
if (priv->media_connected == MFALSE) {
PRINTM(MINFO, "cfg80211: Media not connected!\n");
@@ -4234,7 +4234,7 @@ done:
* @return 0 -- success, otherwise fail
*/
#endif
-int woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
+int woal_cfg80211_del_station(struct wiphy *wiphy, struct wireless_dev *wdev,
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
struct station_del_parameters *param)
#else
@@ -4245,6 +4245,7 @@ int woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev,
#endif
#endif
{
+ struct net_device *dev = wdev->netdev;
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
const u8 *mac_addr = NULL;
#endif