From 4c18816df129c9ca1f939ccb45562fa6deae10a1 Mon Sep 17 00:00:00 2001 From: zhouke Date: Thu, 21 Apr 2022 21:17:17 +0800 Subject: [PATCH 1/4] ap6275s hdf modify Signed-off-by: zhouke --- linux-5.10/rk3568_patch/kernel.patch | 2140 +++++++++++++++++++++++++- 1 file changed, 2064 insertions(+), 76 deletions(-) mode change 100755 => 100644 linux-5.10/rk3568_patch/kernel.patch diff --git a/linux-5.10/rk3568_patch/kernel.patch b/linux-5.10/rk3568_patch/kernel.patch old mode 100755 new mode 100644 index 75be2f1..0690632 --- a/linux-5.10/rk3568_patch/kernel.patch +++ b/linux-5.10/rk3568_patch/kernel.patch @@ -943360,10 +943360,10 @@ index 000000000..c0431638b +} diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/bcmstdlib_s.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/bcmstdlib_s.c new file mode 100755 -index 000000000..bc27ba560 +index 000000000..269db4c3c --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/bcmstdlib_s.c -@@ -0,0 +1,307 @@ +@@ -0,0 +1,314 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Broadcom Secure Standard Library. @@ -943433,6 +943433,8 @@ index 000000000..bc27ba560 + * Also on error, if dest is not a null pointer and destsz not greater + * than RSIZE_MAX, writes destsz zero bytes into the dest object. + */ ++#ifndef CONFIG_AP6XXX_WIFI6_HDF ++ +static int +memmove_s(void *dest, size_t destsz, const void *src, size_t n) +{ @@ -943475,6 +943477,7 @@ index 000000000..bc27ba560 + * Also on error, if dest is not a null pointer and destsz not greater + * than RSIZE_MAX, writes destsz zero bytes into the dest object. + */ ++ +static int +memcpy_s(void *dest, size_t destsz, const void *src, size_t n) +{ @@ -943516,6 +943519,7 @@ index 000000000..bc27ba560 + return err; +} + ++ +/* + * memset_s - secure memset + * dest : pointer to the object to be set @@ -943550,8 +943554,11 @@ index 000000000..bc27ba560 +exit: + return err; +} ++#endif ++ +#endif /* !__STDC_WANT_SECURE_LIB__ && !(__STDC_LIB_EXT1__ && __STDC_WANT_LIB_EXT1__) */ + ++ +#if 0 +/** + * strlcpy - Copy a %NUL terminated string into a sized buffer @@ -964677,10 +964684,10 @@ index 000000000..44cd1cbf2 +} diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_cfg80211.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_cfg80211.c new file mode 100755 -index 000000000..cc35d0860 +index 000000000..84dc10cae --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_cfg80211.c -@@ -0,0 +1,305 @@ +@@ -0,0 +1,335 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Linux cfg80211 driver - Dongle Host Driver (DHD) related @@ -964739,6 +964746,12 @@ index 000000000..cc35d0860 +#include +#include + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++#include "net_device.h" ++struct NetDevice * GetHdfNetDeviceByLinuxInf(struct net_device *dev); ++ ++#endif ++ +static s32 wl_dongle_up(struct net_device *ndev); +static s32 wl_dongle_down(struct net_device *ndev); + @@ -964834,6 +964847,7 @@ index 000000000..cc35d0860 +int wl_cfg80211_remove_if(struct bcm_cfg80211 *cfg, + int ifidx, struct net_device* ndev, bool rtnl_lock_reqd) +{ ++ WL_ERR(("lijg123: call wl_cfg80211_remove_if ifidx=%d rtnl_lock_reqd=%d\n", ifidx, rtnl_lock_reqd)); + return dhd_remove_if(cfg->pub, ifidx, rtnl_lock_reqd); +} + @@ -964847,6 +964861,9 @@ index 000000000..cc35d0860 +struct net_device * dhd_cfg80211_netdev_free(struct net_device *ndev) +{ + struct bcm_cfg80211 *cfg; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ struct NetDevice *hnetdev = NULL; ++#endif + + if (ndev) { + cfg = wl_get_cfg(ndev); @@ -964854,7 +964871,24 @@ index 000000000..cc35d0860 + MFREE(cfg->osh, ndev->ieee80211_ptr, sizeof(struct wireless_dev)); + ndev->ieee80211_ptr = NULL; + } ++ ++ WL_ERR(("call dhd_cfg80211_netdev_free %s\n", ndev->name)); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ hnetdev = GetHdfNetDeviceByLinuxInf(ndev); ++ if (hnetdev == NULL) { ++ WL_ERR(("get NetDevice %s failed\n", ndev->name)); ++ return NULL; ++ } ++ ++ // clear private obj ++ kfree(hnetdev->mlPriv); ++ hnetdev->mlPriv = NULL; ++ ++ // clear NetDevice object ++ NetDeviceDeInit(hnetdev); ++#else + free_netdev(ndev); ++#endif + return NULL; + } + @@ -964864,10 +964898,13 @@ index 000000000..cc35d0860 +void dhd_netdev_free(struct net_device *ndev) +{ +#ifdef WL_CFG80211 ++ WL_ERR(("lijg123 call dhd_netdev_free 01 run this %s\n", ndev->name)); + ndev = dhd_cfg80211_netdev_free(ndev); +#endif // endif -+ if (ndev) ++ if (ndev) { ++ WL_ERR(("lijg123 call dhd_netdev_free 02 %s\n", ndev->name)); + free_netdev(ndev); ++ } +} + +static s32 @@ -987322,10 +987359,10 @@ index 000000000..45be081e3 +#endif /* _dhd_ip_h_ */ diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_linux.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_linux.c new file mode 100755 -index 000000000..37a12817a +index 000000000..411344475 --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_linux.c -@@ -0,0 +1,22324 @@ +@@ -0,0 +1,22693 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Broadcom Dongle Host Driver (DHD), Linux-specific network interface @@ -988263,11 +988300,46 @@ index 000000000..37a12817a +} dhd_dev_priv_t; + +#define DHD_DEV_PRIV_SIZE (sizeof(dhd_dev_priv_t)) ++ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++#include "net_device.h" ++ ++extern int g_hdf_ifidx; ++//struct NetDevice * get_hdf_netdev(int ifidx); ++struct NetDevice * GetHdfNetDeviceByLinuxInf(struct net_device *dev); ++ ++static inline dhd_dev_priv_t * DHD_DEV_PRIV(struct net_device *dev) ++{ ++ dhd_dev_priv_t *__tmp_dhd_netpriv = NULL; ++ struct NetDevice * hnetdev = GetHdfNetDeviceByLinuxInf(dev); ++ if ( hnetdev != NULL) { ++ __tmp_dhd_netpriv = ((dhd_dev_priv_t *)hnetdev->mlPriv); ++ } else { ++ __tmp_dhd_netpriv = NULL; ++ DHD_ERROR(("HDF net_device %s is invalid\n", dev->name)); ++ } ++ ++ return (__tmp_dhd_netpriv); ++} ++ ++void * VOID_DEV_PRIV(struct net_device *dev) ++{ ++ return (void *)DHD_DEV_PRIV(dev); ++} ++ ++#define DHD_DEV_INFO(dev) (DHD_DEV_PRIV(dev)->dhd) ++#define DHD_DEV_IFP(dev) (DHD_DEV_PRIV(dev)->ifp) ++#define DHD_DEV_IFIDX(dev) (DHD_DEV_PRIV(dev)->ifidx) ++#define DHD_DEV_LKUP(dev) (DHD_DEV_PRIV(dev)->lkup) ++ ++ ++#else +#define DHD_DEV_PRIV(dev) ((dhd_dev_priv_t *)DEV_PRIV(dev)) +#define DHD_DEV_INFO(dev) (((dhd_dev_priv_t *)DEV_PRIV(dev))->dhd) +#define DHD_DEV_IFP(dev) (((dhd_dev_priv_t *)DEV_PRIV(dev))->ifp) +#define DHD_DEV_IFIDX(dev) (((dhd_dev_priv_t *)DEV_PRIV(dev))->ifidx) +#define DHD_DEV_LKUP(dev) (((dhd_dev_priv_t *)DEV_PRIV(dev))->lkup) ++#endif + +/** Clear the dhd net_device's private structure. */ +static inline void @@ -991746,6 +991818,11 @@ index 000000000..37a12817a + wake_counts_t *wcp = NULL; +#endif /* DHD_WAKE_STATUS */ + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ struct NetDevice *netDevice = NULL; ++ struct sk_buff *eap_skb = NULL; ++ int ret = 0; ++#endif + DHD_TRACE(("%s: Enter\n", __FUNCTION__)); + BCM_REFERENCE(dump_data); + @@ -992036,6 +992113,19 @@ index 000000000..37a12817a + skb->data = eth; + skb->len = len; + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ // send EAPOL pkt to HDF WIFI ++ if (protocol == ETHER_TYPE_802_1X) { ++ netDevice = GetHdfNetDeviceByLinuxInf(skb->dev); ++ if (netDevice && netDevice->netDeviceIf != NULL && netDevice->netDeviceIf->specialEtherTypeProcess != NULL) { ++ eap_skb = skb_copy(skb, GFP_ATOMIC); ++ skb_linearize(eap_skb); ++ ret = netDevice->netDeviceIf->specialEtherTypeProcess(netDevice, eap_skb); ++ DHD_ERROR(("%s: send EAPOL pkt ret=%d, from %s\n", __FUNCTION__, ret, netDevice->name)); ++ print_hex_dump(KERN_INFO, "recv EAPOL: ", DUMP_PREFIX_NONE, 16, 1, eap_skb->data, eap_skb->len, true); ++ } ++ } ++#endif + DHD_DBG_PKT_MON_RX(dhdp, skb); + /* Strip header, count, deliver upward */ + skb_pull(skb, ETH_HLEN); @@ -995149,6 +995239,18 @@ index 000000000..37a12817a +} +#endif /* WL_STATIC_IF */ + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++struct net_device * get_krn_netdev(int ifidx); ++ ++int get_dhd_priv_data_size(void) ++{ ++ return DHD_DEV_PRIV_SIZE; ++} ++ ++const static struct net_device_ops *hdf_netdev_ops = NULL; ++ ++#endif ++ +/* unregister and free the existing net_device interface (if any) in iflist and + * allocate a new one. the slot is reused. this function does NOT register the + * new interface to linux kernel. dhd_register_if does the job @@ -995160,13 +995262,19 @@ index 000000000..37a12817a + dhd_info_t *dhdinfo = (dhd_info_t *)dhdpub->info; + dhd_if_t *ifp; + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ DHD_ERROR(("%s: bdh6: create netdevice %s hdfidx=%d, ifidx=%d, bssidx=%u\n", __FUNCTION__, name, g_hdf_ifidx, ifidx, bssidx)); ++#else ++ DHD_ERROR(("%s: bdh6: create netdevice %s ifidx=%d, bssidx=%u\n", __FUNCTION__, name, ifidx, bssidx)); ++#endif ++ + ASSERT(dhdinfo && (ifidx < (DHD_MAX_IFS + DHD_MAX_STATIC_IFS))); + + ifp = dhdinfo->iflist[ifidx]; + + if (ifp != NULL) { + if (ifp->net != NULL) { -+ DHD_ERROR(("%s: free existing IF %s ifidx:%d \n", ++ DHD_ERROR(("%s: bdh6 free existing IF %s ifidx:%d \n", + __FUNCTION__, ifp->net->name, ifidx)); + + if (ifidx == 0) { @@ -995216,7 +995324,14 @@ index 000000000..37a12817a + memcpy(&ifp->mac_addr, mac, ETHER_ADDR_LEN); + + /* Allocate etherdev, including space for private structure */ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ ifp->net = get_krn_netdev(g_hdf_ifidx); ++ if (0 == g_hdf_ifidx) { ++ hdf_netdev_ops = ifp->net->netdev_ops; ++ } ++#else + ifp->net = alloc_etherdev(DHD_DEV_PRIV_SIZE); ++#endif + if (ifp->net == NULL) { + DHD_ERROR(("%s: OOM - alloc_etherdev(%zu)\n", __FUNCTION__, sizeof(dhdinfo))); + goto fail; @@ -995368,7 +995483,6 @@ index 000000000..37a12817a + dhd_if_t *ifp; + unsigned long flags; + long timeout; -+ + ifp = dhdinfo->iflist[ifidx]; + + if (ifp != NULL) { @@ -995454,7 +995568,10 @@ index 000000000..37a12817a + return BCME_OK; +} + -+static struct net_device_ops dhd_ops_pri = { ++#ifndef CONFIG_AP6XXX_WIFI6_HDF ++static ++#endif ++struct net_device_ops dhd_ops_pri = { + .ndo_open = dhd_pri_open, + .ndo_stop = dhd_pri_stop, + .ndo_get_stats = dhd_get_stats, @@ -995993,7 +996110,10 @@ index 000000000..37a12817a + /* initialize the l2_filter_cnt */ + dhd->pub.l2_filter_cnt = 0; +#endif // endif ++ ++#ifndef CONFIG_AP6XXX_WIFI6_HDF + net->netdev_ops = NULL; ++#endif + + mutex_init(&dhd->dhd_iovar_mutex); + sema_init(&dhd->proto_sem, 1); @@ -998940,6 +999060,18 @@ index 000000000..37a12817a + return 0; +} + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++int dhd_netdev_changemtu_wrapper(struct net_device *netdev, int mtu) ++{ ++ int bcmerror = BCME_OK; ++ dhd_info_t *dhd = DHD_DEV_INFO(netdev); ++ mtu &= 0xffff; ++ bcmerror = dhd_change_mtu(&dhd->pub, mtu, 0); ++ return bcmerror; ++} ++#endif ++ ++ +#ifdef ARP_OFFLOAD_SUPPORT +/* add or remove AOE host ip(s) (up to 8 IPs on the interface) */ +void @@ -999014,7 +999146,11 @@ index 000000000..37a12817a + + /* Filter notifications meant for non Broadcom devices */ + if ((ifa->ifa_dev->dev->netdev_ops != &dhd_ops_pri) && -+ (ifa->ifa_dev->dev->netdev_ops != &dhd_ops_virt)) { ++ (ifa->ifa_dev->dev->netdev_ops != &dhd_ops_virt) ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ && (ifa->ifa_dev->dev->netdev_ops != hdf_netdev_ops) ++#endif ++ ) { +#if defined(WL_ENABLE_P2P_IF) + if (!wl_cfgp2p_is_ifops(ifa->ifa_dev->dev->netdev_ops)) +#endif /* WL_ENABLE_P2P_IF */ @@ -999211,7 +999347,11 @@ index 000000000..37a12817a + int idx; + + /* Filter notifications meant for non Broadcom devices */ -+ if (inet6_ifa->idev->dev->netdev_ops != &dhd_ops_pri) { ++ if (inet6_ifa->idev->dev->netdev_ops != &dhd_ops_pri ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ && inet6_ifa->idev->dev->netdev_ops != hdf_netdev_ops ++#endif ++ ) { + return NOTIFY_DONE; + } + @@ -999299,6 +999439,9 @@ index 000000000..37a12817a + struct net_device *net = NULL; + int err = 0; + uint8 temp_addr[ETHER_ADDR_LEN] = { 0x00, 0x90, 0x4c, 0x11, 0x22, 0x33 }; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ struct NetDevice *hnetdev = NULL; ++#endif + + DHD_TRACE(("%s: ifidx %d\n", __FUNCTION__, ifidx)); + @@ -999313,14 +999456,25 @@ index 000000000..37a12817a + ASSERT(net && (ifp->idx == ifidx)); + + ASSERT(!net->netdev_ops); ++ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ DHD_ERROR(("%s: bdh6 register netdev=%s hdfidx=%d, ifidx=%d, %p, %p\n", __FUNCTION__, net->name, g_hdf_ifidx, ++ ifidx, net->netdev_ops, &dhd_ops_virt)); ++#else + net->netdev_ops = &dhd_ops_virt; ++ DHD_ERROR(("%s: bdh6 register netdev=%s ifidx=%d\n", __FUNCTION__, net->name, ifidx)); ++#endif + + /* Ok, link into the network layer... */ + if (ifidx == 0) { + /* + * device functions for the primary interface only + */ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ DHD_ERROR(("%s: for primary inf don't set ops %d\n", __FUNCTION__, g_hdf_ifidx)); ++#else + net->netdev_ops = &dhd_ops_pri; ++#endif + if (!ETHER_ISNULLADDR(dhd->pub.mac.octet)) + memcpy(temp_addr, dhd->pub.mac.octet, ETHER_ADDR_LEN); + } else { @@ -999378,10 +999532,23 @@ index 000000000..37a12817a + } + } + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ //if (0 == g_hdf_ifidx) { ++ DHD_ERROR(("%s: for hdf inf %d don't register netdev\n", __FUNCTION__, g_hdf_ifidx)); ++ ++ // update mac address ++ hnetdev = GetHdfNetDeviceByLinuxInf(net); ++ memcpy(hnetdev->macAddr, net->dev_addr, ETHER_ADDR_LEN); ++ // Call linux register_netdev() ++ err = NetDeviceAdd(hnetdev); ++ DHD_ERROR(("%s:NetDeviceAdd %s ret=%d\n", __FUNCTION__, net->name, err)); ++ //} ++#else + if (need_rtnl_lock) + err = register_netdev(net); + else + err = register_netdevice(net); ++#endif + + if (err != 0) { + DHD_ERROR(("couldn't register the net device [%s], err %d\n", net->name, err)); @@ -999447,7 +999614,9 @@ index 000000000..37a12817a + return 0; + +fail: ++#ifndef CONFIG_AP6XXX_WIFI6_HDF + net->netdev_ops = NULL; ++#endif + return err; +} + @@ -999648,6 +999817,7 @@ index 000000000..37a12817a + * (which is set to free_netdev) + */ + if (ifp->net->reg_state == NETREG_UNINITIALIZED) { ++ DHD_ERROR(("lijg123: free netdev 01 %s\n", ifp->net->name)); + free_netdev(ifp->net); + } else { +#if defined(ARGOS_NOTIFY_CB) @@ -1000044,8 +1000214,11 @@ index 000000000..37a12817a + unregister_reboot_notifier(&dhd_reboot_notifier); + dhd_destroy_to_notifier_skt(); +} -+ -+static int __init ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++int ++#else ++static int __init ++#endif +dhd_module_init(void) +{ + int err; @@ -1000106,6 +1000279,7 @@ index 000000000..37a12817a + return NOTIFY_DONE; +} + ++#ifndef CONFIG_AP6XXX_WIFI6_HDF +#if defined(CONFIG_DEFERRED_INITCALLS) && !defined(EXYNOS_PCIE_MODULE_PATCH) +#if defined(CONFIG_MACH_UNIVERSAL7420) || defined(CONFIG_SOC_EXYNOS8890) || \ + defined(CONFIG_ARCH_MSM8996) || defined(CONFIG_ARCH_MSM8998) || \ @@ -1000127,6 +1000301,7 @@ index 000000000..37a12817a +#endif /* USE_LATE_INITCALL_SYNC */ + +module_exit(dhd_module_exit); ++#endif + +/* + * OS specific functions required to implement DHD driver in OS independent way @@ -1001151,7 +1001326,11 @@ index 000000000..37a12817a +int +dhd_dev_get_feature_set(struct net_device *dev) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *ptr = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *ptr = *(dhd_info_t **)netdev_priv(dev); ++#endif + dhd_pub_t *dhd = (&ptr->pub); + int feature_set = 0; + @@ -1001294,7 +1001473,11 @@ index 000000000..37a12817a +int +dhd_dev_ndo_cfg(struct net_device *dev, u8 enable) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + dhd_pub_t *dhdp = &dhd->pub; + int ret = 0; + @@ -1001595,8 +1001778,11 @@ index 000000000..37a12817a +bool +dhd_dev_is_legacy_pno_enabled(struct net_device *dev) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_is_legacy_pno_enabled(&dhd->pub)); +} + @@ -1001624,8 +1001810,11 @@ index 000000000..37a12817a +dhd_dev_pno_set_cfg_gscan(struct net_device *dev, dhd_pno_gscan_cmd_cfg_t type, + void *buf, bool flush) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_pno_set_cfg_gscan(&dhd->pub, type, buf, flush)); +} + @@ -1001633,8 +1001822,11 @@ index 000000000..37a12817a +int +dhd_dev_wait_batch_results_complete(struct net_device *dev) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_wait_batch_results_complete(&dhd->pub)); +} + @@ -1001642,16 +1001834,22 @@ index 000000000..37a12817a +int +dhd_dev_pno_lock_access_batch_results(struct net_device *dev) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_pno_lock_batch_results(&dhd->pub)); +} +/* Linux wrapper to call common dhd_pno_unlock_batch_results */ +void +dhd_dev_pno_unlock_access_batch_results(struct net_device *dev) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_pno_unlock_batch_results(&dhd->pub)); +} + @@ -1001659,8 +1001857,11 @@ index 000000000..37a12817a +int +dhd_dev_pno_run_gscan(struct net_device *dev, bool run, bool flush) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_pno_initiate_gscan_request(&dhd->pub, run, flush)); +} + @@ -1001668,8 +1001869,11 @@ index 000000000..37a12817a +int +dhd_dev_pno_enable_full_scan_result(struct net_device *dev, bool real_time_flag) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_pno_enable_full_scan_result(&dhd->pub, real_time_flag)); +} + @@ -1001678,8 +1001882,11 @@ index 000000000..37a12817a +dhd_dev_hotlist_scan_event(struct net_device *dev, + const void *data, int *send_evt_bytes, hotlist_type_t type, u32 *buf_len) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_handle_hotlist_scan_evt(&dhd->pub, data, send_evt_bytes, type, buf_len)); +} + @@ -1001688,16 +1001895,22 @@ index 000000000..37a12817a +dhd_dev_process_full_gscan_result(struct net_device *dev, +const void *data, uint32 len, int *send_evt_bytes) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_process_full_gscan_result(&dhd->pub, data, len, send_evt_bytes)); +} + +void +dhd_dev_gscan_hotlist_cache_cleanup(struct net_device *dev, hotlist_type_t type) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + dhd_gscan_hotlist_cache_cleanup(&dhd->pub, type); + + return; @@ -1001706,8 +1001919,11 @@ index 000000000..37a12817a +int +dhd_dev_gscan_batch_cache_cleanup(struct net_device *dev) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_gscan_batch_cache_cleanup(&dhd->pub)); +} + @@ -1001715,8 +1001931,11 @@ index 000000000..37a12817a +int +dhd_dev_retrieve_batch_scan(struct net_device *dev) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_retreive_batch_scan_results(&dhd->pub)); +} + @@ -1001724,8 +1001943,11 @@ index 000000000..37a12817a +void * dhd_dev_process_epno_result(struct net_device *dev, + const void *data, uint32 event, int *send_evt_bytes) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_pno_process_epno_result(&dhd->pub, data, event, send_evt_bytes)); +} + @@ -1001733,7 +1001955,11 @@ index 000000000..37a12817a +dhd_dev_set_lazy_roam_cfg(struct net_device *dev, + wlc_roam_exp_params_t *roam_param) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + wl_roam_exp_cfg_t roam_exp_cfg; + int err; + @@ -1001768,7 +1001994,11 @@ index 000000000..37a12817a +dhd_dev_lazy_roam_enable(struct net_device *dev, uint32 enable) +{ + int err; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + wl_roam_exp_cfg_t roam_exp_cfg; + + memset(&roam_exp_cfg, 0, sizeof(roam_exp_cfg)); @@ -1001794,7 +1002024,11 @@ index 000000000..37a12817a +{ + int err; + uint len; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + + bssid_pref->version = BSSID_PREF_LIST_VERSION; + /* By default programming bssid pref flushes out old values */ @@ -1001818,7 +1002052,11 @@ index 000000000..37a12817a + uint32 len, uint32 flush) +{ + int err; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + int macmode; + + if (blacklist) { @@ -1001844,7 +1002082,11 @@ index 000000000..37a12817a + uint32 len, uint32 flush) +{ + int err; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + wl_ssid_whitelist_t whitelist_ssid_flush; + + if (!ssid_whitelist) { @@ -1001873,8 +1002115,11 @@ index 000000000..37a12817a +dhd_dev_pno_get_gscan(struct net_device *dev, dhd_pno_gscan_cmd_cfg_t type, + void *info, uint32 *len) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_pno_get_gscan(&dhd->pub, type, info, len)); +} +#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */ @@ -1001887,8 +1002132,11 @@ index 000000000..37a12817a +{ + int err; + wl_rssi_monitor_cfg_t rssi_monitor; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + rssi_monitor.version = RSSI_MONITOR_VERSION; + rssi_monitor.max_rssi = max_rssi; + rssi_monitor.min_rssi = min_rssi; @@ -1001907,8 +1002155,11 @@ index 000000000..37a12817a +dhd_dev_set_tcpack_sup_mode_cfg(struct net_device *dev, uint8 enable) +{ + int err; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + err = dhd_tcpack_suppress_set(&dhd->pub, enable); + if (err != BCME_OK) { + DHD_ERROR(("%s : Failed to set tcpack_suppress mode: %d\n", __FUNCTION__, err)); @@ -1001920,7 +1002171,11 @@ index 000000000..37a12817a +int +dhd_dev_cfg_rand_mac_oui(struct net_device *dev, uint8 *oui) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + dhd_pub_t *dhdp = &dhd->pub; + + if (!dhdp || !oui) { @@ -1001971,60 +1002226,87 @@ index 000000000..37a12817a +int +dhd_dev_rtt_set_cfg(struct net_device *dev, void *buf) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_rtt_set_cfg(&dhd->pub, buf)); +} + +int +dhd_dev_rtt_cancel_cfg(struct net_device *dev, struct ether_addr *mac_list, int mac_cnt) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_rtt_stop(&dhd->pub, mac_list, mac_cnt)); +} + +int +dhd_dev_rtt_register_noti_callback(struct net_device *dev, void *ctx, dhd_rtt_compl_noti_fn noti_fn) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_rtt_register_noti_callback(&dhd->pub, ctx, noti_fn)); +} + +int +dhd_dev_rtt_unregister_noti_callback(struct net_device *dev, dhd_rtt_compl_noti_fn noti_fn) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_rtt_unregister_noti_callback(&dhd->pub, noti_fn)); +} + +int +dhd_dev_rtt_capability(struct net_device *dev, rtt_capabilities_t *capa) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+ ++#endif + return (dhd_rtt_capability(&dhd->pub, capa)); +} + +int +dhd_dev_rtt_avail_channel(struct net_device *dev, wifi_channel_info *channel_info) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + return (dhd_rtt_avail_channel(&dhd->pub, channel_info)); +} + +int +dhd_dev_rtt_enable_responder(struct net_device *dev, wifi_channel_info *channel_info) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + return (dhd_rtt_enable_responder(&dhd->pub, channel_info)); +} + +int dhd_dev_rtt_cancel_responder(struct net_device *dev) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + return (dhd_rtt_cancel_responder(&dhd->pub)); +} + @@ -1002387,7 +1002669,11 @@ index 000000000..37a12817a +static int +__dhd_apf_delete_filter(struct net_device *ndev, uint32 filter_id) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(ndev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(ndev); ++#endif + dhd_pub_t *dhdp = &dhd->pub; + int ifidx, ret; + @@ -1002456,7 +1002742,11 @@ index 000000000..37a12817a +int +dhd_dev_apf_get_max_len(struct net_device *ndev, uint32 *max_len) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(ndev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(ndev); ++#endif + dhd_pub_t *dhdp = &dhd->pub; + int ifidx, ret; + @@ -1003183,7 +1003473,11 @@ index 000000000..37a12817a +dhd_get_memdump_filename(struct net_device *ndev, char *memdump_path, int len, char *fname) +{ + char memdump_type[32]; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(ndev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(ndev); ++#endif + dhd_pub_t *dhdp = &dhd->pub; + + /* Init file name */ @@ -1004669,7 +1004963,11 @@ index 000000000..37a12817a +int +dhd_sssr_dump_dig_buf_before(void *dev, const void *user_buf, uint32 len) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info_t *dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhd_pub_t *dhdp = &dhd_info->pub; + int pos = 0, ret = BCME_ERROR; + uint dig_buf_size = 0; @@ -1004691,7 +1004989,11 @@ index 000000000..37a12817a +int +dhd_sssr_dump_dig_buf_after(void *dev, const void *user_buf, uint32 len) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info_t *dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhd_pub_t *dhdp = &dhd_info->pub; + int pos = 0, ret = BCME_ERROR; + uint dig_buf_size = 0; @@ -1004713,7 +1005015,11 @@ index 000000000..37a12817a +int +dhd_sssr_dump_d11_buf_before(void *dev, const void *user_buf, uint32 len, int core) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info_t *dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhd_pub_t *dhdp = &dhd_info->pub; + int pos = 0, ret = BCME_ERROR; + @@ -1004729,7 +1005035,11 @@ index 000000000..37a12817a +int +dhd_sssr_dump_d11_buf_after(void *dev, const void *user_buf, uint32 len, int core) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info_t *dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhd_pub_t *dhdp = &dhd_info->pub; + int pos = 0, ret = BCME_ERROR; + @@ -1005103,7 +1005413,11 @@ index 000000000..37a12817a +void +dhd_nla_put_sssr_dump_len(void *ndev, uint32 *arr_len) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); ++#else + dhd_info_t *dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); ++#endif + dhd_pub_t *dhdp = &dhd_info->pub; + + if (dhdp->sssr_dump_collected) { @@ -1005132,7 +1005446,11 @@ index 000000000..37a12817a + dhd_info_t *dhd_info; + + if (ndev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005156,7 +1005474,11 @@ index 000000000..37a12817a + dhd_info_t *dhd_info; + + if (ndev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005180,7 +1005502,11 @@ index 000000000..37a12817a + uint32 remain_len = 0; + + if (ndev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005207,7 +1005533,11 @@ index 000000000..37a12817a + dhd_info_t *dhd_info; + + if (ndev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005232,7 +1005562,11 @@ index 000000000..37a12817a + uint32 remain_len = 0; + + if (ndev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005279,7 +1005613,11 @@ index 000000000..37a12817a + dhd_dbg_ring_t *ring; + + if (ndev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005304,7 +1005642,11 @@ index 000000000..37a12817a + dhd_dbg_ring_t *ring; + + if (ndev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005331,7 +1005673,11 @@ index 000000000..37a12817a + dld_buf = &g_dld_buf[type]; + + if (dev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhdp = &dhd_info->pub; + } else if (!dhdp) { + return BCME_ERROR; @@ -1005431,7 +1005777,11 @@ index 000000000..37a12817a + dhd_info_t *dhd_info; + + if (dev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005531,7 +1005881,11 @@ index 000000000..37a12817a + dhd_info_t *dhd_info; + + if (dev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005576,7 +1005930,11 @@ index 000000000..37a12817a + dhd_info_t *dhd_info; + + if (dev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005622,7 +1005980,11 @@ index 000000000..37a12817a + dhd_info_t *dhd_info; + + if (dev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005663,7 +1006025,11 @@ index 000000000..37a12817a + dhd_info_t *dhd_info; + + if (dev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005687,7 +1006053,11 @@ index 000000000..37a12817a + dhd_info_t *dhd_info; + + if (dev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005737,7 +1006107,11 @@ index 000000000..37a12817a + dhd_info_t *dhd_info; + + if (dev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005767,7 +1006141,11 @@ index 000000000..37a12817a + dhd_info_t *dhd_info; + + if (dev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005793,7 +1006171,11 @@ index 000000000..37a12817a + dhd_info_t *dhd_info; + + if (dev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1005811,7 +1006193,11 @@ index 000000000..37a12817a + uint32 length = 0; + + if (ndev) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); ++#else + dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); ++#endif + dhdp = &dhd_info->pub; + } + @@ -1006138,7 +1006524,11 @@ index 000000000..37a12817a +dhd_os_socram_dump(struct net_device *dev, uint32 *dump_size) +{ + int ret = BCME_OK; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + dhd_pub_t *dhdp = &dhd->pub; + + if (dhdp->busstate == DHD_BUS_DOWN) { @@ -1006166,7 +1006556,11 @@ index 000000000..37a12817a +{ + int ret = BCME_OK; + int orig_len = 0; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + dhd_pub_t *dhdp = &dhd->pub; + if (buf == NULL) + return BCME_ERROR; @@ -1006214,7 +1006608,11 @@ index 000000000..37a12817a +dhd_os_get_axi_error_dump(void *dev, const void *user_buf, uint32 len) +{ + int ret = BCME_OK; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); ++#endif + dhd_pub_t *dhdp = &dhd->pub; + loff_t pos = 0; + if (user_buf == NULL) { @@ -1009553,7 +1009951,11 @@ index 000000000..37a12817a + +void *dhd_get_pub(struct net_device *dev) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhdinfo = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhdinfo = *(dhd_info_t **)netdev_priv(dev); ++#endif + if (dhdinfo) + return (void *)&dhdinfo->pub; + else { @@ -1009564,7 +1009966,11 @@ index 000000000..37a12817a + +void *dhd_get_conf(struct net_device *dev) +{ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ dhd_info_t *dhdinfo = *(dhd_info_t **)DHD_DEV_PRIV(dev); ++#else + dhd_info_t *dhdinfo = *(dhd_info_t **)netdev_priv(dev); ++#endif + if (dhdinfo) + return (void *)dhdinfo->pub.conf; + else { @@ -1070579,6 +1070985,1299 @@ index 000000000..57c149dfd + uint8 id, bool id_ext, uint *ie_len); + +#endif /* __FRAG_H__ */ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hdf_comm.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hdf_comm.c +new file mode 100755 +index 000000000..c31fc9be4 +--- /dev/null ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hdf_comm.c +@@ -0,0 +1,743 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "wifi_module.h" ++#include "wifi_mac80211_ops.h" ++#include "hdf_wlan_utils.h" ++#include "net_bdh_adpater.h" ++#include "hdf_wl_interface.h" ++#include "hdf_public_ap6275s.h" ++ ++#include ++#include ++#include ++ ++#include "osal_mem.h" ++#include "hdf_log.h" ++ ++#include "net_device.h" ++#include "net_device_impl.h" ++#include "net_device_adapter.h" ++#include "hdf_wifi_cmd.h" ++#include "hdf_wifi_event.h" ++#include "hdf_mac80211_sta_event.h" ++#include "hdf_mac80211_sta.h" ++#include ++ ++#include ++#include ++#include ++ ++#include "hdf_wifi_product.h" ++#define HDF_LOG_TAG BDH6Driver ++#define WIFI_SCAN_EXTRA_IE_LEN_MAX (512) ++#define BDH6_POINT_CHANNEL_SIZE (8) ++int dhd_module_init(void); ++s32 wl_get_vif_macaddr(struct bcm_cfg80211 *cfg, u16 wl_iftype, u8 *mac_addr); ++extern struct cfg80211_ap_settings g_ap_setting_info; ++int32_t Bdh6Fband(NetDevice *hnetDev, int32_t band, int32_t *freqs, uint32_t *num) ++{ ++ uint32_t freqIndex = 0; ++ uint32_t channelNumber; ++ uint32_t freqTmp; ++ uint32_t minFreq; ++ uint32_t maxFreq; ++ ++ struct wiphy* wiphy = NULL; ++ struct NetDevice *netDev = NULL; ++ struct ieee80211_supported_band *band5g = NULL; ++ int32_t max5GChNum = 0; ++ const struct ieee80211_regdomain *regdom = bdh6_get_regdomain(); ++ if (regdom == NULL) { ++ HDF_LOGE("%s: wal_get_cfg_regdb failed!", __func__); ++ return HDF_FAILURE; ++ } ++ ++ netDev = get_real_netdev(hnetDev); ++ wiphy = get_linux_wiphy_hdfdev(netDev); ++ if (!wiphy) { ++ HDF_LOGE("%s: wiphy is NULL", __func__); ++ return -1; ++ } ++ ++ (void)netDev; ++ HDF_LOGE("%s: start..., band=%d", __func__, band); ++ ++ minFreq = regdom->reg_rules[0].freq_range.start_freq_khz / MHZ_TO_KHZ(1); ++ maxFreq = regdom->reg_rules[0].freq_range.end_freq_khz / MHZ_TO_KHZ(1); ++ switch (band) { ++ case WLAN_BAND_2G: ++ for (channelNumber = 1; channelNumber <= WIFI_24G_CHANNEL_NUMS; channelNumber++) { ++ if (channelNumber < WAL_MAX_CHANNEL_2G) { ++ freqTmp = WAL_MIN_FREQ_2G + (channelNumber - 1) * WAL_FREQ_2G_INTERVAL; ++ } else if (channelNumber == WAL_MAX_CHANNEL_2G) { ++ freqTmp = WAL_MAX_FREQ_2G; ++ } ++ if (freqTmp < minFreq || freqTmp > maxFreq) { ++ continue; ++ } ++ ++ HDF_LOGE("bdh6 2G %u: freq=%u\n", freqIndex, freqTmp); ++ freqs[freqIndex] = freqTmp; ++ freqIndex++; ++ } ++ *num = freqIndex; ++ break; ++ ++ case WLAN_BAND_5G: ++ band5g = wiphy->bands[IEEE80211_BAND_5GHZ]; ++ if (NULL == band5g) { ++ return HDF_ERR_NOT_SUPPORT; ++ } ++ ++ max5GChNum = min(band5g->n_channels, WIFI_24G_CHANNEL_NUMS); ++ for (freqIndex = 0; freqIndex < max5GChNum; freqIndex++) { ++ freqs[freqIndex] = band5g->channels[freqIndex].center_freq; ++ HDF_LOGE("bdh6 5G %u: freq=%u\n", freqIndex, freqs[freqIndex]); ++ } ++ *num = freqIndex; ++ break; ++ default: ++ HDF_LOGE("%s: no support band!", __func__); ++ return HDF_ERR_NOT_SUPPORT; ++ } ++ return HDF_SUCCESS; ++} ++ ++int32_t Bdh6Ghcap(struct NetDevice *hnetDev, struct WlanHwCapability **capability) ++{ ++ uint8_t loop = 0; ++ struct wiphy* wiphy = NULL; ++ struct NetDevice *netDev = NULL; ++ struct ieee80211_supported_band *band = NULL; ++ struct ieee80211_supported_band *band5g = NULL; ++ struct WlanHwCapability *hwCapability = NULL; ++ uint16_t supportedRateCount = 0; ++ netDev = get_real_netdev(hnetDev); ++ ++ wiphy = get_linux_wiphy_hdfdev(netDev); ++ if (!wiphy) { ++ HDF_LOGE("%s: wiphy is NULL", __func__); ++ return -1; ++ } ++ ++ HDF_LOGE("%s: start...", __func__); ++ band = wiphy->bands[IEEE80211_BAND_2GHZ]; ++ hwCapability = (struct WlanHwCapability *)OsalMemCalloc(sizeof(struct WlanHwCapability)); ++ if (hwCapability == NULL) { ++ HDF_LOGE("%s: oom!\n", __func__); ++ return HDF_FAILURE; ++ } ++ hwCapability->Release = BDH6WalReleaseHwCapability; ++ ++ if (hwCapability->bands[IEEE80211_BAND_2GHZ] == NULL) { ++ hwCapability->bands[IEEE80211_BAND_2GHZ] = ++ OsalMemCalloc(sizeof(struct WlanBand) + (sizeof(struct WlanChannel) * band->n_channels)); ++ if (hwCapability->bands[IEEE80211_BAND_2GHZ] == NULL) { ++ BDH6WalReleaseHwCapability(hwCapability); ++ return HDF_FAILURE; ++ } ++ } ++ ++ hwCapability->htCapability = band->ht_cap.cap; ++ supportedRateCount = band->n_bitrates; ++ ++ hwCapability->bands[IEEE80211_BAND_2GHZ]->channelCount = band->n_channels; ++ for (loop = 0; loop < band->n_channels; loop++) { ++ hwCapability->bands[IEEE80211_BAND_2GHZ]->channels[loop].centerFreq = band->channels[loop].center_freq; ++ hwCapability->bands[IEEE80211_BAND_2GHZ]->channels[loop].flags = band->channels[loop].flags; ++ hwCapability->bands[IEEE80211_BAND_2GHZ]->channels[loop].channelId = band->channels[loop].hw_value; ++ HDF_LOGE("bdh6 2G band %u: centerFreq=%u, channelId=%u, flags=0x%08x\n", loop, ++ hwCapability->bands[IEEE80211_BAND_2GHZ]->channels[loop].centerFreq, ++ hwCapability->bands[IEEE80211_BAND_2GHZ]->channels[loop].channelId, ++ hwCapability->bands[IEEE80211_BAND_2GHZ]->channels[loop].flags); ++ } ++ ++ if (wiphy->bands[IEEE80211_BAND_5GHZ]) { // Fill 5Ghz band ++ band5g = wiphy->bands[IEEE80211_BAND_5GHZ]; ++ hwCapability->bands[IEEE80211_BAND_5GHZ] = OsalMemCalloc(sizeof(struct WlanBand) + (sizeof(struct WlanChannel) * band5g->n_channels)); ++ if (hwCapability->bands[IEEE80211_BAND_5GHZ] == NULL) { ++ HDF_LOGE("%s: oom!\n", __func__); ++ BDH6WalReleaseHwCapability(hwCapability); ++ return HDF_FAILURE; ++ } ++ ++ hwCapability->bands[IEEE80211_BAND_5GHZ]->channelCount = band5g->n_channels; ++ for (loop = 0; loop < band5g->n_channels; loop++) { ++ hwCapability->bands[IEEE80211_BAND_5GHZ]->channels[loop].centerFreq = band5g->channels[loop].center_freq; ++ hwCapability->bands[IEEE80211_BAND_5GHZ]->channels[loop].flags = band5g->channels[loop].flags; ++ hwCapability->bands[IEEE80211_BAND_5GHZ]->channels[loop].channelId = band5g->channels[loop].hw_value; ++ } ++ ++ supportedRateCount += band5g->n_bitrates; ++ } ++ HDF_LOGE("bdh6 htCapability= %u,%u; supportedRateCount= %u,%u,%u\n", hwCapability->htCapability, ++ band5g->ht_cap.cap, supportedRateCount, band->n_bitrates, band5g->n_bitrates); ++ ++ hwCapability->supportedRateCount = supportedRateCount; ++ hwCapability->supportedRates = OsalMemCalloc(sizeof(uint16_t) * supportedRateCount); ++ if (hwCapability->supportedRates == NULL) { ++ HDF_LOGE("%s: oom!\n", __func__); ++ BDH6WalReleaseHwCapability(hwCapability); ++ return HDF_FAILURE; ++ } ++ ++ for (loop = 0; loop < band->n_bitrates; loop++) { ++ hwCapability->supportedRates[loop] = band->bitrates[loop].bitrate; ++ HDF_LOGE("bdh6 2G supportedRates %u: %u\n", loop, hwCapability->supportedRates[loop]); ++ } ++ ++ if (band5g) { ++ for (loop = band->n_bitrates; loop < supportedRateCount; loop++) { ++ hwCapability->supportedRates[loop] = band5g->bitrates[loop].bitrate; ++ HDF_LOGE("bdh6 5G supportedRates %u: %u\n", loop, hwCapability->supportedRates[loop]); ++ } ++ } ++ ++ if (hwCapability->supportedRateCount > MAX_SUPPORTED_RATE) ++ hwCapability->supportedRateCount = MAX_SUPPORTED_RATE; ++ ++ *capability = hwCapability; ++ return HDF_SUCCESS; ++} ++ ++int32_t Bdh6SAction(struct NetDevice *hhnetDev, WifiActionData *actionData) ++{ ++ int retVal = 0; ++ struct NetDevice *hnetdev = NULL; ++ struct net_device *netdev = NULL; ++ struct NetDevice *netDev = NULL; ++ struct wiphy *wiphy = NULL; ++ struct wireless_dev *wdev = NULL; ++ static u64 action_cookie = 0; ++ struct cfg80211_mgmt_tx_params params; ++ u32 center_freq = 0; ++ u8 *action_buf = NULL; ++ struct ieee80211_mgmt *mgmt = NULL; ++ u8 *srcMac = NULL; ++ hnetdev = hhnetDev; // backup it ++ ++ g_mgmt_tx_event_ifidx = get_scan_ifidx(hnetdev->name); ++ HDF_LOGE("%s: start %s... ifidx=%d", __func__, hnetdev->name, g_mgmt_tx_event_ifidx); ++ ++ netDev = get_real_netdev(hhnetDev); ++ netdev = GetLinuxInfByNetDevice(netDev); ++ if (!netdev) { ++ HDF_LOGE("%s: net_device is NULL", __func__); ++ return -1; ++ } ++ wiphy = get_linux_wiphy_ndev(netdev); ++ if (!wiphy) { ++ HDF_LOGE("%s: wiphy is NULL", __func__); ++ return -1; ++ } ++ ++ if (strcmp(hnetdev->name, "p2p0") == 0) { ++ wdev = g_hdf_infmap[HDF_INF_P2P0].wdev; ++ if (g_hdf_infmap[HDF_INF_P2P1].netdev) ++ srcMac = wdev->address; ++ else ++ srcMac = actionData->src; ++ } else { ++ wdev = netdev->ieee80211_ptr; ++ srcMac = actionData->src; ++ } ++ memset_s(¶ms, sizeof(params), 0, sizeof(params)); ++ params.wait = 0; ++ center_freq = p2p_remain_freq; ++ params.chan = ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(center_freq)); ++ if (params.chan == NULL) { ++ HDF_LOGE("%s: get center_freq %u faild", __func__, center_freq); ++ return -1; ++ } ++ ++ // build 802.11 action header ++ action_buf = (u8 *)OsalMemCalloc(MAC_80211_FRAME_LEN+actionData->dataLen); ++ mgmt = (struct ieee80211_mgmt *)action_buf; ++ mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION); ++ memcpy_s(mgmt->da, ETH_ALEN, actionData->dst, ETH_ALEN); ++ memcpy_s(mgmt->sa, ETH_ALEN, srcMac, ETH_ALEN); ++ memcpy_s(mgmt->bssid, ETH_ALEN, actionData->bssid, ETH_ALEN); ++ ++ /* 填充payload信息 */ ++ if (actionData->dataLen > 0) { ++ memcpy_s(action_buf+MAC_80211_FRAME_LEN, actionData->dataLen, actionData->data, actionData->dataLen); ++ } ++ params.buf = action_buf; ++ params.len = (MAC_80211_FRAME_LEN + actionData->dataLen); ++ retVal = (int32_t)wl_cfg80211_ops.mgmt_tx(wiphy, wdev, ¶ms, &action_cookie); ++ OsalMemFree(action_buf); ++ return retVal; ++} ++ ++int32_t WalChangeBeacon(NetDevice *hnetDev, struct WlanBeaconConf *param) ++{ ++ int32_t ret = 0; ++ struct cfg80211_beacon_data info; ++ struct net_device *netdev = NULL; ++ struct wiphy *wiphy = NULL; ++ struct NetDevice *netDev = NULL; ++ netDev = get_real_netdev(hnetDev); ++ netdev = GetLinuxInfByNetDevice(netDev); ++ if (!netdev) { ++ HDF_LOGE("%s: net_device is NULL", __func__); ++ return -1; ++ } ++ ++ wiphy = get_linux_wiphy_ndev(netdev); ++ if (!wiphy) { ++ HDF_LOGE("%s: wiphy is NULL", __func__); ++ return -1; ++ } ++ ++ HDF_LOGE("%s: start...", __func__); ++ ++ memset(&info, 0x00, sizeof(info)); ++ ++#if 1 ++ if (g_ap_setting_info.beacon.head != NULL) { ++ OsalMemFree((uint8_t *)g_ap_setting_info.beacon.head); ++ g_ap_setting_info.beacon.head = NULL; ++ } ++ if (g_ap_setting_info.beacon.tail != NULL) { ++ OsalMemFree((uint8_t *)g_ap_setting_info.beacon.tail); ++ g_ap_setting_info.beacon.tail = NULL; ++ } ++ ++ if (param->headIEs && param->headIEsLength > 0) { ++ g_ap_setting_info.beacon.head = OsalMemCalloc(param->headIEsLength); ++ memcpy((uint8_t *)g_ap_setting_info.beacon.head, param->headIEs, param->headIEsLength); ++ g_ap_setting_info.beacon.head_len = param->headIEsLength; ++ ++ //info.head = g_ap_setting_info.beacon.head; ++ //info.head_len = g_ap_setting_info.beacon.head_len; ++ } ++ ++ if (param->tailIEs && param->tailIEsLength > 0) { ++ g_ap_setting_info.beacon.tail = OsalMemCalloc(param->tailIEsLength); ++ memcpy((uint8_t *)g_ap_setting_info.beacon.tail, param->tailIEs, param->tailIEsLength); ++ g_ap_setting_info.beacon.tail_len = param->tailIEsLength; ++ ++ //info.tail = g_ap_setting_info.beacon.tail; ++ //info.tail_len = g_ap_setting_info.beacon.tail_len; ++ } ++#endif ++ ++ info.head = param->headIEs; ++ info.head_len = (size_t)param->headIEsLength; ++ info.tail = param->tailIEs; ++ info.tail_len = (size_t)param->tailIEsLength; ++ ++ info.beacon_ies = NULL; ++ info.proberesp_ies = NULL; ++ info.assocresp_ies = NULL; ++ info.probe_resp = NULL; ++ //info.lci = NULL; ++ //info.civicloc = NULL; ++ //info.ftm_responder = 0X00; ++ info.beacon_ies_len = 0X00; ++ info.proberesp_ies_len = 0X00; ++ info.assocresp_ies_len = 0X00; ++ info.probe_resp_len = 0X00; ++ //info.lci_len = 0X00; ++ //info.civicloc_len = 0X00; ++ ++ /* add beacon data for start ap*/ ++ g_ap_setting_info.dtim_period = param->DTIMPeriod; ++ g_ap_setting_info.hidden_ssid = param->hiddenSSID; ++ g_ap_setting_info.beacon_interval = param->interval; ++ HDF_LOGE("%s: dtim_period:%d---hidden_ssid:%d---beacon_interval:%d!", ++ __func__, g_ap_setting_info.dtim_period, g_ap_setting_info.hidden_ssid, g_ap_setting_info.beacon_interval); ++ ++ //g_ap_setting_info.beacon.head = param->headIEs; ++ //g_ap_setting_info.beacon.head_len = param->headIEsLength; ++ //g_ap_setting_info.beacon.tail = param->tailIEs; ++ //g_ap_setting_info.beacon.tail_len = param->tailIEsLength; ++ ++ g_ap_setting_info.beacon.beacon_ies = NULL; ++ g_ap_setting_info.beacon.proberesp_ies = NULL; ++ g_ap_setting_info.beacon.assocresp_ies = NULL; ++ g_ap_setting_info.beacon.probe_resp = NULL; ++ //g_ap_setting_info.beacon.lci = NULL; ++ // g_ap_setting_info.beacon.civicloc = NULL; ++ // g_ap_setting_info.beacon.ftm_responder = 0X00; ++ g_ap_setting_info.beacon.beacon_ies_len = 0X00; ++ g_ap_setting_info.beacon.proberesp_ies_len = 0X00; ++ g_ap_setting_info.beacon.assocresp_ies_len = 0X00; ++ g_ap_setting_info.beacon.probe_resp_len = 0X00; ++ // g_ap_setting_info.beacon.lci_len = 0X00; ++ // g_ap_setting_info.beacon.civicloc_len = 0X00; ++ ++ // call nl80211_calculate_ap_params(¶ms); ++ bdh6_nl80211_calculate_ap_params(&g_ap_setting_info); ++ ++ HDF_LOGE("%s: headIEsLen:%d---tailIEsLen:%d!", __func__, param->headIEsLength, param->tailIEsLength); ++ ret = WalStartAp(netDev); ++ HDF_LOGE("call start_ap ret=%d", ret); ++ ++ ret = (int32_t)wl_cfg80211_ops.change_beacon(wiphy, netdev, &info); ++ ++ if (ret < 0) { ++ HDF_LOGE("%s: change_beacon failed!", __func__); ++ } ++ ++ return HDF_SUCCESS; ++} ++ ++int32_t HdfConnect(NetDevice *hnetDev, WlanConnectParams *param) ++{ ++ int32_t ret = 0; ++ struct net_device *ndev = NULL; ++ struct wiphy *wiphy = NULL; ++ struct NetDevice *netDev = NULL; ++ struct cfg80211_connect_params cfg80211_params = { 0 }; ++ g_conn_event_ifidx = get_scan_ifidx(hnetDev->name); ++ netDev = get_real_netdev(hnetDev); ++ if (netDev == NULL || param == NULL) { ++ HDF_LOGE("%s:NULL ptr!", __func__); ++ return HDF_FAILURE; ++ } ++ ndev = GetLinuxInfByNetDevice(netDev); ++ if (ndev == NULL) { ++ HDF_LOGE("%s:NULL ptr!", __func__); ++ return HDF_FAILURE; ++ } ++ ++ wiphy = get_linux_wiphy_ndev(ndev); ++ if (!wiphy) { ++ HDF_LOGE("%s: wiphy is NULL", __func__); ++ return -1; ++ } ++ ++ if (param->centerFreq != WLAN_FREQ_NOT_SPECFIED) { ++ cfg80211_params.channel = WalGetChannel(wiphy, param->centerFreq); ++ if ((cfg80211_params.channel == NULL) || (cfg80211_params.channel->flags & WIFI_CHAN_DISABLED)) { ++ HDF_LOGE("%s:illegal channel.flags=%u", __func__, ++ (cfg80211_params.channel == NULL) ? 0 : cfg80211_params.channel->flags); ++ return HDF_FAILURE; ++ } ++ } ++ ++ cfg80211_params.bssid = param->bssid; ++ cfg80211_params.ssid = param->ssid; ++ cfg80211_params.ie = param->ie; ++ cfg80211_params.ssid_len = param->ssidLen; ++ cfg80211_params.ie_len = param->ieLen; ++ ++ cfg80211_params.crypto.wpa_versions = param->crypto.wpaVersions; ++ cfg80211_params.crypto.cipher_group = param->crypto.cipherGroup; ++ cfg80211_params.crypto.n_ciphers_pairwise = param->crypto.n_ciphersPairwise; ++ ++ memcpy_s(cfg80211_params.crypto.ciphers_pairwise, NL80211_MAX_NR_CIPHER_SUITES*sizeof(cfg80211_params.crypto.ciphers_pairwise[0]), \ ++ param->crypto.ciphersPairwise, NL80211_MAX_NR_CIPHER_SUITES*sizeof(param->crypto.ciphersPairwise[0])); ++ ++ memcpy_s(cfg80211_params.crypto.akm_suites, NL80211_MAX_NR_AKM_SUITES*sizeof(cfg80211_params.crypto.akm_suites[0]), \ ++ param->crypto.akmSuites, NL80211_MAX_NR_AKM_SUITES*sizeof(param->crypto.akmSuites[0])); ++ ++ cfg80211_params.crypto.n_akm_suites = param->crypto.n_akmSuites; ++ ++ if (param->crypto.controlPort) { ++ cfg80211_params.crypto.control_port = true; ++ } else { ++ cfg80211_params.crypto.control_port = false; ++ } ++ ++ cfg80211_params.crypto.control_port_ethertype = param->crypto.controlPortEthertype; ++ cfg80211_params.crypto.control_port_no_encrypt = param->crypto.controlPortNoEncrypt; ++ ++ cfg80211_params.key = param->key; ++ cfg80211_params.auth_type = (unsigned char)param->authType; ++ cfg80211_params.privacy = param->privacy; ++ cfg80211_params.key_len = param->keyLen; ++ cfg80211_params.key_idx = param->keyIdx; ++ cfg80211_params.mfp = (unsigned char)param->mfp; ++ ++ HDF_LOGE("%s: %s connect ssid: %s", __func__, netDev->name, cfg80211_params.ssid); ++ HDF_LOGE("%s: cfg80211_params auth_type:%d--channelId:%d--centerFreq:%d--Mac:%02x:%02x:%02x:%02x:%02x:%02x", ++ __func__, cfg80211_params.auth_type, cfg80211_params.channel->band, param->centerFreq, ++ cfg80211_params.bssid[0], cfg80211_params.bssid[1], cfg80211_params.bssid[2], ++ cfg80211_params.bssid[3], cfg80211_params.bssid[4], cfg80211_params.bssid[5]); ++ ++ ret = wl_cfg80211_ops.connect(wiphy, ndev, &cfg80211_params); ++ if (ret < 0) { ++ HDF_LOGE("%s: connect failed!\n", __func__); ++ } ++ ++ return ret; ++} ++ ++int32_t HdfStartScan(NetDevice *hhnetDev, struct WlanScanRequest *scanParam) ++{ ++ int32_t ret = 0; ++ struct net_device *ndev = NULL; ++ struct wiphy *wiphy = NULL; ++ static int32_t is_p2p_complete = 0; ++ NetDevice *hnetdev = hhnetDev; ++ int32_t channelTotal; ++ struct NetDevice *netDev = NULL; ++ ++ netDev = get_real_netdev(hhnetDev); ++ ndev = GetLinuxInfByNetDevice(netDev); ++ wiphy = get_linux_wiphy_ndev(ndev); ++ channelTotal = ieee80211_get_num_supported_channels(wiphy); ++ g_scan_event_ifidx = get_scan_ifidx(hnetdev->name); ++ ++ struct cfg80211_scan_request *request = ++ (struct cfg80211_scan_request *)OsalMemCalloc(sizeof(struct cfg80211_scan_request) + BDH6_POINT_CHANNEL_SIZE * channelTotal); ++ ++ HDF_LOGE("%s: enter hdfStartScan %s, channelTotal: %d", __func__, ndev->name, channelTotal); ++ ++ if (request == NULL) { ++ return HDF_FAILURE; ++ } ++ if (WifiScanSetRequest(netDev, scanParam, request) != HDF_SUCCESS) { ++ WifiScanFree(&request); ++ return HDF_FAILURE; ++ } ++ ++ HDF_LOGE("%s: enter cfg80211_scan, n_ssids=%d !", __func__, request->n_ssids); ++ ret = wl_cfg80211_ops.scan(wiphy, request); ++ HDF_LOGE("%s: left cfg80211_scan %d!", __func__, ret); ++ ++ if (ret != HDF_SUCCESS) { ++ WifiScanFree(&request); ++ } ++ ++ return ret; ++} ++ ++int32_t WifiScanSetUserIe(const struct WlanScanRequest *params, struct cfg80211_scan_request *request) ++{ ++ if (params->extraIEsLen > WIFI_SCAN_EXTRA_IE_LEN_MAX) { ++ HDF_LOGE("%s:unexpected extra len!extraIesLen=%d", __func__, params->extraIEsLen); ++ return HDF_FAILURE; ++ } ++ if ((params->extraIEs != NULL) && (params->extraIEsLen != 0)) { ++ request->ie = (uint8_t *)OsalMemCalloc(params->extraIEsLen); ++ if (request->ie == NULL) { ++ HDF_LOGE("%s: calloc request->ie null", __func__); ++ goto fail; ++ } ++ (void)memcpy_s((void *)request->ie, params->extraIEsLen, params->extraIEs, params->extraIEsLen); ++ request->ie_len = params->extraIEsLen; ++ } ++ ++ return HDF_SUCCESS; ++ ++fail: ++ if (request->ie != NULL) { ++ OsalMemFree((void *)request->ie); ++ request->ie = NULL; ++ } ++ ++ return HDF_FAILURE; ++} ++ ++int32_t WifiScanSetChannel(const struct wiphy *wiphy, const struct WlanScanRequest *params, ++ struct cfg80211_scan_request *request) ++{ ++ int32_t loop; ++ int32_t count = 0; ++ enum Ieee80211Band band = IEEE80211_BAND_2GHZ; ++ struct ieee80211_channel *chan = NULL; ++ ++ int32_t channelTotal = ieee80211_get_num_supported_channels((struct wiphy *)wiphy); ++ ++ if ((params->freqs == NULL) || (params->freqsCount == 0)) { ++ for (band = IEEE80211_BAND_2GHZ; band <= IEEE80211_BAND_5GHZ; band++) { ++ if (wiphy->bands[band] == NULL) { ++ HDF_LOGE("%s: wiphy->bands[band] = NULL!\n", __func__); ++ continue; ++ } ++ ++ for (loop = 0; loop < (int32_t)wiphy->bands[band]->n_channels; loop++) { ++ if(count >= channelTotal) { ++ break; ++ } ++ ++ chan = &wiphy->bands[band]->channels[loop]; ++ if ((chan->flags & WIFI_CHAN_DISABLED) != 0) { ++ continue; ++ } ++ ++ request->channels[count++] = chan; ++ } ++ } ++ } else { ++ for (loop = 0; loop < params->freqsCount; loop++) { ++ chan = GetChannelByFreq(wiphy, (uint16_t)(params->freqs[loop])); ++ if (chan == NULL) { ++ HDF_LOGE("%s: freq not found!freq=%d!\n", __func__, params->freqs[loop]); ++ continue; ++ } ++ ++ if (count >= channelTotal) { ++ break; ++ } ++ ++ request->channels[count++] = chan; ++ } ++ } ++ ++ if (count == 0) { ++ HDF_LOGE("%s: invalid freq info!\n", __func__); ++ return HDF_FAILURE; ++ } ++ request->n_channels = count; ++ ++ return HDF_SUCCESS; ++} ++ ++#define HDF_ETHER_ADDR_LEN (6) ++int32_t HdfConnectResultEventCallback(struct net_device *ndev, uint8_t *bssid, uint8_t *reqIe, ++ uint8_t *rspIe, uint32_t reqIeLen, uint32_t rspIeLen, uint16_t connectStatus, uint16_t freq) ++{ ++ int32_t retVal = 0; ++ NetDevice *netDev = GetHdfNetDeviceByLinuxInf(ndev); ++ struct ConnetResult connResult; ++ // for check p2p0 report ++ netDev = get_hdf_netdev(g_conn_event_ifidx); ++ ++ HDF_LOGE("%s: enter", __func__); ++ ++ if (netDev == NULL || bssid == NULL || rspIe == NULL || reqIe == NULL) { ++ HDF_LOGE("%s: netDev / bssid / rspIe / reqIe null!", __func__); ++ return -1; ++ } ++ ++ memcpy_s(&connResult.bssid[0], HDF_ETHER_ADDR_LEN, bssid, HDF_ETHER_ADDR_LEN); ++ ++ connResult.rspIe = rspIe; ++ connResult.rspIeLen = rspIeLen; ++ connResult.reqIe = reqIe; ++ connResult.reqIeLen = reqIeLen; ++ connResult.connectStatus = connectStatus; ++ connResult.freq = freq; ++ connResult.statusCode = connectStatus; ++ ++ retVal = HdfWifiEventConnectResult(netDev, &connResult); ++ if (retVal < 0) { ++ HDF_LOGE("%s: hdf wifi event inform connect result failed!", __func__); ++ } ++ return retVal; ++} ++ ++ ++void HdfInformBssFrameEventCallback(struct net_device *ndev, struct ieee80211_channel *channel, int32_t signal, ++ int16_t freq, struct ieee80211_mgmt *mgmt, uint32_t mgmtLen) ++{ ++ int32_t retVal = 0; ++ NetDevice *netDev = GetHdfNetDeviceByLinuxInf(ndev); ++ struct ScannedBssInfo bssInfo; ++ struct WlanChannel hdfchannel; ++ ++ if (channel == NULL || netDev == NULL || mgmt == NULL) { ++ HDF_LOGE("%s: inform_bss_frame channel = null or netDev = null!", __func__); ++ return; ++ } ++ netDev = get_hdf_netdev(g_scan_event_ifidx); ++ bssInfo.signal = signal; ++ bssInfo.freq = freq; ++ bssInfo.mgmtLen = mgmtLen; ++ bssInfo.mgmt = (struct Ieee80211Mgmt *)mgmt; ++ ++ hdfchannel.flags = channel->flags; ++ hdfchannel.channelId = channel->hw_value; ++ hdfchannel.centerFreq = channel->center_freq; ++ retVal = HdfWifiEventInformBssFrame(netDev, &hdfchannel, &bssInfo); ++ if (retVal < 0) { ++ HDF_LOGE("%s: hdf wifi event inform bss frame failed!", __func__); ++ } else { ++ HDF_LOGE("%s: hdf wifi event inform bss frame ret = %d", __func__, retVal); ++ } ++} ++ ++int32_t BDH6Init(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) ++{ ++ int32_t ret = 0; ++ struct HdfWifiNetDeviceData *data = NULL; ++ struct net_device *netdev = NULL; ++ int private_data_size = 0; ++ struct wiphy *wiphy = NULL; ++ struct wireless_dev *wdev = NULL; ++ struct net_device *p2p_netdev = NULL; ++ struct NetDevice *p2p_hnetdev = NULL; ++ struct bcm_cfg80211 *cfg = NULL; ++ ++ (void)chipDriver; ++ HDF_LOGW("bdh6: call BDH6Init"); ++ ++ memset_s(g_hdf_infmap, sizeof(g_hdf_infmap), 0, sizeof(g_hdf_infmap)); ++ g_hdf_ifidx = HDF_INF_WLAN0; // master interface ++ ++ if (netDevice == NULL) { ++ HDF_LOGE("%s netdevice is null!", __func__); ++ return HDF_FAILURE; ++ } ++ ++ netdev = GetLinuxInfByNetDevice(netDevice); ++ if (netdev == NULL) { ++ HDF_LOGE("%s net_device is null!", __func__); ++ return HDF_FAILURE; ++ } ++ ++ data = GetPlatformData(netDevice); ++ if (data == NULL) { ++ HDF_LOGE("%s:netdevice data null!", __func__); ++ return HDF_FAILURE; ++ } ++ ++ hdf_bdh6_netdev_init(netDevice); ++ netDevice->classDriverPriv = data; ++ private_data_size = get_dhd_priv_data_size(); // create bdh6 private object ++ netDevice->mlPriv = kzalloc(private_data_size, GFP_KERNEL); ++ if (netDevice->mlPriv == NULL) { ++ HDF_LOGE("%s:kzalloc mlPriv failed", __func__); ++ return HDF_FAILURE; ++ } ++ ++ set_krn_netdev(netDevice, netdev, g_hdf_ifidx); ++ dhd_module_init(); ++ ret = hdf_bdh6_netdev_open(netDevice); ++ if (ret != 0) { ++ HDF_LOGE("%s:open netdev %s failed", __func__, netDevice->name); ++ return HDF_FAILURE; ++ } ++ ret = BDH6InitNetdev(netDevice, sizeof(void *), NL80211_IFTYPE_P2P_DEVICE, HDF_INF_P2P0); ++ if (ret != 0) { ++ HDF_LOGE("%s:BDH6InitNetdev p2p0 failed", __func__); ++ return HDF_FAILURE; ++ } ++ wdev = kzalloc(sizeof(*wdev), GFP_KERNEL); ++ if (wdev == NULL) { ++ HDF_LOGE("%s:get wlan0 wdev failed", __func__); ++ return HDF_FAILURE; ++ } ++ wiphy = get_linux_wiphy_ndev(netdev); ++ if (wiphy == NULL) { ++ HDF_LOGE("%s:get wlan0 wiphy failed", __func__); ++ return HDF_FAILURE; ++ } ++ p2p_hnetdev = get_hdf_netdev(g_hdf_ifidx); ++ p2p_netdev = get_krn_netdev(g_hdf_ifidx); ++ wdev->wiphy = wiphy; ++ wdev->iftype = NL80211_IFTYPE_P2P_DEVICE; ++ p2p_netdev->ieee80211_ptr = wdev; ++ wdev->netdev = p2p_netdev; ++ p2p_hnetdev->ieee80211Ptr = p2p_netdev->ieee80211_ptr; ++ cfg = wiphy_priv(wiphy); // update mac from wdev address ++ wl_get_vif_macaddr(cfg, 7, p2p_hnetdev->macAddr); // WL_IF_TYPE_P2P_DISC = 7 ++ memcpy_s(p2p_netdev->dev_addr, p2p_netdev->addr_len, p2p_hnetdev->macAddr, MAC_ADDR_SIZE); ++ p2p_hnetdev->netDeviceIf = wal_get_net_p2p_ops(); // reset netdev_ops ++ hdf_cfgp2p_register_ndev(p2p_netdev, netdev, wiphy); ++ ret = NetDeviceAdd(p2p_hnetdev); // Call linux register_netdev() ++ HDF_LOGE("NetDeviceAdd %s ret = %d", p2p_hnetdev->name, ret); ++ return HDF_SUCCESS; ++} +\ No newline at end of file +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hdf_mac80211_p2p.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hdf_mac80211_p2p.c +new file mode 100755 +index 000000000..983cd28eb +--- /dev/null ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hdf_mac80211_p2p.c +@@ -0,0 +1,400 @@ ++/* ++ * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2 ++ * of the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++#include "wifi_mac80211_ops.h" ++#include "hdf_wlan_utils.h" ++#include "wifi_module.h" ++#include ++#include ++#include "osal_mem.h" ++#include "hdf_wifi_event.h" ++#include "hdf_log.h" ++#include "osl.h" ++ ++ ++ ++#include ++#include ++#include ++#include ++#include "net_device_adapter.h" ++#include "hdf_wl_interface.h" ++#include ++#include "eapol.h" ++ ++//#include "hdf_wifi_cmd.h" ++//#include "wl_cfg80211.h" ++ ++ ++ ++enum wl_management_type { ++ WL_BEACON = 0x1, ++ WL_PROBE_RESP = 0x2, ++ WL_ASSOC_RESP = 0x4 ++}; ++ ++#define HDF_LOG_TAG BDH6Driver ++#define HISI_DRIVER_FLAGS_AP 0x00000040 ++#define HISI_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400 ++#define HISI_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200 ++#define HISI_DRIVER_FLAGS_P2P_CAPABLE 0x00000800 ++#define WLAN_WPS_IE_MAX_SIZE 352 ++ ++#if defined(WL_CFG80211_P2P_DEV_IF) ++#define ndev_to_cfg(ndev) ((ndev)->ieee80211_ptr) ++#else ++#define ndev_to_cfg(ndev) (ndev) ++#endif ++#ifndef errno_t ++typedef int errno_t; ++#endif ++extern struct net_device_ops dhd_ops_pri; ++extern struct cfg80211_ops wl_cfg80211_ops; ++extern struct hdf_inf_map g_hdf_infmap[HDF_INF_MAX]; ++extern int g_hdf_ifidx; ++extern int g_event_ifidx; ++ ++extern struct net_device * GetLinuxInfByNetDevice(const struct NetDevice *netDevice); ++extern struct wiphy * get_linux_wiphy_ndev(struct net_device *ndev); ++extern struct wiphy * get_linux_wiphy_hdfdev(NetDevice *netDev); ++int BDH6InitNetdev(struct NetDevice *netDevice, int private_data_size, int type, int ifidx); ++int get_dhd_priv_data_size(void); ++struct NetDevice * get_hdf_netdev(int ifidx); ++ ++ ++extern s32 wl_cfg80211_set_wps_p2p_ie(struct net_device *net, char *buf, int len, ++ enum wl_management_type type); ++ ++ ++struct net_device * get_krn_netdev(int ifidx); ++struct NetDevice * get_real_netdev(NetDevice *netDev); ++extern void rtnl_lock(void); ++extern void rtnl_unlock(void); ++ ++ ++static u64 p2p_cookie = 0; ++u32 p2p_remain_freq = 0; ++ ++int32_t WalRemainOnChannel(struct NetDevice *netDev, WifiOnChannel *onChannel) ++{ ++ struct net_device *netdev = NULL; ++ struct wiphy *wiphy = NULL; ++ bcm_struct_cfgdev *cfgdev = NULL; ++ struct ieee80211_channel *channel = NULL; ++ unsigned int duration; ++ struct NetDevice *hnetdev = netDev; ++ ++ netDev = get_real_netdev(netDev); ++ netdev = GetLinuxInfByNetDevice(netDev); ++ if (!netdev) { ++ HDF_LOGE("%s: net_device is NULL", __func__); ++ return -1; ++ } ++ ++ wiphy = get_linux_wiphy_ndev(netdev); ++ if (!wiphy) { ++ HDF_LOGE("%s: wiphy is NULL", __func__); ++ return -1; ++ } ++ HDF_LOGE("%s: ifname=%s, freq=%u, duration=%u", __func__, hnetdev->name, onChannel->freq, onChannel->duration); ++ ++ channel = OsalMemCalloc(sizeof(struct ieee80211_channel)); ++ cfgdev = ndev_to_cfg(netdev); ++ channel->center_freq = onChannel->freq; //remain_on_channel函数需要的参数 ++ duration = (unsigned int)onChannel->duration; ++ p2p_remain_freq = channel->center_freq; ++ ++ return wl_cfg80211_ops.remain_on_channel(wiphy, cfgdev, channel, duration, &p2p_cookie); ++ OsalMemFree(channel); ++} ++ ++ ++ ++int32_t WalCancelRemainOnChannel(struct NetDevice *netDev) ++ ++{ ++ struct net_device *netdev = NULL; ++ bcm_struct_cfgdev *cfgdev = NULL; ++ struct wiphy *wiphy = NULL; ++ struct NetDevice *hnetdev = netDev; ++ ++ netDev = get_real_netdev(netDev); ++ netdev = GetLinuxInfByNetDevice(netDev); ++ wiphy = get_linux_wiphy_ndev(netdev); ++ if (!wiphy) { ++ HDF_LOGE("%s: wiphy is NULL", __func__); ++ return -1; ++ } ++ ++ HDF_LOGE("%s: ifname = %s", __func__, hnetdev->name); ++ if (!netdev) { ++ HDF_LOGE("%s: net_device is NULL", __func__); ++ return -1; ++ } ++ ++ cfgdev = ndev_to_cfg(netdev); ++ ++ return wl_cfg80211_ops.cancel_remain_on_channel(wiphy, cfgdev, p2p_cookie); ++} ++ ++int32_t WalProbeReqReport(struct NetDevice *netDev, int32_t report) ++ ++{ ++ (void)report; ++ ++ HDF_LOGE("%s: ifname = %s, report=%d", __func__, netDev->name, report); ++ ++ return HDF_SUCCESS; ++ ++} ++//extern int wl_cfgp2p_start_p2p_device(struct wiphy *wiphy, struct wireless_dev *wdev); ++int32_t WalAddIf(struct NetDevice *netDev, WifiIfAdd *ifAdd) ++{ ++ struct wiphy *wiphy = NULL; ++ struct wireless_dev *wdev = NULL; ++ int ret = 0; ++ struct net_device *p2p_netdev = NULL; ++ struct NetDevice *p2p_hnetdev = NULL; ++ ++ if (netDev == NULL || ifAdd == NULL) { ++ HDF_LOGE("%s:NULL ptr!", __func__); ++ return -1; ++ } ++ ++ HDF_LOGE("%s: ifname = %s, type=%u", __func__, netDev->name, ifAdd->type); ++ netDev = get_real_netdev(netDev); ++ if (g_hdf_infmap[HDF_INF_P2P1].hnetdev != NULL) { ++ HDF_LOGE("%s: ifidx=%d was used, failed add if", __func__, HDF_INF_P2P1); ++ return -1; ++ } ++ ++ ret = BDH6InitNetdev(netDev, get_dhd_priv_data_size(), ifAdd->type, HDF_INF_P2P1); ++ if (ret != 0) { ++ HDF_LOGE("%s:BDH6InitNetdev p2p-p2p0-0 failed", __func__); ++ return HDF_FAILURE; ++ } ++ ++ wiphy = get_linux_wiphy_hdfdev(netDev); ++ if (wiphy == NULL) { ++ HDF_LOGE("%s:get wlan0 wiphy failed", __func__); ++ return HDF_FAILURE; ++ } ++ ++ p2p_hnetdev = get_hdf_netdev(g_hdf_ifidx); ++ p2p_netdev = get_krn_netdev(g_hdf_ifidx); ++ ++ wdev = wl_cfg80211_ops.add_virtual_intf(wiphy, p2p_hnetdev->name, NET_NAME_USER, ifAdd->type, NULL); ++ if (wdev == NULL || wdev == ERR_PTR(-ENODEV)) { ++ HDF_LOGE("%s:create wdev for %s %d failed", __func__, p2p_hnetdev->name, ifAdd->type); ++ return HDF_FAILURE; ++ } ++ HDF_LOGE("%s:%s wdev->netdev=%p, %p", __func__, p2p_hnetdev->name, wdev->netdev, p2p_netdev); ++ p2p_hnetdev->ieee80211Ptr = p2p_netdev->ieee80211_ptr; ++ ++ // update mac addr to NetDevice object ++ memcpy_s(p2p_hnetdev->macAddr, MAC_ADDR_SIZE, p2p_netdev->dev_addr, p2p_netdev->addr_len); ++ HDF_LOGE("%s: %s mac: %02x:%02x:%02x:%02x:%02x:%02x", __func__, p2p_hnetdev->name, ++ p2p_hnetdev->macAddr[0], ++ p2p_hnetdev->macAddr[1], ++ p2p_hnetdev->macAddr[2], ++ p2p_hnetdev->macAddr[3], ++ p2p_hnetdev->macAddr[4], ++ p2p_hnetdev->macAddr[5] ++ ); ++ ++ //g_event_ifidx = HDF_INF_P2P1; ++ //hdf_bdh6_netdev_open(p2p_hnetdev); ++ ++ return HDF_SUCCESS; ++} ++ ++int32_t WalRemoveIf(struct NetDevice *netDev, WifiIfRemove *ifRemove) ++{ ++ int i = HDF_INF_WLAN0; ++ struct wiphy *wiphy = NULL; ++ struct wireless_dev *wdev = NULL; ++ struct NetDevice *p2p_hnetdev = NULL; ++ int ret = 0; ++ struct NetDevice *hnetdev = netDev; ++ netDev = get_real_netdev(netDev); ++ ++ wiphy = get_linux_wiphy_hdfdev(netDev); ++ if (wiphy == NULL) { ++ HDF_LOGE("%s:get wlan0 wiphy failed", __func__); ++ return HDF_FAILURE; ++ } ++ ++ HDF_LOGE("%s: ifname=%s, primary netdev %s, remove ifname=%s", __func__, hnetdev->name, netDev->name, ifRemove->ifname); ++ for (; i < HDF_INF_MAX; i ++) { ++ p2p_hnetdev = g_hdf_infmap[i].hnetdev; ++ if (p2p_hnetdev == NULL) { ++ continue; ++ } ++ ++ if (strcmp(p2p_hnetdev->name, ifRemove->ifname) == 0) { ++ // check safely ++ if (i == HDF_INF_WLAN0) { ++ HDF_LOGE("%s: don't remove master interface %s", __func__, ifRemove->ifname); ++ continue; ++ } ++ if (i != HDF_INF_P2P1) { ++ HDF_LOGE("%s: remove %s is not p2p interface (%d %d)", __func__, ifRemove->ifname, i, HDF_INF_P2P1); ++ //return HDF_FAILURE; ++ } ++ ++ wdev = (struct wireless_dev *)p2p_hnetdev->ieee80211Ptr; ++ ret = (int32_t)wl_cfg80211_ops.change_virtual_intf(wiphy, g_hdf_infmap[i].netdev, NL80211_IFTYPE_STATION, NULL); ++ HDF_LOGE("%s: change %s mode %d --> %d, ret=%d", __func__, g_hdf_infmap[i].netdev->name, wdev->iftype, NL80211_IFTYPE_STATION, ret); ++ ++ //g_hdf_ifidx = HDF_INF_P2P0; // delete p2p-p2p0-0 interface ++ ++ rtnl_lock(); ++ // clear private object ++ DestroyEapolData(p2p_hnetdev); ++ p2p_hnetdev->ieee80211Ptr = NULL; ++ // This func free wdev object and call unregister_netdevice() and NetDeviceDeInit() ++ ret = wl_cfg80211_ops.del_virtual_intf(wiphy, wdev); ++ ++ g_hdf_infmap[i].hnetdev = NULL; ++ g_hdf_infmap[i].netdev = NULL; ++ g_hdf_infmap[i].wdev = NULL; ++ g_hdf_ifidx = HDF_INF_WLAN0; ++ g_event_ifidx = HDF_INF_P2P0; ++ rtnl_unlock(); ++ break; ++ } ++ } ++ ++ return ret; ++} ++ ++int32_t WalSetApWpsP2pIe(struct NetDevice *netDev, WifiAppIe *appIe) ++{ ++ struct net_device *netdev = NULL; ++ enum wl_management_type type; ++ ++ netDev = get_real_netdev(netDev); ++ netdev = GetLinuxInfByNetDevice(netDev); ++ type = appIe->appIeType; ++ ++ HDF_LOGE("%s: primary netdev %s, type=%d", __func__, netDev->name, type); ++ if (!netdev) { ++ HDF_LOGE("%s: net_device is NULL", __func__); ++ return -1; ++ } ++ ++ if (appIe->ieLen > WLAN_WPS_IE_MAX_SIZE) { ++ //oam_error_log0(0, 0, "app ie length is too large!"); ++ return -1; ++ } ++ ++ return wl_cfg80211_set_wps_p2p_ie(netdev, appIe->ie, appIe->ieLen, type); ++} ++ ++void cfg80211_init_wdev(struct wireless_dev *wdev); ++ ++int hdf_start_p2p_device(void) ++{ ++ static int start_p2p_completed = 0; ++ int ret = HDF_SUCCESS; ++ struct wiphy *wiphy = NULL; ++ struct wireless_dev *wdev = NULL; ++ struct net_device *netdev = get_krn_netdev(HDF_INF_WLAN0); ++ ++ if (start_p2p_completed == 1) { ++ HDF_LOGE("%s:start p2p completed already", __func__); ++ return 0; ++ } ++ ++ // create wdev object for p2p-dev-wlan0 device, refer nl80211_new_interface() ++ wiphy = get_linux_wiphy_ndev(netdev); ++ if (wiphy == NULL) { ++ HDF_LOGE("%s:get wlan0 wiphy failed", __func__); ++ return HDF_FAILURE; ++ } ++ ++ wdev = wl_cfg80211_ops.add_virtual_intf(wiphy, "p2p-dev-wlan0", NET_NAME_USER, NL80211_IFTYPE_P2P_DEVICE, NULL); ++ if (wdev == NULL) { ++ HDF_LOGE("%s:create wdev for p2p-dev-wlan0 %d failed", __func__, NL80211_IFTYPE_P2P_DEVICE); ++ return HDF_FAILURE; ++ } ++ cfg80211_init_wdev(wdev); ++ HDF_LOGE("%s:p2p-dev-wlan0 wdev->netdev=%p", __func__, wdev->netdev); ++ ++ g_hdf_infmap[HDF_INF_P2P0].wdev = wdev; // free it for module released !! ++ ++ ret = wl_cfg80211_ops.start_p2p_device(wiphy, NULL); ++ HDF_LOGE("call start_p2p_device ret = %d", ret); ++ g_event_ifidx = HDF_INF_P2P0; ++ start_p2p_completed = 1; ++ ++ return ret; ++} ++ ++int32_t WalGetDriverFlag(struct NetDevice *netDev, WifiGetDrvFlags **params) ++{ ++ struct wireless_dev *wdev = NULL; ++ WifiGetDrvFlags *getDrvFlag = NULL; ++ int iftype = 0; ++ ++ HDF_LOGE("%s: primary netdev %s", __func__, netDev->name); ++ if (netDev == NULL || params == NULL) { ++ HDF_LOGE("%s:NULL ptr!", __func__); ++ return -1; ++ } ++ wdev = (struct wireless_dev*)((netDev)->ieee80211Ptr); ++ getDrvFlag = (WifiGetDrvFlags *)OsalMemCalloc(sizeof(WifiGetDrvFlags)); ++ iftype = wdev->iftype; ++ ++ //iftype = NL80211_IFTYPE_P2P_DEVICE; ++ ++ switch (iftype) { ++ case NL80211_IFTYPE_P2P_CLIENT: ++ /* fall-through */ ++ case NL80211_IFTYPE_P2P_GO: ++ getDrvFlag->drvFlags = (unsigned int)(HISI_DRIVER_FLAGS_AP); ++ g_event_ifidx = HDF_INF_P2P1; ++ break; ++ case NL80211_IFTYPE_P2P_DEVICE: ++ getDrvFlag->drvFlags = (unsigned int)(HISI_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE | ++ HISI_DRIVER_FLAGS_P2P_CONCURRENT | ++ HISI_DRIVER_FLAGS_P2P_CAPABLE); ++ //getDrvFlag->drvFlags = (unsigned int)0xBA0CFEC0; ++ hdf_start_p2p_device(); ++ break; ++ default: ++ getDrvFlag->drvFlags = 0; ++ } ++ ++ *params = getDrvFlag; ++ ++ HDF_LOGE("%s: %s iftype=%d, drvflag=%lu", __func__, netDev->name, iftype, getDrvFlag->drvFlags); ++ return HDF_SUCCESS; ++} ++ ++struct HdfMac80211P2POps g_bdh6_p2pOps = { ++ .RemainOnChannel = WalRemainOnChannel, ++ .CancelRemainOnChannel = WalCancelRemainOnChannel, ++ .ProbeReqReport = WalProbeReqReport, ++ .AddIf = WalAddIf, ++ .RemoveIf = WalRemoveIf, ++ .SetApWpsP2pIe = WalSetApWpsP2pIe, ++ .GetDriverFlag = WalGetDriverFlag, ++}; ++ ++ +diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hdf_public_ap6275s.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hdf_public_ap6275s.h +new file mode 100755 +index 000000000..d19b8f89e +--- /dev/null ++++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hdf_public_ap6275s.h +@@ -0,0 +1,131 @@ ++/* ++ * hdf_public_ap6275s.h ++ * ++ * ap6275s driver header ++ * ++ * Copyright (c) 2020-2021 Huawei Device Co., Ltd. ++ * ++ * This software is licensed under the terms of the GNU General Public ++ * License version 2, as published by the Free Software Foundation, and ++ * may be copied, distributed, and modified under those terms. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ */ ++#ifndef _HDF_PUBLIC_AP6275S_H_ ++#define _HDF_PUBLIC_AP6275S_H_ ++#include ++#include "net_device.h" ++#include "hdf_wl_interface.h" ++ ++#include "wifi_module.h" ++#include "wifi_mac80211_ops.h" ++#include "hdf_wlan_utils.h" ++#include "net_bdh_adpater.h" ++ ++#if defined(WL_CFG80211_P2P_DEV_IF) ++#define ndev_to_cfg(ndev) ((ndev)->ieee80211_ptr) ++#else ++#define ndev_to_cfg(ndev) (ndev) ++#endif ++#ifndef errno_t ++typedef int errno_t; ++#endif ++ ++int get_scan_ifidx(const char *ifname); ++extern struct cfg80211_ops wl_cfg80211_ops; ++extern struct net_device_ops dhd_ops_pri; ++extern struct hdf_inf_map g_hdf_infmap[HDF_INF_MAX]; ++extern struct net_device *GetLinuxInfByNetDevice(const struct NetDevice *netDevice); ++extern struct wireless_dev *wrap_get_widev(void); ++extern struct ieee80211_regdomain *wrp_get_regdomain(void); ++extern int32_t wl_get_all_sta(struct net_device *ndev, uint32_t *num); ++extern s32 wl_get_all_sta_info(struct net_device *ndev, char* mac, uint32_t num); ++extern int g_hdf_ifidx; ++extern int g_mgmt_tx_event_ifidx; ++//extern u64 p2p_cookie; ++extern u32 p2p_remain_freq; ++extern struct HdfMac80211STAOps g_bdh6_staOps; ++extern struct HdfMac80211APOps g_bdh6_apOps; ++extern struct HdfMac80211P2POps g_bdh6_p2pOps; ++extern struct NetDevice* GetHdfNetDeviceByLinuxInf(struct net_device *dev); ++extern int g_scan_event_ifidx; ++extern int g_conn_event_ifidx; ++void dhd_get_mac_address(struct net_device *dev, unsigned char **addr); ++ ++int32_t wal_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, struct net_device *netDev); ++int32_t wal_cfg80211_remain_on_channel(struct wiphy *wiphy, struct net_device *netDev, int32_t freq, ++ unsigned int duration); ++void wl_cfg80211_add_virtual_iface_wrap(struct wiphy *wiphy, char *name, enum nl80211_iftype type, ++ struct vif_params *params); ++extern int memcpy_s(void *dest, size_t dest_max, const void *src, size_t count); ++extern int32_t HdfWifiEventDelSta(struct NetDevice *netDev, const uint8_t *macAddr, uint8_t addrLen); ++/*int32_t HdfWifiEventInformBssFrame(const struct NetDevice *netDev, ++ const struct WlanChannel *channel, const struct ScannedBssInfo *bssInfo);*/ ++int hdf_cfgp2p_register_ndev(struct net_device *p2p_netdev, struct net_device *primary_netdev, struct wiphy *wiphy); ++struct NetDeviceInterFace *wal_get_net_p2p_ops(void); ++s32 wldev_ioctl_get(struct net_device *dev, u32 cmd, unsigned char *arg, u32 len); ++struct wiphy *get_linux_wiphy_hdfdev(NetDevice *netDev); ++extern int dhd_netdev_changemtu_wrapper(struct net_device *netdev, int mtu); ++extern struct NetDeviceInterFace *wal_get_net_dev_ops(void); ++ ++int BDH6InitNetdev(struct NetDevice *netDevice, int private_data_size, int type, int ifidx); ++struct NetDevice *get_hdf_netdev(int ifidx); ++struct net_device *get_krn_netdev(int ifidx); ++extern void rtnl_lock(void); ++extern void rtnl_unlock(void); ++ ++struct NetDevice *get_real_netdev(NetDevice *netDev); ++extern struct wiphy *get_linux_wiphy_ndev(struct net_device *ndev); ++int get_dhd_priv_data_size(void); ++extern int32_t wl_cfg80211_set_country_code(struct net_device *net, char *country_code, ++ bool notify, bool user_enforced, int revinfo); ++extern int snprintf_s(char *dest, size_t dest_max, size_t count, const char *format, ...); ++ ++extern int32_t WalChangeBeacon(NetDevice *hnetDev, struct WlanBeaconConf *param); ++extern int32_t Bdh6Ghcap(struct NetDevice *hnetDev, struct WlanHwCapability **capability); ++extern int32_t HdfStartScan(NetDevice *hhnetDev, struct WlanScanRequest *scanParam); ++extern int32_t WifiScanSetUserIe(const struct WlanScanRequest *params, struct cfg80211_scan_request *request); ++extern int32_t WifiScanSetChannel(const struct wiphy *wiphy, const struct WlanScanRequest *params, ++ struct cfg80211_scan_request *request); ++extern int32_t BDH6Init(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice); ++ ++/*********************************hdf_bdh_mac80211***********************************************/ ++typedef enum { ++ WLAN_BAND_2G, ++ WLAN_BAND_5G, ++ WLAN_BAND_BUTT ++} wlan_channel_band_enum; ++#define WIFI_24G_CHANNEL_NUMS (14) ++#define WAL_MIN_CHANNEL_2G (1) ++#define WAL_MAX_CHANNEL_2G (14) ++#define WAL_MIN_FREQ_2G (2412 + 5*(WAL_MIN_CHANNEL_2G - 1)) ++#define WAL_MAX_FREQ_2G (2484) ++#define WAL_FREQ_2G_INTERVAL (5) ++ ++#define WLAN_WPS_IE_MAX_SIZE (352) // (WLAN_MEM_EVENT_SIZE2 - 32) /* 32表示事件自身占用的空间 */ ++#define MAC_80211_FRAME_LEN 24 /* 非四地址情况下,MAC帧头的长度 */ ++extern struct ieee80211_regdomain *bdh6_get_regdomain(void); ++extern void BDH6WalReleaseHwCapability(struct WlanHwCapability *self); ++ ++/*************************************ap.c*************************************************/ ++extern void bdh6_nl80211_calculate_ap_params(struct cfg80211_ap_settings *params); ++extern int32_t WalStartAp(NetDevice *hnetDev); ++ ++ ++/************************************sta.c***************************************/ ++extern int32_t WifiScanSetRequest(struct NetDevice *netdev, const struct WlanScanRequest *params, ++ struct cfg80211_scan_request *request); ++extern struct ieee80211_channel *WalGetChannel(struct wiphy *wiphy, int32_t freq); ++extern struct ieee80211_channel *GetChannelByFreq(const struct wiphy *wiphy, uint16_t center_freq); ++ ++/*************************************hdf_wl_interface.h**************************************/ ++extern int g_event_ifidx; ++ ++extern int32_t Bdh6SAction(struct NetDevice *hhnetDev, WifiActionData *actionData); ++extern int32_t Bdh6Fband(NetDevice *hnetDev, int32_t band, int32_t *freqs, uint32_t *num); ++extern int32_t HdfConnect(NetDevice *hnetDev, WlanConnectParams *param); ++#endif diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hnd_pktpool.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hnd_pktpool.c new file mode 100755 index 000000000..09c2520b8 @@ -1093953,10 +1095652,10 @@ index 000000000..aa72338de +#endif /* _bcmsrom_tbl_h_ */ diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/include/bcmstdlib_s.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/include/bcmstdlib_s.h new file mode 100755 -index 000000000..6c79800c8 +index 000000000..b80b3195f --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/include/bcmstdlib_s.h -@@ -0,0 +1,46 @@ +@@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Broadcom Secure Standard Library. @@ -1093993,9 +1095692,15 @@ index 000000000..6c79800c8 +#ifndef BWL_NO_INTERNAL_STDLIB_SUPPORT +#if !defined(__STDC_WANT_SECURE_LIB__) && !(defined(__STDC_LIB_EXT1__) && \ + defined(__STDC_WANT_LIB_EXT1__)) ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++int memmove_s(void *dest, size_t destsz, const void *src, size_t n); ++int memcpy_s(void *dest, size_t destsz, const void *src, size_t n); ++int memset_s(void *dest, size_t destsz, int c, size_t n); ++#else +static int memmove_s(void *dest, size_t destsz, const void *src, size_t n); +static int memcpy_s(void *dest, size_t destsz, const void *src, size_t n); +static int memset_s(void *dest, size_t destsz, int c, size_t n); ++#endif +#endif /* !__STDC_WANT_SECURE_LIB__ && !(__STDC_LIB_EXT1__ && __STDC_WANT_LIB_EXT1__) */ +#if !defined(FREEBSD) && !defined(BCM_USE_PLATFORM_STRLCPY) +extern size_t strlcpy(char *dest, const char *src, size_t size); @@ -1153109,10 +1154814,10 @@ index 000000000..1686e8882 +#endif /* _siutils_priv_h_ */ diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_android.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_android.c new file mode 100755 -index 000000000..a8e96385b +index 000000000..f1ca3f227 --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_android.c -@@ -0,0 +1,6630 @@ +@@ -0,0 +1,6644 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Linux cfg80211 driver - Android related functions @@ -1153199,6 +1154904,14 @@ index 000000000..a8e96385b +#define WL_BSSIDX_MAX 16 +#endif /* WL_STATIC_IF */ + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++#include "net_device.h" ++ ++extern int g_event_ifidx; ++struct NetDevice * get_hdf_netdev(int ifidx); ++#endif ++ ++ +uint android_msg_level = ANDROID_ERROR_LEVEL | ANDROID_MSG_LEVEL; + +#define ANDROID_ERROR_MSG(x, args...) \ @@ -1157307,6 +1159020,12 @@ index 000000000..a8e96385b + &cfg->remain_on_chan, + cfg->remain_on_chan_type, GFP_KERNEL); +#endif /* WL_CFG80211_P2P_DEV_IF */ ++ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ int32 ret = 0; ++ ret = HdfWifiEventCancelRemainOnChannel(get_hdf_netdev(g_event_ifidx), cfg->remain_on_chan.center_freq); ++ WL_ERR(("HdfWifiEventCancelRemainOnChannel ret=%d\n", ret)); ++#endif + } + wl_cfg80211_p2plo_deinit(cfg); + } @@ -1158993,7 +1160712,7 @@ index 000000000..a8e96385b + } + else if (strnicmp(command, CMD_INTERFACE_CREATE, strlen(CMD_INTERFACE_CREATE)) == 0) { + char *name = (command + strlen(CMD_INTERFACE_CREATE) +1); -+ ANDROID_INFO(("Creating %s interface\n", name)); ++ printk(KERN_INFO"Creating %s interface for wl_handle_private_cmd\n", name); + if (wl_cfg80211_add_if(wl_get_cfg(net), net, WL_IF_TYPE_STA, + name, NULL) == NULL) { + bytes_written = -ENODEV; @@ -1168148,10 +1169867,10 @@ index 000000000..ff10499ff + diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfg80211.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfg80211.c new file mode 100755 -index 000000000..7680903aa +index 000000000..f93062cc2 --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfg80211.c -@@ -0,0 +1,24840 @@ +@@ -0,0 +1,25011 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Linux cfg80211 driver @@ -1168185,7 +1169904,9 @@ index 000000000..7680903aa +#include +#include +#include -+ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++#include "hdf_mac80211_sta_event.h" ++#endif +#include +#include +#include @@ -1168311,6 +1170032,7 @@ index 000000000..7680903aa + +static struct device *cfg80211_parent_dev = NULL; +static struct bcm_cfg80211 *g_bcmcfg = NULL; ++//u32 wl_dbg_level = 0xff; +u32 wl_dbg_level = WL_DBG_ERR; // | WL_DBG_P2P_ACTION | WL_DBG_INFO; + +#define MAX_VIF_OFFSET 15 @@ -1168351,6 +1170073,31 @@ index 000000000..7680903aa +}; +#endif /* WL_RELMCAST */ + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++#include "hdf_wl_interface.h" ++#include "net_device.h" ++int32_t HdfWifiEventMgmtTxStatus(const struct NetDevice *netDev, const uint8_t *buf, size_t len, uint8_t ack); ++int32_t HdfWifiEventRxMgmt(const struct NetDevice *netDev, int32_t freq, int32_t sigMbm, const uint8_t *buf, size_t len); ++int32_t HdfWifiEventCsaChannelSwitch(const struct NetDevice *netDev, int32_t freq); ++int32_t HdfWifiEventRemainOnChannel(const struct NetDevice *netDev, uint32_t freq, uint32_t duration); ++ ++struct NetDevice * GetHdfNetDeviceByLinuxInf(struct net_device *dev); ++ ++int ChangNewSta(struct net_device *dev, const uint8_t *macAddr, uint8_t addrLen, ++ const struct station_info *info); ++int ChangDelSta(struct net_device *dev,const uint8_t *macAddr, uint8_t addrLen); ++extern void HdfInformBssFrameEventCallback(struct net_device *ndev, struct ieee80211_channel *channel, int32_t signal, ++ int16_t freq, struct ieee80211_mgmt *mgmt, uint32_t mgmtLen); ++extern int32_t HdfConnectResultEventCallback(struct net_device *ndev, uint8_t *bssid, uint8_t *reqIe, ++ uint8_t *rspIe, uint32_t reqIeLen, uint32_t rspIeLen, uint16_t connectStatus, uint16_t freq); ++ ++extern int g_event_ifidx; ++extern struct hdf_inf_map g_hdf_infmap[HDF_INF_MAX]; ++struct NetDevice * get_hdf_netdev(int ifidx); ++extern int g_mgmt_tx_event_ifidx; ++ ++#endif ++ +/* This is to override regulatory domains defined in cfg80211 module (reg.c) + * By default world regulatory domain defined in reg.c puts the flags NL80211_RRF_PASSIVE_SCAN + * and NL80211_RRF_NO_IBSS for 5GHz channels (for 36..48 and 149..165). @@ -1168381,6 +1170128,14 @@ index 000000000..7680903aa + /* IEEE 802.11a, channel 100..165 */ + REG_RULE(5470-10, 5850+10, 40, 6, 20, 0), } +}; ++ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++const struct ieee80211_regdomain * bdh6_get_regdomain(void) ++{ ++ return &brcm_regdom; ++} ++#endif ++ +#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == \ + 4 && __GNUC_MINOR__ >= 6)) +_Pragma("GCC diagnostic pop") @@ -1168637,13 +1170392,19 @@ index 000000000..7680903aa +static s32 wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, + struct net_device *dev, bool enabled, + s32 timeout); -+static int wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, ++#ifndef CONFIG_AP6XXX_WIFI6_HDF ++static ++#endif ++int wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_connect_params *sme); +#if defined(WL_FILS) +static int wl_cfg80211_update_connect_params(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_connect_params *sme, u32 changed); +#endif /* WL_FILS */ -+static s32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, ++#ifndef CONFIG_AP6XXX_WIFI6_HDF ++static ++#endif ++s32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, + u16 reason_code); +#if defined(WL_CFG80211_P2P_DEV_IF) +static s32 @@ -1169978,9 +1171739,15 @@ index 000000000..7680903aa + return NULL; + } + ++ printk(KERN_INFO"wl_cfg80211_p2p_if_add type=%d, name=%s\n", wl_iftype, name); ++ +#if defined(WL_CFG80211_P2P_DEV_IF) + if (wl_iftype == WL_IF_TYPE_P2P_DISC) { + /* Handle Dedicated P2P discovery Interface */ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ // cache @mac_addr ... ++ memcpy(g_hdf_infmap[HDF_INF_P2P0].macaddr, mac_addr, ETH_ALEN); ++#endif + return wl_cfgp2p_add_p2p_disc_if(cfg); + } +#endif /* WL_CFG80211_P2P_DEV_IF */ @@ -1171064,8 +1172831,8 @@ index 000000000..7680903aa + dhd_pub_t *dhd; + wl_iftype_t macaddr_iftype = wl_iftype; + -+ WL_INFORM_MEM(("if name: %s, wl_iftype:%d \n", -+ name ? name : "NULL", wl_iftype)); ++ printk(KERN_INFO"%s if name: %s, wl_iftype:%d \n", __func__, ++ name ? name : "NULL", wl_iftype); + if (!cfg || !primary_ndev || !name) { + WL_ERR(("cfg/ndev/name ptr null\n")); + return NULL; @@ -1171254,6 +1173021,7 @@ index 000000000..7680903aa + return ERR_PTR(-EINVAL); + } + ++ printk(KERN_INFO"wl_cfg80211_add_if %s new ifname=%s, type=%u,mode=%u\n", primary_ndev->name, name, wl_iftype, wl_mode); + wdev = wl_cfg80211_add_if(cfg, primary_ndev, wl_iftype, name, NULL); + if (unlikely(!wdev)) { + return ERR_PTR(-ENODEV); @@ -1171579,8 +1173347,8 @@ index 000000000..7680903aa + if (!dhd) + return -EINVAL; + -+ WL_INFORM_MEM(("[%s] Enter. current cfg_iftype:%d new cfg_iftype:%d \n", -+ ndev->name, ndev->ieee80211_ptr->iftype, type)); ++ printk(KERN_INFO"[%s] Enter. current cfg_iftype:%d new cfg_iftype:%d \n", ++ ndev->name, ndev->ieee80211_ptr->iftype, type); + primary_ndev = bcmcfg_to_prmry_ndev(cfg); + + if (cfg80211_to_wl_iftype(type, &wl_iftype, &wl_mode) < 0) { @@ -1174394,7 +1176162,10 @@ index 000000000..7680903aa +#define MAX_SCAN_ABORT_WAIT_CNT 20 +#define WAIT_SCAN_ABORT_OSL_SLEEP_TIME 10 + -+static s32 ++#ifndef CONFIG_AP6XXX_WIFI6_HDF ++static ++#endif ++s32 +wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_connect_params *sme) +{ @@ -1174424,7 +1176195,7 @@ index 000000000..7680903aa + int wait_cnt; + char sec[32]; + -+ WL_DBG(("In\n")); ++ WL_DBG(("In %s\n", dev->name)); + if (!dev) { + WL_ERR(("dev is null\n")); + return -EINVAL; @@ -1174962,7 +1176733,10 @@ index 000000000..7680903aa + return; +} + -+static s32 ++#ifndef CONFIG_AP6XXX_WIFI6_HDF ++static ++#endif ++s32 +wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, + u16 reason_code) +{ @@ -1176220,7 +1177994,7 @@ index 000000000..7680903aa + dhd_pub_t *dhd = cfg->pub; + RETURN_EIO_IF_NOT_UP(cfg); + -+ WL_DBG(("Enter\n")); ++ WL_DBG(("Enter %s enable=%d, timeout=%u\n", dev->name, enabled, timeout)); + mode = wl_get_mode_by_netdev(cfg, dev); + if (cfg->p2p_net == dev || _net_info == NULL || + !wl_get_drv_status(cfg, CONNECTED, dev) || @@ -1176785,6 +1178559,10 @@ index 000000000..7680903aa + s32 err = BCME_OK; + struct ether_addr primary_mac; + struct net_device *ndev = NULL; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ NetDevice *netdev = NULL; ++ int ret = 0; ++#endif + struct bcm_cfg80211 *cfg = wiphy_priv(wiphy); + + RETURN_EIO_IF_NOT_UP(cfg); @@ -1176918,8 +1178696,14 @@ index 000000000..7680903aa + if (err == BCME_OK) { + WL_DBG(("Success\n")); +#if defined(WL_CFG80211_P2P_DEV_IF) ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ netdev = get_hdf_netdev(HDF_INF_P2P0); ++ ret = HdfWifiEventRemainOnChannel(netdev, channel->center_freq, duration); ++ printk(KERN_INFO"call HdfWifiEventRemainOnChannel cookie=%llu, ret=%d\n", *cookie, ret); ++#else + cfg80211_ready_on_channel(cfgdev, *cookie, channel, + duration, GFP_KERNEL); ++#endif +#else + cfg80211_ready_on_channel(cfgdev, *cookie, channel, + channel_type, duration, GFP_KERNEL); @@ -1176968,7 +1178752,7 @@ index 000000000..7680903aa + + if (cfg->last_roc_id == cookie) { + wl_cfgp2p_set_p2p_mode(cfg, WL_P2P_DISC_ST_SCAN, 0, 0, -+ wl_to_p2p_bss_bssidx(cfg, P2PAPI_BSSCFG_DEVICE)); ++ wl_to_p2p_bss_bssidx(cfg, P2PAPI_BSSCFG_DEVICE)); + } else { + WL_ERR(("wl_cfg80211_cancel_remain_on_channel: ignore, request cookie(%llu)" + " is not matched. (cur : %llu)\n", @@ -1177702,7 +1179486,7 @@ index 000000000..7680903aa + } + } + -+ WL_DBG(("TX target bssidx=%d\n", bssidx)); ++ WL_DBG(("TX target bssidx=%d, wdev iftype=%d, center_freq=%u\n", bssidx, cfgdev->iftype, params->chan->center_freq)); + + if (p2p_is_on(cfg)) { + /* Suspend P2P discovery search-listen to prevent it from changing the @@ -1177729,6 +1179513,9 @@ index 000000000..7680903aa + wl_cfg80211_set_mgmt_vndr_ies(cfg, ndev_to_cfgdev(dev), bssidx, + VNDR_IE_PRBRSP_FLAG, (const u8 *)(buf + ie_offset), ie_len); + cfg80211_mgmt_tx_status(cfgdev, *cookie, buf, len, true, GFP_KERNEL); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventMgmtTxStatus(get_hdf_netdev(g_mgmt_tx_event_ifidx), buf, len, true); ++#endif +#if defined(P2P_IE_MISSING_FIX) + if (!cfg->p2p_prb_noti) { + cfg->p2p_prb_noti = true; @@ -1177767,6 +1179554,9 @@ index 000000000..7680903aa + wl_delay(400); + + cfg80211_mgmt_tx_status(cfgdev, *cookie, buf, len, true, GFP_KERNEL); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventMgmtTxStatus(get_hdf_netdev(g_mgmt_tx_event_ifidx), buf, len, true); ++#endif + goto exit; + + } else if (ieee80211_is_action(mgmt->frame_control)) { @@ -1177814,6 +1179604,9 @@ index 000000000..7680903aa + } + MFREE(cfg->osh, ambuf, param_len); + cfg80211_mgmt_tx_status(cfgdev, *cookie, buf, len, ack, GFP_KERNEL); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventMgmtTxStatus(get_hdf_netdev(g_mgmt_tx_event_ifidx), buf, len, ack); ++#endif + goto exit; + } +#endif /* WL_CLIENT_SAE */ @@ -1177861,6 +1179654,9 @@ index 000000000..7680903aa + ack = wl_cfg80211_send_action_frame(wiphy, dev, cfgdev, af_params, + action_frame, action_frame->len, bssidx); + cfg80211_mgmt_tx_status(cfgdev, *cookie, buf, len, ack, GFP_KERNEL); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventMgmtTxStatus(get_hdf_netdev(g_mgmt_tx_event_ifidx), buf, len, ack); ++#endif + + MFREE(cfg->osh, af_params, WL_WIFI_AF_PARAMS_SIZE); +exit: @@ -1180823,7 +1182619,10 @@ index 000000000..7680903aa +} +#endif /* WL_SUPPORT_ACS */ + -+static struct cfg80211_ops wl_cfg80211_ops = { ++#ifndef CONFIG_AP6XXX_WIFI6_HDF ++static ++#endif ++struct cfg80211_ops wl_cfg80211_ops = { + .add_virtual_intf = wl_cfg80211_add_virtual_iface, + .del_virtual_intf = wl_cfg80211_del_virtual_iface, + .change_virtual_intf = wl_cfg80211_change_virtual_iface, @@ -1181473,7 +1183272,9 @@ index 000000000..7680903aa + gfp_t aflags; + u8 tmp_buf[IEEE80211_MAX_SSID_LEN + 1]; + chanspec_t chanspec; -+ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ struct net_device *ndev = bcmcfg_to_prmry_ndev(cfg); ++#endif + if (unlikely(dtoh32(bi->length) > WL_BSS_INFO_MAX)) { + WL_DBG(("Beacon is larger than buffer. Discarding\n")); + return err; @@ -1181552,7 +1183353,7 @@ index 000000000..7680903aa + channel = ieee80211_get_channel(wiphy, freq); + memcpy(tmp_buf, bi->SSID, bi->SSID_len); + tmp_buf[bi->SSID_len] = '\0'; -+ WL_SCAN(("BSSID %pM, channel %3d(%3d %3sMHz), rssi %3d, capa 0x%-4x, mgmt_type %d, " ++ WL_ERR(("###0331###BSSID %pM, channel %3d(%3d %3sMHz), rssi %3d, capa 0x%-4x, mgmt_type %d, " + "frame_len %3d, SSID \"%s\"\n", + &bi->BSSID, notif_bss_info->channel, CHSPEC_CHANNEL(chanspec), + CHSPEC_IS20(chanspec)?"20": @@ -1181569,7 +1183370,7 @@ index 000000000..7680903aa + return -EINVAL; + } + -+ signal = notif_bss_info->rssi * 100; ++ signal = notif_bss_info->rssi*100; + if (!mgmt->u.probe_resp.timestamp) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) + struct osl_timespec ts; @@ -1181594,7 +1183395,10 @@ index 000000000..7680903aa + } + + CFG80211_PUT_BSS(wiphy, cbss); -+ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ //WL_ERR(("bdh6 frame_len %u == %u, netdev=%s\n", le16_to_cpu(notif_bss_info->frame_len), notif_bss_info->frame_len, ndev->name)); ++ HdfInformBssFrameEventCallback(ndev, channel, signal, freq, mgmt, notif_bss_info->frame_len); ++#endif + if (DBG_RING_ACTIVE(dhdp, DHD_EVENT_RING_ID) && + (cfg->sched_scan_req && !cfg->scan_request)) { + alloc_len = sizeof(log_conn_event_t) + IEEE80211_MAX_SSID_LEN + sizeof(uint16) + @@ -1181928,6 +1183732,9 @@ index 000000000..7680903aa + if (!err) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) + cfg80211_rx_mgmt(cfgdev, freq, 0, mgmt_frame, len, 0); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventRxMgmt(get_hdf_netdev(g_event_ifidx), freq, 0, mgmt_frame, len); ++#endif +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) + cfg80211_rx_mgmt(cfgdev, freq, 0, mgmt_frame, len, 0, GFP_ATOMIC); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) @@ -1182108,6 +1183915,9 @@ index 000000000..7680903aa + ((event == WLC_E_DEAUTH_IND) || (event == WLC_E_DEAUTH))) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) + cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventRxMgmt(get_hdf_netdev(g_event_ifidx), freq, 0, mgmt_frame, len); ++#endif +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) + cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0, GFP_ATOMIC); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || \ @@ -1182147,6 +1183957,9 @@ index 000000000..7680903aa + wl_ext_in4way_sync(ndev, AP_WAIT_STA_RECONNECT, + WL_EXT_STATUS_STA_CONNECTED, (void *)&e->addr); + cfg80211_new_sta(ndev, e->addr.octet, &sinfo, GFP_ATOMIC); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ ChangNewSta(ndev,e->addr.octet,6,&sinfo); ++#endif +#ifdef WL_WPS_SYNC + wl_wps_session_update(ndev, WPS_STATE_LINKUP, e->addr.octet); +#endif /* WL_WPS_SYNC */ @@ -1182158,6 +1183971,9 @@ index 000000000..7680903aa + wl_ext_in4way_sync(ndev, AP_WAIT_STA_RECONNECT, + WL_EXT_STATUS_STA_DISCONNECTED, (void *)&e->addr); + cfg80211_del_sta(ndev, e->addr.octet, GFP_ATOMIC); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ ChangDelSta(ndev,e->addr.octet,6); ++#endif +#ifdef WL_WPS_SYNC + wl_wps_session_update(ndev, WPS_STATE_LINKDOWN, e->addr.octet); +#endif /* WL_WPS_SYNC */ @@ -1182352,6 +1184168,9 @@ index 000000000..7680903aa + if (event == WLC_E_ASSOC_IND && reason == DOT11_SC_SUCCESS) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) + cfg80211_rx_mgmt(cfgdev, freq, rssi, mgmt_frame, len, 0); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventRxMgmt(get_hdf_netdev(g_event_ifidx), freq, rssi, mgmt_frame, len); ++#endif +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) + cfg80211_rx_mgmt(cfgdev, freq, 0, mgmt_frame, len, 0, GFP_ATOMIC); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) @@ -1182362,6 +1184181,9 @@ index 000000000..7680903aa + } else if (event == WLC_E_DISASSOC_IND) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) + cfg80211_rx_mgmt(cfgdev, freq, rssi, mgmt_frame, len, 0); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventRxMgmt(get_hdf_netdev(g_event_ifidx), freq, rssi, mgmt_frame, len); ++#endif +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) + cfg80211_rx_mgmt(cfgdev, freq, 0, mgmt_frame, len, 0, GFP_ATOMIC); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) @@ -1182372,6 +1184194,9 @@ index 000000000..7680903aa + } else if ((event == WLC_E_DEAUTH_IND) || (event == WLC_E_DEAUTH)) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) + cfg80211_rx_mgmt(cfgdev, freq, rssi, mgmt_frame, len, 0); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventRxMgmt(get_hdf_netdev(g_event_ifidx), freq, rssi, mgmt_frame, len); ++#endif +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) + cfg80211_rx_mgmt(cfgdev, freq, 0, mgmt_frame, len, 0, GFP_ATOMIC); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) @@ -1182382,6 +1184207,9 @@ index 000000000..7680903aa + } else if (event == WLC_E_AUTH) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) + cfg80211_rx_mgmt(cfgdev, freq, rssi, mgmt_frame, len, 0); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventRxMgmt(get_hdf_netdev(g_event_ifidx), freq, rssi, mgmt_frame, len); ++#endif +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) + cfg80211_rx_mgmt(cfgdev, freq, 0, mgmt_frame, len, 0, GFP_ATOMIC); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) @@ -1182745,6 +1184573,9 @@ index 000000000..7680903aa + ((event == WLC_E_DEAUTH_IND) || (event == WLC_E_DEAUTH))) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) + cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventRxMgmt(get_hdf_netdev(g_event_ifidx), freq, 0, mgmt_frame, len); ++#endif +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) + cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0, GFP_ATOMIC); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || \ @@ -1182794,6 +1184625,36 @@ index 000000000..7680903aa +} +#endif /* WLMESH_CFG80211 */ + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++static s32 wl_notify_connect_sta_status(struct bcm_cfg80211 *cfg, struct net_device *ndev, ++ const wl_event_msg_t *e, void *data, bool completed, struct cfg80211_bss *bss) ++{ ++ uint8_t *curbssid = NULL; ++ uint16_t connectStatus = 0; ++ uint16_t freq = 0; ++ struct wl_connect_info *conn_info = NULL; ++ conn_info = wl_to_conn(cfg); ++ curbssid = (uint8_t *)wl_read_prof(cfg, ndev, WL_PROF_BSSID); ++ ++ if(completed) { ++ connectStatus = 0; ++ } else { ++ connectStatus = 1; ++ } ++ ++ if(bss != NULL) { ++ if(bss->channel != NULL) { ++ freq = bss->channel->center_freq; ++ } ++ } ++ ++ HdfConnectResultEventCallback(ndev, curbssid, conn_info->req_ie, conn_info->resp_ie, \ ++ conn_info->req_ie_len, conn_info->resp_ie_len, connectStatus, freq); ++ ++ return 0; ++} ++#endif ++ +static s32 +wl_notify_connect_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, + const wl_event_msg_t *e, void *data) @@ -1183187,6 +1185048,9 @@ index 000000000..7680903aa +#endif /* WL_ANALYTICS */ + } + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfDisconnectedEventCallback(ndev, reason, ie_ptr, ie_len); ++#endif + CFG80211_DISCONNECTED(ndev, reason, ie_ptr, ie_len, + loc_gen, GFP_KERNEL); + WL_INFORM_MEM(("[%s] Disconnect event sent to upper layer" @@ -1184375,6 +1186239,10 @@ index 000000000..7680903aa + sec->auth_assoc_res_status : + WLAN_STATUS_UNSPECIFIED_FAILURE, + GFP_KERNEL); ++ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ wl_notify_connect_sta_status(cfg, ndev, e, data, completed, bss); ++#endif + } + } else { + WL_INFORM_MEM(("[%s] Ignore event:%d. drv status" @@ -1184619,6 +1186487,9 @@ index 000000000..7680903aa +{ + struct ieee80211_supported_band *band; + struct wiphy *wiphy = bcmcfg_to_wiphy(cfg); ++//#ifdef CONFIG_AP6XXX_WIFI6_HDF ++// struct net_device *netdev = bcmcfg_to_prmry_ndev(cfg); ++//#endif + struct ether_addr da; + struct ether_addr bssid; + bool isfree = false; @@ -1184921,6 +1186792,9 @@ index 000000000..7680903aa + WL_DBG(("Rx Managment frame For Iface (%s) \n", ndev->name)); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) + cfg80211_rx_mgmt(cfgdev, freq, 0, mgmt_frame, mgmt_frame_len, 0); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventRxMgmt(get_hdf_netdev(g_event_ifidx), freq, 0, mgmt_frame, mgmt_frame_len); ++#endif +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) + cfg80211_rx_mgmt(cfgdev, freq, 0, mgmt_frame, mgmt_frame_len, 0, GFP_ATOMIC); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || \ @@ -1185483,9 +1187357,11 @@ index 000000000..7680903aa + break; + } + case NETDEV_UNREGISTER: ++ WL_DBG(("lijg123: unregister notify begin %s\n", dev->name)); + wl_cfg80211_clear_per_bss_ies(cfg, wdev); + /* after calling list_del_rcu(&wdev->list) */ + wl_dealloc_netinfo_by_wdev(cfg, wdev); ++ WL_DBG(("lijg123: unregister notify end %s\n", dev->name)); + break; + case NETDEV_GOING_DOWN: + /* @@ -1185994,6 +1187870,10 @@ index 000000000..7680903aa + return BCME_OK; +} + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++void set_krn_wiphy(void *pwiphy); ++#endif ++ +s32 wl_cfg80211_attach(struct net_device *ndev, void *context) +{ + struct wireless_dev *wdev; @@ -1186036,6 +1187916,9 @@ index 000000000..7680903aa + spin_lock_init(&cfg->vndr_oui_sync); + spin_lock_init(&cfg->net_list_sync); + ndev->ieee80211_ptr = wdev; ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ set_krn_wiphy(wdev->wiphy); ++#endif + SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); + wdev->netdev = ndev; + cfg->state_notifier = wl_notifier_change_state; @@ -1187905,6 +1189788,10 @@ index 000000000..7680903aa +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) + cfg80211_rx_mgmt(cfgdev, cfg->tdls_mgmt_freq, 0, + cfg->tdls_mgmt_frame, cfg->tdls_mgmt_frame_len, 0); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventRxMgmt(get_hdf_netdev(g_event_ifidx), cfg->tdls_mgmt_freq, 0, ++ cfg->tdls_mgmt_frame, cfg->tdls_mgmt_frame_len); ++#endif +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) + cfg80211_rx_mgmt(cfgdev, cfg->tdls_mgmt_freq, 0, + cfg->tdls_mgmt_frame, cfg->tdls_mgmt_frame_len, 0, @@ -1189789,6 +1191676,9 @@ index 000000000..7680903aa +#if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) + freq = chandef.chan ? chandef.chan->center_freq : chandef.center_freq1; + cfg80211_ch_switch_notify(dev, &chandef); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfWifiEventCsaChannelSwitch(get_hdf_netdev(HDF_INF_P2P0), freq); ++#endif +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) + freq = chan_info.freq; + cfg80211_ch_switch_notify(dev, freq, chan_info.chan_type); @@ -1205119,10 +1207009,10 @@ index 000000000..6eca82b80 +#endif /* _wl_cfgnan_h_ */ diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfgp2p.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfgp2p.c new file mode 100755 -index 000000000..510fbd2f0 +index 000000000..ed9d89fc2 --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfgp2p.c -@@ -0,0 +1,2750 @@ +@@ -0,0 +1,2792 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Linux cfgp2p driver @@ -1205208,9 +1207098,17 @@ index 000000000..510fbd2f0 +}; +#endif /* WL_ENABLE_P2P_IF */ + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++#include "net_device.h" ++ ++extern int g_event_ifidx; ++struct NetDevice * get_hdf_netdev(int ifidx); ++int32_t HdfWifiEventCancelRemainOnChannel(const struct NetDevice *netDev, uint32_t freq); ++#else +int dhd_del_monitor(struct net_device *ndev); +int magiclink_add_p2p(const char *name, struct ether_addr *p2p_dev_addr, struct net_device **new_ndev); +struct net_device* p2p_debug_ndev = NULL; ++#endif + +bool wl_cfgp2p_is_pub_action(void *frame, u32 frame_len) +{ @@ -1206549,6 +1208447,11 @@ index 000000000..510fbd2f0 + cfg80211_remain_on_channel_expired(cfgdev, cfg->last_roc_id, + &cfg->remain_on_chan, cfg->remain_on_chan_type, GFP_KERNEL); +#endif /* WL_CFG80211_P2P_DEV_IF */ ++ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ ret = HdfWifiEventCancelRemainOnChannel(get_hdf_netdev(g_event_ifidx), cfg->remain_on_chan.center_freq); ++ WL_ERR(("HdfWifiEventCancelRemainOnChannel ret=%d\n", ret)); ++#endif + } + } +#endif /* P2P_LISTEN_OFFLOADING */ @@ -1206599,6 +1208502,10 @@ index 000000000..510fbd2f0 + */ + cfg80211_remain_on_channel_expired(bcmcfg_to_p2p_wdev(cfg), + cfg->last_roc_id, &cfg->remain_on_chan, GFP_KERNEL); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ ret = HdfWifiEventCancelRemainOnChannel(get_hdf_netdev(g_event_ifidx), cfg->remain_on_chan.center_freq); ++ WL_ERR(("HdfWifiEventCancelRemainOnChannel ret=%d\n", ret)); ++#endif + } else + CFGP2P_ERR(("Invalid cfgdev. Dropping the" + "remain_on_channel_expired event.\n")); @@ -1206607,6 +1208514,11 @@ index 000000000..510fbd2f0 + cfg80211_remain_on_channel_expired(cfgdev, + cfg->last_roc_id, &cfg->remain_on_chan, + cfg->remain_on_chan_type, GFP_KERNEL); ++ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ ret = HdfWifiEventCancelRemainOnChannel(get_hdf_netdev(g_event_ifidx), cfg->remain_on_chan.center_freq); ++ WL_ERR(("HdfWifiEventCancelRemainOnChannel ret=%d\n", ret)); ++#endif +#endif /* WL_CFG80211_P2P_DEV_IF */ + } + } @@ -1206680,6 +1208592,12 @@ index 000000000..510fbd2f0 + cfg80211_remain_on_channel_expired(ndev, cfg->last_roc_id, + &cfg->remain_on_chan, cfg->remain_on_chan_type, GFP_KERNEL); +#endif /* WL_CFG80211_P2P_DEV_IF */ ++ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ int ret =0; ++ ret = HdfWifiEventCancelRemainOnChannel(get_hdf_netdev(g_event_ifidx), cfg->remain_on_chan.center_freq); ++ WL_ERR(("HdfWifiEventCancelRemainOnChannel ret=%d\n", ret)); ++#endif + } + } + return 0; @@ -1207457,6 +1209375,16 @@ index 000000000..510fbd2f0 +}; +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) */ + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++int hdf_cfgp2p_register_ndev(struct net_device *p2p_netdev, struct net_device *primary_netdev, struct wiphy *wiphy) ++{ ++ ++ //SET_NETDEV_DEV(p2p_netdev, wiphy); ++ WL_MSG(p2p_netdev->name, "P2P Interface Registered\n"); ++ return 0; ++} ++#endif ++ +#if defined(WL_ENABLE_P2P_IF) +s32 +wl_cfgp2p_register_ndev(struct bcm_cfg80211 *cfg) @@ -1207645,7 +1209573,7 @@ index 000000000..510fbd2f0 + if (!cfg || !cfg->p2p_supported) + return ERR_PTR(-EINVAL); + -+ WL_TRACE(("Enter\n")); ++ printk(KERN_INFO"Enter wl_cfgp2p_add_p2p_disc_if, p2p_wdev=%p\n", cfg->p2p_wdev); + + if (cfg->p2p_wdev) { +#ifndef EXPLICIT_DISCIF_CLEANUP @@ -1207706,11 +1209634,12 @@ index 000000000..510fbd2f0 + /* store p2p wdev ptr for further reference. */ + cfg->p2p_wdev = wdev; + -+ printf("P2P interface registered\n"); ++ printf("P2P interface registered, wdev mac = %02x:%02x:%02x:%02x:%02x:%02x\n", wdev->address[0], wdev->address[1], ++ wdev->address[2], wdev->address[3], wdev->address[4], wdev->address[5]); + printf("%s: wdev: %p, wdev->net: %p\n", __FUNCTION__, wdev, wdev->netdev); -+ -+ magiclink_add_p2p("p2p0",wl_to_p2p_bss_macaddr(cfg, P2PAPI_BSSCFG_DEVICE), &p2p_debug_ndev); -+ ++#ifndef CONFIG_AP6XXX_WIFI6_HDF ++ magiclink_add_p2p("p2p0", wl_to_p2p_bss_macaddr(cfg, P2PAPI_BSSCFG_DEVICE), &p2p_debug_ndev); ++#endif + return wdev; +} + @@ -1207805,7 +1209734,7 @@ index 000000000..510fbd2f0 + return -EINVAL; + } + -+ WL_INFORM(("Enter\n")); ++ printk(KERN_INFO"Enter wl_cfgp2p_del_p2p_disc_if wdev->netdev=%p %d\n", wdev->netdev, wdev->iftype); + + if (!cfg->p2p_wdev) { + WL_ERR(("Already deleted p2p_wdev\n")); @@ -1207817,7 +1209746,9 @@ index 000000000..510fbd2f0 + rollback_lock = true; + } + ++#ifndef CONFIG_AP6XXX_WIFI6_HDF + cfg80211_unregister_wdev(wdev); ++#endif + + if (rollback_lock) + rtnl_unlock(); @@ -1207829,9 +1209760,10 @@ index 000000000..510fbd2f0 + cfg->p2p_wdev = NULL; + + CFGP2P_ERR(("P2P interface unregistered\n")); ++#ifndef CONFIG_AP6XXX_WIFI6_HDF + if (p2p_debug_ndev != NULL) + dhd_del_monitor(p2p_debug_ndev); -+ ++#endif + return 0; +} +#endif /* WL_CFG80211_P2P_DEV_IF */ @@ -1208339,10 +1210271,10 @@ index 000000000..e47f8af9b +#endif /* _wl_cfgp2p_h_ */ diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfgscan.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfgscan.c new file mode 100755 -index 000000000..8b9382deb +index 000000000..d6e5dfb40 --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfgscan.c -@@ -0,0 +1,3298 @@ +@@ -0,0 +1,3344 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Linux cfg80211 driver scan related code @@ -1208427,6 +1210359,9 @@ index 000000000..8b9382deb +#include "dhd_rtt.h" +#endif /* RTT_SUPPORT */ +#include ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++#include "hdf_mac80211_sta_event.h" ++#endif + +#define ACTIVE_SCAN 1 +#define PASSIVE_SCAN 0 @@ -1209029,11 +1210964,19 @@ index 000000000..8b9382deb + } + wl_inform_bss(cfg); + wl_notify_escan_complete(cfg, ndev, false, false); ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ printk("scan done success!\n"); ++ HdfScanEventCallback(ndev, HDF_WIFI_SCAN_SUCCESS); ++#endif + } + wl_escan_increment_sync_id(cfg, SCAN_BUF_NEXT); + } else if ((status == WLC_E_STATUS_ABORT) || (status == WLC_E_STATUS_NEWSCAN) || + (status == WLC_E_STATUS_11HQUIET) || (status == WLC_E_STATUS_CS_ABORT) || + (status == WLC_E_STATUS_NEWASSOC)) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ printk("scan abort status=%d\n", status); ++ //HdfScanEventCallback(ndev, HDF_WIFI_SCAN_FAILED); ++#endif + /* Dump FW preserve buffer content */ + if (status == WLC_E_STATUS_ABORT) { + wl_flush_fw_log_buffer(ndev, FW_LOGSET_MASK_ALL); @@ -1209093,12 +1211036,19 @@ index 000000000..8b9382deb + } + wl_escan_increment_sync_id(cfg, SCAN_BUF_CNT); + } else if (status == WLC_E_STATUS_TIMEOUT) { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ HdfScanEventCallback(ndev, HDF_WIFI_SCAN_TIMEOUT); ++#endif + WL_ERR(("WLC_E_STATUS_TIMEOUT : scan_request[%p]\n", cfg->scan_request)); + WL_ERR(("reason[0x%x]\n", e->reason)); + if (e->reason == 0xFFFFFFFF) { + wl_notify_escan_complete(cfg, cfg->escan_info.ndev, true, true); + } + } else { ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ printk("scan failed 3\n"); ++ HdfScanEventCallback(ndev, HDF_WIFI_SCAN_FAILED); ++#endif + WL_ERR(("unexpected Escan Event %d : abort\n", status)); + cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE; + wl_escan_print_sync_id(status, escan_result->sync_id, @@ -1210219,7 +1212169,7 @@ index 000000000..8b9382deb + struct net_device *ndev = wdev_to_wlc_ndev(request->wdev, cfg); +#endif /* WL_CFG80211_P2P_DEV_IF */ + -+ WL_DBG(("Enter\n")); ++ WL_DBG(("Enter request wdev netdev=%s, wdev iftype=%d\n", ndev->name, request->wdev->iftype)); + RETURN_EIO_IF_NOT_UP(cfg); + +#ifdef DHD_IFDEBUG @@ -1210482,6 +1212432,20 @@ index 000000000..8b9382deb + WL_DBG(("wl_cfg80211_abort_scan: Scan abort issued to FW\n")); + } +} ++#else ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++void ++wl_cfg80211_abort_scan(struct wiphy *wiphy, struct wireless_dev *wdev) ++{ ++ struct bcm_cfg80211 *cfg; ++ ++ WL_DBG(("Enter wl_cfg80211_abort_scan\n")); ++ cfg = wiphy_priv(wdev->wiphy); ++ ++ /* cancel scan and notify scan status */ ++ wl_cfg80211_cancel_scan(cfg); ++} ++#endif +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) */ + +int wl_cfg80211_scan_stop(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev) @@ -1210518,10 +1212482,19 @@ index 000000000..8b9382deb +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)) + memset_s(&info, sizeof(struct cfg80211_scan_info), 0, sizeof(struct cfg80211_scan_info)); + info.aborted = aborted; ++ ++#ifndef CONFIG_AP6XXX_WIFI6_HDF + cfg80211_scan_done(cfg->scan_request, &info); ++#endif +#else ++#ifndef CONFIG_AP6XXX_WIFI6_HDF + cfg80211_scan_done(cfg->scan_request, aborted); ++#endif +#endif // endif ++ ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++ WifiScanFree(&cfg->scan_request); ++#endif + cfg->scan_request = NULL; +} + @@ -1210773,9 +1212746,14 @@ index 000000000..8b9382deb + + bzero(&info, sizeof(struct cfg80211_scan_info)); + info.aborted = aborted; ++ ++#ifndef CONFIG_AP6XXX_WIFI6_HDF + cfg80211_scan_done(cfg->scan_request, &info); ++#endif +#else ++#ifndef CONFIG_AP6XXX_WIFI6_HDF + cfg80211_scan_done(cfg->scan_request, aborted); ++#endif +#endif // endif +} + @@ -1211643,10 +1213621,10 @@ index 000000000..8b9382deb +} diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfgscan.h b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfgscan.h new file mode 100755 -index 000000000..236d3ed29 +index 000000000..ddd133514 --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfgscan.h -@@ -0,0 +1,96 @@ +@@ -0,0 +1,101 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Header for Linux cfg80211 scan @@ -1211716,6 +1213694,11 @@ index 000000000..236d3ed29 +#endif /* WL_CFG80211_P2P_DEV_IF */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) +extern void wl_cfg80211_abort_scan(struct wiphy *wiphy, struct wireless_dev *wdev); ++#else ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++void ++wl_cfg80211_abort_scan(struct wiphy *wiphy, struct wireless_dev *wdev); ++#endif +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) */ +extern void wl_cfg80211_scan_abort(struct bcm_cfg80211 *cfg); +extern s32 wl_init_scan(struct bcm_cfg80211 *cfg); @@ -1224486,10 +1226469,10 @@ index 000000000..d1ff33ae4 + diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_iw.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_iw.c new file mode 100755 -index 000000000..9281cdbe4 +index 000000000..789486268 --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_iw.c -@@ -0,0 +1,4335 @@ +@@ -0,0 +1,4340 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Linux Wireless Extensions support @@ -1224734,8 +1226717,13 @@ index 000000000..9281cdbe4 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) +#define WL_DEV_LINK(dev) (priv_link_t*)(dev->priv) +#else ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++void * VOID_DEV_PRIV(struct net_device *dev); ++#define WL_DEV_LINK(dev) (priv_link_t*)VOID_DEV_PRIV(dev) ++#else +#define WL_DEV_LINK(dev) (priv_link_t*)netdev_priv(dev) +#endif ++#endif + +/* dev to wl_iw_t */ +#define IW_DEV_IF(dev) ((wl_iw_t*)(WL_DEV_LINK(dev))->wliw) -- Gitee From 9bb7d44f173e8cbfee637e657f0ddd1e28db9301 Mon Sep 17 00:00:00 2001 From: zhouke Date: Thu, 28 Apr 2022 14:30:02 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0ap6275s=20WiFi6=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8HDF=E9=80=82=E9=85=8D=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhouke --- linux-5.10/rk3568_patch/hdf.patch | 0 linux-5.10/rk3568_patch/kernel.patch | 445 +++++++++------------------ 2 files changed, 153 insertions(+), 292 deletions(-) mode change 100644 => 100755 linux-5.10/rk3568_patch/hdf.patch diff --git a/linux-5.10/rk3568_patch/hdf.patch b/linux-5.10/rk3568_patch/hdf.patch old mode 100644 new mode 100755 diff --git a/linux-5.10/rk3568_patch/kernel.patch b/linux-5.10/rk3568_patch/kernel.patch index 0690632..0cba5a4 100644 --- a/linux-5.10/rk3568_patch/kernel.patch +++ b/linux-5.10/rk3568_patch/kernel.patch @@ -490,7 +490,7 @@ diff --git a/arch/arm/boot/dts/rk3036.dtsi b/arch/arm/boot/dts/rk3036.dtsi index 093567022..dc4c26a8a 100644 --- a/arch/arm/boot/dts/rk3036.dtsi +++ b/arch/arm/boot/dts/rk3036.dtsi -@@ -85,6 +85,11 @@ display-subsystem { +@@ -85,6 +85,11 @@ ports = <&vop_out>; }; @@ -502,7 +502,7 @@ index 093567022..dc4c26a8a 100644 timer { compatible = "arm,armv7-timer"; arm,cpu-registers-not-fw-configured; -@@ -360,7 +365,7 @@ pwm0: pwm@20050000 { +@@ -360,7 +365,7 @@ #pwm-cells = <3>; clocks = <&cru PCLK_PWM>; clock-names = "pwm"; @@ -511,7 +511,7 @@ index 093567022..dc4c26a8a 100644 pinctrl-0 = <&pwm0_pin>; status = "disabled"; }; -@@ -371,7 +376,7 @@ pwm1: pwm@20050010 { +@@ -371,7 +376,7 @@ #pwm-cells = <3>; clocks = <&cru PCLK_PWM>; clock-names = "pwm"; @@ -520,7 +520,7 @@ index 093567022..dc4c26a8a 100644 pinctrl-0 = <&pwm1_pin>; status = "disabled"; }; -@@ -382,7 +387,7 @@ pwm2: pwm@20050020 { +@@ -382,7 +387,7 @@ #pwm-cells = <3>; clocks = <&cru PCLK_PWM>; clock-names = "pwm"; @@ -529,7 +529,7 @@ index 093567022..dc4c26a8a 100644 pinctrl-0 = <&pwm2_pin>; status = "disabled"; }; -@@ -393,7 +398,7 @@ pwm3: pwm@20050030 { +@@ -393,7 +398,7 @@ #pwm-cells = <2>; clocks = <&cru PCLK_PWM>; clock-names = "pwm"; @@ -542,7 +542,7 @@ diff --git a/arch/arm/boot/dts/rk3066a-rayeager.dts b/arch/arm/boot/dts/rk3066a- index 309518403..1a9891f80 100644 --- a/arch/arm/boot/dts/rk3066a-rayeager.dts +++ b/arch/arm/boot/dts/rk3066a-rayeager.dts -@@ -23,6 +23,20 @@ ir: ir-receiver { +@@ -23,6 +23,20 @@ pinctrl-0 = <&ir_int>; }; @@ -567,7 +567,7 @@ diff --git a/arch/arm/boot/dts/rk3066a.dtsi b/arch/arm/boot/dts/rk3066a.dtsi index bbc3bff50..49b8652da 100644 --- a/arch/arm/boot/dts/rk3066a.dtsi +++ b/arch/arm/boot/dts/rk3066a.dtsi -@@ -800,22 +800,22 @@ power-domain@RK3066_PD_GPU { +@@ -800,22 +800,22 @@ }; &pwm0 { @@ -598,7 +598,7 @@ diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi index b6bde9d12..c1a87fbe1 100644 --- a/arch/arm/boot/dts/rk3188.dtsi +++ b/arch/arm/boot/dts/rk3188.dtsi -@@ -739,22 +739,22 @@ power-domain@RK3188_PD_GPU { +@@ -739,22 +739,22 @@ }; &pwm0 { @@ -629,7 +629,7 @@ diff --git a/arch/arm/boot/dts/rk322x.dtsi b/arch/arm/boot/dts/rk322x.dtsi index 7de8b006c..4b2b7f027 100644 --- a/arch/arm/boot/dts/rk322x.dtsi +++ b/arch/arm/boot/dts/rk322x.dtsi -@@ -398,7 +398,7 @@ pwm0: pwm@110b0000 { +@@ -398,7 +398,7 @@ #pwm-cells = <3>; clocks = <&cru PCLK_PWM>; clock-names = "pwm"; @@ -638,7 +638,7 @@ index 7de8b006c..4b2b7f027 100644 pinctrl-0 = <&pwm0_pin>; status = "disabled"; }; -@@ -409,7 +409,7 @@ pwm1: pwm@110b0010 { +@@ -409,7 +409,7 @@ #pwm-cells = <3>; clocks = <&cru PCLK_PWM>; clock-names = "pwm"; @@ -647,7 +647,7 @@ index 7de8b006c..4b2b7f027 100644 pinctrl-0 = <&pwm1_pin>; status = "disabled"; }; -@@ -420,7 +420,7 @@ pwm2: pwm@110b0020 { +@@ -420,7 +420,7 @@ #pwm-cells = <3>; clocks = <&cru PCLK_PWM>; clock-names = "pwm"; @@ -656,7 +656,7 @@ index 7de8b006c..4b2b7f027 100644 pinctrl-0 = <&pwm2_pin>; status = "disabled"; }; -@@ -431,7 +431,7 @@ pwm3: pwm@110b0030 { +@@ -431,7 +431,7 @@ #pwm-cells = <2>; clocks = <&cru PCLK_PWM>; clock-names = "pwm"; @@ -669,7 +669,7 @@ diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index 0d89ad274..8683c9c13 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi -@@ -695,7 +695,7 @@ pwm0: pwm@ff680000 { +@@ -695,7 +695,7 @@ compatible = "rockchip,rk3288-pwm"; reg = <0x0 0xff680000 0x0 0x10>; #pwm-cells = <3>; @@ -678,7 +678,7 @@ index 0d89ad274..8683c9c13 100644 pinctrl-0 = <&pwm0_pin>; clocks = <&cru PCLK_RKPWM>; clock-names = "pwm"; -@@ -706,7 +706,7 @@ pwm1: pwm@ff680010 { +@@ -706,7 +706,7 @@ compatible = "rockchip,rk3288-pwm"; reg = <0x0 0xff680010 0x0 0x10>; #pwm-cells = <3>; @@ -687,7 +687,7 @@ index 0d89ad274..8683c9c13 100644 pinctrl-0 = <&pwm1_pin>; clocks = <&cru PCLK_RKPWM>; clock-names = "pwm"; -@@ -717,7 +717,7 @@ pwm2: pwm@ff680020 { +@@ -717,7 +717,7 @@ compatible = "rockchip,rk3288-pwm"; reg = <0x0 0xff680020 0x0 0x10>; #pwm-cells = <3>; @@ -696,7 +696,7 @@ index 0d89ad274..8683c9c13 100644 pinctrl-0 = <&pwm2_pin>; clocks = <&cru PCLK_RKPWM>; clock-names = "pwm"; -@@ -728,7 +728,7 @@ pwm3: pwm@ff680030 { +@@ -728,7 +728,7 @@ compatible = "rockchip,rk3288-pwm"; reg = <0x0 0xff680030 0x0 0x10>; #pwm-cells = <3>; @@ -709,7 +709,7 @@ diff --git a/arch/arm/boot/dts/rv1108.dtsi b/arch/arm/boot/dts/rv1108.dtsi index a1a08cb93..b079c0008 100644 --- a/arch/arm/boot/dts/rv1108.dtsi +++ b/arch/arm/boot/dts/rv1108.dtsi -@@ -217,7 +217,7 @@ pwm4: pwm@10280000 { +@@ -217,7 +217,7 @@ interrupts = ; clocks = <&cru SCLK_PWM>, <&cru PCLK_PWM>; clock-names = "pwm", "pclk"; @@ -718,7 +718,7 @@ index a1a08cb93..b079c0008 100644 pinctrl-0 = <&pwm4_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -229,7 +229,7 @@ pwm5: pwm@10280010 { +@@ -229,7 +229,7 @@ interrupts = ; clocks = <&cru SCLK_PWM>, <&cru PCLK_PWM>; clock-names = "pwm", "pclk"; @@ -727,7 +727,7 @@ index a1a08cb93..b079c0008 100644 pinctrl-0 = <&pwm5_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -241,7 +241,7 @@ pwm6: pwm@10280020 { +@@ -241,7 +241,7 @@ interrupts = ; clocks = <&cru SCLK_PWM>, <&cru PCLK_PWM>; clock-names = "pwm", "pclk"; @@ -736,7 +736,7 @@ index a1a08cb93..b079c0008 100644 pinctrl-0 = <&pwm6_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -253,7 +253,7 @@ pwm7: pwm@10280030 { +@@ -253,7 +253,7 @@ interrupts = ; clocks = <&cru SCLK_PWM>, <&cru PCLK_PWM>; clock-names = "pwm", "pclk"; @@ -745,7 +745,7 @@ index a1a08cb93..b079c0008 100644 pinctrl-0 = <&pwm7_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -392,7 +392,7 @@ pwm0: pwm@20040000 { +@@ -392,7 +392,7 @@ interrupts = ; clocks = <&cru SCLK_PWM0_PMU>, <&cru PCLK_PWM0_PMU>; clock-names = "pwm", "pclk"; @@ -754,7 +754,7 @@ index a1a08cb93..b079c0008 100644 pinctrl-0 = <&pwm0_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -404,7 +404,7 @@ pwm1: pwm@20040010 { +@@ -404,7 +404,7 @@ interrupts = ; clocks = <&cru SCLK_PWM0_PMU>, <&cru PCLK_PWM0_PMU>; clock-names = "pwm", "pclk"; @@ -763,7 +763,7 @@ index a1a08cb93..b079c0008 100644 pinctrl-0 = <&pwm1_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -416,7 +416,7 @@ pwm2: pwm@20040020 { +@@ -416,7 +416,7 @@ interrupts = ; clocks = <&cru SCLK_PWM0_PMU>, <&cru PCLK_PWM0_PMU>; clock-names = "pwm", "pclk"; @@ -772,7 +772,7 @@ index a1a08cb93..b079c0008 100644 pinctrl-0 = <&pwm2_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -428,7 +428,7 @@ pwm3: pwm@20040030 { +@@ -428,7 +428,7 @@ interrupts = ; clocks = <&cru SCLK_PWM0_PMU>, <&cru PCLK_PWM0_PMU>; clock-names = "pwm", "pclk"; @@ -10862,7 +10862,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/px30.dtsi b/arch/arm64/boot/dts/rockch index 0d6761074..237c0d9af 100644 --- a/arch/arm64/boot/dts/rockchip/px30.dtsi +++ b/arch/arm64/boot/dts/rockchip/px30.dtsi -@@ -25,6 +25,9 @@ aliases { +@@ -25,6 +25,9 @@ i2c1 = &i2c1; i2c2 = &i2c2; i2c3 = &i2c3; @@ -10872,7 +10872,7 @@ index 0d6761074..237c0d9af 100644 serial0 = &uart0; serial1 = &uart1; serial2 = &uart2; -@@ -244,20 +247,20 @@ power: power-controller { +@@ -244,20 +247,20 @@ #size-cells = <0>; /* These power domains are grouped by VD_LOGIC */ @@ -10896,7 +10896,7 @@ index 0d6761074..237c0d9af 100644 reg = ; clocks = <&cru ACLK_GMAC>, <&cru PCLK_GMAC>, -@@ -265,7 +268,7 @@ power-domain@PX30_PD_GMAC { +@@ -265,7 +268,7 @@ <&cru SCLK_GMAC_RX_TX>; pm_qos = <&qos_gmac>; }; @@ -10905,7 +10905,7 @@ index 0d6761074..237c0d9af 100644 reg = ; clocks = <&cru HCLK_NANDC>, <&cru HCLK_EMMC>, -@@ -278,14 +281,14 @@ power-domain@PX30_PD_MMC_NAND { +@@ -278,14 +281,14 @@ pm_qos = <&qos_emmc>, <&qos_nand>, <&qos_sdio>, <&qos_sfc>; }; @@ -10922,7 +10922,7 @@ index 0d6761074..237c0d9af 100644 reg = ; clocks = <&cru ACLK_RGA>, <&cru ACLK_VOPB>, -@@ -301,7 +304,7 @@ power-domain@PX30_PD_VO { +@@ -301,7 +304,7 @@ pm_qos = <&qos_rga_rd>, <&qos_rga_wr>, <&qos_vop_m0>, <&qos_vop_m1>; }; @@ -10931,7 +10931,7 @@ index 0d6761074..237c0d9af 100644 reg = ; clocks = <&cru ACLK_CIF>, <&cru ACLK_ISP>, -@@ -312,7 +315,7 @@ power-domain@PX30_PD_VI { +@@ -312,7 +315,7 @@ <&qos_isp_wr>, <&qos_isp_m1>, <&qos_vip>; }; @@ -10940,7 +10940,7 @@ index 0d6761074..237c0d9af 100644 reg = ; clocks = <&cru SCLK_GPU>; pm_qos = <&qos_gpu>; -@@ -612,7 +615,7 @@ pwm0: pwm@ff200000 { +@@ -612,7 +615,7 @@ reg = <0x0 0xff200000 0x0 0x10>; clocks = <&cru SCLK_PWM0>, <&cru PCLK_PWM0>; clock-names = "pwm", "pclk"; @@ -10949,7 +10949,7 @@ index 0d6761074..237c0d9af 100644 pinctrl-0 = <&pwm0_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -623,7 +626,7 @@ pwm1: pwm@ff200010 { +@@ -623,7 +626,7 @@ reg = <0x0 0xff200010 0x0 0x10>; clocks = <&cru SCLK_PWM0>, <&cru PCLK_PWM0>; clock-names = "pwm", "pclk"; @@ -10958,7 +10958,7 @@ index 0d6761074..237c0d9af 100644 pinctrl-0 = <&pwm1_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -634,7 +637,7 @@ pwm2: pwm@ff200020 { +@@ -634,7 +637,7 @@ reg = <0x0 0xff200020 0x0 0x10>; clocks = <&cru SCLK_PWM0>, <&cru PCLK_PWM0>; clock-names = "pwm", "pclk"; @@ -10967,7 +10967,7 @@ index 0d6761074..237c0d9af 100644 pinctrl-0 = <&pwm2_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -645,7 +648,7 @@ pwm3: pwm@ff200030 { +@@ -645,7 +648,7 @@ reg = <0x0 0xff200030 0x0 0x10>; clocks = <&cru SCLK_PWM0>, <&cru PCLK_PWM0>; clock-names = "pwm", "pclk"; @@ -10976,7 +10976,7 @@ index 0d6761074..237c0d9af 100644 pinctrl-0 = <&pwm3_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -656,7 +659,7 @@ pwm4: pwm@ff208000 { +@@ -656,7 +659,7 @@ reg = <0x0 0xff208000 0x0 0x10>; clocks = <&cru SCLK_PWM1>, <&cru PCLK_PWM1>; clock-names = "pwm", "pclk"; @@ -10985,7 +10985,7 @@ index 0d6761074..237c0d9af 100644 pinctrl-0 = <&pwm4_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -667,7 +670,7 @@ pwm5: pwm@ff208010 { +@@ -667,7 +670,7 @@ reg = <0x0 0xff208010 0x0 0x10>; clocks = <&cru SCLK_PWM1>, <&cru PCLK_PWM1>; clock-names = "pwm", "pclk"; @@ -10994,7 +10994,7 @@ index 0d6761074..237c0d9af 100644 pinctrl-0 = <&pwm5_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -678,7 +681,7 @@ pwm6: pwm@ff208020 { +@@ -678,7 +681,7 @@ reg = <0x0 0xff208020 0x0 0x10>; clocks = <&cru SCLK_PWM1>, <&cru PCLK_PWM1>; clock-names = "pwm", "pclk"; @@ -11003,7 +11003,7 @@ index 0d6761074..237c0d9af 100644 pinctrl-0 = <&pwm6_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -689,7 +692,7 @@ pwm7: pwm@ff208030 { +@@ -689,7 +692,7 @@ reg = <0x0 0xff208030 0x0 0x10>; clocks = <&cru SCLK_PWM1>, <&cru PCLK_PWM1>; clock-names = "pwm", "pclk"; @@ -19197,7 +19197,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts b/arch/arm64/boot/dt index bce6f8b7d..7a96be10e 100644 --- a/arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts +++ b/arch/arm64/boot/dts/rockchip/rk3308-roc-cc.dts -@@ -78,8 +78,8 @@ vcc_sdmmc: vcc-sdmmc { +@@ -78,8 +78,8 @@ regulator-min-microvolt = <1800000>; regulator-max-microvolt = <3300000>; gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_HIGH>; @@ -19245,7 +19245,7 @@ index 2560b9877..cc86c0880 100644 #include / { -@@ -147,6 +148,21 @@ psci { +@@ -147,6 +148,21 @@ method = "smc"; }; @@ -19267,7 +19267,7 @@ index 2560b9877..cc86c0880 100644 timer { compatible = "arm,armv8-timer"; interrupts = , -@@ -366,7 +382,7 @@ pwm8: pwm@ff160000 { +@@ -366,7 +382,7 @@ reg = <0x0 0xff160000 0x0 0x10>; clocks = <&cru SCLK_PWM2>, <&cru PCLK_PWM2>; clock-names = "pwm", "pclk"; @@ -19276,7 +19276,7 @@ index 2560b9877..cc86c0880 100644 pinctrl-0 = <&pwm8_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -377,7 +393,7 @@ pwm9: pwm@ff160010 { +@@ -377,7 +393,7 @@ reg = <0x0 0xff160010 0x0 0x10>; clocks = <&cru SCLK_PWM2>, <&cru PCLK_PWM2>; clock-names = "pwm", "pclk"; @@ -19285,7 +19285,7 @@ index 2560b9877..cc86c0880 100644 pinctrl-0 = <&pwm9_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -388,7 +404,7 @@ pwm10: pwm@ff160020 { +@@ -388,7 +404,7 @@ reg = <0x0 0xff160020 0x0 0x10>; clocks = <&cru SCLK_PWM2>, <&cru PCLK_PWM2>; clock-names = "pwm", "pclk"; @@ -19294,7 +19294,7 @@ index 2560b9877..cc86c0880 100644 pinctrl-0 = <&pwm10_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -399,7 +415,7 @@ pwm11: pwm@ff160030 { +@@ -399,7 +415,7 @@ reg = <0x0 0xff160030 0x0 0x10>; clocks = <&cru SCLK_PWM2>, <&cru PCLK_PWM2>; clock-names = "pwm", "pclk"; @@ -19303,7 +19303,7 @@ index 2560b9877..cc86c0880 100644 pinctrl-0 = <&pwm11_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -410,7 +426,7 @@ pwm4: pwm@ff170000 { +@@ -410,7 +426,7 @@ reg = <0x0 0xff170000 0x0 0x10>; clocks = <&cru SCLK_PWM1>, <&cru PCLK_PWM1>; clock-names = "pwm", "pclk"; @@ -19312,7 +19312,7 @@ index 2560b9877..cc86c0880 100644 pinctrl-0 = <&pwm4_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -421,7 +437,7 @@ pwm5: pwm@ff170010 { +@@ -421,7 +437,7 @@ reg = <0x0 0xff170010 0x0 0x10>; clocks = <&cru SCLK_PWM1>, <&cru PCLK_PWM1>; clock-names = "pwm", "pclk"; @@ -19321,7 +19321,7 @@ index 2560b9877..cc86c0880 100644 pinctrl-0 = <&pwm5_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -432,7 +448,7 @@ pwm6: pwm@ff170020 { +@@ -432,7 +448,7 @@ reg = <0x0 0xff170020 0x0 0x10>; clocks = <&cru SCLK_PWM1>, <&cru PCLK_PWM1>; clock-names = "pwm", "pclk"; @@ -19330,7 +19330,7 @@ index 2560b9877..cc86c0880 100644 pinctrl-0 = <&pwm6_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -443,7 +459,7 @@ pwm7: pwm@ff170030 { +@@ -443,7 +459,7 @@ reg = <0x0 0xff170030 0x0 0x10>; clocks = <&cru SCLK_PWM1>, <&cru PCLK_PWM1>; clock-names = "pwm", "pclk"; @@ -19339,7 +19339,7 @@ index 2560b9877..cc86c0880 100644 pinctrl-0 = <&pwm7_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -454,7 +470,7 @@ pwm0: pwm@ff180000 { +@@ -454,7 +470,7 @@ reg = <0x0 0xff180000 0x0 0x10>; clocks = <&cru SCLK_PWM0>, <&cru PCLK_PWM0>; clock-names = "pwm", "pclk"; @@ -19348,7 +19348,7 @@ index 2560b9877..cc86c0880 100644 pinctrl-0 = <&pwm0_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -465,7 +481,7 @@ pwm1: pwm@ff180010 { +@@ -465,7 +481,7 @@ reg = <0x0 0xff180010 0x0 0x10>; clocks = <&cru SCLK_PWM0>, <&cru PCLK_PWM0>; clock-names = "pwm", "pclk"; @@ -19357,7 +19357,7 @@ index 2560b9877..cc86c0880 100644 pinctrl-0 = <&pwm1_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -476,7 +492,7 @@ pwm2: pwm@ff180020 { +@@ -476,7 +492,7 @@ reg = <0x0 0xff180020 0x0 0x10>; clocks = <&cru SCLK_PWM0>, <&cru PCLK_PWM0>; clock-names = "pwm", "pclk"; @@ -19366,7 +19366,7 @@ index 2560b9877..cc86c0880 100644 pinctrl-0 = <&pwm2_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -487,7 +503,7 @@ pwm3: pwm@ff180030 { +@@ -487,7 +503,7 @@ reg = <0x0 0xff180030 0x0 0x10>; clocks = <&cru SCLK_PWM0>, <&cru PCLK_PWM0>; clock-names = "pwm", "pclk"; @@ -34491,7 +34491,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3328-evb.dts b/arch/arm64/boot/dts/r index a48767931..82d2f01a8 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-evb.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-evb.dts -@@ -37,6 +37,18 @@ sdio_pwrseq: sdio-pwrseq { +@@ -37,6 +37,18 @@ reset-gpios = <&gpio1 18 GPIO_ACTIVE_LOW>; }; @@ -34510,7 +34510,7 @@ index a48767931..82d2f01a8 100644 vcc_sd: sdmmc-regulator { compatible = "regulator-fixed"; gpio = <&gpio0 30 GPIO_ACTIVE_LOW>; -@@ -64,6 +76,14 @@ vcc_phy: vcc-phy-regulator { +@@ -64,6 +76,14 @@ regulator-always-on; regulator-boot-on; }; @@ -34525,7 +34525,7 @@ index a48767931..82d2f01a8 100644 }; &cpu0 { -@@ -109,7 +129,7 @@ rk805: pmic@18 { +@@ -109,7 +129,7 @@ interrupt-parent = <&gpio2>; interrupts = <6 IRQ_TYPE_LEVEL_LOW>; #clock-cells = <1>; @@ -34538,7 +34538,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts b/arch/arm64/boo index 83a0bdbe0..1eecad724 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts -@@ -71,8 +71,8 @@ vcc_io_sdio: sdmmcio-regulator { +@@ -71,8 +71,8 @@ regulator-settling-time-us = <5000>; regulator-type = "voltage"; startup-delay-us = <2000>; @@ -34553,7 +34553,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts b/arch/arm64/boot/dt index daa9a0c60..b76282e70 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-roc-cc.dts -@@ -45,8 +45,8 @@ vcc_sd: sdmmc-regulator { +@@ -45,8 +45,8 @@ vcc_sdio: sdmmcio-regulator { compatible = "regulator-gpio"; gpios = <&grf_gpio 0 GPIO_ACTIVE_HIGH>; @@ -35264,7 +35264,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dt index 95ab6928c..4c33c21ee 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts -@@ -21,6 +21,13 @@ gmac_clkin: external-gmac-clock { +@@ -21,6 +21,13 @@ #clock-cells = <0>; }; @@ -35278,7 +35278,7 @@ index 95ab6928c..4c33c21ee 100644 vcc_sd: sdmmc-regulator { compatible = "regulator-fixed"; gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>; -@@ -176,7 +183,7 @@ rk805: pmic@18 { +@@ -176,7 +183,7 @@ interrupt-parent = <&gpio2>; interrupts = <6 IRQ_TYPE_LEVEL_LOW>; #clock-cells = <1>; @@ -35287,7 +35287,7 @@ index 95ab6928c..4c33c21ee 100644 gpio-controller; #gpio-cells = <2>; pinctrl-names = "default"; -@@ -384,11 +391,6 @@ &usb20_otg { +@@ -384,11 +391,6 @@ status = "okay"; }; @@ -35303,7 +35303,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rock index e546c9d1d..03f8b2fe4 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi -@@ -318,13 +318,13 @@ power: power-controller { +@@ -318,13 +318,13 @@ #address-cells = <1>; #size-cells = <0>; @@ -35320,7 +35320,7 @@ index e546c9d1d..03f8b2fe4 100644 reg = ; clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; }; -@@ -456,7 +456,7 @@ wdt: watchdog@ff1a0000 { +@@ -456,7 +456,7 @@ compatible = "snps,dw-wdt"; reg = <0x0 0xff1a0000 0x0 0x100>; interrupts = ; @@ -35329,7 +35329,7 @@ index e546c9d1d..03f8b2fe4 100644 }; pwm0: pwm@ff1b0000 { -@@ -464,7 +464,7 @@ pwm0: pwm@ff1b0000 { +@@ -464,7 +464,7 @@ reg = <0x0 0xff1b0000 0x0 0x10>; clocks = <&cru SCLK_PWM>, <&cru PCLK_PWM>; clock-names = "pwm", "pclk"; @@ -35338,7 +35338,7 @@ index e546c9d1d..03f8b2fe4 100644 pinctrl-0 = <&pwm0_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -475,7 +475,7 @@ pwm1: pwm@ff1b0010 { +@@ -475,7 +475,7 @@ reg = <0x0 0xff1b0010 0x0 0x10>; clocks = <&cru SCLK_PWM>, <&cru PCLK_PWM>; clock-names = "pwm", "pclk"; @@ -35347,7 +35347,7 @@ index e546c9d1d..03f8b2fe4 100644 pinctrl-0 = <&pwm1_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -486,7 +486,7 @@ pwm2: pwm@ff1b0020 { +@@ -486,7 +486,7 @@ reg = <0x0 0xff1b0020 0x0 0x10>; clocks = <&cru SCLK_PWM>, <&cru PCLK_PWM>; clock-names = "pwm", "pclk"; @@ -35356,7 +35356,7 @@ index e546c9d1d..03f8b2fe4 100644 pinctrl-0 = <&pwm2_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -498,7 +498,7 @@ pwm3: pwm@ff1b0030 { +@@ -498,7 +498,7 @@ interrupts = ; clocks = <&cru SCLK_PWM>, <&cru PCLK_PWM>; clock-names = "pwm", "pclk"; @@ -35365,7 +35365,7 @@ index e546c9d1d..03f8b2fe4 100644 pinctrl-0 = <&pwmir_pin>; #pwm-cells = <3>; status = "disabled"; -@@ -552,10 +552,9 @@ tsadc: tsadc@ff250000 { +@@ -552,10 +552,9 @@ assigned-clock-rates = <50000>; clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>; clock-names = "tsadc", "apb_pclk"; @@ -35377,7 +35377,7 @@ index e546c9d1d..03f8b2fe4 100644 resets = <&cru SRST_TSADC>; reset-names = "tsadc-apb"; rockchip,grf = <&grf>; -@@ -984,25 +983,6 @@ usb_host0_ohci: usb@ff5d0000 { +@@ -984,25 +983,6 @@ status = "disabled"; }; @@ -44069,7 +44069,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3368.dtsi b/arch/arm64/boot/dts/rock index 3746f23dc..e962c7962 100644 --- a/arch/arm64/boot/dts/rockchip/rk3368.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3368.dtsi -@@ -562,7 +562,7 @@ pwm0: pwm@ff680000 { +@@ -562,7 +562,7 @@ compatible = "rockchip,rk3368-pwm", "rockchip,rk3288-pwm"; reg = <0x0 0xff680000 0x0 0x10>; #pwm-cells = <3>; @@ -44078,7 +44078,7 @@ index 3746f23dc..e962c7962 100644 pinctrl-0 = <&pwm0_pin>; clocks = <&cru PCLK_PWM1>; clock-names = "pwm"; -@@ -573,7 +573,7 @@ pwm1: pwm@ff680010 { +@@ -573,7 +573,7 @@ compatible = "rockchip,rk3368-pwm", "rockchip,rk3288-pwm"; reg = <0x0 0xff680010 0x0 0x10>; #pwm-cells = <3>; @@ -44087,7 +44087,7 @@ index 3746f23dc..e962c7962 100644 pinctrl-0 = <&pwm1_pin>; clocks = <&cru PCLK_PWM1>; clock-names = "pwm"; -@@ -593,7 +593,7 @@ pwm3: pwm@ff680030 { +@@ -593,7 +593,7 @@ compatible = "rockchip,rk3368-pwm", "rockchip,rk3288-pwm"; reg = <0x0 0xff680030 0x0 0x10>; #pwm-cells = <3>; @@ -44096,7 +44096,7 @@ index 3746f23dc..e962c7962 100644 pinctrl-0 = <&pwm3_pin>; clocks = <&cru PCLK_PWM1>; clock-names = "pwm"; -@@ -1009,17 +1009,33 @@ pwm0 { +@@ -1009,17 +1009,33 @@ pwm0_pin: pwm0-pin { rockchip,pins = <3 RK_PB0 2 &pcfg_pull_none>; }; @@ -57316,7 +57316,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi b/arch/arm64/b index e9ecffc40..60cd1c18c 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi -@@ -245,7 +245,7 @@ &ppvar_gpu_pwm { +@@ -245,7 +245,7 @@ pp1800_pcie: &pp1800_s0 { }; &ppvar_sd_card_io { @@ -57329,7 +57329,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi b/arch/arm64/boot/dts/ index 765b24a2b..32dcaf210 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi -@@ -247,8 +247,8 @@ ppvar_sd_card_io: ppvar-sd-card-io { +@@ -247,8 +247,8 @@ enable-active-high; enable-gpio = <&gpio2 2 GPIO_ACTIVE_HIGH>; gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>; @@ -58895,7 +58895,7 @@ index d6f1095ab..f9f2cc8ab 100644 }; }; -@@ -39,93 +103,253 @@ cluster1_opp: opp-table1 { +@@ -39,93 +103,253 @@ compatible = "operating-points-v2"; opp-shared; @@ -59181,7 +59181,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi b/arch/arm64/boot/d index 35b7ab3bf..20309076d 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi -@@ -384,7 +384,6 @@ regulator-state-mem { +@@ -384,7 +384,6 @@ vcc_sdio: LDO_REG4 { regulator-name = "vcc_sdio"; @@ -59189,7 +59189,7 @@ index 35b7ab3bf..20309076d 100644 regulator-boot-on; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <3000000>; -@@ -489,8 +488,6 @@ vdd_gpu: regulator@41 { +@@ -489,8 +488,6 @@ regulator-min-microvolt = <712500>; regulator-max-microvolt = <1500000>; regulator-ramp-delay = <1000>; @@ -60296,7 +60296,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock960.dts b/arch/arm64/boot/d index c88295782..1a23e8f3c 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-rock960.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-rock960.dts -@@ -63,6 +63,20 @@ bt_active_led: led-6 { +@@ -63,6 +63,20 @@ }; @@ -60317,7 +60317,7 @@ index c88295782..1a23e8f3c 100644 &pcie0 { ep-gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_HIGH>; }; -@@ -125,45 +139,6 @@ &spi4 { +@@ -125,45 +139,6 @@ status = "okay"; }; @@ -62724,7 +62724,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi b/arch/arm64/boot index 701a567d7..3d9e27750 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi -@@ -515,6 +515,8 @@ &pwm0 { +@@ -515,6 +515,8 @@ &pwm2 { status = "okay"; @@ -65818,7 +65818,7 @@ index 4b6065dbb..d1bf1b6a0 100644 / { compatible = "rockchip,rk3399"; -@@ -164,7 +169,7 @@ CLUSTER_SLEEP: cluster-sleep { +@@ -164,7 +169,7 @@ }; }; @@ -65827,7 +65827,7 @@ index 4b6065dbb..d1bf1b6a0 100644 compatible = "rockchip,display-subsystem"; ports = <&vopl_out>, <&vopb_out>; }; -@@ -200,6 +205,20 @@ xin24m: xin24m { +@@ -200,6 +205,20 @@ #clock-cells = <0>; }; @@ -65848,7 +65848,7 @@ index 4b6065dbb..d1bf1b6a0 100644 amba: bus { compatible = "simple-bus"; #address-cells = <2>; -@@ -346,6 +365,7 @@ sdhci: sdhci@fe330000 { +@@ -346,6 +365,7 @@ phy-names = "phy_arasan"; power-domains = <&power RK3399_PD_EMMC>; disable-cqe-dcmd; @@ -65856,7 +65856,7 @@ index 4b6065dbb..d1bf1b6a0 100644 status = "disabled"; }; -@@ -764,76 +784,58 @@ spi5: spi@ff200000 { +@@ -764,76 +784,58 @@ }; thermal_zones: thermal-zones { @@ -65955,7 +65955,7 @@ index 4b6065dbb..d1bf1b6a0 100644 }; }; -@@ -849,10 +851,9 @@ tsadc: tsadc@ff260000 { +@@ -849,10 +851,9 @@ reset-names = "tsadc-apb"; rockchip,grf = <&grf>; rockchip,hw-tshut-temp = <95000>; @@ -65967,7 +65967,7 @@ index 4b6065dbb..d1bf1b6a0 100644 #thermal-sensor-cells = <1>; status = "disabled"; }; -@@ -1000,26 +1001,26 @@ power: power-controller { +@@ -1000,26 +1001,26 @@ #size-cells = <0>; /* These power domains are grouped by VD_CENTER */ @@ -65998,7 +65998,7 @@ index 4b6065dbb..d1bf1b6a0 100644 reg = ; clocks = <&cru ACLK_VDU>, <&cru HCLK_VDU>; -@@ -1028,94 +1029,94 @@ power-domain@RK3399_PD_VDU { +@@ -1028,94 +1029,94 @@ }; /* These power domains are grouped by VD_GPU */ @@ -66109,7 +66109,7 @@ index 4b6065dbb..d1bf1b6a0 100644 reg = ; clocks = <&cru ACLK_VOP1>, <&cru HCLK_VOP1>; -@@ -1134,6 +1135,33 @@ pmu_io_domains: io-domains { +@@ -1134,6 +1135,33 @@ compatible = "rockchip,rk3399-pmu-io-voltage-domain"; status = "disabled"; }; @@ -66143,7 +66143,7 @@ index 4b6065dbb..d1bf1b6a0 100644 }; spi3: spi@ff350000 { -@@ -1211,7 +1239,7 @@ pwm0: pwm@ff420000 { +@@ -1211,7 +1239,7 @@ compatible = "rockchip,rk3399-pwm", "rockchip,rk3288-pwm"; reg = <0x0 0xff420000 0x0 0x10>; #pwm-cells = <3>; @@ -66152,7 +66152,7 @@ index 4b6065dbb..d1bf1b6a0 100644 pinctrl-0 = <&pwm0_pin>; clocks = <&pmucru PCLK_RKPWM_PMU>; clock-names = "pwm"; -@@ -1222,7 +1250,7 @@ pwm1: pwm@ff420010 { +@@ -1222,7 +1250,7 @@ compatible = "rockchip,rk3399-pwm", "rockchip,rk3288-pwm"; reg = <0x0 0xff420010 0x0 0x10>; #pwm-cells = <3>; @@ -66161,7 +66161,7 @@ index 4b6065dbb..d1bf1b6a0 100644 pinctrl-0 = <&pwm1_pin>; clocks = <&pmucru PCLK_RKPWM_PMU>; clock-names = "pwm"; -@@ -1233,7 +1261,7 @@ pwm2: pwm@ff420020 { +@@ -1233,7 +1261,7 @@ compatible = "rockchip,rk3399-pwm", "rockchip,rk3288-pwm"; reg = <0x0 0xff420020 0x0 0x10>; #pwm-cells = <3>; @@ -66170,7 +66170,7 @@ index 4b6065dbb..d1bf1b6a0 100644 pinctrl-0 = <&pwm2_pin>; clocks = <&pmucru PCLK_RKPWM_PMU>; clock-names = "pwm"; -@@ -1244,13 +1272,32 @@ pwm3: pwm@ff420030 { +@@ -1244,13 +1272,32 @@ compatible = "rockchip,rk3399-pwm", "rockchip,rk3288-pwm"; reg = <0x0 0xff420030 0x0 0x10>; #pwm-cells = <3>; @@ -66204,7 +66204,7 @@ index 4b6065dbb..d1bf1b6a0 100644 vpu: video-codec@ff650000 { compatible = "rockchip,rk3399-vpu"; reg = <0x0 0xff650000 0x0 0x800>; -@@ -1296,6 +1343,20 @@ vdec_mmu: iommu@ff660480 { +@@ -1296,6 +1343,20 @@ #iommu-cells = <0>; }; @@ -66225,7 +66225,7 @@ index 4b6065dbb..d1bf1b6a0 100644 iep_mmu: iommu@ff670800 { compatible = "rockchip,iommu"; reg = <0x0 0xff670800 0x0 0x40>; -@@ -1327,6 +1388,10 @@ efuse0: efuse@ff690000 { +@@ -1327,6 +1388,10 @@ clock-names = "pclk_efuse"; /* Data cells */ @@ -66236,7 +66236,7 @@ index 4b6065dbb..d1bf1b6a0 100644 cpu_id: cpu-id@7 { reg = <0x07 0x10>; }; -@@ -1348,6 +1413,10 @@ logic_leakage: logic-leakage@1b { +@@ -1348,6 +1413,10 @@ wafer_info: wafer-info@1c { reg = <0x1c 0x1>; }; @@ -66247,7 +66247,7 @@ index 4b6065dbb..d1bf1b6a0 100644 }; pmucru: pmu-clock-controller@ff750000 { -@@ -1485,6 +1554,42 @@ pcie_phy: pcie-phy { +@@ -1485,6 +1554,42 @@ reset-names = "phy"; status = "disabled"; }; @@ -66290,7 +66290,7 @@ index 4b6065dbb..d1bf1b6a0 100644 }; tcphy0: phy@ff7c0000 { -@@ -1611,6 +1716,16 @@ i2s2: i2s@ff8a0000 { +@@ -1611,6 +1716,16 @@ status = "disabled"; }; @@ -66307,7 +66307,7 @@ index 4b6065dbb..d1bf1b6a0 100644 vopl: vop@ff8f0000 { compatible = "rockchip,rk3399-vop-lit"; reg = <0x0 0xff8f0000 0x0 0x3efc>; -@@ -1656,6 +1771,17 @@ vopl_out_dp: endpoint@4 { +@@ -1656,6 +1771,17 @@ }; }; @@ -66325,7 +66325,7 @@ index 4b6065dbb..d1bf1b6a0 100644 vopl_mmu: iommu@ff8f3f00 { compatible = "rockchip,iommu"; reg = <0x0 0xff8f3f00 0x0 0x100>; -@@ -1713,6 +1839,17 @@ vopb_out_dp: endpoint@4 { +@@ -1713,6 +1839,17 @@ }; }; @@ -66343,7 +66343,7 @@ index 4b6065dbb..d1bf1b6a0 100644 vopb_mmu: iommu@ff903f00 { compatible = "rockchip,iommu"; reg = <0x0 0xff903f00 0x0 0x100>; -@@ -1915,7 +2052,95 @@ gpu: gpu@ff9a0000 { +@@ -1915,7 +2052,95 @@ clocks = <&cru ACLK_GPU>; #cooling-cells = <2>; power-domains = <&power RK3399_PD_GPU>; @@ -66439,7 +66439,7 @@ index 4b6065dbb..d1bf1b6a0 100644 }; pinctrl: pinctrl { -@@ -2179,6 +2404,13 @@ i2c3_xfer: i2c3-xfer { +@@ -2179,6 +2404,13 @@ <4 RK_PC1 1 &pcfg_pull_none>, <4 RK_PC0 1 &pcfg_pull_none>; }; @@ -66453,7 +66453,7 @@ index 4b6065dbb..d1bf1b6a0 100644 }; i2c4 { -@@ -2342,7 +2574,7 @@ sdmmc_wp: sdmmc-wp { +@@ -2342,7 +2574,7 @@ }; }; @@ -66462,7 +66462,7 @@ index 4b6065dbb..d1bf1b6a0 100644 ap_pwroff: ap-pwroff { rockchip,pins = <1 RK_PA5 1 &pcfg_pull_none>; }; -@@ -2644,6 +2876,11 @@ pwm3a_pin: pwm3a-pin { +@@ -2644,6 +2876,11 @@ rockchip,pins = <0 RK_PA6 1 &pcfg_pull_none>; }; @@ -66474,7 +66474,7 @@ index 4b6065dbb..d1bf1b6a0 100644 }; pwm3b { -@@ -2651,6 +2888,11 @@ pwm3b_pin: pwm3b-pin { +@@ -2651,6 +2888,11 @@ rockchip,pins = <1 RK_PB6 1 &pcfg_pull_none>; }; @@ -66486,7 +66486,7 @@ index 4b6065dbb..d1bf1b6a0 100644 }; hdmi { -@@ -2679,4 +2921,27 @@ pcie_clkreqnb_cpm: pci-clkreqnb-cpm { +@@ -2679,4 +2921,27 @@ }; }; @@ -964684,10 +964684,10 @@ index 000000000..44cd1cbf2 +} diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_cfg80211.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_cfg80211.c new file mode 100755 -index 000000000..84dc10cae +index 000000000..51a13e092 --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_cfg80211.c -@@ -0,0 +1,335 @@ +@@ -0,0 +1,332 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Linux cfg80211 driver - Dongle Host Driver (DHD) related @@ -964847,7 +964847,6 @@ index 000000000..84dc10cae +int wl_cfg80211_remove_if(struct bcm_cfg80211 *cfg, + int ifidx, struct net_device* ndev, bool rtnl_lock_reqd) +{ -+ WL_ERR(("lijg123: call wl_cfg80211_remove_if ifidx=%d rtnl_lock_reqd=%d\n", ifidx, rtnl_lock_reqd)); + return dhd_remove_if(cfg->pub, ifidx, rtnl_lock_reqd); +} + @@ -964898,11 +964897,9 @@ index 000000000..84dc10cae +void dhd_netdev_free(struct net_device *ndev) +{ +#ifdef WL_CFG80211 -+ WL_ERR(("lijg123 call dhd_netdev_free 01 run this %s\n", ndev->name)); + ndev = dhd_cfg80211_netdev_free(ndev); +#endif // endif + if (ndev) { -+ WL_ERR(("lijg123 call dhd_netdev_free 02 %s\n", ndev->name)); + free_netdev(ndev); + } +} @@ -987359,10 +987356,10 @@ index 000000000..45be081e3 +#endif /* _dhd_ip_h_ */ diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_linux.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_linux.c new file mode 100755 -index 000000000..411344475 +index 000000000..72e3cb597 --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_linux.c -@@ -0,0 +1,22693 @@ +@@ -0,0 +1,22557 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Broadcom Dongle Host Driver (DHD), Linux-specific network interface @@ -987596,6 +987593,12 @@ index 000000000..411344475 +static bool dhd_inet6addr_notifier_registered = FALSE; +#endif /* CONFIG_IPV6 && IPV6_NDO_SUPPORT */ + ++#ifdef CONFIG_AP6XXX_WIFI6_HDF ++#define DHD_DEV_PRIV_CFG(dev) DHD_DEV_PRIV(dev) ++#else ++#define DHD_DEV_PRIV_CFG(dev) netdev_priv(dev) ++#endif ++ +#if defined(CONFIG_PM_SLEEP) +#include +volatile bool dhd_mmc_suspend = FALSE; @@ -992122,7 +992125,7 @@ index 000000000..411344475 + skb_linearize(eap_skb); + ret = netDevice->netDeviceIf->specialEtherTypeProcess(netDevice, eap_skb); + DHD_ERROR(("%s: send EAPOL pkt ret=%d, from %s\n", __FUNCTION__, ret, netDevice->name)); -+ print_hex_dump(KERN_INFO, "recv EAPOL: ", DUMP_PREFIX_NONE, 16, 1, eap_skb->data, eap_skb->len, true); ++ print_hex_dump(KERN_INFO, "recv EAPOL: ", DUMP_PREFIX_NONE, 16, 1, skb->data, skb->len, true); + } + } +#endif @@ -999533,7 +999536,6 @@ index 000000000..411344475 + } + +#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ //if (0 == g_hdf_ifidx) { + DHD_ERROR(("%s: for hdf inf %d don't register netdev\n", __FUNCTION__, g_hdf_ifidx)); + + // update mac address @@ -999542,7 +999544,6 @@ index 000000000..411344475 + // Call linux register_netdev() + err = NetDeviceAdd(hnetdev); + DHD_ERROR(("%s:NetDeviceAdd %s ret=%d\n", __FUNCTION__, net->name, err)); -+ //} +#else + if (need_rtnl_lock) + err = register_netdev(net); @@ -1001326,11 +1001327,7 @@ index 000000000..411344475 +int +dhd_dev_get_feature_set(struct net_device *dev) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *ptr = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *ptr = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *ptr = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_pub_t *dhd = (&ptr->pub); + int feature_set = 0; + @@ -1001473,11 +1001470,7 @@ index 000000000..411344475 +int +dhd_dev_ndo_cfg(struct net_device *dev, u8 enable) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_pub_t *dhdp = &dhd->pub; + int ret = 0; + @@ -1001778,11 +1001771,7 @@ index 000000000..411344475 +bool +dhd_dev_is_legacy_pno_enabled(struct net_device *dev) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_is_legacy_pno_enabled(&dhd->pub)); +} + @@ -1001810,11 +1001799,7 @@ index 000000000..411344475 +dhd_dev_pno_set_cfg_gscan(struct net_device *dev, dhd_pno_gscan_cmd_cfg_t type, + void *buf, bool flush) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_set_cfg_gscan(&dhd->pub, type, buf, flush)); +} + @@ -1001822,11 +1001807,7 @@ index 000000000..411344475 +int +dhd_dev_wait_batch_results_complete(struct net_device *dev) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_wait_batch_results_complete(&dhd->pub)); +} + @@ -1001834,22 +1001815,14 @@ index 000000000..411344475 +int +dhd_dev_pno_lock_access_batch_results(struct net_device *dev) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_lock_batch_results(&dhd->pub)); +} +/* Linux wrapper to call common dhd_pno_unlock_batch_results */ +void +dhd_dev_pno_unlock_access_batch_results(struct net_device *dev) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_unlock_batch_results(&dhd->pub)); +} + @@ -1001857,11 +1001830,7 @@ index 000000000..411344475 +int +dhd_dev_pno_run_gscan(struct net_device *dev, bool run, bool flush) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_initiate_gscan_request(&dhd->pub, run, flush)); +} + @@ -1001869,11 +1001838,7 @@ index 000000000..411344475 +int +dhd_dev_pno_enable_full_scan_result(struct net_device *dev, bool real_time_flag) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_enable_full_scan_result(&dhd->pub, real_time_flag)); +} + @@ -1001882,11 +1001847,7 @@ index 000000000..411344475 +dhd_dev_hotlist_scan_event(struct net_device *dev, + const void *data, int *send_evt_bytes, hotlist_type_t type, u32 *buf_len) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_handle_hotlist_scan_evt(&dhd->pub, data, send_evt_bytes, type, buf_len)); +} + @@ -1001895,22 +1001856,14 @@ index 000000000..411344475 +dhd_dev_process_full_gscan_result(struct net_device *dev, +const void *data, uint32 len, int *send_evt_bytes) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_process_full_gscan_result(&dhd->pub, data, len, send_evt_bytes)); +} + +void +dhd_dev_gscan_hotlist_cache_cleanup(struct net_device *dev, hotlist_type_t type) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_gscan_hotlist_cache_cleanup(&dhd->pub, type); + + return; @@ -1001919,11 +1001872,7 @@ index 000000000..411344475 +int +dhd_dev_gscan_batch_cache_cleanup(struct net_device *dev) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_gscan_batch_cache_cleanup(&dhd->pub)); +} + @@ -1001931,11 +1001880,7 @@ index 000000000..411344475 +int +dhd_dev_retrieve_batch_scan(struct net_device *dev) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_retreive_batch_scan_results(&dhd->pub)); +} + @@ -1001943,11 +1001888,7 @@ index 000000000..411344475 +void * dhd_dev_process_epno_result(struct net_device *dev, + const void *data, uint32 event, int *send_evt_bytes) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_process_epno_result(&dhd->pub, data, event, send_evt_bytes)); +} + @@ -1001955,11 +1001896,7 @@ index 000000000..411344475 +dhd_dev_set_lazy_roam_cfg(struct net_device *dev, + wlc_roam_exp_params_t *roam_param) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + wl_roam_exp_cfg_t roam_exp_cfg; + int err; + @@ -1001994,11 +1001931,7 @@ index 000000000..411344475 +dhd_dev_lazy_roam_enable(struct net_device *dev, uint32 enable) +{ + int err; -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + wl_roam_exp_cfg_t roam_exp_cfg; + + memset(&roam_exp_cfg, 0, sizeof(roam_exp_cfg)); @@ -1002024,11 +1001957,7 @@ index 000000000..411344475 +{ + int err; + uint len; -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + + bssid_pref->version = BSSID_PREF_LIST_VERSION; + /* By default programming bssid pref flushes out old values */ @@ -1002052,11 +1001981,7 @@ index 000000000..411344475 + uint32 len, uint32 flush) +{ + int err; -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + int macmode; + + if (blacklist) { @@ -1002082,11 +1002007,7 @@ index 000000000..411344475 + uint32 len, uint32 flush) +{ + int err; -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + wl_ssid_whitelist_t whitelist_ssid_flush; + + if (!ssid_whitelist) { @@ -1002115,11 +1002036,7 @@ index 000000000..411344475 +dhd_dev_pno_get_gscan(struct net_device *dev, dhd_pno_gscan_cmd_cfg_t type, + void *info, uint32 *len) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_get_gscan(&dhd->pub, type, info, len)); +} +#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */ @@ -1002132,11 +1002049,7 @@ index 000000000..411344475 +{ + int err; + wl_rssi_monitor_cfg_t rssi_monitor; -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + rssi_monitor.version = RSSI_MONITOR_VERSION; + rssi_monitor.max_rssi = max_rssi; + rssi_monitor.min_rssi = min_rssi; @@ -1002155,11 +1002068,7 @@ index 000000000..411344475 +dhd_dev_set_tcpack_sup_mode_cfg(struct net_device *dev, uint8 enable) +{ + int err; -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + err = dhd_tcpack_suppress_set(&dhd->pub, enable); + if (err != BCME_OK) { + DHD_ERROR(("%s : Failed to set tcpack_suppress mode: %d\n", __FUNCTION__, err)); @@ -1002171,11 +1002080,7 @@ index 000000000..411344475 +int +dhd_dev_cfg_rand_mac_oui(struct net_device *dev, uint8 *oui) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_pub_t *dhdp = &dhd->pub; + + if (!dhdp || !oui) { @@ -1002226,87 +1002131,55 @@ index 000000000..411344475 +int +dhd_dev_rtt_set_cfg(struct net_device *dev, void *buf) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_set_cfg(&dhd->pub, buf)); +} + +int +dhd_dev_rtt_cancel_cfg(struct net_device *dev, struct ether_addr *mac_list, int mac_cnt) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_stop(&dhd->pub, mac_list, mac_cnt)); +} + +int +dhd_dev_rtt_register_noti_callback(struct net_device *dev, void *ctx, dhd_rtt_compl_noti_fn noti_fn) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_register_noti_callback(&dhd->pub, ctx, noti_fn)); +} + +int +dhd_dev_rtt_unregister_noti_callback(struct net_device *dev, dhd_rtt_compl_noti_fn noti_fn) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_unregister_noti_callback(&dhd->pub, noti_fn)); +} + +int +dhd_dev_rtt_capability(struct net_device *dev, rtt_capabilities_t *capa) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_capability(&dhd->pub, capa)); +} + +int +dhd_dev_rtt_avail_channel(struct net_device *dev, wifi_channel_info *channel_info) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_avail_channel(&dhd->pub, channel_info)); +} + +int +dhd_dev_rtt_enable_responder(struct net_device *dev, wifi_channel_info *channel_info) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_enable_responder(&dhd->pub, channel_info)); +} + +int dhd_dev_rtt_cancel_responder(struct net_device *dev) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_cancel_responder(&dhd->pub)); +} + @@ -1006524,11 +1006397,7 @@ index 000000000..411344475 +dhd_os_socram_dump(struct net_device *dev, uint32 *dump_size) +{ + int ret = BCME_OK; -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_pub_t *dhdp = &dhd->pub; + + if (dhdp->busstate == DHD_BUS_DOWN) { @@ -1006556,11 +1006425,7 @@ index 000000000..411344475 +{ + int ret = BCME_OK; + int orig_len = 0; -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_pub_t *dhdp = &dhd->pub; + if (buf == NULL) + return BCME_ERROR; @@ -1006608,11 +1006473,7 @@ index 000000000..411344475 +dhd_os_get_axi_error_dump(void *dev, const void *user_buf, uint32 len) +{ + int ret = BCME_OK; -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_pub_t *dhdp = &dhd->pub; + loff_t pos = 0; + if (user_buf == NULL) { @@ -1169867,7 +1169728,7 @@ index 000000000..ff10499ff + diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfg80211.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfg80211.c new file mode 100755 -index 000000000..f93062cc2 +index 000000000..607ea25a4 --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfg80211.c @@ -0,0 +1,25011 @@ @@ -1173021,8 +1172882,8 @@ index 000000000..f93062cc2 + return ERR_PTR(-EINVAL); + } + -+ printk(KERN_INFO"wl_cfg80211_add_if %s new ifname=%s, type=%u,mode=%u\n", primary_ndev->name, name, wl_iftype, wl_mode); + wdev = wl_cfg80211_add_if(cfg, primary_ndev, wl_iftype, name, NULL); ++ WL_INFORM_MEM(("add inf ifname=%s, type=%d, primary ifname=%s, wdev=%p, %p\n", name, type, primary_ndev->name, wdev, wdev?wdev->netdev:NULL)); + if (unlikely(!wdev)) { + return ERR_PTR(-ENODEV); + } -- Gitee From 21a03938582c4a8f80111d9cc8c831a34f1ef1dd Mon Sep 17 00:00:00 2001 From: zhouke Date: Thu, 28 Apr 2022 14:33:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?hdf.patch=20=E6=9D=83=E9=99=90=E6=81=A2?= =?UTF-8?q?=E5=A4=8D644?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhouke --- linux-5.10/rk3568_patch/hdf.patch | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 linux-5.10/rk3568_patch/hdf.patch diff --git a/linux-5.10/rk3568_patch/hdf.patch b/linux-5.10/rk3568_patch/hdf.patch old mode 100755 new mode 100644 -- Gitee From bfad826f6a60cd375bc18d538b437149d49514e1 Mon Sep 17 00:00:00 2001 From: zhouke Date: Fri, 29 Apr 2022 14:15:30 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=86=97=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhouke --- linux-5.10/rk3568_patch/kernel.patch | 255 ++++++++------------------- 1 file changed, 72 insertions(+), 183 deletions(-) mode change 100644 => 100755 linux-5.10/rk3568_patch/kernel.patch diff --git a/linux-5.10/rk3568_patch/kernel.patch b/linux-5.10/rk3568_patch/kernel.patch old mode 100644 new mode 100755 index 0cba5a4..4dbd00d --- a/linux-5.10/rk3568_patch/kernel.patch +++ b/linux-5.10/rk3568_patch/kernel.patch @@ -987356,10 +987356,10 @@ index 000000000..45be081e3 +#endif /* _dhd_ip_h_ */ diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_linux.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_linux.c new file mode 100755 -index 000000000..72e3cb597 +index 000000000..96fe104af --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/dhd_linux.c -@@ -0,0 +1,22557 @@ +@@ -0,0 +1,22444 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Broadcom Dongle Host Driver (DHD), Linux-specific network interface @@ -999818,7 +999818,6 @@ index 000000000..72e3cb597 + * (which is set to free_netdev) + */ + if (ifp->net->reg_state == NETREG_UNINITIALIZED) { -+ DHD_ERROR(("lijg123: free netdev 01 %s\n", ifp->net->name)); + free_netdev(ifp->net); + } else { +#if defined(ARGOS_NOTIFY_CB) @@ -1001470,7 +1001469,7 @@ index 000000000..72e3cb597 +int +dhd_dev_ndo_cfg(struct net_device *dev, u8 enable) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_pub_t *dhdp = &dhd->pub; + int ret = 0; + @@ -1001771,7 +1001770,7 @@ index 000000000..72e3cb597 +bool +dhd_dev_is_legacy_pno_enabled(struct net_device *dev) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_is_legacy_pno_enabled(&dhd->pub)); +} + @@ -1001799,7 +1001798,7 @@ index 000000000..72e3cb597 +dhd_dev_pno_set_cfg_gscan(struct net_device *dev, dhd_pno_gscan_cmd_cfg_t type, + void *buf, bool flush) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_set_cfg_gscan(&dhd->pub, type, buf, flush)); +} + @@ -1001807,7 +1001806,7 @@ index 000000000..72e3cb597 +int +dhd_dev_wait_batch_results_complete(struct net_device *dev) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_wait_batch_results_complete(&dhd->pub)); +} + @@ -1001815,14 +1001814,14 @@ index 000000000..72e3cb597 +int +dhd_dev_pno_lock_access_batch_results(struct net_device *dev) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_lock_batch_results(&dhd->pub)); +} +/* Linux wrapper to call common dhd_pno_unlock_batch_results */ +void +dhd_dev_pno_unlock_access_batch_results(struct net_device *dev) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_unlock_batch_results(&dhd->pub)); +} + @@ -1001830,7 +1001829,7 @@ index 000000000..72e3cb597 +int +dhd_dev_pno_run_gscan(struct net_device *dev, bool run, bool flush) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_initiate_gscan_request(&dhd->pub, run, flush)); +} + @@ -1001838,7 +1001837,7 @@ index 000000000..72e3cb597 +int +dhd_dev_pno_enable_full_scan_result(struct net_device *dev, bool real_time_flag) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_enable_full_scan_result(&dhd->pub, real_time_flag)); +} + @@ -1001847,7 +1001846,7 @@ index 000000000..72e3cb597 +dhd_dev_hotlist_scan_event(struct net_device *dev, + const void *data, int *send_evt_bytes, hotlist_type_t type, u32 *buf_len) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_handle_hotlist_scan_evt(&dhd->pub, data, send_evt_bytes, type, buf_len)); +} + @@ -1001856,14 +1001855,14 @@ index 000000000..72e3cb597 +dhd_dev_process_full_gscan_result(struct net_device *dev, +const void *data, uint32 len, int *send_evt_bytes) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_process_full_gscan_result(&dhd->pub, data, len, send_evt_bytes)); +} + +void +dhd_dev_gscan_hotlist_cache_cleanup(struct net_device *dev, hotlist_type_t type) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_gscan_hotlist_cache_cleanup(&dhd->pub, type); + + return; @@ -1001872,7 +1001871,7 @@ index 000000000..72e3cb597 +int +dhd_dev_gscan_batch_cache_cleanup(struct net_device *dev) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_gscan_batch_cache_cleanup(&dhd->pub)); +} + @@ -1001880,7 +1001879,7 @@ index 000000000..72e3cb597 +int +dhd_dev_retrieve_batch_scan(struct net_device *dev) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_retreive_batch_scan_results(&dhd->pub)); +} + @@ -1001888,7 +1001887,7 @@ index 000000000..72e3cb597 +void * dhd_dev_process_epno_result(struct net_device *dev, + const void *data, uint32 event, int *send_evt_bytes) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_process_epno_result(&dhd->pub, data, event, send_evt_bytes)); +} + @@ -1001896,7 +1001895,7 @@ index 000000000..72e3cb597 +dhd_dev_set_lazy_roam_cfg(struct net_device *dev, + wlc_roam_exp_params_t *roam_param) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + wl_roam_exp_cfg_t roam_exp_cfg; + int err; + @@ -1001931,7 +1001930,7 @@ index 000000000..72e3cb597 +dhd_dev_lazy_roam_enable(struct net_device *dev, uint32 enable) +{ + int err; -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + wl_roam_exp_cfg_t roam_exp_cfg; + + memset(&roam_exp_cfg, 0, sizeof(roam_exp_cfg)); @@ -1001957,7 +1001956,7 @@ index 000000000..72e3cb597 +{ + int err; + uint len; -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + + bssid_pref->version = BSSID_PREF_LIST_VERSION; + /* By default programming bssid pref flushes out old values */ @@ -1001981,7 +1001980,7 @@ index 000000000..72e3cb597 + uint32 len, uint32 flush) +{ + int err; -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + int macmode; + + if (blacklist) { @@ -1002007,7 +1002006,7 @@ index 000000000..72e3cb597 + uint32 len, uint32 flush) +{ + int err; -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + wl_ssid_whitelist_t whitelist_ssid_flush; + + if (!ssid_whitelist) { @@ -1002036,7 +1002035,7 @@ index 000000000..72e3cb597 +dhd_dev_pno_get_gscan(struct net_device *dev, dhd_pno_gscan_cmd_cfg_t type, + void *info, uint32 *len) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_pno_get_gscan(&dhd->pub, type, info, len)); +} +#endif /* GSCAN_SUPPORT || DHD_GET_VALID_CHANNELS */ @@ -1002049,7 +1002048,7 @@ index 000000000..72e3cb597 +{ + int err; + wl_rssi_monitor_cfg_t rssi_monitor; -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + rssi_monitor.version = RSSI_MONITOR_VERSION; + rssi_monitor.max_rssi = max_rssi; + rssi_monitor.min_rssi = min_rssi; @@ -1002068,7 +1002067,7 @@ index 000000000..72e3cb597 +dhd_dev_set_tcpack_sup_mode_cfg(struct net_device *dev, uint8 enable) +{ + int err; -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + err = dhd_tcpack_suppress_set(&dhd->pub, enable); + if (err != BCME_OK) { + DHD_ERROR(("%s : Failed to set tcpack_suppress mode: %d\n", __FUNCTION__, err)); @@ -1002080,7 +1002079,7 @@ index 000000000..72e3cb597 +int +dhd_dev_cfg_rand_mac_oui(struct net_device *dev, uint8 *oui) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_pub_t *dhdp = &dhd->pub; + + if (!dhdp || !oui) { @@ -1002131,55 +1002130,55 @@ index 000000000..72e3cb597 +int +dhd_dev_rtt_set_cfg(struct net_device *dev, void *buf) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_set_cfg(&dhd->pub, buf)); +} + +int +dhd_dev_rtt_cancel_cfg(struct net_device *dev, struct ether_addr *mac_list, int mac_cnt) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_stop(&dhd->pub, mac_list, mac_cnt)); +} + +int +dhd_dev_rtt_register_noti_callback(struct net_device *dev, void *ctx, dhd_rtt_compl_noti_fn noti_fn) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_register_noti_callback(&dhd->pub, ctx, noti_fn)); +} + +int +dhd_dev_rtt_unregister_noti_callback(struct net_device *dev, dhd_rtt_compl_noti_fn noti_fn) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_unregister_noti_callback(&dhd->pub, noti_fn)); +} + +int +dhd_dev_rtt_capability(struct net_device *dev, rtt_capabilities_t *capa) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_capability(&dhd->pub, capa)); +} + +int +dhd_dev_rtt_avail_channel(struct net_device *dev, wifi_channel_info *channel_info) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_avail_channel(&dhd->pub, channel_info)); +} + +int +dhd_dev_rtt_enable_responder(struct net_device *dev, wifi_channel_info *channel_info) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_enable_responder(&dhd->pub, channel_info)); +} + +int dhd_dev_rtt_cancel_responder(struct net_device *dev) +{ -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + return (dhd_rtt_cancel_responder(&dhd->pub)); +} + @@ -1002542,11 +1002541,7 @@ index 000000000..72e3cb597 +static int +__dhd_apf_delete_filter(struct net_device *ndev, uint32 filter_id) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(ndev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(ndev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(ndev); + dhd_pub_t *dhdp = &dhd->pub; + int ifidx, ret; + @@ -1002615,11 +1002610,7 @@ index 000000000..72e3cb597 +int +dhd_dev_apf_get_max_len(struct net_device *ndev, uint32 *max_len) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(ndev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(ndev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(ndev); + dhd_pub_t *dhdp = &dhd->pub; + int ifidx, ret; + @@ -1003346,11 +1003337,7 @@ index 000000000..72e3cb597 +dhd_get_memdump_filename(struct net_device *ndev, char *memdump_path, int len, char *fname) +{ + char memdump_type[32]; -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV(ndev); -+#else -+ dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(ndev); -+#endif ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(ndev); + dhd_pub_t *dhdp = &dhd->pub; + + /* Init file name */ @@ -1004836,11 +1004823,7 @@ index 000000000..72e3cb597 +int +dhd_sssr_dump_dig_buf_before(void *dev, const void *user_buf, uint32 len) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info_t *dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhd_pub_t *dhdp = &dhd_info->pub; + int pos = 0, ret = BCME_ERROR; + uint dig_buf_size = 0; @@ -1004862,11 +1004845,7 @@ index 000000000..72e3cb597 +int +dhd_sssr_dump_dig_buf_after(void *dev, const void *user_buf, uint32 len) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info_t *dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhd_pub_t *dhdp = &dhd_info->pub; + int pos = 0, ret = BCME_ERROR; + uint dig_buf_size = 0; @@ -1004888,11 +1004867,7 @@ index 000000000..72e3cb597 +int +dhd_sssr_dump_d11_buf_before(void *dev, const void *user_buf, uint32 len, int core) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info_t *dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhd_pub_t *dhdp = &dhd_info->pub; + int pos = 0, ret = BCME_ERROR; + @@ -1004908,11 +1004883,7 @@ index 000000000..72e3cb597 +int +dhd_sssr_dump_d11_buf_after(void *dev, const void *user_buf, uint32 len, int core) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info_t *dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhd_pub_t *dhdp = &dhd_info->pub; + int pos = 0, ret = BCME_ERROR; + @@ -1005286,11 +1005257,7 @@ index 000000000..72e3cb597 +void +dhd_nla_put_sssr_dump_len(void *ndev, uint32 *arr_len) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); -+#else -+ dhd_info_t *dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); -+#endif ++ dhd_info_t *dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)ndev); + dhd_pub_t *dhdp = &dhd_info->pub; + + if (dhdp->sssr_dump_collected) { @@ -1005319,11 +1005286,7 @@ index 000000000..72e3cb597 + dhd_info_t *dhd_info; + + if (ndev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)ndev); + dhdp = &dhd_info->pub; + } + @@ -1005347,11 +1005310,7 @@ index 000000000..72e3cb597 + dhd_info_t *dhd_info; + + if (ndev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)ndev); + dhdp = &dhd_info->pub; + } + @@ -1005375,11 +1005334,7 @@ index 000000000..72e3cb597 + uint32 remain_len = 0; + + if (ndev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)ndev); + dhdp = &dhd_info->pub; + } + @@ -1005406,11 +1005361,7 @@ index 000000000..72e3cb597 + dhd_info_t *dhd_info; + + if (ndev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)ndev); + dhdp = &dhd_info->pub; + } + @@ -1005435,11 +1005386,7 @@ index 000000000..72e3cb597 + uint32 remain_len = 0; + + if (ndev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)ndev); + dhdp = &dhd_info->pub; + } + @@ -1005486,11 +1005433,7 @@ index 000000000..72e3cb597 + dhd_dbg_ring_t *ring; + + if (ndev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)ndev); + dhdp = &dhd_info->pub; + } + @@ -1005515,11 +1005458,7 @@ index 000000000..72e3cb597 + dhd_dbg_ring_t *ring; + + if (ndev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)ndev); + dhdp = &dhd_info->pub; + } + @@ -1005546,11 +1005485,7 @@ index 000000000..72e3cb597 + dld_buf = &g_dld_buf[type]; + + if (dev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhdp = &dhd_info->pub; + } else if (!dhdp) { + return BCME_ERROR; @@ -1005650,11 +1005585,7 @@ index 000000000..72e3cb597 + dhd_info_t *dhd_info; + + if (dev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhdp = &dhd_info->pub; + } + @@ -1005754,11 +1005685,7 @@ index 000000000..72e3cb597 + dhd_info_t *dhd_info; + + if (dev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhdp = &dhd_info->pub; + } + @@ -1005803,11 +1005730,7 @@ index 000000000..72e3cb597 + dhd_info_t *dhd_info; + + if (dev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhdp = &dhd_info->pub; + } + @@ -1005853,11 +1005776,7 @@ index 000000000..72e3cb597 + dhd_info_t *dhd_info; + + if (dev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhdp = &dhd_info->pub; + } + @@ -1005898,11 +1005817,7 @@ index 000000000..72e3cb597 + dhd_info_t *dhd_info; + + if (dev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhdp = &dhd_info->pub; + } + @@ -1005926,11 +1005841,7 @@ index 000000000..72e3cb597 + dhd_info_t *dhd_info; + + if (dev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhdp = &dhd_info->pub; + } + @@ -1005980,11 +1005891,7 @@ index 000000000..72e3cb597 + dhd_info_t *dhd_info; + + if (dev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhdp = &dhd_info->pub; + } + @@ -1006014,11 +1005921,7 @@ index 000000000..72e3cb597 + dhd_info_t *dhd_info; + + if (dev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhdp = &dhd_info->pub; + } + @@ -1006044,11 +1005947,7 @@ index 000000000..72e3cb597 + dhd_info_t *dhd_info; + + if (dev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)dev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)dev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)dev); + dhdp = &dhd_info->pub; + } + @@ -1006066,11 +1005965,7 @@ index 000000000..72e3cb597 + uint32 length = 0; + + if (ndev) { -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV((struct net_device *)ndev); -+#else -+ dhd_info = *(dhd_info_t **)netdev_priv((struct net_device *)ndev); -+#endif ++ dhd_info = *(dhd_info_t **)DHD_DEV_PRIV_CFG((struct net_device *)ndev); + dhdp = &dhd_info->pub; + } + @@ -1006397,7 +1006292,7 @@ index 000000000..72e3cb597 +dhd_os_socram_dump(struct net_device *dev, uint32 *dump_size) +{ + int ret = BCME_OK; -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_pub_t *dhdp = &dhd->pub; + + if (dhdp->busstate == DHD_BUS_DOWN) { @@ -1006425,7 +1006320,7 @@ index 000000000..72e3cb597 +{ + int ret = BCME_OK; + int orig_len = 0; -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_pub_t *dhdp = &dhd->pub; + if (buf == NULL) + return BCME_ERROR; @@ -1006473,7 +1006368,7 @@ index 000000000..72e3cb597 +dhd_os_get_axi_error_dump(void *dev, const void *user_buf, uint32 len) +{ + int ret = BCME_OK; -+ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); ++ dhd_info_t *dhd = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + dhd_pub_t *dhdp = &dhd->pub; + loff_t pos = 0; + if (user_buf == NULL) { @@ -1009812,11 +1009707,7 @@ index 000000000..72e3cb597 + +void *dhd_get_pub(struct net_device *dev) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhdinfo = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhdinfo = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhdinfo = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + if (dhdinfo) + return (void *)&dhdinfo->pub; + else { @@ -1009827,11 +1009718,7 @@ index 000000000..72e3cb597 + +void *dhd_get_conf(struct net_device *dev) +{ -+#ifdef CONFIG_AP6XXX_WIFI6_HDF -+ dhd_info_t *dhdinfo = *(dhd_info_t **)DHD_DEV_PRIV(dev); -+#else -+ dhd_info_t *dhdinfo = *(dhd_info_t **)netdev_priv(dev); -+#endif ++ dhd_info_t *dhdinfo = *(dhd_info_t **)DHD_DEV_PRIV_CFG(dev); + if (dhdinfo) + return (void *)dhdinfo->pub.conf; + else { @@ -1070848,10 +1070735,10 @@ index 000000000..57c149dfd +#endif /* __FRAG_H__ */ diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hdf_comm.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hdf_comm.c new file mode 100755 -index 000000000..c31fc9be4 +index 000000000..1285808f0 --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/hdf_comm.c -@@ -0,0 +1,743 @@ +@@ -0,0 +1,747 @@ +#include +#include +#include @@ -1071152,6 +1071039,10 @@ index 000000000..c31fc9be4 + } + + HDF_LOGE("%s: start...", __func__); ++ if ((int)param->interval <= 0) { ++ HDF_LOGE("%s: invalid beacon interval=%d, %d,%d", __func__, (int)param->interval, param->DTIMPeriod, (int)param->hiddenSSID); ++ return 0; ++ } + + memset(&info, 0x00, sizeof(info)); + @@ -1169728,10 +1169619,10 @@ index 000000000..ff10499ff + diff --git a/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfg80211.c b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfg80211.c new file mode 100755 -index 000000000..607ea25a4 +index 000000000..a560acdf6 --- /dev/null +++ b/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/wl_cfg80211.c -@@ -0,0 +1,25011 @@ +@@ -0,0 +1,25009 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Linux cfg80211 driver @@ -1187218,11 +1187109,9 @@ index 000000000..607ea25a4 + break; + } + case NETDEV_UNREGISTER: -+ WL_DBG(("lijg123: unregister notify begin %s\n", dev->name)); + wl_cfg80211_clear_per_bss_ies(cfg, wdev); + /* after calling list_del_rcu(&wdev->list) */ + wl_dealloc_netinfo_by_wdev(cfg, wdev); -+ WL_DBG(("lijg123: unregister notify end %s\n", dev->name)); + break; + case NETDEV_GOING_DOWN: + /* -- Gitee