From b400ebe7fef36f535e01a82ef522bbb212a1b7b3 Mon Sep 17 00:00:00 2001 From: Sherry Sun Date: Fri, 17 Sep 2021 20:02:35 +0800 Subject: [PATCH] mxm_wifiex: fix mlanutl fail on L5.15 When use mlanutl on L5.15, will meet below error logs: root@imx8mqevk:/usr/share/nxp_wireless# ./mlanutl mlan0 hssetpara 2 0xff 0xc8 3 400 mlanutl: Operation not supported mlanutl: hssetpara fail This is due to the net common api change the ndo_do_ioctl behavior, it splits out all the users of SIOCDEVPRIVATE ioctls into a separate ndo_siocdevprivate callback. All the ioctl functions through SIOCDEVPRIVATE in mlanutl.c will fail if not follow this upstream api change. So here change to use new ndo_siocdevprivate instead of ndo_do_ioctl on L5.15. Signed-off-by: Sherry Sun Approved-by: Tian Yang --- mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c | 9 +++++++++ mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h | 4 ++++ mxm_wifiex/wlan_src/mlinux/moal_main.c | 8 ++++++++ mxm_wifiex/wlan_src/mlinux/moal_uap.c | 10 ++++++++++ mxm_wifiex/wlan_src/mlinux/moal_uap.h | 4 ++++ 5 files changed, 35 insertions(+) diff --git a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c index 379881f..8b12de3 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c @@ -17178,12 +17178,21 @@ int wlan_get_scan_table_ret_entry(BSSDescriptor_t *pbss_desc, t_u8 **ppbuffer, * * @return 0 --success, otherwise fail */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) +int woal_do_ioctl(struct net_device *dev, struct ifreq *req, void __user *data, int cmd) +#else int woal_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) +#endif { int ret = 0; ENTER(); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) + if (in_compat_syscall()) /* not implemented yet */ + return -EOPNOTSUPP; +#endif + PRINTM(MINFO, "woal_do_ioctl: ioctl cmd = 0x%x\n", cmd); switch (cmd) { case WOAL_ANDROID_DEF_CMD: diff --git a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h index 96a8eba..450b3ad 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h @@ -364,7 +364,11 @@ typedef struct _ssu_params_cfg { #define PRIV_CMD_LPM "lpm" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) +int woal_do_ioctl(struct net_device *dev, struct ifreq *req, void __user *data, int cmd); +#else int woal_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd); +#endif /* * For android private commands, fixed value of ioctl is used. diff --git a/mxm_wifiex/wlan_src/mlinux/moal_main.c b/mxm_wifiex/wlan_src/mlinux/moal_main.c index 6be17e0..be43cc4 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_main.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_main.c @@ -3751,7 +3751,11 @@ const struct net_device_ops woal_netdev_ops = { .ndo_open = woal_open, .ndo_start_xmit = woal_hard_start_xmit, .ndo_stop = woal_close, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) + .ndo_siocdevprivate = woal_do_ioctl, +#else .ndo_do_ioctl = woal_do_ioctl, +#endif .ndo_set_mac_address = woal_set_mac_address, .ndo_tx_timeout = woal_tx_timeout, .ndo_get_stats = woal_get_stats, @@ -3826,7 +3830,11 @@ const struct net_device_ops woal_uap_netdev_ops = { .ndo_open = woal_open, .ndo_start_xmit = woal_hard_start_xmit, .ndo_stop = woal_close, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) + .ndo_siocdevprivate = woal_uap_do_ioctl, +#else .ndo_do_ioctl = woal_uap_do_ioctl, +#endif .ndo_set_mac_address = woal_set_mac_address, .ndo_tx_timeout = woal_tx_timeout, .ndo_get_stats = woal_get_stats, diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap.c b/mxm_wifiex/wlan_src/mlinux/moal_uap.c index a9095b7..b925c36 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap.c @@ -4223,10 +4223,20 @@ void woal_uap_set_multicast_list(struct net_device *dev) * * @return 0 --success, otherwise fail */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) +int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, void __user *data, int cmd) +#else int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd) +#endif { int ret = 0; ENTER(); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) + if (in_compat_syscall()) /* not implemented yet */ + return -EOPNOTSUPP; +#endif + switch (cmd) { case WOAL_ANDROID_DEF_CMD: /** android default ioctl ID is SIOCDEVPRIVATE + 1 */ diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap.h b/mxm_wifiex/wlan_src/mlinux/moal_uap.h index 006db2e..461d275 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap.h @@ -531,7 +531,11 @@ typedef struct _domain_info_param { int woal_set_get_uap_power_mode(moal_private *priv, t_u32 action, mlan_ds_ps_mgmt *ps_mgmt); void woal_uap_set_multicast_list(struct net_device *dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) +int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, void __user *data, int cmd); +#else int woal_uap_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd); +#endif int woal_uap_bss_ctrl(moal_private *priv, t_u8 wait_option, int data); #ifdef UAP_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)