diff mbox series

[06/13] wcn36xx: Add ipv6 namespace offload in suspend

Message ID 20201228162839.369156-7-bryan.odonoghue@linaro.org (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series wcn36xx: Enable downstream consistent Wake on Lan | expand

Commit Message

Bryan O'Donoghue Dec. 28, 2020, 4:28 p.m. UTC
We need to respond to ipv6 namespace lookups when in suspend. This patch
adds the necessary changes to issue the appropriate firmware command on
suspend and resume to enter/exit firmware offloaded ns lookup.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/hal.h  |  3 ++
 drivers/net/wireless/ath/wcn36xx/main.c |  4 ++
 drivers/net/wireless/ath/wcn36xx/smd.c  | 55 +++++++++++++++++++++++++
 drivers/net/wireless/ath/wcn36xx/smd.h  |  3 ++
 4 files changed, 65 insertions(+)

Comments

kernel test robot Dec. 28, 2020, 9:49 p.m. UTC | #1
Hi Bryan,

I love your patch! Yet something to improve:

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on wireless-drivers/master ath6kl/ath-next v5.11-rc1 next-20201223]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Bryan-O-Donoghue/wcn36xx-Enable-downstream-consistent-Wake-on-Lan/20201229-003134
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: m68k-randconfig-r004-20201228 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/3af46faf5418cb35d31847e75156f9bb24b3828a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Bryan-O-Donoghue/wcn36xx-Enable-downstream-consistent-Wake-on-Lan/20201229-003134
        git checkout 3af46faf5418cb35d31847e75156f9bb24b3828a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:11,
                    from include/linux/skbuff.h:13,
                    from include/linux/if_ether.h:19,
                    from include/linux/etherdevice.h:20,
                    from drivers/net/wireless/ath/wcn36xx/smd.c:19:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
     169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
         |                                                 ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |  ^~~~~~
   include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |          ^~~~~~~~~~~~~~~
   drivers/net/wireless/ath/wcn36xx/smd.c: In function 'wcn36xx_smd_ipv6_ns_offload':
>> drivers/net/wireless/ath/wcn36xx/smd.c:2816:15: error: 'struct wcn36xx_vif' has no member named 'num_target_ipv6_addrs'
    2816 |   if (vif_priv->num_target_ipv6_addrs) {
         |               ^~
   In file included from include/linux/string.h:20,
                    from include/linux/bitmap.h:9,
                    from include/linux/cpumask.h:12,
                    from include/linux/smp.h:13,
                    from include/linux/lockdep.h:14,
                    from include/linux/spinlock.h:59,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:6,
                    from include/linux/mm.h:10,
                    from include/linux/bvec.h:14,
                    from include/linux/skbuff.h:17,
                    from include/linux/if_ether.h:19,
                    from include/linux/etherdevice.h:20,
                    from drivers/net/wireless/ath/wcn36xx/smd.c:19:
>> drivers/net/wireless/ath/wcn36xx/smd.c:2818:20: error: 'struct wcn36xx_vif' has no member named 'target_ipv6_addrs'
    2818 |           &vif_priv->target_ipv6_addrs[0].in6_u,
         |                    ^~
   arch/m68k/include/asm/string.h:72:45: note: in definition of macro 'memcpy'
      72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
         |                                             ^
   drivers/net/wireless/ath/wcn36xx/smd.c:2821:20: error: 'struct wcn36xx_vif' has no member named 'target_ipv6_addrs'
    2821 |           &vif_priv->target_ipv6_addrs[0].in6_u,
         |                    ^~
   arch/m68k/include/asm/string.h:72:45: note: in definition of macro 'memcpy'
      72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
         |                                             ^
   drivers/net/wireless/ath/wcn36xx/smd.c:2825:15: error: 'struct wcn36xx_vif' has no member named 'num_target_ipv6_addrs'
    2825 |   if (vif_priv->num_target_ipv6_addrs > 1) {
         |               ^~
   In file included from include/linux/string.h:20,
                    from include/linux/bitmap.h:9,
                    from include/linux/cpumask.h:12,
                    from include/linux/smp.h:13,
                    from include/linux/lockdep.h:14,
                    from include/linux/spinlock.h:59,
                    from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:6,
                    from include/linux/mm.h:10,
                    from include/linux/bvec.h:14,
                    from include/linux/skbuff.h:17,
                    from include/linux/if_ether.h:19,
                    from include/linux/etherdevice.h:20,
                    from drivers/net/wireless/ath/wcn36xx/smd.c:19:
   drivers/net/wireless/ath/wcn36xx/smd.c:2827:20: error: 'struct wcn36xx_vif' has no member named 'target_ipv6_addrs'
    2827 |           &vif_priv->target_ipv6_addrs[1].in6_u,
         |                    ^~
   arch/m68k/include/asm/string.h:72:45: note: in definition of macro 'memcpy'
      72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
         |                                             ^


vim +2816 drivers/net/wireless/ath/wcn36xx/smd.c

  2796	
  2797	int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif,
  2798					bool enable)
  2799	{
  2800		struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
  2801		struct wcn36xx_hal_host_offload_req_msg msg_body;
  2802		struct wcn36xx_hal_ns_offload_params *ns_params;
  2803		struct wcn36xx_hal_host_offload_req *ho_params;
  2804		int ret;
  2805	
  2806		mutex_lock(&wcn->hal_mutex);
  2807	
  2808		INIT_HAL_MSG(msg_body, WCN36XX_HAL_HOST_OFFLOAD_REQ);
  2809		ho_params = &msg_body.host_offload_params;
  2810		ns_params = &msg_body.ns_offload_params;
  2811	
  2812		ho_params->offload_type = WCN36XX_HAL_IPV6_NS_OFFLOAD;
  2813		if (enable) {
  2814			ho_params->enable =
  2815				WCN36XX_HAL_OFFLOAD_NS_AND_MCAST_FILTER_ENABLE;
> 2816			if (vif_priv->num_target_ipv6_addrs) {
  2817				memcpy(&ho_params->u,
> 2818				       &vif_priv->target_ipv6_addrs[0].in6_u,
  2819				       sizeof(struct in6_addr));
  2820				memcpy(&ns_params->target_ipv6_addr1,
  2821				       &vif_priv->target_ipv6_addrs[0].in6_u,
  2822				       sizeof(struct in6_addr));
  2823				ns_params->target_ipv6_addr1_valid = 1;
  2824			}
  2825			if (vif_priv->num_target_ipv6_addrs > 1) {
  2826				memcpy(&ns_params->target_ipv6_addr2,
  2827				       &vif_priv->target_ipv6_addrs[1].in6_u,
  2828				       sizeof(struct in6_addr));
  2829				ns_params->target_ipv6_addr2_valid = 1;
  2830			}
  2831		}
  2832		memcpy(&ns_params->self_addr, vif->addr, ETH_ALEN);
  2833		ns_params->bss_index = vif_priv->bss_index;
  2834	
  2835		PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
  2836	
  2837		ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
  2838		if (ret) {
  2839			wcn36xx_err("Sending host_offload_arp failed\n");
  2840			goto out;
  2841		}
  2842		ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
  2843		if (ret) {
  2844			wcn36xx_err("host_offload_arp failed err=%d\n", ret);
  2845			goto out;
  2846		}
  2847	out:
  2848		mutex_unlock(&wcn->hal_mutex);
  2849		return ret;
  2850	}
  2851	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Bryan O'Donoghue Dec. 29, 2020, 2:15 a.m. UTC | #2
On 28/12/2020 21:49, kernel test robot wrote:
> [auto build test ERROR on wireless-drivers-next/master]

hmm

works against this

* 77da2c99eca0 - (tag: ath-202012180905, ath.git/master) Add 
localversion-wireless-testing-ath (11 days ago)
Kalle Valo Jan. 11, 2021, 11:27 a.m. UTC | #3
Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:

> On 28/12/2020 21:49, kernel test robot wrote:
>> [auto build test ERROR on wireless-drivers-next/master]
>
> hmm
>
> works against this
>
> * 77da2c99eca0 - (tag: ath-202012180905, ath.git/master) Add
> localversion-wireless-testing-ath (11 days ago)

The bot tested only ath-next from ath.git, not the master branch:

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on wireless-drivers/master ath6kl/ath-next v5.11-rc1 next-20201223]

I'm guessing that this build error is due to some API changes in
net-next. I'm planning to update ath.git tree today to v5.11, hopefully
that clears up the issue.
Chen, Rong A Jan. 12, 2021, 10:51 a.m. UTC | #4
On 1/11/2021 7:27 PM, Kalle Valo wrote:
> Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:
> 
>> On 28/12/2020 21:49, kernel test robot wrote:
>>> [auto build test ERROR on wireless-drivers-next/master]
>>
>> hmm
>>
>> works against this
>>
>> * 77da2c99eca0 - (tag: ath-202012180905, ath.git/master) Add
>> localversion-wireless-testing-ath (11 days ago)
> 
> The bot tested only ath-next from ath.git, not the master branch:

Hi,

Thanks for the help, we have switched to test on master branch.

Best Regards,
Rong Chen

> 
> [auto build test ERROR on wireless-drivers-next/master]
> [also build test ERROR on wireless-drivers/master ath6kl/ath-next v5.11-rc1 next-20201223]
> 
> I'm guessing that this build error is due to some API changes in
> net-next. I'm planning to update ath.git tree today to v5.11, hopefully
> that clears up the issue.
>
Kalle Valo Jan. 12, 2021, 11:18 a.m. UTC | #5
"Chen, Rong A" <rong.a.chen@intel.com> writes:

> On 1/11/2021 7:27 PM, Kalle Valo wrote:
>> Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:
>>
>>> On 28/12/2020 21:49, kernel test robot wrote:
>>>> [auto build test ERROR on wireless-drivers-next/master]
>>>
>>> hmm
>>>
>>> works against this
>>>
>>> * 77da2c99eca0 - (tag: ath-202012180905, ath.git/master) Add
>>> localversion-wireless-testing-ath (11 days ago)
>>
>> The bot tested only ath-next from ath.git, not the master branch:
>
> Hi,
>
> Thanks for the help, we have switched to test on master branch.

The bot was correctly testing the ath-next branch, as I use that branch
to commit the patches. Can you still change the bot back to use
ath-next, just as it did previously?

Sorry for the confusion.
Chen, Rong A Jan. 13, 2021, 1:57 a.m. UTC | #6
On 1/12/21 7:18 PM, Kalle Valo wrote:
> "Chen, Rong A" <rong.a.chen@intel.com> writes:
>
>> On 1/11/2021 7:27 PM, Kalle Valo wrote:
>>> Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:
>>>
>>>> On 28/12/2020 21:49, kernel test robot wrote:
>>>>> [auto build test ERROR on wireless-drivers-next/master]
>>>> hmm
>>>>
>>>> works against this
>>>>
>>>> * 77da2c99eca0 - (tag: ath-202012180905, ath.git/master) Add
>>>> localversion-wireless-testing-ath (11 days ago)
>>> The bot tested only ath-next from ath.git, not the master branch:
>> Hi,
>>
>> Thanks for the help, we have switched to test on master branch.
> The bot was correctly testing the ath-next branch, as I use that branch
> to commit the patches. Can you still change the bot back to use
> ath-next, just as it did previously?
>
> Sorry for the confusion.
>

Got it, we'll still test ath-next branch.

Best Regards,
Rong Chen
Kalle Valo Jan. 13, 2021, 7:11 a.m. UTC | #7
Rong Chen <rong.a.chen@intel.com> writes:

> On 1/12/21 7:18 PM, Kalle Valo wrote:
>> "Chen, Rong A" <rong.a.chen@intel.com> writes:
>>
>>> On 1/11/2021 7:27 PM, Kalle Valo wrote:
>>>> Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:
>>>>
>>>>> On 28/12/2020 21:49, kernel test robot wrote:
>>>>>> [auto build test ERROR on wireless-drivers-next/master]
>>>>> hmm
>>>>>
>>>>> works against this
>>>>>
>>>>> * 77da2c99eca0 - (tag: ath-202012180905, ath.git/master) Add
>>>>> localversion-wireless-testing-ath (11 days ago)
>>>> The bot tested only ath-next from ath.git, not the master branch:
>>> Hi,
>>>
>>> Thanks for the help, we have switched to test on master branch.
>> The bot was correctly testing the ath-next branch, as I use that branch
>> to commit the patches. Can you still change the bot back to use
>> ath-next, just as it did previously?
>>
>> Sorry for the confusion.
>>
>
> Got it, we'll still test ath-next branch.

Great, thank you. And thank you for maintaing kbuild bot, it's awesome :)
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h
index 90333daed845..3b949b0b3792 100644
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
@@ -3464,6 +3464,9 @@  struct wcn36xx_hal_rem_bcn_filter_req {
 #define WCN36XX_HAL_OFFLOAD_DISABLE                         0
 #define WCN36XX_HAL_OFFLOAD_ENABLE                          1
 #define WCN36XX_HAL_OFFLOAD_BCAST_FILTER_ENABLE             0x2
+#define WCN36XX_HAL_OFFLOAD_MCAST_FILTER_ENABLE             0x4
+#define WCN36XX_HAL_OFFLOAD_NS_AND_MCAST_FILTER_ENABLE	\
+	(WCN36XX_HAL_OFFLOAD_ENABLE | WCN36XX_HAL_OFFLOAD_MCAST_FILTER_ENABLE)
 #define WCN36XX_HAL_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE	\
 	(WCN36XX_HAL_OFFLOAD_ENABLE | WCN36XX_HAL_OFFLOAD_BCAST_FILTER_ENABLE)
 #define WCN36XX_HAL_IPV6_OFFLOAD_ADDR_MAX		0x02
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index af59638d696f..579bb7f4db9c 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1118,6 +1118,9 @@  static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow)
 		if (!vif_priv->sta_assoc)
 			goto out;
 		ret = wcn36xx_smd_arp_offload(wcn, vif, true);
+		if (ret)
+			goto out;
+		ret = wcn36xx_smd_ipv6_ns_offload(wcn, vif, true);
 		if (ret)
 			goto out;
 		ret = wcn36xx_smd_set_power_params(wcn, true);
@@ -1143,6 +1146,7 @@  static int wcn36xx_resume(struct ieee80211_hw *hw)
 			goto out;
 
 		wcn36xx_smd_set_power_params(wcn, false);
+		wcn36xx_smd_ipv6_ns_offload(wcn, vif, false);
 		wcn36xx_smd_arp_offload(wcn, vif, false);
 	}
 out:
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index 4589c3d26027..b05f1e1f253a 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -2794,6 +2794,61 @@  int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif,
 	return ret;
 }
 
+int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+				bool enable)
+{
+	struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
+	struct wcn36xx_hal_host_offload_req_msg msg_body;
+	struct wcn36xx_hal_ns_offload_params *ns_params;
+	struct wcn36xx_hal_host_offload_req *ho_params;
+	int ret;
+
+	mutex_lock(&wcn->hal_mutex);
+
+	INIT_HAL_MSG(msg_body, WCN36XX_HAL_HOST_OFFLOAD_REQ);
+	ho_params = &msg_body.host_offload_params;
+	ns_params = &msg_body.ns_offload_params;
+
+	ho_params->offload_type = WCN36XX_HAL_IPV6_NS_OFFLOAD;
+	if (enable) {
+		ho_params->enable =
+			WCN36XX_HAL_OFFLOAD_NS_AND_MCAST_FILTER_ENABLE;
+		if (vif_priv->num_target_ipv6_addrs) {
+			memcpy(&ho_params->u,
+			       &vif_priv->target_ipv6_addrs[0].in6_u,
+			       sizeof(struct in6_addr));
+			memcpy(&ns_params->target_ipv6_addr1,
+			       &vif_priv->target_ipv6_addrs[0].in6_u,
+			       sizeof(struct in6_addr));
+			ns_params->target_ipv6_addr1_valid = 1;
+		}
+		if (vif_priv->num_target_ipv6_addrs > 1) {
+			memcpy(&ns_params->target_ipv6_addr2,
+			       &vif_priv->target_ipv6_addrs[1].in6_u,
+			       sizeof(struct in6_addr));
+			ns_params->target_ipv6_addr2_valid = 1;
+		}
+	}
+	memcpy(&ns_params->self_addr, vif->addr, ETH_ALEN);
+	ns_params->bss_index = vif_priv->bss_index;
+
+	PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
+
+	ret = wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+	if (ret) {
+		wcn36xx_err("Sending host_offload_arp failed\n");
+		goto out;
+	}
+	ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
+	if (ret) {
+		wcn36xx_err("host_offload_arp failed err=%d\n", ret);
+		goto out;
+	}
+out:
+	mutex_unlock(&wcn->hal_mutex);
+	return ret;
+}
+
 int wcn36xx_smd_rsp_process(struct rpmsg_device *rpdev,
 			    void *buf, int len, void *priv, u32 addr)
 {
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h
index 1458682ee715..380ea58b58ec 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.h
+++ b/drivers/net/wireless/ath/wcn36xx/smd.h
@@ -150,4 +150,7 @@  int wcn36xx_smd_set_mc_list(struct wcn36xx *wcn,
 int wcn36xx_smd_arp_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif,
 			    bool enable);
 
+int wcn36xx_smd_ipv6_ns_offload(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+				bool enable);
+
 #endif	/* _SMD_H_ */