Re: [v8 4/8] rsi: add coex support

2018-02-25 Thread kbuild test robot
Hi Prameela,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on v4.16-rc3 next-20180223]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Amitkumar-Karwar/rsi-add-bluetooth-and-coex-support/20180226-073244
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git 
master
config: x86_64-randconfig-ne0-02261019 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

Note: the 
linux-review/Amitkumar-Karwar/rsi-add-bluetooth-and-coex-support/20180226-073244
 HEAD 9c5222af2b3dbf5143bc1fa4dc0af78fcfa3559d builds fine.
  It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers/net/wireless/rsi/rsi_91x_main.c: In function 'rsi_read_pkt':
>> drivers/net/wireless/rsi/rsi_91x_main.c:165:5: error: implicit declaration 
>> of function 'rsi_coex_recv_pkt' [-Werror=implicit-function-declaration]
rsi_coex_recv_pkt(common, frame_desc + offset);
^
   drivers/net/wireless/rsi/rsi_91x_main.c: In function 'rsi_91x_init':
>> drivers/net/wireless/rsi/rsi_91x_main.c:287:7: error: implicit declaration 
>> of function 'rsi_coex_attach' [-Werror=implicit-function-declaration]
  if (rsi_coex_attach(common)) {
  ^~~
   drivers/net/wireless/rsi/rsi_91x_main.c: In function 'rsi_91x_deinit':
>> drivers/net/wireless/rsi/rsi_91x_main.c:323:3: error: implicit declaration 
>> of function 'rsi_coex_detach' [-Werror=implicit-function-declaration]
  rsi_coex_detach(common);
  ^~~
   cc1: some warnings being treated as errors

vim +/rsi_coex_recv_pkt +165 drivers/net/wireless/rsi/rsi_91x_main.c

   133  
   134  /**
   135   * rsi_read_pkt() - This function reads frames from the card.
   136   * @common: Pointer to the driver private structure.
   137   * @rcv_pkt_len: Received pkt length. In case of USB it is 0.
   138   *
   139   * Return: 0 on success, -1 on failure.
   140   */
   141  int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len)
   142  {
   143  u8 *frame_desc = NULL, extended_desc = 0;
   144  u32 index, length = 0, queueno = 0;
   145  u16 actual_length = 0, offset;
   146  struct sk_buff *skb = NULL;
   147  
   148  index = 0;
   149  do {
   150  frame_desc = _pkt[index];
   151  actual_length = *(u16 *)_desc[0];
   152  offset = *(u16 *)_desc[2];
   153  
   154  queueno = rsi_get_queueno(frame_desc, offset);
   155  length = rsi_get_length(frame_desc, offset);
   156  
   157  /* Extended descriptor is valid for WLAN queues only */
   158  if (queueno == RSI_WIFI_DATA_Q || queueno == 
RSI_WIFI_MGMT_Q)
   159  extended_desc = 
rsi_get_extended_desc(frame_desc,
   160offset);
   161  
   162  switch (queueno) {
   163  case RSI_COEX_Q:
   164  if (common->coex_mode > 1)
 > 165  rsi_coex_recv_pkt(common, frame_desc + 
 > offset);
   166  else
   167  rsi_mgmt_pkt_recv(common,
   168(frame_desc + 
offset));
   169  break;
   170  
   171  case RSI_WIFI_DATA_Q:
   172  skb = rsi_prepare_skb(common,
   173(frame_desc + offset),
   174length,
   175extended_desc);
   176  if (skb == NULL)
   177  goto fail;
   178  
   179  rsi_indicate_pkt_to_os(common, skb);
   180  break;
   181  
   182  case RSI_WIFI_MGMT_Q:
   183  rsi_mgmt_pkt_recv(common, (frame_desc + 
offset));
   184  break;
   185  
   186  default:
   187  rsi_dbg(ERR_ZONE, "%s: pkt from invalid queue: 
%d\n",
   188  __func__,   queueno);
   189  goto fail;
   190  }
   191  
   192  index  += actual_length;
   193  rcv_pkt_len -= actual_length;
   194  } while (rcv_pkt_len > 0);
   195  
   196  return 0;
   197  fail:
   198  return -EINVAL;
   199  }
   200  EXPORT_SYMBOL_GPL(rsi_read_pkt);
   201  
   202  /**
   203   * rsi_tx_scheduler_thread() - This 

Re: [v8 4/8] rsi: add coex support

2018-02-25 Thread kbuild test robot
Hi Prameela,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on v4.16-rc2 next-20180223]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Amitkumar-Karwar/rsi-add-bluetooth-and-coex-support/20180226-073244
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git 
master
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sh 

Note: the 
linux-review/Amitkumar-Karwar/rsi-add-bluetooth-and-coex-support/20180226-073244
 HEAD 9c5222af2b3dbf5143bc1fa4dc0af78fcfa3559d builds fine.
  It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers/net//wireless/rsi/rsi_91x_main.c: In function 'rsi_read_pkt':
>> drivers/net//wireless/rsi/rsi_91x_main.c:165:5: error: implicit declaration 
>> of function 'rsi_coex_recv_pkt'; did you mean 'rsi_read_pkt'? 
>> [-Werror=implicit-function-declaration]
rsi_coex_recv_pkt(common, frame_desc + offset);
^
rsi_read_pkt
   drivers/net//wireless/rsi/rsi_91x_main.c: In function 'rsi_91x_init':
>> drivers/net//wireless/rsi/rsi_91x_main.c:287:7: error: implicit declaration 
>> of function 'rsi_coex_attach'; did you mean 'driver_attach'? 
>> [-Werror=implicit-function-declaration]
  if (rsi_coex_attach(common)) {
  ^~~
  driver_attach
   drivers/net//wireless/rsi/rsi_91x_main.c: In function 'rsi_91x_deinit':
>> drivers/net//wireless/rsi/rsi_91x_main.c:323:3: error: implicit declaration 
>> of function 'rsi_coex_detach'; did you mean 'rsi_91x_deinit'? 
>> [-Werror=implicit-function-declaration]
  rsi_coex_detach(common);
  ^~~
  rsi_91x_deinit
   cc1: some warnings being treated as errors

vim +165 drivers/net//wireless/rsi/rsi_91x_main.c

   133  
   134  /**
   135   * rsi_read_pkt() - This function reads frames from the card.
   136   * @common: Pointer to the driver private structure.
   137   * @rcv_pkt_len: Received pkt length. In case of USB it is 0.
   138   *
   139   * Return: 0 on success, -1 on failure.
   140   */
   141  int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len)
   142  {
   143  u8 *frame_desc = NULL, extended_desc = 0;
   144  u32 index, length = 0, queueno = 0;
   145  u16 actual_length = 0, offset;
   146  struct sk_buff *skb = NULL;
   147  
   148  index = 0;
   149  do {
   150  frame_desc = _pkt[index];
   151  actual_length = *(u16 *)_desc[0];
   152  offset = *(u16 *)_desc[2];
   153  
   154  queueno = rsi_get_queueno(frame_desc, offset);
   155  length = rsi_get_length(frame_desc, offset);
   156  
   157  /* Extended descriptor is valid for WLAN queues only */
   158  if (queueno == RSI_WIFI_DATA_Q || queueno == 
RSI_WIFI_MGMT_Q)
   159  extended_desc = 
rsi_get_extended_desc(frame_desc,
   160offset);
   161  
   162  switch (queueno) {
   163  case RSI_COEX_Q:
   164  if (common->coex_mode > 1)
 > 165  rsi_coex_recv_pkt(common, frame_desc + 
 > offset);
   166  else
   167  rsi_mgmt_pkt_recv(common,
   168(frame_desc + 
offset));
   169  break;
   170  
   171  case RSI_WIFI_DATA_Q:
   172  skb = rsi_prepare_skb(common,
   173(frame_desc + offset),
   174length,
   175extended_desc);
   176  if (skb == NULL)
   177  goto fail;
   178  
   179  rsi_indicate_pkt_to_os(common, skb);
   180  break;
   181  
   182  case RSI_WIFI_MGMT_Q:
   183  rsi_mgmt_pkt_recv(common, (frame_desc + 
offset));
   184  break;
   185  
   186  default:
   187  rsi_dbg(ERR_ZONE, "%s: pkt from invalid queue: 
%d\n",
   188  __func__,   queueno);
   189  goto fail;
   190  }
   191  
   192  index  += actual_length;
   

[v8 4/8] rsi: add coex support

2018-02-23 Thread Amitkumar Karwar
From: Prameela Rani Garnepudi 

With BT support, driver has to handle two streams of data
(i.e. wlan and BT). Actual coex implementation is in firmware.
Coex module just schedule the packets to firmware by taking them
from the corresponding paths.

Structures for module and protocol operations are introduced for
this purpose. Protocol operations structure is global structure
which can be shared among different modules. Move initialization
of coex and operating mode values to rsi_91x_init().

Signed-off-by: Prameela Rani Garnepudi 
Signed-off-by: Siva Rebbagondla 
Signed-off-by: Amitkumar Karwar 
---
v8: Resolve error reported by 'kbuild test robot' by moving header
file code under CONFIG_RSI_COEX flag
v7: Use mutex instead of semaphore (Kalle)
v6: Rename semaphore tx_bus_lock to tx_bus_sema. Modified coex
scheduling loop to avoid while(1) (Kalle)
v5: Same as earlier versions
---
 drivers/net/wireless/rsi/Kconfig|   9 ++
 drivers/net/wireless/rsi/Makefile   |   1 +
 drivers/net/wireless/rsi/rsi_91x_coex.c | 177 
 drivers/net/wireless/rsi/rsi_91x_hal.c  |  17 +--
 drivers/net/wireless/rsi/rsi_91x_main.c |  30 +-
 drivers/net/wireless/rsi/rsi_91x_mgmt.c |   2 +-
 drivers/net/wireless/rsi/rsi_91x_sdio.c |   1 +
 drivers/net/wireless/rsi/rsi_91x_usb.c  |   2 +
 drivers/net/wireless/rsi/rsi_coex.h |  37 +++
 drivers/net/wireless/rsi/rsi_main.h |   6 ++
 drivers/net/wireless/rsi/rsi_mgmt.h |   3 +
 include/net/rsi_91x.h   |  20 
 12 files changed, 295 insertions(+), 10 deletions(-)
 create mode 100644 drivers/net/wireless/rsi/rsi_91x_coex.c
 create mode 100644 drivers/net/wireless/rsi/rsi_coex.h

diff --git a/drivers/net/wireless/rsi/Kconfig b/drivers/net/wireless/rsi/Kconfig
index 7c5e4ca..e6135ee 100644
--- a/drivers/net/wireless/rsi/Kconfig
+++ b/drivers/net/wireless/rsi/Kconfig
@@ -42,4 +42,13 @@ config RSI_USB
  This option enables the USB bus support in rsi drivers.
  Select M (recommended), if you have a RSI 1x1 wireless module.
 
+config RSI_COEX
+   bool "Redpine Signals WLAN BT Coexistence support"
+   depends on BT_HCIRSI && RSI_91X
+   default y
+   ---help---
+ This option enables the WLAN BT coex support in rsi drivers.
+ Select M (recommended), if you have want to use this feature
+ and you have RS9113 module.
+
 endif # WLAN_VENDOR_RSI
diff --git a/drivers/net/wireless/rsi/Makefile 
b/drivers/net/wireless/rsi/Makefile
index 47c4590..ff87121a 100644
--- a/drivers/net/wireless/rsi/Makefile
+++ b/drivers/net/wireless/rsi/Makefile
@@ -5,6 +5,7 @@ rsi_91x-y   += rsi_91x_mac80211.o
 rsi_91x-y  += rsi_91x_mgmt.o
 rsi_91x-y  += rsi_91x_hal.o
 rsi_91x-y  += rsi_91x_ps.o
+rsi_91x-$(CONFIG_RSI_COEX) += rsi_91x_coex.o
 rsi_91x-$(CONFIG_RSI_DEBUGFS)  += rsi_91x_debugfs.o
 
 rsi_usb-y  += rsi_91x_usb.o rsi_91x_usb_ops.o
diff --git a/drivers/net/wireless/rsi/rsi_91x_coex.c 
b/drivers/net/wireless/rsi/rsi_91x_coex.c
new file mode 100644
index 000..c07e839
--- /dev/null
+++ b/drivers/net/wireless/rsi/rsi_91x_coex.c
@@ -0,0 +1,177 @@
+/**
+ * Copyright (c) 2018 Redpine Signals Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "rsi_main.h"
+#include "rsi_coex.h"
+#include "rsi_mgmt.h"
+#include "rsi_hal.h"
+
+static enum rsi_coex_queues rsi_coex_determine_coex_q
+   (struct rsi_coex_ctrl_block *coex_cb)
+{
+   enum rsi_coex_queues q_num = RSI_COEX_Q_INVALID;
+
+   if (skb_queue_len(_cb->coex_tx_qs[RSI_COEX_Q_COMMON]) > 0)
+   q_num = RSI_COEX_Q_COMMON;
+   if (skb_queue_len(_cb->coex_tx_qs[RSI_COEX_Q_BT]) > 0)
+   q_num = RSI_COEX_Q_BT;
+   if (skb_queue_len(_cb->coex_tx_qs[RSI_COEX_Q_WLAN]) > 0)
+   q_num = RSI_COEX_Q_WLAN;
+
+   return q_num;
+}
+
+static void rsi_coex_sched_tx_pkts(struct rsi_coex_ctrl_block *coex_cb)
+{
+   enum rsi_coex_queues coex_q = RSI_COEX_Q_INVALID;
+   struct sk_buff *skb;
+
+   do {
+   coex_q =