diff mbox

[v2] ath10k: parse Rx MAC timestamp in mgmt frame for FW 10.4

Message ID 20caae0068a19c546f87ef4a25e3651af92c02ab.1458686620.git.poh@qca.qualcomm.com (mailing list archive)
State Not Applicable
Delegated to: Kalle Valo
Headers show

Commit Message

Peter Oh March 22, 2016, 10:44 p.m. UTC
Check and parse Rx MAC timestamp when firmware sets its flag
to status variable.
10.4 firmware adds it in Rx beacon frame only at this moment.
Drivers and mac80211 may utilize it to detect such clockdrift
or beacon collision and use the result for beacon collision
avoidance.

Signed-off-by: Peter Oh <poh@qca.qualcomm.com>
---

v2:
 * Rebased. no code changes.

 drivers/net/wireless/ath/ath10k/wmi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

kernel test robot March 22, 2016, 11:14 p.m. UTC | #1
Hi Peter,

[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on v4.5 next-20160322]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Peter-Oh/ath10k-parse-Rx-MAC-timestamp-in-mgmt-frame-for-FW-10-4/20160323-064843
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: x86_64-randconfig-x000-201612 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/linkage.h:4:0,
                    from include/linux/kernel.h:6,
                    from include/linux/skbuff.h:17,
                    from drivers/net/wireless/ath/ath10k/wmi.c:18:
   drivers/net/wireless/ath/ath10k/wmi.c: In function 'ath10k_wmi_10_4_op_pull_mgmt_rx_ev':
   drivers/net/wireless/ath/ath10k/wmi.c:2236:33: error: 'WMI_RX_STATUS_EXT_INFO' undeclared (first use in this function)
     if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
                                    ^
   include/linux/compiler.h:147:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^
>> drivers/net/wireless/ath/ath10k/wmi.c:2236:2: note: in expansion of macro 'if'
     if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
     ^
   drivers/net/wireless/ath/ath10k/wmi.c:2236:33: note: each undeclared identifier is reported only once for each function it appears in
     if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
                                    ^
   include/linux/compiler.h:147:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^
>> drivers/net/wireless/ath/ath10k/wmi.c:2236:2: note: in expansion of macro 'if'
     if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
     ^
   drivers/net/wireless/ath/ath10k/wmi.c:2239:14: error: 'struct wmi_mgmt_rx_ev_arg' has no member named 'ext_info'
      memcpy(&arg->ext_info, ext_info,
                 ^
   drivers/net/wireless/ath/ath10k/wmi.c:2240:17: error: invalid application of 'sizeof' to incomplete type 'struct wmi_mgmt_rx_ext_info'
             sizeof(struct wmi_mgmt_rx_ext_info));
                    ^

vim +/if +2236 drivers/net/wireless/ath/ath10k/wmi.c

  2220	
  2221		if (skb->len < pull_len)
  2222			return -EPROTO;
  2223	
  2224		skb_pull(skb, pull_len);
  2225		arg->channel = ev_hdr->channel;
  2226		arg->buf_len = ev_hdr->buf_len;
  2227		arg->status = ev_hdr->status;
  2228		arg->snr = ev_hdr->snr;
  2229		arg->phy_mode = ev_hdr->phy_mode;
  2230		arg->rate = ev_hdr->rate;
  2231	
  2232		msdu_len = __le32_to_cpu(arg->buf_len);
  2233		if (skb->len < msdu_len)
  2234			return -EPROTO;
  2235	
> 2236		if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
  2237			len = ALIGN(le32_to_cpu(arg->buf_len), 4);
  2238			ext_info = (struct wmi_mgmt_rx_ext_info *)(skb->data + len);
  2239			memcpy(&arg->ext_info, ext_info,
  2240			       sizeof(struct wmi_mgmt_rx_ext_info));
  2241		}
  2242	
  2243		/* Make sure bytes added for padding are removed. */
  2244		skb_trim(skb, msdu_len);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Peter Oh March 23, 2016, 12:14 a.m. UTC | #2
On 03/22/2016 04:14 PM, kbuild test robot wrote:
> Hi Peter,
>
> [auto build test WARNING on wireless-drivers-next/master]
> [also build test WARNING on v4.5 next-20160322]
> [if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
>
> url:    https://github.com/0day-ci/linux/commits/Peter-Oh/ath10k-parse-Rx-MAC-timestamp-in-mgmt-frame-for-FW-10-4/20160323-064843
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
> config: x86_64-randconfig-x000-201612 (attached as .config)
> reproduce:
>          # save the attached .config to linux build tree
>          make ARCH=x86_64
>
> All warnings (new ones prefixed by >>):
>
>     In file included from include/linux/linkage.h:4:0,
>                      from include/linux/kernel.h:6,
>                      from include/linux/skbuff.h:17,
>                      from drivers/net/wireless/ath/ath10k/wmi.c:18:
>     drivers/net/wireless/ath/ath10k/wmi.c: In function 'ath10k_wmi_10_4_op_pull_mgmt_rx_ev':
>     drivers/net/wireless/ath/ath10k/wmi.c:2236:33: error: 'WMI_RX_STATUS_EXT_INFO' undeclared (first use in this function)
it seems the warning is false report. I could see WMI_RX_STATUS_EXT_INFO 
is defined in wmi.h.
Moreover this check command doesn't claim any warning/error make 
M=drivers/net/wireless/ath/ath10k C=2 CF="-D__CHECK_ENDIAN__"
>       if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
>                                      ^
>     include/linux/compiler.h:147:30: note: in definition of macro '__trace_if'
>       if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
>                                   ^
>>> drivers/net/wireless/ath/ath10k/wmi.c:2236:2: note: in expansion of macro 'if'
>       if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
>       ^
>     drivers/net/wireless/ath/ath10k/wmi.c:2236:33: note: each undeclared identifier is reported only once for each function it appears in
>       if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
>                                      ^
>     include/linux/compiler.h:147:30: note: in definition of macro '__trace_if'
>       if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
>                                   ^
>>> drivers/net/wireless/ath/ath10k/wmi.c:2236:2: note: in expansion of macro 'if'
>       if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
>       ^
>     drivers/net/wireless/ath/ath10k/wmi.c:2239:14: error: 'struct wmi_mgmt_rx_ev_arg' has no member named 'ext_info'
>        memcpy(&arg->ext_info, ext_info,
>                   ^
>     drivers/net/wireless/ath/ath10k/wmi.c:2240:17: error: invalid application of 'sizeof' to incomplete type 'struct wmi_mgmt_rx_ext_info'
>               sizeof(struct wmi_mgmt_rx_ext_info));
>                      ^
>
> vim +/if +2236 drivers/net/wireless/ath/ath10k/wmi.c
>
>    2220	
>    2221		if (skb->len < pull_len)
>    2222			return -EPROTO;
>    2223	
>    2224		skb_pull(skb, pull_len);
>    2225		arg->channel = ev_hdr->channel;
>    2226		arg->buf_len = ev_hdr->buf_len;
>    2227		arg->status = ev_hdr->status;
>    2228		arg->snr = ev_hdr->snr;
>    2229		arg->phy_mode = ev_hdr->phy_mode;
>    2230		arg->rate = ev_hdr->rate;
>    2231	
>    2232		msdu_len = __le32_to_cpu(arg->buf_len);
>    2233		if (skb->len < msdu_len)
>    2234			return -EPROTO;
>    2235	
>> 2236		if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
>    2237			len = ALIGN(le32_to_cpu(arg->buf_len), 4);
>    2238			ext_info = (struct wmi_mgmt_rx_ext_info *)(skb->data + len);
>    2239			memcpy(&arg->ext_info, ext_info,
>    2240			       sizeof(struct wmi_mgmt_rx_ext_info));
>    2241		}
>    2242	
>    2243		/* Make sure bytes added for padding are removed. */
>    2244		skb_trim(skb, msdu_len);
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michal Kazior March 23, 2016, 6:27 a.m. UTC | #3
On 23 March 2016 at 01:14, Peter Oh <poh@codeaurora.org> wrote:
>
> On 03/22/2016 04:14 PM, kbuild test robot wrote:
>>
>> Hi Peter,
>>
>> [auto build test WARNING on wireless-drivers-next/master]
>> [also build test WARNING on v4.5 next-20160322]
>> [if your patch is applied to the wrong git tree, please drop us a note to
>> help improving the system]
>>
>> url:
>> https://github.com/0day-ci/linux/commits/Peter-Oh/ath10k-parse-Rx-MAC-timestamp-in-mgmt-frame-for-FW-10-4/20160323-064843
>> base:
>> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git
>> master
>> config: x86_64-randconfig-x000-201612 (attached as .config)
>> reproduce:
>>          # save the attached .config to linux build tree
>>          make ARCH=x86_64
>>
>> All warnings (new ones prefixed by >>):
>>
>>     In file included from include/linux/linkage.h:4:0,
>>                      from include/linux/kernel.h:6,
>>                      from include/linux/skbuff.h:17,
>>                      from drivers/net/wireless/ath/ath10k/wmi.c:18:
>>     drivers/net/wireless/ath/ath10k/wmi.c: In function
>> 'ath10k_wmi_10_4_op_pull_mgmt_rx_ev':
>>     drivers/net/wireless/ath/ath10k/wmi.c:2236:33: error:
>> 'WMI_RX_STATUS_EXT_INFO' undeclared (first use in this function)
>
> it seems the warning is false report. I could see WMI_RX_STATUS_EXT_INFO is
> defined in wmi.h.
> Moreover this check command doesn't claim any warning/error make
> M=drivers/net/wireless/ath/ath10k C=2 CF="-D__CHECK_ENDIAN__"

I think the problem here is buildbot tested your patch against
wireless-drivers-next tree which doesn't include the macro yet. The
macro is in ath.git though.


Micha?
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kalle Valo April 4, 2016, 2:57 p.m. UTC | #4
Peter Oh <poh@qca.qualcomm.com> writes:

> Check and parse Rx MAC timestamp when firmware sets its flag
> to status variable.
> 10.4 firmware adds it in Rx beacon frame only at this moment.
> Drivers and mac80211 may utilize it to detect such clockdrift
> or beacon collision and use the result for beacon collision
> avoidance.
>
> Signed-off-by: Peter Oh <poh@qca.qualcomm.com>

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 9137566..9977876 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2191,6 +2191,8 @@  static int ath10k_wmi_10_4_op_pull_mgmt_rx_ev(struct ath10k *ar,
 	struct wmi_10_4_mgmt_rx_hdr *ev_hdr;
 	size_t pull_len;
 	u32 msdu_len;
+	struct wmi_mgmt_rx_ext_info *ext_info;
+	u32 len;
 
 	ev = (struct wmi_10_4_mgmt_rx_event *)skb->data;
 	ev_hdr = &ev->hdr;
@@ -2211,6 +2213,13 @@  static int ath10k_wmi_10_4_op_pull_mgmt_rx_ev(struct ath10k *ar,
 	if (skb->len < msdu_len)
 		return -EPROTO;
 
+	if (le32_to_cpu(arg->status) & WMI_RX_STATUS_EXT_INFO) {
+		len = ALIGN(le32_to_cpu(arg->buf_len), 4);
+		ext_info = (struct wmi_mgmt_rx_ext_info *)(skb->data + len);
+		memcpy(&arg->ext_info, ext_info,
+		       sizeof(struct wmi_mgmt_rx_ext_info));
+	}
+
 	/* Make sure bytes added for padding are removed. */
 	skb_trim(skb, msdu_len);