Fwd: [pim] Fwd: [ieee-ietf-coord] draft on Multicast Considerations over IEEE 802 Wireless Media

2017-04-03 Thread Linus Lüssing
Since we had some discussions concerning multicast and wireless
regarding "multicast-to-unicast" just recently, maybe this draft
is of interest to some people here, too.

Regards, Linus


- Forwarded message from "Alvaro Retana (aretana)"  -

Date: Fri, 31 Mar 2017 13:37:53 +
From: "Alvaro Retana (aretana)" 
To: "p...@ietf.org" , "mbo...@ietf.org" 
Cc: "draft-perkins-intarea-multicast-ieee...@ietf.org" 

Subject: [pim] Fwd: [ieee-ietf-coord] draft on Multicast Considerations over 
IEEE 802 Wireless Media

FYI.

This topic was discussed previously in pim/mboned.  Please take a look and 
follow the discussion on int-area.  I also cc'd the authors.

Alvaro.

Thumb-typed and autocorrected..

Begin forwarded message:

From: Juan Carlos Zuniga mailto:j.c.zun...@ieee.org>>
Date: March 31, 2017 at 8:33:01 AM CDT
To: ieee-ietf-co...@ietf.org, Juan Carlos 
Zuniga mailto:juancarlos.zun...@sigfox.com>>
Subject: [ieee-ietf-coord] draft on Multicast Considerations over IEEE 802 
Wireless Media

Hello all,

This is the draft that I mentioned during the meeting. Please take a look and 
provide inputs either here or in the IntArea WG list 
(int-a...@ietf.org):

https://tools.ietf.org/html/draft-perkins-intarea-multicast-ieee802-02

Best,

Juan Carlos
___
ieee-ietf-coord mailing list
ieee-ietf-co...@ietf.org
https://www.ietf.org/mailman/listinfo/ieee-ietf-coord

___
pim mailing list
p...@ietf.org
https://www.ietf.org/mailman/listinfo/pim


- End forwarded message -


[PATCHv3 1/2] cfg80211: Add support to enable or disable btcoex and set btcoex_priority

2017-04-03 Thread c_traja
From: Tamizh chelvam 

This patch introduces NL80211_CMD_SET_BTCOEX command and
NL80211_ATTR_BTCOEX_OP attribute to enable or disable btcoex.
And this change enables user to set btcoex priority by using
NL80211_ATTR_BTCOEX_PRIORITY attribute for the driver which
has the btcoex priority capability. Driver should expose such
capability and make use of this priority to decide whom to share the radio
(either bluetooth or WLAN). When the high priority wlan frames are queued
driver or firmware will signal to block BT activity.
Capable drivers should advertise this support by setting
NL80211_EXT_FEATURE_BTCOEX_PRIORITY nl80211 extended feature.

Signed-off-by: Tamizh chelvam 
---
 include/net/cfg80211.h   |   35 
 include/uapi/linux/nl80211.h |   20 +++
 net/wireless/nl80211.c   |   45 ++
 net/wireless/rdev-ops.h  |   13 
 net/wireless/trace.h |   17 
 5 files changed, 130 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 273b1dc..b144998 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2856,6 +2856,10 @@ struct cfg80211_nan_func {
  * All other parameters must be ignored.
  *
  * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
+ * @set_btcoex: Use this callback to call driver API when user wants to
+ * enable/disable btcoex and use this callback to set wlan high priority
+ * over bluetooth. When BTCOEX enabled, the high priority wlan frames
+ * will have more priority than BT.
  */
 struct cfg80211_ops {
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -3144,6 +3148,8 @@ struct cfg80211_ops {
int (*set_multicast_to_unicast)(struct wiphy *wiphy,
struct net_device *dev,
const bool enabled);
+   int (*set_btcoex)(struct wiphy *wiphy, bool enabled,
+ u32 btcoex_priority);
 };
 
 /*
@@ -3488,6 +3494,35 @@ struct wiphy_iftype_ext_capab {
 };
 
 /**
+ * enum btcoex_priority_support_flag - btcoex priority supported frame types 
and
+ * its bitmap values.
+ * @WIPHY_BTCOEX_SUPPORTS_BE_PREF - BE wlan frame takes more preference than
+ *  BT traffic.
+ * @WIPHY_BTCOEX_SUPPORTS_BK_PREF - BK wlan frame takes more preference than
+ *  BT traffic.
+ * @WIPHY_BTCOEX_SUPPORTS_VI_PREF - VI wlan frame takes more preference than
+ *  BT traffic.
+ * @WIPHY_BTCOEX_SUPPORTS_VO_PREF - VO wlan frame takes more preference than
+ *  BT traffic.
+ * @WIPHY_BTCOEX_SUPPORTS_BEACON_PREF - BEACON wlan frame takes more preference
+ * than  BT traffic.
+ * @WIPHY_BTCOEX_SUPPORTS_MGMT_PREF - MGMT wlan frame takes more preference 
than
+ *  BT traffic.
+ * @WIPHY_BTCOEX_SUPPORTS_MAX_PREF - MAX supported value for btcoex priority
+ * feature.
+ */
+
+enum btcoex_priority_support_flag {
+   WIPHY_BTCOEX_SUPPORTS_BE_PREF = BIT(0),
+   WIPHY_BTCOEX_SUPPORTS_BK_PREF = BIT(1),
+   WIPHY_BTCOEX_SUPPORTS_VI_PREF = BIT(2),
+   WIPHY_BTCOEX_SUPPORTS_VO_PREF = BIT(3),
+   WIPHY_BTCOEX_SUPPORTS_BEACON_PREF = BIT(4),
+   WIPHY_BTCOEX_SUPPORTS_MGMT_PREF = BIT(5),
+   WIPHY_BTCOEX_SUPPORTS_MAX_PREF  = BIT(6) - 1,
+};
+
+/**
  * struct wiphy - wireless hardware description
  * @reg_notifier: the driver's regulatory notification callback,
  * note that if your driver uses wiphy_apply_custom_regulatory()
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 6095a6c..e6b2647 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -944,6 +944,8 @@
  * BSS selection. This command can be issued only while connected and it
  * does not result in a change for the current association. Currently,
  * only the %NL80211_ATTR_IE data is used and updated with this command.
+ * @NL80211_CMD_SET_BTCOEX: Enable/Disable btcoex using
+ * %NL80211_ATTR_SET_BTCOEX
  *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
@@ -1144,6 +1146,8 @@ enum nl80211_commands {
 
NL80211_CMD_UPDATE_CONNECT_PARAMS,
 
+   NL80211_CMD_SET_BTCOEX,
+
/* add new commands above here */
 
/* used to define NL80211_CMD_MAX below */
@@ -2081,6 +2085,16 @@ enum nl80211_commands {
  * @NL80211_ATTR_PMK: PMK for the PMKSA identified by %NL80211_ATTR_PMKID.
  * This is used with @NL80211_CMD_SET_PMKSA.
  *
+ * @NL80211_ATTR_BTCOEX_OP: u8 attribute for driver supporting
+ * the btcoex feature. When used with %NL80211_CMD_SET_BTCOEX it contains
+ * either 0 for disable or 1 for enable btcoex.
+ *
+ * @NL80211_ATTR_BTCOEX_PRIORITY: This is for the driver which supprot
+ * btcoex priority feature. It used with %NL80211_CMD_SET_BTCOEX.
+ * This will have u32 BITMAP value which represents
+ * frame(bk, b

[PATCHv3 2/2] mac80211: Add support to enable or disable btcoex and set btcoex priority value

2017-04-03 Thread c_traja
From: Tamizh chelvam 

This patch introduces a new driver call back drv_set_btcoex.
This API will pass user space value to driver to
enable or disabe btcoex and set or modify the btcoex priority value.

Signed-off-by: Tamizh chelvam 
---
 include/net/mac80211.h|5 +
 net/mac80211/cfg.c|9 +
 net/mac80211/driver-ops.h |   15 +++
 net/mac80211/trace.h  |   20 
 4 files changed, 49 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b1ac872..7d0f1dd 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3453,6 +3453,9 @@ enum ieee80211_reconfig_type {
  * @del_nan_func: Remove a NAN function. The driver must call
  * ieee80211_nan_func_terminated() with
  * NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
+ * @set_btcoex_: Called when BTCOEX is enabled/disabled, use
+ * this callback to enable or disable btcoex and use this callback to
+ * set btcoex_priority. BTCOEX should be enabled to set this priority.
  */
 struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -3734,6 +3737,8 @@ struct ieee80211_ops {
void (*del_nan_func)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u8 instance_id);
+   int (*set_btcoex)(struct ieee80211_hw *hw, bool enabled,
+ u32 btcoex_priority);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8bc3d366..512e5f7 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3617,6 +3617,14 @@ static int ieee80211_set_multicast_to_unicast(struct 
wiphy *wiphy,
return 0;
 }
 
+static int ieee80211_set_btcoex(struct wiphy *wiphy, bool enabled,
+   u32 btcoex_priority)
+{
+   struct ieee80211_local *local = wiphy_priv(wiphy);
+
+   return drv_set_btcoex(local, enabled, btcoex_priority);
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
@@ -3709,4 +3717,5 @@ static int ieee80211_set_multicast_to_unicast(struct 
wiphy *wiphy,
.add_nan_func = ieee80211_add_nan_func,
.del_nan_func = ieee80211_del_nan_func,
.set_multicast_to_unicast = ieee80211_set_multicast_to_unicast,
+   .set_btcoex = ieee80211_set_btcoex,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 09f77e4..c420da5 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1248,4 +1248,19 @@ static inline void drv_del_nan_func(struct 
ieee80211_local *local,
trace_drv_return_void(local);
 }
 
+static inline int drv_set_btcoex(struct ieee80211_local *local,
+bool enabled, u32 btcoex_priority)
+{
+   int ret = -EOPNOTSUPP;
+
+   trace_drv_set_btcoex(local, enabled, btcoex_priority);
+   if (local->ops->set_btcoex)
+   ret = local->ops->set_btcoex(&local->hw, enabled,
+btcoex_priority);
+
+   trace_drv_return_int(local, ret);
+
+   return ret;
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 0d645bc..3a4621e 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -742,6 +742,26 @@
TP_ARGS(local, value)
 );
 
+TRACE_EVENT(drv_set_btcoex,
+   TP_PROTO(struct ieee80211_local *local, bool enabled,
+u32 btcoex_priority),
+   TP_ARGS(local, enabled, btcoex_priority),
+   TP_STRUCT__entry(
+   LOCAL_ENTRY
+   __field(bool, enabled)
+   __field(u32, btcoex_priority)
+   ),
+   TP_fast_assign(
+   LOCAL_ASSIGN;
+   __entry->enabled = enabled;
+   __entry->btcoex_priority = btcoex_priority;
+   ),
+   TP_printk(
+   LOCAL_PR_FMT " enabled:%d btcoex_priority :%u",
+   LOCAL_PR_ARG, __entry->enabled, __entry->btcoex_priority
+   )
+);
+
 TRACE_EVENT(drv_set_coverage_class,
TP_PROTO(struct ieee80211_local *local, s16 value),
 
-- 
1.7.9.5



[PATCHv3 0/2] cfg80211: mac80211: BTCOEX feature support

2017-04-03 Thread c_traja
From: Tamizh chelvam 

This patchset add support for BTCOEX feature to enable/disable and
modifying btcoex priority value via nl80211

Tamizh chelvam (2):
  cfg80211: Add support to enable or disable btcoex and  set
btcoex_priority
  mac80211: Add support to enable or disable btcoex and set btcoex
priority value

v3 :
  * Introduced NL80211_EXT_FEATURE_BTCOEX_PRIORITY to expose
btcoex priority support and removed bool variable.

v2 :
  * Introduced NL80211_CMD_SET_BTCOEX to enable/disable btcoex and
to set/modify btcoex_priority.
  * Added bool variable in wiphy structure to advertise btcoex_priority
feature and removed BITMAP calculation for btcoex_priority value.

 include/net/cfg80211.h   |   35 
 include/net/mac80211.h   |5 +
 include/uapi/linux/nl80211.h |   20 +++
 net/mac80211/cfg.c   |9 +
 net/mac80211/driver-ops.h|   15 ++
 net/mac80211/trace.h |   20 +++
 net/wireless/nl80211.c   |   45 ++
 net/wireless/rdev-ops.h  |   13 
 net/wireless/trace.h |   17 
 9 files changed, 179 insertions(+)

-- 
1.7.9.5



[PATCH] NFC: pn533: use constant off-stack buffer for sending acks

2017-04-03 Thread Michał Mirosław
This fixes following WARNing:

usb 3-2.4.1: NFC: Exchanging data failed (error 0x13)
llcp: nfc_llcp_recv: err -5
llcp: nfc_llcp_symm_timer: SYMM timeout
[ cut here ]
WARNING: CPU: 1 PID: 26397 at .../drivers/usb/core/hcd.c:1584 
usb_hcd_map_urb_for_dma+0x370/0x550
transfer buffer not dma capable
[...]
Workqueue: events nfc_llcp_timeout_work [nfc]
Call Trace:
 ? dump_stack+0x46/0x5a
 ? __warn+0xb9/0xe0
 ? warn_slowpath_fmt+0x5a/0x80
 ? usb_hcd_map_urb_for_dma+0x370/0x550
 ? usb_hcd_submit_urb+0x2fb/0xa60
 ? dequeue_entity+0x3f2/0xc30
 ? pn533_usb_send_ack+0x5d/0x80 [pn533_usb]
 ? pn533_usb_abort_cmd+0x13/0x20 [pn533_usb]
 ? pn533_dep_link_down+0x32/0x70 [pn533]
 ? nfc_dep_link_down+0x87/0xd0 [nfc]
[...]
usb 3-2.4.1: NFC: Exchanging data failed (error 0x13)
llcp: nfc_llcp_recv: err -5
llcp: nfc_llcp_symm_timer: SYMM timeout

Signed-off-by: Michał Mirosław 
---

Patch against stable linux-4.10.8.

---
 drivers/nfc/pn533/i2c.c | 7 ---
 drivers/nfc/pn533/usb.c | 7 ---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/nfc/pn533/i2c.c b/drivers/nfc/pn533/i2c.c
index 1dc89248e58e..35f410797fe4 100644
--- a/drivers/nfc/pn533/i2c.c
+++ b/drivers/nfc/pn533/i2c.c
@@ -49,10 +49,11 @@ struct pn533_i2c_phy {
 
 static int pn533_i2c_send_ack(struct pn533 *dev, gfp_t flags)
 {
-   struct pn533_i2c_phy *phy = dev->phy;
-   struct i2c_client *client = phy->i2c_dev;
-   u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00};
+   static const u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00};
/* spec 6.2.1.3:  Preamble, SoPC (2), ACK Code (2), Postamble */
+
+   struct pn533_i2c_phy *phy = dev->phy;
+   struct i2c_client *client = phy->i2c_dev;
int rc;
 
rc = i2c_master_send(client, ack, 6);
diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c
index 33ed78be2750..09e1db8e8dc3 100644
--- a/drivers/nfc/pn533/usb.c
+++ b/drivers/nfc/pn533/usb.c
@@ -147,12 +147,13 @@ static int pn533_submit_urb_for_ack(struct pn533_usb_phy 
*phy, gfp_t flags)
 
 static int pn533_usb_send_ack(struct pn533 *dev, gfp_t flags)
 {
-   struct pn533_usb_phy *phy = dev->phy;
-   u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00};
+   static const u8 ack[6] = {0x00, 0x00, 0xff, 0x00, 0xff, 0x00};
/* spec 7.1.1.3:  Preamble, SoPC (2), ACK Code (2), Postamble */
+
+   struct pn533_usb_phy *phy = dev->phy;
int rc;
 
-   phy->out_urb->transfer_buffer = ack;
+   phy->out_urb->transfer_buffer = (u8 *)ack;
phy->out_urb->transfer_buffer_length = sizeof(ack);
rc = usb_submit_urb(phy->out_urb, flags);
 
-- 
2.11.0



[PATCH 3/3] rsi: Remove old firmware loading method for RS9113 chip set

2017-04-03 Thread Prameela Rani Garnepudi
Older firmware loading method is not being used by any RSI
module. Hence removing that part of code doesn't impact.

Signed-off-by: Prameela Rani Garnepudi 
---
 drivers/net/wireless/rsi/rsi_91x_sdio_ops.c | 187 
 drivers/net/wireless/rsi/rsi_91x_usb_ops.c  | 124 --
 2 files changed, 311 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c 
b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
index c516be1..d8581c3 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c
@@ -21,171 +21,6 @@
 #include "rsi_hal.h"
 
 /**
- * rsi_copy_to_card() - This function includes the actual funtionality of
- * copying the TA firmware to the card.Basically this
- * function includes opening the TA file,reading the
- * TA file and writing their values in blocks of data.
- * @common: Pointer to the driver private structure.
- * @fw: Pointer to the firmware value to be written.
- * @len: length of firmware file.
- * @num_blocks: Number of blocks to be written to the card.
- *
- * Return: 0 on success and -1 on failure.
- */
-static int rsi_copy_to_card(struct rsi_common *common,
-   const u8 *fw,
-   u32 len,
-   u32 num_blocks)
-{
-   struct rsi_hw *adapter = common->priv;
-   struct rsi_91x_sdiodev *dev =
-   (struct rsi_91x_sdiodev *)adapter->rsi_dev;
-   u32 indx, ii;
-   u32 block_size = dev->tx_blk_size;
-   u32 lsb_address;
-   __le32 data[] = { TA_HOLD_THREAD_VALUE, TA_SOFT_RST_CLR,
- TA_PC_ZERO, TA_RELEASE_THREAD_VALUE };
-   u32 address[] = { TA_HOLD_THREAD_REG, TA_SOFT_RESET_REG,
- TA_TH0_PC_REG, TA_RELEASE_THREAD_REG };
-   u32 base_address;
-   u16 msb_address;
-
-   base_address = TA_LOAD_ADDRESS;
-   msb_address = base_address >> 16;
-
-   for (indx = 0, ii = 0; ii < num_blocks; ii++, indx += block_size) {
-   lsb_address = ((u16) base_address | RSI_SD_REQUEST_MASTER);
-   if (rsi_sdio_write_register_multiple(adapter,
-lsb_address,
-(u8 *)(fw + indx),
-block_size)) {
-   rsi_dbg(ERR_ZONE,
-   "%s: Unable to load %s blk\n", __func__,
-   FIRMWARE_RSI9113);
-   return -1;
-   }
-   rsi_dbg(INIT_ZONE, "%s: loading block: %d\n", __func__, ii);
-   base_address += block_size;
-   if ((base_address >> 16) != msb_address) {
-   msb_address += 1;
-   if (rsi_sdio_master_access_msword(adapter,
- msb_address)) {
-   rsi_dbg(ERR_ZONE,
-   "%s: Unable to set ms word reg\n",
-   __func__);
-   return -1;
-   }
-   }
-   }
-
-   if (len % block_size) {
-   lsb_address = ((u16) base_address | RSI_SD_REQUEST_MASTER);
-   if (rsi_sdio_write_register_multiple(adapter,
-lsb_address,
-(u8 *)(fw + indx),
-len % block_size)) {
-   rsi_dbg(ERR_ZONE,
-   "%s: Unable to load f/w\n", __func__);
-   return -1;
-   }
-   }
-   rsi_dbg(INIT_ZONE,
-   "%s: Succesfully loaded TA instructions\n", __func__);
-
-   if (rsi_sdio_master_access_msword(adapter, TA_BASE_ADDR)) {
-   rsi_dbg(ERR_ZONE,
-   "%s: Unable to set ms word to common reg\n",
-   __func__);
-   return -1;
-   }
-
-   for (ii = 0; ii < ARRAY_SIZE(data); ii++) {
-   /* Bringing TA out of reset */
-   if (rsi_sdio_write_register_multiple(adapter,
-(address[ii] |
-RSI_SD_REQUEST_MASTER),
-(u8 *)&data[ii],
-4)) {
-   rsi_dbg(ERR_ZONE,
-   "%s: Unable to hold TA threads\n", __func__);
-   return -1;
-   }
-   }
-
-   rsi_dbg(INIT_ZONE, "%s: loaded firmware\n", __func__);
-   return 0;
-}
-
-/**
- * rsi_load_ta_instructions() - This function includes the actual funtionality
- *   

[PATCH 2/3] rsi: Add new firmware loading method for RS9113 chip set

2017-04-03 Thread Prameela Rani Garnepudi
The older firmware loading method has been deprecated and not
in use with the current RS9113 modules. The newer method uses
soft boot loader to load the functional firmware.
In this method complete RAM image and FLASH image are present
in the flash. Before loading the functional firmware, host
issues boot loader commands to verify whether the firmware
to load is different from the firmware in device. If it is
different, firmware upgrade will progress and then boot loader
switches to the functional firmware.

Signed-off-by: Prameela Rani Garnepudi 
---
 drivers/net/wireless/rsi/rsi_91x_hal.c  | 595 +++-
 drivers/net/wireless/rsi/rsi_91x_main.c |   2 +
 drivers/net/wireless/rsi/rsi_91x_sdio.c | 267 -
 drivers/net/wireless/rsi/rsi_91x_sdio_ops.c |  42 +-
 drivers/net/wireless/rsi/rsi_91x_usb.c  | 166 +++-
 drivers/net/wireless/rsi/rsi_hal.h  | 110 +
 drivers/net/wireless/rsi/rsi_main.h |  46 ++-
 drivers/net/wireless/rsi/rsi_sdio.h |   5 +-
 drivers/net/wireless/rsi/rsi_usb.h  |   4 +-
 9 files changed, 1146 insertions(+), 91 deletions(-)
 create mode 100644 drivers/net/wireless/rsi/rsi_hal.h

diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c 
b/drivers/net/wireless/rsi/rsi_91x_hal.c
index 02920c9..7f78ca1 100644
--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
+++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
@@ -1,6 +1,9 @@
 /**
  * Copyright (c) 2014 Redpine Signals Inc.
  *
+ * Developers
+ * Prameela Rani Garnepudi 2016 
+ *
  * 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.
@@ -14,7 +17,17 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include 
+#include 
 #include "rsi_mgmt.h"
+#include "rsi_hal.h"
+#include "rsi_sdio.h"
+
+/* FLASH Firmware */
+struct ta_metadata metadata_flash_content[] = {
+   {"flash_content", 0x0001},
+   {"RS9113_wlan_qspi.rps", 0x0001},
+};
 
 /**
  * rsi_send_data_pkt() - This function sends the recieved data packet from
@@ -100,9 +113,9 @@ int rsi_send_data_pkt(struct rsi_common *common, struct 
sk_buff *skb)
(skb->priority & 0xf) |
(tx_params->sta_id << 8));
 
-   status = adapter->host_intf_write_pkt(common->priv,
- skb->data,
- skb->len);
+   status = adapter->host_intf_ops->write_pkt(common->priv,
+  skb->data,
+  skb->len);
if (status)
rsi_dbg(ERR_ZONE, "%s: Failed to write pkt\n",
__func__);
@@ -148,9 +161,9 @@ int rsi_send_mgmt_pkt(struct rsi_common *common,
}
skb_push(skb, extnd_size);
skb->data[extnd_size + 4] = extnd_size;
-   status = adapter->host_intf_write_pkt(common->priv,
- (u8 *)skb->data,
- skb->len);
+   status = adapter->host_intf_ops->write_pkt(common->priv,
+  (u8 *)skb->data,
+  skb->len);
if (status) {
rsi_dbg(ERR_ZONE,
"%s: Failed to write the packet\n", __func__);
@@ -203,9 +216,9 @@ int rsi_send_mgmt_pkt(struct rsi_common *common,
 
msg[7] |= cpu_to_le16(vap_id << 8);
 
-   status = adapter->host_intf_write_pkt(common->priv,
- (u8 *)msg,
- skb->len);
+   status = adapter->host_intf_ops->write_pkt(common->priv,
+  (u8 *)msg,
+  skb->len);
if (status)
rsi_dbg(ERR_ZONE, "%s: Failed to write the packet\n", __func__);
 
@@ -213,3 +226,567 @@ int rsi_send_mgmt_pkt(struct rsi_common *common,
rsi_indicate_tx_status(common->priv, skb, status);
return status;
 }
+
+static void bl_cmd_timeout(unsigned long priv)
+{
+   struct rsi_hw *adapter = (struct rsi_hw *)priv;
+
+   adapter->blcmd_timer_expired = 1;
+   del_timer(&adapter->bl_cmd_timer);
+}
+
+static int bl_start_cmd_timer(struct rsi_hw *adapter, u32 timeout)
+{
+   init_timer(&adapter->bl_cmd_timer);
+   adapter->bl_cmd_timer.data = (unsigned long)adapter;
+   adapter->bl_cmd_timer.function = (void *)&bl_cmd_timeout;
+   adapter->bl_cmd_timer.expires = (msecs_to_jiffies(timeout) + jiffies);
+
+   adapter->blcmd_timer_expired = 0;
+   add_timer(&adapter->bl_cmd_timer);
+
+ 

[PATCH 1/3] rsi: Rename the file rsi_91x_pkt.c to rsi_91x_hal.c

2017-04-03 Thread Prameela Rani Garnepudi
The file rsi_91x_hal.c will contain new firmware loading method for
RSI 9113 chipset. So this file will have device specific operations.
As the file 'rsi_91x_pkt.c' contains code for preparing device
(frimware understandable) specific descriptors for the transmit frames,
it is moved to 'rsi_91x_hal.c'

Signed-off-by: Prameela Rani Garnepudi 
---
 drivers/net/wireless/rsi/Makefile  |   2 +-
 drivers/net/wireless/rsi/rsi_91x_hal.c | 215 +
 drivers/net/wireless/rsi/rsi_91x_pkt.c | 215 -
 3 files changed, 216 insertions(+), 216 deletions(-)
 create mode 100644 drivers/net/wireless/rsi/rsi_91x_hal.c
 delete mode 100644 drivers/net/wireless/rsi/rsi_91x_pkt.c

diff --git a/drivers/net/wireless/rsi/Makefile 
b/drivers/net/wireless/rsi/Makefile
index 25828b6..a475c81 100644
--- a/drivers/net/wireless/rsi/Makefile
+++ b/drivers/net/wireless/rsi/Makefile
@@ -2,7 +2,7 @@ rsi_91x-y   += rsi_91x_main.o
 rsi_91x-y  += rsi_91x_core.o
 rsi_91x-y  += rsi_91x_mac80211.o
 rsi_91x-y  += rsi_91x_mgmt.o
-rsi_91x-y  += rsi_91x_pkt.o
+rsi_91x-y  += rsi_91x_hal.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_hal.c 
b/drivers/net/wireless/rsi/rsi_91x_hal.c
new file mode 100644
index 000..02920c9
--- /dev/null
+++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
@@ -0,0 +1,215 @@
+/**
+ * Copyright (c) 2014 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_mgmt.h"
+
+/**
+ * rsi_send_data_pkt() - This function sends the recieved data packet from
+ *  driver to device.
+ * @common: Pointer to the driver private structure.
+ * @skb: Pointer to the socket buffer structure.
+ *
+ * Return: status: 0 on success, -1 on failure.
+ */
+int rsi_send_data_pkt(struct rsi_common *common, struct sk_buff *skb)
+{
+   struct rsi_hw *adapter = common->priv;
+   struct ieee80211_hdr *tmp_hdr;
+   struct ieee80211_tx_info *info;
+   struct skb_info *tx_params;
+   struct ieee80211_bss_conf *bss;
+   int status;
+   u8 ieee80211_size = MIN_802_11_HDR_LEN;
+   u8 extnd_size;
+   __le16 *frame_desc;
+   u16 seq_num;
+
+   info = IEEE80211_SKB_CB(skb);
+   bss = &info->control.vif->bss_conf;
+   tx_params = (struct skb_info *)info->driver_data;
+
+   if (!bss->assoc) {
+   status = -EINVAL;
+   goto err;
+   }
+
+   tmp_hdr = (struct ieee80211_hdr *)&skb->data[0];
+   seq_num = (le16_to_cpu(tmp_hdr->seq_ctrl) >> 4);
+
+   extnd_size = ((uintptr_t)skb->data & 0x3);
+
+   if ((FRAME_DESC_SZ + extnd_size) > skb_headroom(skb)) {
+   rsi_dbg(ERR_ZONE, "%s: Unable to send pkt\n", __func__);
+   status = -ENOSPC;
+   goto err;
+   }
+
+   skb_push(skb, (FRAME_DESC_SZ + extnd_size));
+   frame_desc = (__le16 *)&skb->data[0];
+   memset((u8 *)frame_desc, 0, FRAME_DESC_SZ);
+
+   if (ieee80211_is_data_qos(tmp_hdr->frame_control)) {
+   ieee80211_size += 2;
+   frame_desc[6] |= cpu_to_le16(BIT(12));
+   }
+
+   if ((!(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) &&
+   (common->secinfo.security_enable)) {
+   if (rsi_is_cipher_wep(common))
+   ieee80211_size += 4;
+   else
+   ieee80211_size += 8;
+   frame_desc[6] |= cpu_to_le16(BIT(15));
+   }
+
+   frame_desc[0] = cpu_to_le16((skb->len - FRAME_DESC_SZ) |
+   (RSI_WIFI_DATA_Q << 12));
+   frame_desc[2] = cpu_to_le16((extnd_size) | (ieee80211_size) << 8);
+
+   if (common->min_rate != 0x) {
+   /* Send fixed rate */
+   frame_desc[3] = cpu_to_le16(RATE_INFO_ENABLE);
+   frame_desc[4] = cpu_to_le16(common->min_rate);
+
+   if (conf_is_ht40(&common->priv->hw->conf))
+   frame_desc[5] = cpu_to_le16(FULL40M_ENABLE);
+
+   if (common->vif_info[0].sgi) {
+   i

[PATCH] mwifiex: Fix invalid port issue

2017-04-03 Thread Ganapathi Bhat
We have to use start port, for TX/RX of single packet,
instead of current aggregating port. This will fix SDIO
CMD53(TX/RX) returning -ETIMEDOUT and halting the data path.

fixes: 0cb52aac4 ('mwifiex: do not set multiport flag for tx/rx single packet')
Signed-off-by: Ganapathi Bhat 
---
 drivers/net/wireless/marvell/mwifiex/sdio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 58d3da0..369450a 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -1380,7 +1380,7 @@ static int mwifiex_sdio_card_to_host_mp_aggr(struct 
mwifiex_adapter *adapter,
}
 
if (card->mpa_rx.pkt_cnt == 1)
-   mport = adapter->ioport + port;
+   mport = adapter->ioport + card->mpa_rx.start_port;
 
if (mwifiex_read_data_sync(adapter, card->mpa_rx.buf,
   card->mpa_rx.buf_len, mport, 1))
@@ -1813,7 +1813,7 @@ static int mwifiex_host_to_card_mp_aggr(struct 
mwifiex_adapter *adapter,
}
 
if (card->mpa_tx.pkt_cnt == 1)
-   mport = adapter->ioport + port;
+   mport = adapter->ioport + card->mpa_tx.start_port;
 
ret = mwifiex_write_data_to_card(adapter, card->mpa_tx.buf,
 card->mpa_tx.buf_len, mport);
-- 
1.9.1



Re: [PATCH v2] nfc: don't be making arch specific unaligned decisions at driver level.

2017-04-03 Thread Paul Gortmaker
[Re: [PATCH v2] nfc: don't be making arch specific unaligned decisions at 
driver level.] On 02/04/2017 (Sun 00:22) Samuel Ortiz wrote:

> Hi Paul,
> 
> On Mon, Jan 09, 2017 at 12:52:22PM -0500, Paul Gortmaker wrote:
> > Currently ia64 fails building allmodconfig with variations of:
> > 
> >In file included from drivers/nfc/nxp-nci/i2c.c:39:0:
> >./include/linux/unaligned/access_ok.h:62:29: error: redefinition of 
> > ‘put_unaligned_be64’

[...]

> > 
> > The decision of what variant for unaligned access to use needs to be
> > left to the arch level and not used at the driver level.  Since not
> > all arch will have sourced asm/unaligned.h already, we need to call
> > it out and then the arch can give us just the one definition that
> > is needed.
> > 
> > See commit 064106a91be5 ("kernel: add common infrastructure for
> > unaligned access") as a reference.
> > 

[...]

> This build issue is now fixed in nfc-next with a couple of different
> patches.

I added nfc-next as a remote and saw you pulled similar commits out of
the NFC backlog just recently:

commit 2eee74b7e2a496dea49847c36fd09320505f45b7
Author: Guenter Roeck 
AuthorDate: Sat Aug 1 06:59:29 2015 -0700
Commit: Samuel Ortiz 
CommitDate: Sat Apr 1 23:52:25 2017 +0200

NFC: nxp-nci: Include unaligned.h instead of access_ok.h

...and...

commit d916d923724d59cde99ee588f15eec59dd863bbd
Author: Tobias Klauser 
AuthorDate: Wed Oct 26 11:00:12 2016 +0200
Commit: Samuel Ortiz 
CommitDate: Sat Apr 1 23:45:31 2017 +0200

NFC: nfcmrvl: Include unaligned.h instead of access_ok.h

Thanks for finding those in the backlog and folding them in; presumably
the backlog was related to the MAINTAINERS change on the same branch.

Anyway, they appear to be the same as the change I proposed, and I build
tested nfc-next on ia64 and x86-64 without issue.  So it looks good.

One thing I did notice, is that nfc-next doesn't appear to be merged
into the linux-next trees, which explains why I didn't see a conflict
with my patch against your two new commits.  Given the recent maintainer
change you added, it seems your nfc-next is now the unconditional source
for NFC changes.  So maybe you want to ask Stephen (Cc:'d) to add your
tree to the daily linux-next coverage?

All he needs is the repo and branch, which I assume are:

git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git #master

Well, that and the request for it really should come from you... :)

Thanks,
Paul.
--

> 
> Cheers,
> Samuel.


Re: [PATCH RFC] remove custom Michael MIC implementation

2017-04-03 Thread Tobin C. Harding
On Mon, Apr 03, 2017 at 12:15:15PM +0200, Arend Van Spriel wrote:
> seems we are missing out again?

Sorry, I don't understand what this comment means?

> On 3-4-2017 11:50, Toke Høiland-Jørgensen wrote:
> > "Tobin C. Harding"  writes:
> > 
> >> Except one: do you know off the top of your head of a canonical
> >> implementation of a softmac wi-fi driver.
> > 
> > I'll suggest taking a look at the ath9k driver :)
> 
> Looking at ks7010 driver it looks like it has 802.11 stack in firmware
> and not sure if Renesas is actively supporting this effort to come up
> with mac80211-friendly firmware or provide detailed chip info.

Thanks for taking a look. If the ks7010 driver has 802.11 stack in
firmware does that mean it is not compatible with using the kernel
mac80211 stack with the current firmware? I do not have my hopes up
about getting any chip information out of Renesas, all I think we have
to go in is the current WEXT driver.

This is an exercise in learning for me, but I do not want to take any
ones time up with a project that is not that useful. Is getting the
ks7010 driver out of staging something that is of use to the kernel
community or are there other wi-fi tasks that our time is better spent
on?

thanks,
Tobin.


Re: [PATCH 1/2] Documentation/sphinx: kerneldoc: add "unused-functions"

2017-04-03 Thread Johannes Berg
On Fri, 2017-03-31 at 15:54 +0300, Jani Nikula wrote:
> 
> I'm sure the parameter name could be improved to capture what you
> mean better; alas I don't have a suggestion.

Yes, that's a fair point - perhaps "functions-not-linked" or something
like that.

> > Internally this works by collecting (per-file) those functions
> > (and enums, structs, doc sections...) that are explicitly used,
> > and invoking the kernel-doc script with "-nofunction" later.
> 
> A quick thought that I don't have the time to check now, but should
> be checked before merging: Is the order of directive extension
> execution deterministic if the Sphinx run is parallelized (sphinx-
> build -j)? Is it deterministic within an rst file? Surely it's not
> deterministic when called from several rst files? The latter is,
> perhaps, acceptable, but the former not.

Interesting, TBH I never even considered this. How would I even run it
that way? Presumably "make htmldocs" doesn't do this?

Sphinx documentation (http://www.sphinx-doc.org/en/stable/extdev/) says
this:

The setup() function can return a dictionary. This is treated by
Sphinx as metadata of the extension. Metadata keys currently
recognized are:
[...]
'parallel_read_safe': a boolean that specifies if parallel reading
of source files can be used when the extension is loaded. It
defaults to False, i.e. you have to explicitly specify your
extension to be parallel-read-safe after checking that it is.

We do set this right now, so I guess it'd only be guaranteed to work
right within a single rst file, and then I should perhaps consider not
making this state global but somehow linking it to the rst file being
processed?

johannes


RE: linux-4.11-rc5/drivers/net/wireless/ath/wil6210/pmc.c: 2 * poor place for limits check ?

2017-04-03 Thread qca_dlansky
From: David Binderman [mailto:dcb...@hotmail.com] 
Sent: Monday, April 3, 2017 2:16 PM

>
> Hello there,
>
> 1.
>
> linux-4.11-rc5/drivers/net/wireless/ath/wil6210/pmc.c:188]: (style) Array 
> index 'i' is used before limits check.

Thanks for letting us know.
We'll upload a fix soon.

Thanks,
 Dedy.


Re: [PATCH 3/3] mwifiex: pcie: avoid hardcode wifi-only firmware name

2017-04-03 Thread Brian Norris
On Fri, Mar 31, 2017 at 03:50:27PM -0700, Dmitry Torokhov wrote:
> That said, I consider the whole wifi-only firmware business is quite
> fragile. Can we have unified firmware and have driver figure out what
> part shoudl be [re]loaded?

+1. I think we should really give a stab at this first, and *then* see
how we want to patch up the flagging of support on a per-chipset basis.
As-is, you're wasting filesystem space on a duplicate firmware blob,
that we have to make sure gets updated in sync with the combined
firmware every time there's an update.

Proof of the duplicate blob -- the latter portion of the combined FW is
identical to the WLAN-only:

  $ cmp mrvl/pcie{usb8997_combo,8997_wlan}_v4.bin $((0x2919c)); echo $?
  0

Brian


[PATCH v3 07/12] rtlwifi: btcoex: 23b 2ant: adjust wifi duration for bt a2dp

2017-04-03 Thread Larry Finger
From: Yan-Hsuan Chuang 

The larger the bt a2dp bit pool is, the more time bt needs to receive
them. If we do not adjust the wifi duration, the voice quality will be
low. Hence we reduce the time that wifi holds, to improve the a2dp
service.

Signed-off-by: Yan-Hsuan Chuang 
Signed-off-by: Larry Finger 
Cc: Pkshih 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - no changes.
v3 - Fixed indentation problem noted by test build robot.
---
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 72 +++---
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.h|  3 +
 2 files changed, 65 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index 2264b24fea9a..57eed18e19c8 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -1134,6 +1134,7 @@ static void btc8723b2ant_ps_tdma(struct btc_coexist 
*btcoexist, bool force_exec,
 {
struct rtl_priv *rtlpriv = btcoexist->adapter;
struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
+   s8 wifi_duration_adjust = 0x0;
u8 tdma_byte4_modify = 0x0;
 
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
@@ -1156,6 +1157,36 @@ static void btc8723b2ant_ps_tdma(struct btc_coexist 
*btcoexist, bool force_exec,
return;
}
 
+   if (coex_sta->scan_ap_num <= 5) {
+   if (coex_sta->a2dp_bit_pool >= 45)
+   wifi_duration_adjust = -15;
+   else if (coex_sta->a2dp_bit_pool >= 35)
+   wifi_duration_adjust = -10;
+   else
+   wifi_duration_adjust = 5;
+   } else if (coex_sta->scan_ap_num <= 20) {
+   if (coex_sta->a2dp_bit_pool >= 45)
+   wifi_duration_adjust = -15;
+   else if (coex_sta->a2dp_bit_pool >= 35)
+   wifi_duration_adjust = -10;
+   else
+   wifi_duration_adjust = 0;
+   } else if (coex_sta->scan_ap_num <= 40) {
+   if (coex_sta->a2dp_bit_pool >= 45)
+   wifi_duration_adjust = -15;
+   else if (coex_sta->a2dp_bit_pool >= 35)
+   wifi_duration_adjust = -10;
+   else
+   wifi_duration_adjust = -5;
+   } else {
+   if (coex_sta->a2dp_bit_pool >= 45)
+   wifi_duration_adjust = -15;
+   else if (coex_sta->a2dp_bit_pool >= 35)
+   wifi_duration_adjust = -10;
+   else
+   wifi_duration_adjust = -10;
+   }
+
if ((bt_link_info->slave_role) && (bt_link_info->a2dp_exist))
/* 0x778 = 0x1 at wifi slot (no blocking BT Low-Pri pkts) */
tdma_byte4_modify = 0x1;
@@ -1204,8 +1235,9 @@ static void btc8723b2ant_ps_tdma(struct btc_coexist 
*btcoexist, bool force_exec,
0x90 | tdma_byte4_modify);
break;
case 9:
-   btc8723b2ant_set_fw_ps_tdma(btcoexist, 0xe3, 0x1a,
-   0x1a, 0xe1, 0x90);
+   btc8723b2ant_set_fw_ps_tdma(
+   btcoexist, 0xe3, 0x3c + wifi_duration_adjust,
+   0x03, 0xf1, 0x90 | tdma_byte4_modify);
break;
case 10:
btc8723b2ant_set_fw_ps_tdma(
@@ -1247,8 +1279,8 @@ static void btc8723b2ant_ps_tdma(struct btc_coexist 
*btcoexist, bool force_exec,
0x2f, 0x60, 0x90);
break;
case 18:
-   btc8723b2ant_set_fw_ps_tdma(btcoexist, 0xe3, 0x5,
-   0x5, 0xe1, 0x90);
+   btc8723b2ant_set_fw_ps_tdma(btcoexist, 0xe3, 0x5, 0x5,
+   0xe1, 0x90);
break;
case 19:
btc8723b2ant_set_fw_ps_tdma(btcoexist, 0xe3, 0x25,
@@ -1263,8 +1295,25 @@ static void btc8723b2ant_ps_tdma(struct btc_coexist 
*btcoexist, bool force_exec,
0x03, 0x70, 0x90);
break;
case 71:
-   btc8723b2ant_set_fw_ps_tdma(btcoexist, 0xe3, 0x1a,
-   0x1a, 0xe1, 0x90);
+   btc8723b2ant_set_fw_ps_tdma(
+   btcoexist, 0xe3, 0x3c + wifi_duration_adjust,
+   0x03, 0xf1, 0x90);
+   break;
+   case 101:
+   case 105:
+   case 113:
+

[PATCH v3 06/12] rtlwifi: btcoex: 23b 2ant: less sensitive to tx rate penalty

2017-04-03 Thread Larry Finger
From: Yan-Hsuan Chuang 

modify h2c parameter so that the rate suffers less penalty from retry

Signed-off-by: Yan-Hsuan Chuang 
Signed-off-by: Larry Finger 
Cc: Pkshih 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - No changes.
v3 - No changes.
---
 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index e9c692a5b13e..2264b24fea9a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -754,9 +754,9 @@ static void btc8723b_set_penalty_txrate(struct btc_coexist 
*btcoexist,
h2c_parameter[1] |= BIT0;
/* normal rate except MCS7/6/5, OFDM54/48/36 */
h2c_parameter[2] = 0x00;
-   h2c_parameter[3] = 0xf7; /* MCS7 or OFDM54 */
-   h2c_parameter[4] = 0xf8; /* MCS6 or OFDM48 */
-   h2c_parameter[5] = 0xf9; /* MCS5 or OFDM36 */
+   h2c_parameter[3] = 0xf4; /* MCS7 or OFDM54 */
+   h2c_parameter[4] = 0xf5; /* MCS6 or OFDM48 */
+   h2c_parameter[5] = 0xf6; /* MCS5 or OFDM36 */
}
 
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-- 
2.12.0



[PATCH v3 08/12] rtlwifi: btcoex: 23b 2ant: coex table fine tune

2017-04-03 Thread Larry Finger
From: Yan-Hsuan Chuang 

set coex table fine tune, for register settings

Signed-off-by: Yan-Hsuan Chuang 
Signed-off-by: Larry Finger 
Cc: Pkshih 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - No changes.
v3 - No changes.
---
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 52 +-
 1 file changed, 32 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index 57eed18e19c8..4139ddf6022b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -915,55 +915,67 @@ static void btc8723b2ant_coex_table_with_type(struct 
btc_coexist *btcoexist,
switch (type) {
case 0:
btc8723b2ant_coex_table(btcoexist, force_exec, 0x,
-   0x, 0x, 0x3);
+   0x, 0xff, 0x3);
break;
case 1:
btc8723b2ant_coex_table(btcoexist, force_exec, 0x,
-   0x5afa5afa, 0x, 0x3);
+   0x5afa5afa, 0xff, 0x3);
break;
case 2:
-   btc8723b2ant_coex_table(btcoexist, force_exec, 0x5a5a5a5a,
-   0x5a5a5a5a, 0x, 0x3);
+   btc8723b2ant_coex_table(btcoexist, force_exec, 0x5ada5ada,
+   0x5ada5ada, 0xff, 0x3);
break;
case 3:
btc8723b2ant_coex_table(btcoexist, force_exec, 0x,
-   0x, 0x, 0x3);
+   0x, 0xff, 0x3);
break;
case 4:
btc8723b2ant_coex_table(btcoexist, force_exec, 0x,
-   0x, 0x, 0x3);
+   0x, 0xff, 0x3);
break;
case 5:
btc8723b2ant_coex_table(btcoexist, force_exec, 0x5fff5fff,
-   0x5fff5fff, 0x, 0x3);
+   0x5fff5fff, 0xff, 0x3);
break;
case 6:
btc8723b2ant_coex_table(btcoexist, force_exec, 0x55ff55ff,
-   0x5a5a5a5a, 0x, 0x3);
+   0x5a5a5a5a, 0xff, 0x3);
break;
case 7:
-   btc8723b2ant_coex_table(btcoexist, force_exec, 0x55ff55ff,
-   0x5afa5afa, 0x, 0x3);
+   btc8723b2ant_coex_table(btcoexist, force_exec, 0x55dd55dd,
+   0x5ada5ada, 0xff, 0x3);
break;
case 8:
-   btc8723b2ant_coex_table(btcoexist, force_exec, 0x5aea5aea,
-   0x5aea5aea, 0x, 0x3);
+   btc8723b2ant_coex_table(btcoexist, force_exec, 0x55dd55dd,
+   0x5ada5ada, 0xff, 0x3);
break;
case 9:
-   btc8723b2ant_coex_table(btcoexist, force_exec, 0x55ff55ff,
-   0x5aea5aea, 0x, 0x3);
+   btc8723b2ant_coex_table(btcoexist, force_exec, 0x55dd55dd,
+   0x5ada5ada, 0xff, 0x3);
break;
case 10:
-   btc8723b2ant_coex_table(btcoexist, force_exec, 0x55ff55ff,
-   0x5aff5aff, 0x, 0x3);
+   btc8723b2ant_coex_table(btcoexist, force_exec, 0x55dd55dd,
+   0x5ada5ada, 0xff, 0x3);
break;
case 11:
-   btc8723b2ant_coex_table(btcoexist, force_exec, 0x55ff55ff,
-   0x5a5f5a5f, 0x, 0x3);
+   btc8723b2ant_coex_table(btcoexist, force_exec, 0x55dd55dd,
+   0x5ada5ada, 0xff, 0x3);
break;
case 12:
-   btc8723b2ant_coex_table(btcoexist, force_exec, 0x55ff55ff,
-   0x5f5f5f5f, 0x, 0x3);
+   btc8723b2ant_coex_table(btcoexist, force_exec, 0x55dd55dd,
+   0x5ada5ada, 0xff, 0x3);
+   break;
+   case 13:
+   btc8723b2ant_coex_table(btcoexist, force_exec, 0x5fff5fff,
+   0x, 0xff, 0x3);
+   break;
+   case 14:
+   btc8723b2ant_coex_table(btcoexist, force_exec, 0x5fff5fff,
+   0x5ada5ada, 0xff, 0x3);
+   break;
+   case 15:
+   btc8723b2ant_coex_table(btc

[PATCH v3 10/12] rtlwifi: btcoex: 23b 2ant: finer bt power adjustment

2017-04-03 Thread Larry Finger
From: Yan-Hsuan Chuang 

The bt can specify a power level to decrease. Rather than decreasing by a
fixed value (usually 2), this change makes the driver fit to the
environment more quickly.

Signed-off-by: Yan-Hsuan Chuang 
Signed-off-by: Larry Finger 
Cc: Pkshih 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - No changes.
v3 - No changes.
---
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 52 ++
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.h|  4 +-
 2 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index e72baa00b42f..b1a4c8466bc6 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -660,44 +660,40 @@ static void btc8723b2ant_set_fw_dac_swing_level(struct 
btc_coexist *btcoexist,
 }
 
 static void btc8723b2ant_set_fw_dec_bt_pwr(struct btc_coexist *btcoexist,
-  bool dec_bt_pwr)
+  u8 dec_bt_pwr_lvl)
 {
struct rtl_priv *rtlpriv = btcoexist->adapter;
u8 h2c_parameter[1] = {0};
 
-   h2c_parameter[0] = 0;
-
-   if (dec_bt_pwr)
-   h2c_parameter[0] |= BIT1;
+   h2c_parameter[0] = dec_bt_pwr_lvl;
 
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-"[BTCoex], decrease Bt Power : %s, FW write 0x62=0x%x\n",
-   (dec_bt_pwr ? "Yes!!" : "No!!"), h2c_parameter[0]);
+"[BTCoex], decrease Bt Power Level : %u\n", dec_bt_pwr_lvl);
 
btcoexist->btc_fill_h2c(btcoexist, 0x62, 1, h2c_parameter);
 }
 
 static void btc8723b2ant_dec_bt_pwr(struct btc_coexist *btcoexist,
-   bool force_exec, bool dec_bt_pwr)
+   bool force_exec, u8 dec_bt_pwr_lvl)
 {
struct rtl_priv *rtlpriv = btcoexist->adapter;
 
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-"[BTCoex], %s Dec BT power = %s\n",
-   force_exec ? "force to" : "", dec_bt_pwr ? "ON" : "OFF");
-   coex_dm->cur_dec_bt_pwr = dec_bt_pwr;
+"[BTCoex], Dec BT power level = %u\n", dec_bt_pwr_lvl);
+   coex_dm->cur_dec_bt_pwr_lvl = dec_bt_pwr_lvl;
 
if (!force_exec) {
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-"[BTCoex], bPreDecBtPwr=%d, bCurDecBtPwr=%d\n",
-   coex_dm->pre_dec_bt_pwr, coex_dm->cur_dec_bt_pwr);
+"[BTCoex], PreDecBtPwrLvl=%d, CurDecBtPwrLvl=%d\n",
+   coex_dm->pre_dec_bt_pwr_lvl,
+   coex_dm->cur_dec_bt_pwr_lvl);
 
-   if (coex_dm->pre_dec_bt_pwr == coex_dm->cur_dec_bt_pwr)
+   if (coex_dm->pre_dec_bt_pwr_lvl == coex_dm->cur_dec_bt_pwr_lvl)
return;
}
-   btc8723b2ant_set_fw_dec_bt_pwr(btcoexist, coex_dm->cur_dec_bt_pwr);
+   btc8723b2ant_set_fw_dec_bt_pwr(btcoexist, coex_dm->cur_dec_bt_pwr_lvl);
 
-   coex_dm->pre_dec_bt_pwr = coex_dm->cur_dec_bt_pwr;
+   coex_dm->pre_dec_bt_pwr_lvl = coex_dm->cur_dec_bt_pwr_lvl;
 }
 
 static void btc8723b2ant_fw_dac_swing_lvl(struct btc_coexist *btcoexist,
@@ -1340,7 +1336,7 @@ static void btc8723b2ant_coex_alloff(struct btc_coexist 
*btcoexist)
/* fw all off */
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
-   btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
+   btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
 
/* sw all off */
btc8723b2ant_sw_mechanism(btcoexist, false, false, false, false);
@@ -1356,7 +1352,7 @@ static void btc8723b2ant_init_coex_dm(struct btc_coexist 
*btcoexist)
 
btc8723b2ant_ps_tdma(btcoexist, FORCE_EXEC, false, 1);
btc8723b2ant_fw_dac_swing_lvl(btcoexist, FORCE_EXEC, 6);
-   btc8723b2ant_dec_bt_pwr(btcoexist, FORCE_EXEC, false);
+   btc8723b2ant_dec_bt_pwr(btcoexist, FORCE_EXEC, 0);
 
btc8723b2ant_sw_mechanism(btcoexist, false, false, false, false);
 
@@ -1381,7 +1377,7 @@ static void btc8723b2ant_action_bt_inquiry(struct 
btc_coexist *btcoexist)
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
}
btc8723b2ant_fw_dac_swing_lvl(btcoexist, FORCE_EXEC, 6);
-   btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
+   btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
 
btc8723b2ant_sw_mechanism(btcoexist, false, false, false, false);
 }
@@ -1413,7 +1409,7 @@ static bool btc8723b2ant_is_common_action(struct 
btc_coexist *btcoexist)
btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0);
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
btc8723

[PATCH v3 12/12] rtlwifi: btcoex: 23b 2ant: new fw use h2c to control GNT_BT

2017-04-03 Thread Larry Finger
From: Yan-Hsuan Chuang 

Earlier versions of the FW did not support h2c to set GNT_BT, but later
versions have that capability. Hence we check the FW version and decide
whether to use h2c or just write to the register.

Signed-off-by: Yan-Hsuan Chuang 
Signed-off-by: Larry Finger 
Cc: Pkshih 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - No changes.
v3 - No changes.
---
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 37 +-
 1 file changed, 29 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index fb72bcd4090c..988f276531dd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -1065,8 +1065,14 @@ static void btc8723b2ant_set_ant_path(struct btc_coexist 
*btcoexist,
btcoexist->btc_write_1byte(btcoexist, 0x930, 0x77);
btcoexist->btc_write_1byte_bitmask(btcoexist, 0x67, 0x20, 0x1);
 
-   /* Force GNT_BT to low */
-   btcoexist->btc_write_1byte_bitmask(btcoexist, 0x765, 0x18, 0x0);
+   if (fw_ver >= 0x18) {
+   /* Use H2C to set GNT_BT to High to avoid A2DP click */
+   h2c_parameter[0] = 1;
+   btcoexist->btc_fill_h2c(btcoexist, 0x6E, 1,
+   h2c_parameter);
+   } else {
+   btcoexist->btc_write_1byte(btcoexist, 0x765, 0x18);
+   }
 
if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT) {
/* tell firmware "no antenna inverse" */
@@ -1078,8 +1084,12 @@ static void btc8723b2ant_set_ant_path(struct btc_coexist 
*btcoexist,
} else {
/* tell firmware "antenna inverse" */
h2c_parameter[0] = 1;
-   h2c_parameter[1] = 1;  /* ext switch type */
-   btcoexist->btc_fill_h2c(btcoexist, 0x65, 2,
+   }
+   } else {
+   if (fw_ver >= 0x18) {
+   /* Use H2C to set GNT_BT to "Control by PTA"*/
+   h2c_parameter[0] = 0;
+   btcoexist->btc_fill_h2c(btcoexist, 0x6E, 1,
h2c_parameter);
btcoexist->btc_write_2byte(btcoexist, 0x948, 0x280);
}
@@ -2370,12 +2380,23 @@ static void btc8723b2ant_run_coexist_mechanism(struct 
btc_coexist *btcoexist)
 
 static void btc8723b2ant_wifioff_hwcfg(struct btc_coexist *btcoexist)
 {
+   u8 h2c_parameter[2] = {0};
+   u32 fw_ver = 0;
+
/* set wlan_act to low */
btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4);
-   /* Force GNT_BT to High */
-   btcoexist->btc_write_1byte_bitmask(btcoexist, 0x765, 0x18, 0x3);
-   /* BT select s0/s1 is controlled by BT */
-   btcoexist->btc_write_1byte_bitmask(btcoexist, 0x67, 0x20, 0x0);
+
+   /* WiFi standby while GNT_BT 0 -> 1 */
+   btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xf, 0x780);
+
+   btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver);
+   if (fw_ver >= 0x18) {
+   /* Use H2C to set GNT_BT to HIGH */
+   h2c_parameter[0] = 1;
+   btcoexist->btc_fill_h2c(btcoexist, 0x6E, 1, h2c_parameter);
+   } else {
+   btcoexist->btc_write_1byte(btcoexist, 0x765, 0x18);
+   }
 }
 
 /*
-- 
2.12.0



[PATCH v3 05/12] rtlwifi: btcoex: 23b 2ant: monitor wifi counter for allocate tdma time

2017-04-03 Thread Larry Finger
From: Yan-Hsuan Chuang 

If there are too many CRC error packets, it means the wifi is operating
under low quality circumstances. If so, we need to reallocate the
resources of wifi and bt

Signed-off-by: Yan-Hsuan Chuang 
Signed-off-by: Larry Finger 
Cc: Pkshih 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - No changes.
v3 - No changes.
---
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 40 ++
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.h| 10 ++
 2 files changed, 50 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index 2c9f626c3ec7..e9c692a5b13e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -309,6 +309,43 @@ static void btc8723b2ant_monitor_bt_ctr(struct btc_coexist 
*btcoexist)
btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc);
 }
 
+static void btc8723b2ant_monitor_wifi_ctr(struct btc_coexist *btcoexist)
+{
+   if (coex_sta->under_ips) {
+   coex_sta->crc_ok_cck = 0;
+   coex_sta->crc_ok_11g = 0;
+   coex_sta->crc_ok_11n = 0;
+   coex_sta->crc_ok_11n_agg = 0;
+
+   coex_sta->crc_err_cck = 0;
+   coex_sta->crc_err_11g = 0;
+   coex_sta->crc_err_11n = 0;
+   coex_sta->crc_err_11n_agg = 0;
+   } else {
+   coex_sta->crc_ok_cck =
+   btcoexist->btc_read_4byte(btcoexist, 0xf88);
+   coex_sta->crc_ok_11g =
+   btcoexist->btc_read_2byte(btcoexist, 0xf94);
+   coex_sta->crc_ok_11n =
+   btcoexist->btc_read_2byte(btcoexist, 0xf90);
+   coex_sta->crc_ok_11n_agg =
+   btcoexist->btc_read_2byte(btcoexist, 0xfb8);
+
+   coex_sta->crc_err_cck =
+   btcoexist->btc_read_4byte(btcoexist, 0xf84);
+   coex_sta->crc_err_11g =
+   btcoexist->btc_read_2byte(btcoexist, 0xf96);
+   coex_sta->crc_err_11n =
+   btcoexist->btc_read_2byte(btcoexist, 0xf92);
+   coex_sta->crc_err_11n_agg =
+   btcoexist->btc_read_2byte(btcoexist, 0xfba);
+   }
+
+   /* reset counter */
+   btcoexist->btc_write_1byte_bitmask(btcoexist, 0xf16, 0x1, 0x1);
+   btcoexist->btc_write_1byte_bitmask(btcoexist, 0xf16, 0x1, 0x0);
+}
+
 static void btc8723b2ant_query_bt_info(struct btc_coexist *btcoexist)
 {
struct rtl_priv *rtlpriv = btcoexist->adapter;
@@ -2875,6 +2912,9 @@ void ex_btc8723b2ant_periodical(struct btc_coexist 
*btcoexist)
 #if (BT_AUTO_REPORT_ONLY_8723B_2ANT == 0)
btc8723b2ant_query_bt_info(btcoexist);
 #else
+   btc8723b2ant_monitor_bt_ctr(btcoexist);
+   btc8723b2ant_monitor_wifi_ctr(btcoexist);
+
if (btc8723b2ant_is_wifi_status_changed(btcoexist) ||
coex_dm->auto_tdma_adjust)
btc8723b2ant_run_coexist_mechanism(btcoexist);
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h
index d787ae3bced2..d1bfdbec82b0 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h
@@ -149,6 +149,16 @@ struct coex_sta_8723b_2ant {
u8 bt_retry_cnt;
u8 bt_info_ext;
u32 pop_event_cnt;
+
+   u32 crc_ok_cck;
+   u32 crc_ok_11g;
+   u32 crc_ok_11n;
+   u32 crc_ok_11n_agg;
+
+   u32 crc_err_cck;
+   u32 crc_err_11g;
+   u32 crc_err_11n;
+   u32 crc_err_11n_agg;
 };
 
 /*
-- 
2.12.0



Re: [PATCH 2/3] mwifiex: using general print function during device intialization

2017-04-03 Thread Brian Norris
On Fri, Mar 31, 2017 at 03:46:58PM -0700, Dmitry Torokhov wrote:
> On Thu, Mar 30, 2017 at 2:19 AM, Xinming Hu  wrote:
> > From: Xinming Hu 
> >
> > adapter->dev is initialized after mwifiex_register done, before that
> > print message by general pr_* function
> 
> No, we should move away from naked pr_*() as much as possible. Please
> change  mwifiex_register() to accept "dev" parameter and assign
> adapter->dev early enough so that the standard mwifiex_err() calls are
> usable.

Agreed. You mean like I did here? :)

ba1c7e45ec22 mwifiex: set adapter->dev before starting to use mwifiex_dbg()

That's in v4.11-rc4, partly as a bugfix to this:

2e02b5814217 ("mwifiex: Allow mwifiex early access to device structure")

> Also consider changing _mwifiex_dbg() to handle cases when
> adapter->dev is NULL and fall back to pr_.

That'd be nice. It would have mitigated the problems of commit
2e02b5814217 too.

Brian

> > Signed-off-by: Xinming Hu 
> > Signed-off-by: Amitkumar Karwar 
> > ---
> >  drivers/net/wireless/marvell/mwifiex/pcie.c | 78 
> > -
> >  drivers/net/wireless/marvell/mwifiex/sdio.c |  3 +-
> >  2 files changed, 34 insertions(+), 47 deletions(-)

[...]


[PATCH v3 11/12] rtlwifi: btcoex: 23b 2ant: add comments to describe how duration adjusted

2017-04-03 Thread Larry Finger
From: Yan-Hsuan Chuang 

Since btcoex uses static variables to store the cumulative information
on the wifi status, some tricks are used that are a bit obscure. We add
some comments about the criteria we use to adjust wifi duration.

Signed-off-by: Yan-Hsuan Chuang 
Signed-off-by: Larry Finger 
Cc: Pkshih 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - No changes.
v3 - No changes.
---
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c   | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index b1a4c8466bc6..fb72bcd4090c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -1622,6 +1622,9 @@ static void btc8723b2ant_tdma_duration_adjust(struct 
btc_coexist *btcoexist,
dn = 0;
 
if (up >= n) {
+   /* if retry count during continuous n*2
+* seconds is 0, enlarge WiFi duration
+*/
wait_count = 0;
n = 3;
up = 0;
@@ -1638,12 +1641,20 @@ static void btc8723b2ant_tdma_duration_adjust(struct 
btc_coexist *btcoexist,
up = 0;
 
if (dn == 2) {
+   /* if continuous 2 retry count(every 2
+* seconds) >0 and < 3, reduce WiFi duration
+*/
if (wait_count <= 2)
+   /* avoid loop between the two levels */
m++;
else
m = 1;
 
if (m >= 20)
+   /* maximum of m = 20 ' will recheck if
+* need to adjust wifi duration in
+* maximum time interval 120 seconds
+*/
m = 20;
 
n = 3 * m;
@@ -1655,12 +1666,20 @@ static void btc8723b2ant_tdma_duration_adjust(struct 
btc_coexist *btcoexist,
 "[BTCoex], Decrease wifi duration for 
retry_counter<3!!\n");
}
} else {
+   /* retry count > 3, once retry count > 3, to reduce
+*  WiFi duration
+*/
if (wait_count == 1)
+   /* to avoid loop between the two levels */
m++;
else
m = 1;
 
if (m >= 20)
+   /* maximum of m = 20 ' will recheck if need to
+* adjust wifi duration in maximum time interval
+* 120 seconds
+*/
m = 20;
 
n = 3 * m;
-- 
2.12.0



[PATCH v3 09/12] rtlwifi: btcoex: 23b 2ant: remove redundant bt stack report

2017-04-03 Thread Larry Finger
From: Yan-Hsuan Chuang 

New ICs have hardware mailbox to deliver bt information instead of doing
it by driver itself, so remove them.

Signed-off-by: Yan-Hsuan Chuang 
Signed-off-by: Larry Finger 
Cc: Pkshih 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - No changes.
v3 - No changes.
---
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 18 +-
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index 4139ddf6022b..e72baa00b42f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -399,11 +399,9 @@ static bool btc8723b2ant_is_wifi_status_changed(struct 
btc_coexist *btcoexist)
 
 static void btc8723b2ant_update_bt_link_info(struct btc_coexist *btcoexist)
 {
-   /*struct btc_stack_info *stack_info = &btcoexist->stack_info;*/
struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
bool bt_hs_on = false;
 
-#if (BT_AUTO_REPORT_ONLY_8723B_2ANT == 1) /* profile from bt patch */
btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on);
 
bt_link_info->bt_link_exist = coex_sta->bt_link_exist;
@@ -417,21 +415,7 @@ static void btc8723b2ant_update_bt_link_info(struct 
btc_coexist *btcoexist)
bt_link_info->pan_exist = true;
bt_link_info->bt_link_exist = true;
}
-#else  /* profile from bt stack */
-   bt_link_info->bt_link_exist = stack_info->bt_link_exist;
-   bt_link_info->sco_exist = stack_info->sco_exist;
-   bt_link_info->a2dp_exist = stack_info->a2dp_exist;
-   bt_link_info->pan_exist = stack_info->pan_exist;
-   bt_link_info->hid_exist = stack_info->hid_exist;
-
-   /*for win-8 stack HID report error*/
-   if (!stack_info->hid_exist)
-   stack_info->hid_exist = coex_sta->hid_exist;
-   /*sync  BTInfo with BT firmware and stack*/
-   /* when stack HID report error, here we use the info from bt fw.*/
-   if (!stack_info->bt_link_exist)
-   stack_info->bt_link_exist = coex_sta->bt_link_exist;
-#endif
+
/* check if Sco only */
if (bt_link_info->sco_exist && !bt_link_info->a2dp_exist &&
!bt_link_info->pan_exist && !bt_link_info->hid_exist)
-- 
2.12.0



[PATCH v3 04/12] rtlwifi: btcoex: 23b 2ant: detect if bt is slave, and modify tdma

2017-04-03 Thread Larry Finger
From: Yan-Hsuan Chuang 

if the bt is slave, it may receive packet at any time, so we
need to mark them as high priority packets to avoid packet loss.

Signed-off-by: Yan-Hsuan Chuang 
Signed-off-by: Larry Finger 
Cc: Pkshih 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - No changes.
v3 - No changes.
---
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 91 +++---
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h   |  1 +
 2 files changed, 62 insertions(+), 30 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index b182c61edf91..2c9f626c3ec7 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -266,6 +266,7 @@ void btc8723b2ant_limited_rx(struct btc_coexist *btcoexist, 
bool force_exec,
 static void btc8723b2ant_monitor_bt_ctr(struct btc_coexist *btcoexist)
 {
struct rtl_priv *rtlpriv = btcoexist->adapter;
+   struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
u32 reg_hp_txrx, reg_lp_txrx, u32tmp;
u32 reg_hp_tx = 0, reg_hp_rx = 0;
u32 reg_lp_tx = 0, reg_lp_rx = 0;
@@ -286,6 +287,17 @@ static void btc8723b2ant_monitor_bt_ctr(struct btc_coexist 
*btcoexist)
coex_sta->low_priority_tx = reg_lp_tx;
coex_sta->low_priority_rx = reg_lp_rx;
 
+   if ((coex_sta->low_priority_tx > 1050) &&
+   (!coex_sta->c2h_bt_inquiry_page))
+   coex_sta->pop_event_cnt++;
+
+   if ((coex_sta->low_priority_rx >= 950) &&
+   (coex_sta->low_priority_rx >= coex_sta->low_priority_tx) &&
+   (!coex_sta->under_ips))
+   bt_link_info->slave_role = true;
+   else
+   bt_link_info->slave_role = false;
+
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
 "[BTCoex], High Priority Tx/Rx(reg 0x%x)=0x%x(%d)/0x%x(%d)\n",
 reg_hp_txrx, reg_hp_tx, reg_hp_tx, reg_hp_rx, reg_hp_rx);
@@ -1084,6 +1096,8 @@ static void btc8723b2ant_ps_tdma(struct btc_coexist 
*btcoexist, bool force_exec,
 bool turn_on, u8 type)
 {
struct rtl_priv *rtlpriv = btcoexist->adapter;
+   struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
+   u8 tdma_byte4_modify = 0x0;
 
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
 "[BTCoex], %s turn %s PS TDMA, type=%d\n",
@@ -1104,75 +1118,92 @@ static void btc8723b2ant_ps_tdma(struct btc_coexist 
*btcoexist, bool force_exec,
(coex_dm->pre_ps_tdma == coex_dm->cur_ps_tdma))
return;
}
+
+   if ((bt_link_info->slave_role) && (bt_link_info->a2dp_exist))
+   /* 0x778 = 0x1 at wifi slot (no blocking BT Low-Pri pkts) */
+   tdma_byte4_modify = 0x1;
+
if (turn_on) {
switch (type) {
case 1:
default:
-   btc8723b2ant_set_fw_ps_tdma(btcoexist, 0xe3, 0x1a,
-   0x1a, 0xe1, 0x90);
+   btc8723b2ant_set_fw_ps_tdma(
+   btcoexist, 0xe3, 0x3c,
+   0x03, 0xf1, 0x90 | tdma_byte4_modify);
break;
case 2:
-   btc8723b2ant_set_fw_ps_tdma(btcoexist, 0xe3, 0x12,
-   0x12, 0xe1, 0x90);
+   btc8723b2ant_set_fw_ps_tdma(
+   btcoexist, 0xe3, 0x2d,
+   0x03, 0xf1, 0x90 | tdma_byte4_modify);
break;
case 3:
-   /* This call breaks BT when wireless is active -
-* comment it out for now until a better fix is found:
-* btc8723b2ant_set_fw_ps_tdma(btcoexist, 0xe3, 0x1c,
-*  0x3, 0xf1, 0x90);
-*/
+   btc8723b2ant_set_fw_ps_tdma(btcoexist, 0xe3, 0x1c,
+   0x3, 0xf1,
+   0x90 | tdma_byte4_modify);
break;
case 4:
btc8723b2ant_set_fw_ps_tdma(btcoexist, 0xe3, 0x10,
-   0x03, 0xf1, 0x90);
+   0x03, 0xf1,
+   0x90 | tdma_byte4_modify);
break;
case 5:
-   btc8723b2ant_set_fw_ps_tdma(btcoexist, 0xe3, 0x1a,
-   0x1a, 0x60, 0x90);
+   btc8723b2ant_set_fw_ps_tdma(
+   btcoexist, 0xe3, 0x3c,
+

[PATCH v3 03/12] rtlwifi: btcoex: 23b 2ant: add btc8723b2ant_limited_rx to reduce agg size

2017-04-03 Thread Larry Finger
From: Yan-Hsuan Chuang 

For wifi and bt coexistence, if the aggregation size of wifi is too
large, the transmission time of the aggregated packet could be too long
and the bt packets might "cut off" the wifi packet. We need to reduce
the aggregation size to improve wifi performance.

Signed-off-by: Yan-Hsuan Chuang 
Signed-off-by: Larry Finger 
Cc: Pkshih 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - No changes.
v3 - No changes.
---
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 40 ++
 1 file changed, 40 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index 9b09b94cbb43..b182c61edf91 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -240,6 +240,29 @@ static u8 btc8723b2ant_wifi_rssi_state(struct btc_coexist 
*btcoexist,
return wifi_rssi_state;
 }
 
+static
+void btc8723b2ant_limited_rx(struct btc_coexist *btcoexist, bool force_exec,
+bool rej_ap_agg_pkt, bool bt_ctrl_agg_buf_size,
+u8 agg_buf_size)
+{
+   bool reject_rx_agg = rej_ap_agg_pkt;
+   bool bt_ctrl_rx_agg_size = bt_ctrl_agg_buf_size;
+   u8 rx_agg_size = agg_buf_size;
+
+   /*  */
+   /*  Rx Aggregation related setting  */
+   /*  */
+   btcoexist->btc_set(btcoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT,
+  &reject_rx_agg);
+   /* decide BT control aggregation buf size or not */
+   btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_CTRL_AGG_SIZE,
+  &bt_ctrl_rx_agg_size);
+   /* aggregate buf size, only work when BT control Rx aggregate size */
+   btcoexist->btc_set(btcoexist, BTC_SET_U1_AGG_BUF_SIZE, &rx_agg_size);
+   /* real update aggregation setting */
+   btcoexist->btc_set(btcoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL);
+}
+
 static void btc8723b2ant_monitor_bt_ctr(struct btc_coexist *btcoexist)
 {
struct rtl_priv *rtlpriv = btcoexist->adapter;
@@ -1266,6 +1289,8 @@ static bool btc8723b2ant_is_common_action(struct 
btc_coexist *btcoexist)
low_pwr_disable = false;
btcoexist->btc_set(btcoexist, BTC_SET_ACT_DISABLE_LOW_POWER,
   &low_pwr_disable);
+   btc8723b2ant_limited_rx(btcoexist, NORMAL_EXEC,
+   false, false, 0x8);
 
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
 "[BTCoex], Wifi non-connected idle!!\n");
@@ -1288,6 +1313,8 @@ static bool btc8723b2ant_is_common_action(struct 
btc_coexist *btcoexist)
btcoexist->btc_set(btcoexist,
   BTC_SET_ACT_DISABLE_LOW_POWER,
   &low_pwr_disable);
+   btc8723b2ant_limited_rx(btcoexist, NORMAL_EXEC,
+   false, false, 0x8);
 
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
 "[BTCoex], Wifi connected + BT non 
connected-idle!!\n");
@@ -1317,6 +1344,8 @@ static bool btc8723b2ant_is_common_action(struct 
btc_coexist *btcoexist)
return false;
RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
 "[BTCoex], Wifi connected + BT 
connected-idle!!\n");
+   btc8723b2ant_limited_rx(btcoexist, NORMAL_EXEC,
+   false, false, 0x8);
 
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1,
  0xf, 0x0);
@@ -1576,6 +1605,7 @@ static void btc8723b2ant_action_sco(struct btc_coexist 
*btcoexist)
 
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xf, 0x0);
 
+   btc8723b2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false, 0x8);
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 4);
 
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
@@ -1623,6 +1653,7 @@ static void btc8723b2ant_action_hid(struct btc_coexist 
*btcoexist)
 
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xf, 0x0);
 
+   btc8723b2ant_limited_rx(btcoexist, NORMAL_EXEC, false, true, 0x5);
btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
 
btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
@@ -1701,6 +1732,7 @@ static void btc8723b2ant_action_a2dp(struct btc_coexist 
*btcoexist)
}
 
btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1, 0xf, 0x0);
+   btc8723b2ant_limited_rx(btcoexist, NORMAL_EXEC, false, false, 0x8);
 
btc8723b2ant_fw_dac_swing_lvl

[PATCH v3 01/12] rtlwifi: btcoex: remove unused functions

2017-04-03 Thread Larry Finger
From: Yan-Hsuan Chuang 

A number of functions in the Bluetooth Coexistence routines are not used,
and can be removed.

Signed-off-by: Yan-Hsuan Chuang 
Signed-off-by: Larry Finger 
Cc: Pkshih 
Cc: Birming Chiu 
Cc: Shaofu 
Cc: Steven Ting 
---
v2 - Fixed build error from v1.
v3 - Fixed indentation error.
---
 .../realtek/rtlwifi/btcoexist/halbtc8192e2ant.c| 592 +
 .../realtek/rtlwifi/btcoexist/halbtc8723b1ant.c| 589 -
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 897 +--
 .../realtek/rtlwifi/btcoexist/halbtc8821a1ant.c| 329 +--
 .../realtek/rtlwifi/btcoexist/halbtc8821a2ant.c| 959 +
 5 files changed, 27 insertions(+), 3339 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c 
b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c
index ffa1f438424d..113eea8e25eb 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8192e2ant.c
@@ -376,7 +376,7 @@ static void halbtc8192e2ant_limited_tx(struct btc_coexist 
*btcoexist,
   coex_dm->cur_sstype,
   ra_masktype);
halbtc8192e2ant_Updatera_mask(btcoexist, force_exec, disra_mask);
-btc8192e2ant_autorate_fallback_retry(btcoexist, force_exec, arfr_type);
+   btc8192e2ant_autorate_fallback_retry(btcoexist, force_exec, arfr_type);
halbtc8192e2ant_retrylimit(btcoexist, force_exec, retrylimit_type);
halbtc8192e2ant_ampdu_maxtime(btcoexist, force_exec, ampdutime_type);
 }
@@ -1573,585 +1573,6 @@ static bool halbtc8192e2ant_is_common_action(struct 
btc_coexist *btcoexist)
return common;
 }
 
-static void btc8192e_int1(struct btc_coexist *btcoexist, bool tx_pause,
- int result)
-{
-   struct rtl_priv *rtlpriv = btcoexist->adapter;
-
-   if (tx_pause) {
-   RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-"[BTCoex], TxPause = 1\n");
-
-   if (coex_dm->cur_ps_tdma == 71) {
-   halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC,
-   true, 5);
-   coex_dm->tdma_adj_type = 5;
-   } else if (coex_dm->cur_ps_tdma == 1) {
-   halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC,
-   true, 5);
-   coex_dm->tdma_adj_type = 5;
-   } else if (coex_dm->cur_ps_tdma == 2) {
-   halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC,
-   true, 6);
-   coex_dm->tdma_adj_type = 6;
-   } else if (coex_dm->cur_ps_tdma == 3) {
-   halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC,
-   true, 7);
-   coex_dm->tdma_adj_type = 7;
-   } else if (coex_dm->cur_ps_tdma == 4) {
-   halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC,
-   true, 8);
-   coex_dm->tdma_adj_type = 8;
-   }
-   if (coex_dm->cur_ps_tdma == 9) {
-   halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC,
-   true, 13);
-   coex_dm->tdma_adj_type = 13;
-   } else if (coex_dm->cur_ps_tdma == 10) {
-   halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC,
-   true, 14);
-   coex_dm->tdma_adj_type = 14;
-   } else if (coex_dm->cur_ps_tdma == 11) {
-   halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC,
-   true, 15);
-   coex_dm->tdma_adj_type = 15;
-   } else if (coex_dm->cur_ps_tdma == 12) {
-   halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC,
-   true, 16);
-   coex_dm->tdma_adj_type = 16;
-   }
-
-   if (result == -1) {
-   if (coex_dm->cur_ps_tdma == 5) {
-   halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC,
-   true, 6);
-   coex_dm->tdma_adj_type = 6;
-   } else if (coex_dm->cur_ps_tdma == 6) {
-   halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC,
-   true, 7);
-   coex_dm->tdma_adj_type = 7;
-   } else if (coex_dm->cur_ps_tdma == 7) {
-   halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_

Re: [PATCH 1/3] mwifiex: remove unnecessary wakeup interrupt number sanity check

2017-04-03 Thread Brian Norris
On Fri, Mar 31, 2017 at 03:37:01PM -0700, Dmitry Torokhov wrote:
> On Thu, Mar 30, 2017 at 2:19 AM, Xinming Hu  wrote:
> > From: Xinming Hu 
> >
> > Sanity check of interrupt number in interrupt handler is unnecessary and
> > confusion, remove it.
> 
> I'd reworded the explanation a bit: "If wakeup interrupt handler is
> called, we know that the wakeup interrupt number is valid, there is no
> need to check it."

Either way works for me (modulo grammar), though Dmitry's is more
informative. So +1.

> Otherwise:
> 
> Reviewed-by: Dmitry Torokhov 

Ooh, me too!

Reviewed-by: Brian Norris 

I believe this same pattern occurs in btmrvl_sdio. Possibly others.

> > Signed-off-by: Xinming Hu 
> > Signed-off-by: Amitkumar Karwar 
> > ---
> >  drivers/net/wireless/marvell/mwifiex/main.c | 8 +++-
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/wireless/marvell/mwifiex/main.c 
> > b/drivers/net/wireless/marvell/mwifiex/main.c
> > index 30f4994..5e82602 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/main.c
> > +++ b/drivers/net/wireless/marvell/mwifiex/main.c
> > @@ -1503,11 +1503,9 @@ static irqreturn_t mwifiex_irq_wakeup_handler(int 
> > irq, void *priv)
> >  {
> > struct mwifiex_adapter *adapter = priv;
> >
> > -   if (adapter->irq_wakeup >= 0) {
> > -   dev_dbg(adapter->dev, "%s: wake by wifi", __func__);
> > -   adapter->wake_by_wifi = true;
> > -   disable_irq_nosync(irq);
> > -   }
> > +   dev_dbg(adapter->dev, "%s: wake by wifi", __func__);
> > +   adapter->wake_by_wifi = true;
> > +   disable_irq_nosync(irq);
> >
> > /* Notify PM core we are wakeup source */
> > pm_wakeup_event(adapter->dev, 0);
> > --
> > 1.8.1.4
> >


Re: [PATCH v2] nfc: don't be making arch specific unaligned decisions at driver level.

2017-04-03 Thread Paul Gortmaker
[Re: [PATCH v2] nfc: don't be making arch specific unaligned decisions at 
driver level.] On 02/04/2017 (Sun 00:22) Samuel Ortiz wrote:

> Hi Paul,
> 
> On Mon, Jan 09, 2017 at 12:52:22PM -0500, Paul Gortmaker wrote:
> > Currently ia64 fails building allmodconfig with variations of:
> > 

[...]

> > 
> >  drivers/nfc/nfcmrvl/fw_dnld.c  | 2 +-
> >  drivers/nfc/nxp-nci/firmware.c | 2 +-
> >  drivers/nfc/nxp-nci/i2c.c  | 2 +-
> >  3 files changed, 3 insertions(+), 3 deletions(-)
> This build issue is now fixed in nfc-next with a couple of different
> patches.

OK, I'll remove it from my local queue and retest and let you know if I
see any issues still.

Thanks,
Paul.
--

> 
> Cheers,
> Samuel.


[PATCH] mwifiex: add missing IEs related to TDLS operation

2017-04-03 Thread Ganapathi Bhat
From: Karthik Ananthapadmanabha 

In mwifiex,IEs such as supported channels, supported operating classes
20/40 BSS COexistence are missing and also extra QOS capabilities IE
is added during TDLS discovery response, TDLS setup request and
TDLS setupresponse.
This patch adds require IEs and also removes extra IE.

Signed-off-by: Karthik Ananthapadmanabha 
Signed-off-by: Ganapathi Bhat 
---
 drivers/net/wireless/marvell/mwifiex/ioctl.h |  2 ++
 drivers/net/wireless/marvell/mwifiex/tdls.c  | 49 ++--
 2 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/ioctl.h 
b/drivers/net/wireless/marvell/mwifiex/ioctl.h
index 536ab83..48e154e 100644
--- a/drivers/net/wireless/marvell/mwifiex/ioctl.h
+++ b/drivers/net/wireless/marvell/mwifiex/ioctl.h
@@ -91,6 +91,8 @@ struct wep_key {
 #define MWIFIEX_TDLS_DEF_QOS_CAPAB 0xf
 #define MWIFIEX_PRIO_BK2
 #define MWIFIEX_PRIO_VI5
+#define MWIFIEX_SUPPORTED_CHANNELS 2
+#define MWIFIEX_OPERATING_CLASSES  16
 
 struct mwifiex_uap_bss_param {
u8 channel;
diff --git a/drivers/net/wireless/marvell/mwifiex/tdls.c 
b/drivers/net/wireless/marvell/mwifiex/tdls.c
index e228c03..6e507c99 100644
--- a/drivers/net/wireless/marvell/mwifiex/tdls.c
+++ b/drivers/net/wireless/marvell/mwifiex/tdls.c
@@ -431,6 +431,41 @@ static void mwifiex_tdls_add_qos_capab(struct sk_buff *skb)
*buf++ = qosinfo; /* U-APSD no in use */
 }
 
+static void mwifiex_tdls_add_bss_co_2040(struct sk_buff *skb)
+{
+   struct ieee_types_bss_co_2040 *bssco;
+
+   bssco = (void *)skb_put(skb, sizeof(struct ieee_types_bss_co_2040));
+   bssco->ieee_hdr.element_id = WLAN_EID_BSS_COEX_2040;
+   bssco->ieee_hdr.len = sizeof(struct ieee_types_bss_co_2040) -
+ sizeof(struct ieee_types_header);
+   bssco->bss_2040co = 0x01;
+}
+
+static void mwifiex_tdls_add_supported_chan(struct sk_buff *skb)
+{
+   struct ieee_types_generic *supp_chan;
+   u8 chan_supp[] = {1, 11};
+
+   supp_chan = (void *)skb_put(skb, (sizeof(struct ieee_types_header) +
+ sizeof(chan_supp)));
+   supp_chan->ieee_hdr.element_id = WLAN_EID_SUPPORTED_CHANNELS;
+   supp_chan->ieee_hdr.len = sizeof(chan_supp);
+   memcpy(supp_chan->data, chan_supp, sizeof(chan_supp));
+}
+
+static void mwifiex_tdls_add_oper_class(struct sk_buff *skb)
+{
+   struct ieee_types_generic *reg_class;
+   u8 rc_list[] = {1,
+   1, 2, 3, 4, 12, 22, 23, 24, 25, 27, 28, 29, 30, 32, 33};
+   reg_class = (void *)skb_put(skb, (sizeof(struct ieee_types_header) +
+ sizeof(rc_list)));
+   reg_class->ieee_hdr.element_id = WLAN_EID_SUPPORTED_REGULATORY_CLASSES;
+   reg_class->ieee_hdr.len = sizeof(rc_list);
+   memcpy(reg_class->data, rc_list, sizeof(rc_list));
+}
+
 static int mwifiex_prep_tdls_encap_data(struct mwifiex_private *priv,
const u8 *peer, u8 action_code,
u8 dialog_token,
@@ -484,7 +519,9 @@ static int mwifiex_prep_tdls_encap_data(struct 
mwifiex_private *priv,
}
 
mwifiex_tdls_add_ext_capab(priv, skb);
-   mwifiex_tdls_add_qos_capab(skb);
+   mwifiex_tdls_add_bss_co_2040(skb);
+   mwifiex_tdls_add_supported_chan(skb);
+   mwifiex_tdls_add_oper_class(skb);
mwifiex_add_wmm_info_ie(priv, skb, 0);
break;
 
@@ -522,7 +559,9 @@ static int mwifiex_prep_tdls_encap_data(struct 
mwifiex_private *priv,
}
 
mwifiex_tdls_add_ext_capab(priv, skb);
-   mwifiex_tdls_add_qos_capab(skb);
+   mwifiex_tdls_add_bss_co_2040(skb);
+   mwifiex_tdls_add_supported_chan(skb);
+   mwifiex_tdls_add_oper_class(skb);
mwifiex_add_wmm_info_ie(priv, skb, 0);
break;
 
@@ -612,6 +651,9 @@ int mwifiex_send_tdls_data_frame(struct mwifiex_private 
*priv, const u8 *peer,
  sizeof(struct ieee_types_bss_co_2040) +
  sizeof(struct ieee80211_ht_operation) +
  sizeof(struct ieee80211_tdls_lnkie) +
+ (2 * (sizeof(struct ieee_types_header))) +
+  MWIFIEX_SUPPORTED_CHANNELS +
+  MWIFIEX_OPERATING_CLASSES +
  sizeof(struct ieee80211_wmm_param_ie) +
  extra_ies_len;
 
@@ -760,7 +802,10 @@ int mwifiex_send_tdls_data_frame(struct mwifiex_private 
*priv, const u8 *peer,
}
 
mwifiex_tdls_add_ext_capab(priv, skb);
+   mwifiex_tdls_add_bss_co_2040(skb);
+   mwifiex_tdls_add_supported_chan(skb);
mwifiex_tdls_add_qos_capab(skb);
+   mwifiex_tdls_add_oper_class(skb);

Re: [PATCH 1/2] wireless: ath9k_htc: fix NULL-deref at probe

2017-04-03 Thread Johan Hovold
On Mon, Apr 03, 2017 at 01:21:08PM +, Kalle Valo wrote:
> Johan Hovold  writes:
> 
> > On Mon, Apr 03, 2017 at 01:02:28PM +, Kalle Valo wrote:
> >> Kalle Valo  writes:
> >> 
> >> > Johan Hovold  writes:
> >> >
> >> >> On Mon, Mar 13, 2017 at 01:44:20PM +0100, Johan Hovold wrote:
> >> >>> Make sure to check the number of endpoints to avoid dereferencing a
> >> >>> NULL-pointer or accessing memory beyond the endpoint array should a
> >> >>> malicious device lack the expected endpoints.
> >> >>> 
> >> >>> Fixes: 36bcce430657 ("ath9k_htc: Handle storage devices")
> >> >>> Cc: Sujith Manoharan 
> >> >>> Signed-off-by: Johan Hovold 
> >> >>
> >> >> Is this one still in your queue, Kalle?
> >> >
> >> > Yes, I'm just lacking behing:
> >> >
> >> > https://patchwork.kernel.org/patch/9620723/
> >> 
> >> Meant "lagging" of course. Mondays..
> >> 
> >> >> As I mentioned earlier, I should have added a
> >> >>
> >> >> Cc: stable  # 2.6.39
> >> >>
> >> >> but left it out as I mistakingly thought the net recommendations to do
> >> >> so applied also to wireless.
> >> >
> >> > Ok, I'll add that.
> >> 
> >> But is 2.6.39 really correct? Shouldn't it be 2.6.39+ so that it means
> >> all versions since 2.6.39?
> >
> > Either way is fine, the stable maintainers apply them to all later
> > versions.
> >
> > I notice now that adding a plus sign is more common, but it's still a
> > 1:2 ratio judging from quick grep, while the stable-kernel-rules.rst
> > actually uses a minus sign...
> 
> Heh, quite confusing :) I added the plus sign already to the patch in my
> pending branch so unless you object I'll keep it.

Please do, no objection. :)

Thanks,
Johan


Re: [PATCH 1/2] wireless: ath9k_htc: fix NULL-deref at probe

2017-04-03 Thread Kalle Valo
Johan Hovold  writes:

> On Mon, Apr 03, 2017 at 01:02:28PM +, Kalle Valo wrote:
>> Kalle Valo  writes:
>> 
>> > Johan Hovold  writes:
>> >
>> >> On Mon, Mar 13, 2017 at 01:44:20PM +0100, Johan Hovold wrote:
>> >>> Make sure to check the number of endpoints to avoid dereferencing a
>> >>> NULL-pointer or accessing memory beyond the endpoint array should a
>> >>> malicious device lack the expected endpoints.
>> >>> 
>> >>> Fixes: 36bcce430657 ("ath9k_htc: Handle storage devices")
>> >>> Cc: Sujith Manoharan 
>> >>> Signed-off-by: Johan Hovold 
>> >>
>> >> Is this one still in your queue, Kalle?
>> >
>> > Yes, I'm just lacking behing:
>> >
>> > https://patchwork.kernel.org/patch/9620723/
>> 
>> Meant "lagging" of course. Mondays..
>> 
>> >> As I mentioned earlier, I should have added a
>> >>
>> >> Cc: stable  # 2.6.39
>> >>
>> >> but left it out as I mistakingly thought the net recommendations to do
>> >> so applied also to wireless.
>> >
>> > Ok, I'll add that.
>> 
>> But is 2.6.39 really correct? Shouldn't it be 2.6.39+ so that it means
>> all versions since 2.6.39?
>
> Either way is fine, the stable maintainers apply them to all later
> versions.
>
> I notice now that adding a plus sign is more common, but it's still a
> 1:2 ratio judging from quick grep, while the stable-kernel-rules.rst
> actually uses a minus sign...

Heh, quite confusing :) I added the plus sign already to the patch in my
pending branch so unless you object I'll keep it.

-- 
Kalle Valo

Re: [PATCH 1/2] wireless: ath9k_htc: fix NULL-deref at probe

2017-04-03 Thread Johan Hovold
On Mon, Apr 03, 2017 at 01:02:28PM +, Kalle Valo wrote:
> Kalle Valo  writes:
> 
> > Johan Hovold  writes:
> >
> >> On Mon, Mar 13, 2017 at 01:44:20PM +0100, Johan Hovold wrote:
> >>> Make sure to check the number of endpoints to avoid dereferencing a
> >>> NULL-pointer or accessing memory beyond the endpoint array should a
> >>> malicious device lack the expected endpoints.
> >>> 
> >>> Fixes: 36bcce430657 ("ath9k_htc: Handle storage devices")
> >>> Cc: Sujith Manoharan 
> >>> Signed-off-by: Johan Hovold 
> >>
> >> Is this one still in your queue, Kalle?
> >
> > Yes, I'm just lacking behing:
> >
> > https://patchwork.kernel.org/patch/9620723/
> 
> Meant "lagging" of course. Mondays..
> 
> >> As I mentioned earlier, I should have added a
> >>
> >> Cc: stable  # 2.6.39
> >>
> >> but left it out as I mistakingly thought the net recommendations to do
> >> so applied also to wireless.
> >
> > Ok, I'll add that.
> 
> But is 2.6.39 really correct? Shouldn't it be 2.6.39+ so that it means
> all versions since 2.6.39?

Either way is fine, the stable maintainers apply them to all later
versions.

I notice now that adding a plus sign is more common, but it's still a
1:2 ratio judging from quick grep, while the stable-kernel-rules.rst
actually uses a minus sign...

Thanks,
Johan


Re: [PATCH 1/2] wireless: ath9k_htc: fix NULL-deref at probe

2017-04-03 Thread Kalle Valo
Kalle Valo  writes:

> Johan Hovold  writes:
>
>> On Mon, Mar 13, 2017 at 01:44:20PM +0100, Johan Hovold wrote:
>>> Make sure to check the number of endpoints to avoid dereferencing a
>>> NULL-pointer or accessing memory beyond the endpoint array should a
>>> malicious device lack the expected endpoints.
>>> 
>>> Fixes: 36bcce430657 ("ath9k_htc: Handle storage devices")
>>> Cc: Sujith Manoharan 
>>> Signed-off-by: Johan Hovold 
>>
>> Is this one still in your queue, Kalle?
>
> Yes, I'm just lacking behing:
>
> https://patchwork.kernel.org/patch/9620723/

Meant "lagging" of course. Mondays..

>> As I mentioned earlier, I should have added a
>>
>> Cc: stable  # 2.6.39
>>
>> but left it out as I mistakingly thought the net recommendations to do
>> so applied also to wireless.
>
> Ok, I'll add that.

But is 2.6.39 really correct? Shouldn't it be 2.6.39+ so that it means
all versions since 2.6.39?

-- 
Kalle Valo

Re: [PATCH v2 07/12] rtlwifi: btcoex: 23b 2ant: adjust wifi duration for bt a2dp

2017-04-03 Thread kbuild test robot
Hi Yan-Hsuan,

[auto build test WARNING on wireless-drivers-next/master]
[also build test WARNING on v4.11-rc5 next-20170403]
[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/Larry-Finger/rtlwifi-btcoex-remove-unused-functions/20170403-201454
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git 
master
config: i386-randconfig-x008-201714 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c: In 
function 'ex_btc8723b2ant_scan_notify':
>> drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c:2683:7: 
>> warning: this 'if' clause does not guard... [-Wmisleading-indentation]
 else if (BTC_SCAN_FINISH == type)
  ^~
   drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c:2686:3: 
note: ...this statement, but the latter is misleadingly indented as if it is 
guarded by the 'if'
  btcoexist->btc_get(btcoexist, BTC_GET_U1_AP_NUM,
  ^

vim +/if +2683 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c

aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2667 "[BTCoex], LPS ENABLE 
notify\n");
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2668coex_sta->under_lps = true;
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2669} else if (BTC_LPS_DISABLE == type) {
2277f5f11 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2017-02-03  2670RT_TRACE(rtlpriv, COMP_BT_COEXIST, 
DBG_LOUD,
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2671 "[BTCoex], LPS DISABLE 
notify\n");
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2672coex_sta->under_lps = false;
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2673}
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2674  }
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2675  
e79fff285 drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-09-04  2676  void ex_btc8723b2ant_scan_notify(struct 
btc_coexist *btcoexist, u8 type)
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2677  {
2277f5f11 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2017-02-03  2678struct rtl_priv *rtlpriv = 
btcoexist->adapter;
2277f5f11 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2017-02-03  2679  
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2680if (BTC_SCAN_START == type)
2277f5f11 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2017-02-03  2681RT_TRACE(rtlpriv, COMP_BT_COEXIST, 
DBG_LOUD,
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2682 "[BTCoex], SCAN START 
notify\n");
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28 @2683else if (BTC_SCAN_FINISH == type)
2277f5f11 drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2017-02-03  2684RT_TRACE(rtlpriv, COMP_BT_COEXIST, 
DBG_LOUD,
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2685 "[BTCoex], SCAN FINISH 
notify\n");
0c464652f drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
Yan-Hsuan Chuang 2017-04-02  2686btcoexist->btc_get(btcoexist, 
BTC_GET_U1_AP_NUM,
0c464652f drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c 
Yan-Hsuan Chuang 2017-04-02  2687   
&coex_sta->scan_ap_num);
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2688  }
aa45a673b drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-02-28  2689  
e79fff285 drivers/net/wireless/rtlwifi/btcoexist/halbtc8723b2ant.c 
Larry Finger 2014-09-04  2690  void ex_btc8723b2ant_connect_notify(struct 
btc_coexist *btcoexist, u8 type)

Re: [PATCH RFC] remove custom Michael MIC implementation

2017-04-03 Thread Greg Kroah-Hartman
On Mon, Apr 03, 2017 at 07:03:59PM +1000, Tobin C. Harding wrote:
> On Mon, Apr 03, 2017 at 08:19:40AM +0300, Kalle Valo wrote:
> > + linux-wireless
> > 
> > "Tobin C. Harding"  writes:
> > 
> > > On Fri, Mar 31, 2017 at 09:58:51AM +0200, Wolfram Sang wrote:
> > >> 
> > >> > The code is untested, I have hardware in the mail.
> > >> 
> > >> Cool!
> > >
> > > The card I have is a Spectec FCC ID: S2Y-WLAN-11B-G which I believe is
> > > a SDW-823 and should use the ks7010 driver. I am going to attempt to
> > > get it running on a Raspberry Pi B+. I ordered the wrong size break
> > > out board originally so waiting on the new one now.
> > >
> > >> 
> > >> > If any one is interested and has any comments I would really like to
> > >> > hear them. I am open to all suggestions (even down to trivial coding
> > >> > style issues).
> > >> 
> > >> I'll just repeat that the key move to get this driver out of staging is
> > >> to get away from the WEXT interface to CFG80211. Otherwise no chance
> > >> that wireless maintainers will even look at it. This is a huge change
> > >> but once it is done, features like Michael MIC come with it for free
> > >> (from what I recall, I am not a wireless expert myself).
> > >
> > > That would explain why I could not find more than the Orinoco driver
> > > using the Michael MIC module directly.
> > 
> > I think cfg80211 and mac80211 got mixed up. mac80211 (the full IEEE
> > 802.11 stack for "softmac" devices) provides Michael MIC implementation,
> > but cfg80211 (for "hardmac" devices) does not.
> 
> Cool, thanks for clarifying. Hilariously I was just sitting down
> trying to figure out what was up after a day spent trying to merge
> ideas from ath6kl (fullmac) and ks7010. I finally spent some time
> reading the cw1200 driver (softmac) for further inspiration.

As an example of a driver that has been moved from an internal wireless
stack to using the kernel stack is the vt6655 driver.  I think it's the
only driver that has done this type of transition, so look at the patch
history of it for an example of what to do.

good luck!

greg k-h


Re: [PATCH 1/3] rsi: Rename the file rsi_91x_pkt.c to rsi_91x_hal.c

2017-04-03 Thread Kalle Valo
+ linux-wireless

Prameela Rani Garnepudi  writes:

> The file rsi_91x_hal.c will contain new firmware loading method for
> RSI 9113 chipset. So this file will have device specific operations.
> As the file 'rsi_91x_pkt.c' contains code for preparing device
> (frimware understandable) specific descriptors for the transmit frames,
> it is moved to 'rsi_91x_hal.c'
>
> Signed-off-by: Prameela Rani Garnepudi 

Always remember CC linux-wireless for wireless patches. So please
resend.

-- 
Kalle Valo


Re: [PATCH 1/5] brcmfmac: wrap brcmf_fws_init into bcdc layer

2017-04-03 Thread Kalle Valo
Arend Van Spriel  writes:

> On 29-3-2017 13:18, Rafał Miłecki wrote:
>> On 03/28/2017 12:43 PM, Arend van Spriel wrote:
>>> From: Franky Lin 
>>>
>>> Create a new protocol layer interface brcmf_proto_init_cb for protocol
>>> layer to finish initialzation after core module components(fweh and
>>> etc.) are initialized.
>>>
>>> Signed-off-by: Franky Lin 
>>> Change-Id: I560d2478a7c09766cf07b20d74b31dff5ca6ac7b
>>> Reviewed-on: http://hnd-swgit.sj.broadcom.com:8080/8156
>> 
>> These 2 lines are rather useless.
>
> Sorry. Our Gerrit server adds these and I make an effort to remove this
> before submitting, but every now and then a few slip through.
>
>>> Reviewed-by: brcm80211 ci 
>> 
>> Please use full names only.
>
> Sure thing. This is actually Jenkins account we use for building and
> smoketesting the driver.

I'll remove these from patches 1-4 during commit. (patch 5 seems to be
ok)

-- 
Kalle Valo


Re: [PATCH 16/16] drivers, net, intersil: convert request_context.refcount from atomic_t to refcount_t

2017-04-03 Thread Kalle Valo
Elena Reshetova  writes:

> refcount_t type and corresponding API should be
> used instead of atomic_t when the variable is used as
> a reference counter. This allows to avoid accidental
> refcounter overflows that might lead to use-after-free
> situations.
>
> Signed-off-by: Elena Reshetova 
> Signed-off-by: Hans Liljestrand 
> Signed-off-by: Kees Cook 
> Signed-off-by: David Windsor 
> ---
>  drivers/net/wireless/intersil/orinoco/orinoco_usb.c | 15 ---
>  1 file changed, 8 insertions(+), 7 deletions(-)

The prefix should be "orinoco_usb:", I'll fix that.

-- 
Kalle Valo


Re: [PATCH 15/16] drivers, net, intersil: convert hostap_cmd_queue.usecnt from atomic_t to refcount_t

2017-04-03 Thread Kalle Valo
Elena Reshetova  writes:

> refcount_t type and corresponding API should be
> used instead of atomic_t when the variable is used as
> a reference counter. This allows to avoid accidental
> refcounter overflows that might lead to use-after-free
> situations.
>
> Signed-off-by: Elena Reshetova 
> Signed-off-by: Hans Liljestrand 
> Signed-off-by: Kees Cook 
> Signed-off-by: David Windsor 
> ---
>  drivers/net/wireless/intersil/hostap/hostap_hw.c   | 12 ++--
>  drivers/net/wireless/intersil/hostap/hostap_wlan.h |  3 ++-
>  2 files changed, 8 insertions(+), 7 deletions(-)

The prefix should be "hostap:", I'll fix that.

-- 
Kalle Valo


pull-request: wireless-drivers-next 2017-04-03

2017-04-03 Thread Kalle Valo
Hi Dave,

here few really small fixes. I'm hoping this to be the last pull request
for 4.11.

Please let me if there are any problems.

Kalle

The following changes since commit 6be3b6cce1e225f189b68b4e84fc711d19b4277b:

  ath10k: fix incorrect wlan_mac_base in qca6174_regs (2017-03-20 17:11:31 
+0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git 
tags/wireless-drivers-for-davem-2017-04-03

for you to fetch changes up to d77facb88448cdeaaa3adba5b9704a48ac2ac8d6:

  brcmfmac: use local iftype avoiding use-after-free of virtual interface 
(2017-03-30 19:43:51 +0300)


wireless-drivers fixes for 4.11

iwlwifi

* an RCU fix
* a fix for a potential out-of-bounds access crash
* a fix for IBSS which has been broken since DQA was enabled

rtlwifi

* fix scheduling while atomic regression

brcmfmac

* fix use-after-free bug found by KASAN


Arend Van Spriel (1):
  brcmfmac: use local iftype avoiding use-after-free of virtual interface

Dan Carpenter (1):
  iwlwifi: mvm: writing zero bytes to debugfs causes a crash

Kalle Valo (1):
  Merge tag 'iwlwifi-for-kalle-2017-03-29' of 
git://git.kernel.org/.../iwlwifi/iwlwifi-fixes

Larry Finger (1):
  rtlwifi: Fix scheduling while atomic splat

Liad Kaufman (1):
  iwlwifi: mvm: support ibss in dqa mode

Sara Sharon (1):
  iwlwifi: mvm: fix accessing fw_id_to_mac_id

 drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 8 +---
 drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c   | 2 ++
 drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c  | 3 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c  | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c   | 9 ++---
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c| 7 +--
 drivers/net/wireless/realtek/rtlwifi/base.c| 6 --
 7 files changed, 25 insertions(+), 12 deletions(-)


Re: [PATCH RFC] remove custom Michael MIC implementation

2017-04-03 Thread Arend Van Spriel
seems we are missing out again?

On 3-4-2017 11:50, Toke Høiland-Jørgensen wrote:
> "Tobin C. Harding"  writes:
> 
>> Except one: do you know off the top of your head of a canonical
>> implementation of a softmac wi-fi driver.
> 
> I'll suggest taking a look at the ath9k driver :)

Looking at ks7010 driver it looks like it has 802.11 stack in firmware
and not sure if Renesas is actively supporting this effort to come up
with mac80211-friendly firmware or provide detailed chip info.

Regards,
Arend



Re: [PATCH RFC] remove custom Michael MIC implementation

2017-04-03 Thread Toke Høiland-Jørgensen
"Tobin C. Harding"  writes:

> Except one: do you know off the top of your head of a canonical
> implementation of a softmac wi-fi driver.

I'll suggest taking a look at the ath9k driver :)

-Toke


Re: [PATCH RFC] remove custom Michael MIC implementation

2017-04-03 Thread Kalle Valo
"Tobin C. Harding"  writes:

>> >> But if you want a clean WEXT driver first, this is a step in the right
>> >> direction.
>> >
>> > Let's go for a CFG80211 driver and get out of staging :) So next step
>> > is I guess study the ath6kl driver, learn how CFG80211 is done and
>> > implement that interface in ks7010? Oh, and test that it works.
>> 
>> Please keep linux-wireless list in loop so that people on that list can
>> help.
>
> How newbie friendly is the linux-wireless list please?

I would claim quite friendly, but I'm finnish and our definition of
"friendly" seems to be very different from rest of the world ;)

> I am having trouble separating the data path code from the control
> path. I think I will spend a few more days on it though before asking
> any questions.

People do send questions to the list and most of the time they get
answered. So go for it.

There's also an irc channel which usually is helpful:

https://wireless.wiki.kernel.org/en/users/support#linux_wireless_user_irc_channel

> Except one: do you know off the top of your head of a canonical
> implementation of a softmac wi-fi driver.

You mean a mac80211 driver? mac80211_hwsim is the simplest one, but
that's not a real driver as it's a simulator. Just grep
ieee80211_register() to find all the drivers. Smaller drivers like
rtl8xxxu or wl1251 might be good starting points to get familiar with
the stack.

And I guess you already saw the documentation:

https://wireless.wiki.kernel.org/en/developers/documentation/mac80211

-- 
Kalle Valo


[PATCH][V2] wlcore: fix spelling mistakes in wl1271_warning

2017-04-03 Thread Colin King
From: Colin Ian King 

trivial fix to spelling mistakes in wl1271_warning error message, change
iligal to invalid and opperation to operation.

Signed-off-by: Colin Ian King 
---
 drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c 
b/drivers/net/wireless/ti/wlcore/debugfs.c
index 58e148d7bc7b..416080adc181 100644
--- a/drivers/net/wireless/ti/wlcore/debugfs.c
+++ b/drivers/net/wireless/ti/wlcore/debugfs.c
@@ -1249,7 +1249,7 @@ static ssize_t fw_logger_write(struct file *file,
}
 
if (wl->conf.fwlog.output == 0) {
-   wl1271_warning("iligal opperation - fw logger disabled by 
default, please change mode via wlconf");
+   wl1271_warning("invalid operation - fw logger disabled by 
default, please change mode via wlconf");
return -EINVAL;
}
 
-- 
2.11.0



Re: [PATCH] wlcore: fix spelling mistake in wl1271_warning 'iligal' -> 'illegal'

2017-04-03 Thread Colin Ian King
On 03/04/17 10:20, Joe Perches wrote:
> On Mon, 2017-04-03 at 10:15 +0100, Colin King wrote:
>> From: Colin Ian King 
>>
>> trivial fix to spelling mistake in wl1271_warning error message
>>
>> Signed-off-by: Colin Ian King 
>> ---
>>  drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c 
>> b/drivers/net/wireless/ti/wlcore/debugfs.c
>> index 58e148d7bc7b..416080adc181 100644
>> --- a/drivers/net/wireless/ti/wlcore/debugfs.c
>> +++ b/drivers/net/wireless/ti/wlcore/debugfs.c
>> @@ -1249,7 +1249,7 @@ static ssize_t fw_logger_write(struct file *file,
>>  }
>>  
>>  if (wl->conf.fwlog.output == 0) {
>> -wl1271_warning("iligal opperation - fw logger disabled by 
>> default, please change mode via wlconf");
>> +wl1271_warning("illegal opperation - fw logger disabled by 
>> default, please change mode via wlconf");
> 
> Hi Colin.
> 
> When you do these would you please fix all the typos on the
> same line?  opperation -> operation

Sure, I stupidly missed that.

> 
> Also, generally, invalid is a better word choice than illegal
> for these situations.

Good point.
> 
> Thanks and cheers, Joe
> 



Re: [PATCH 1/2] wireless: ath9k_htc: fix NULL-deref at probe

2017-04-03 Thread Kalle Valo
Johan Hovold  writes:

> On Mon, Mar 13, 2017 at 01:44:20PM +0100, Johan Hovold wrote:
>> Make sure to check the number of endpoints to avoid dereferencing a
>> NULL-pointer or accessing memory beyond the endpoint array should a
>> malicious device lack the expected endpoints.
>> 
>> Fixes: 36bcce430657 ("ath9k_htc: Handle storage devices")
>> Cc: Sujith Manoharan 
>> Signed-off-by: Johan Hovold 
>
> Is this one still in your queue, Kalle?

Yes, I'm just lacking behing:

https://patchwork.kernel.org/patch/9620723/

> As I mentioned earlier, I should have added a
>
> Cc: stable  # 2.6.39
>
> but left it out as I mistakingly thought the net recommendations to do
> so applied also to wireless.

Ok, I'll add that.

-- 
Kalle Valo


Re: [PATCH] wlcore: fix spelling mistake in wl1271_warning 'iligal' -> 'illegal'

2017-04-03 Thread Joe Perches
On Mon, 2017-04-03 at 10:15 +0100, Colin King wrote:
> From: Colin Ian King 
> 
> trivial fix to spelling mistake in wl1271_warning error message
> 
> Signed-off-by: Colin Ian King 
> ---
>  drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c 
> b/drivers/net/wireless/ti/wlcore/debugfs.c
> index 58e148d7bc7b..416080adc181 100644
> --- a/drivers/net/wireless/ti/wlcore/debugfs.c
> +++ b/drivers/net/wireless/ti/wlcore/debugfs.c
> @@ -1249,7 +1249,7 @@ static ssize_t fw_logger_write(struct file *file,
>   }
>  
>   if (wl->conf.fwlog.output == 0) {
> - wl1271_warning("iligal opperation - fw logger disabled by 
> default, please change mode via wlconf");
> + wl1271_warning("illegal opperation - fw logger disabled by 
> default, please change mode via wlconf");

Hi Colin.

When you do these would you please fix all the typos on the
same line?  opperation -> operation

Also, generally, invalid is a better word choice than illegal
for these situations.

Thanks and cheers, Joe



[PATCH] wlcore: fix spelling mistake in wl1271_warning 'iligal' -> 'illegal'

2017-04-03 Thread Colin King
From: Colin Ian King 

trivial fix to spelling mistake in wl1271_warning error message

Signed-off-by: Colin Ian King 
---
 drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c 
b/drivers/net/wireless/ti/wlcore/debugfs.c
index 58e148d7bc7b..416080adc181 100644
--- a/drivers/net/wireless/ti/wlcore/debugfs.c
+++ b/drivers/net/wireless/ti/wlcore/debugfs.c
@@ -1249,7 +1249,7 @@ static ssize_t fw_logger_write(struct file *file,
}
 
if (wl->conf.fwlog.output == 0) {
-   wl1271_warning("iligal opperation - fw logger disabled by 
default, please change mode via wlconf");
+   wl1271_warning("illegal opperation - fw logger disabled by 
default, please change mode via wlconf");
return -EINVAL;
}
 
-- 
2.11.0



Re: [PATCH RFC] remove custom Michael MIC implementation

2017-04-03 Thread Tobin C. Harding
On Mon, Apr 03, 2017 at 08:19:40AM +0300, Kalle Valo wrote:
> + linux-wireless
> 
> "Tobin C. Harding"  writes:
> 
> > On Fri, Mar 31, 2017 at 09:58:51AM +0200, Wolfram Sang wrote:
> >> 
> >> > The code is untested, I have hardware in the mail.
> >> 
> >> Cool!
> >
> > The card I have is a Spectec FCC ID: S2Y-WLAN-11B-G which I believe is
> > a SDW-823 and should use the ks7010 driver. I am going to attempt to
> > get it running on a Raspberry Pi B+. I ordered the wrong size break
> > out board originally so waiting on the new one now.
> >
> >> 
> >> > If any one is interested and has any comments I would really like to
> >> > hear them. I am open to all suggestions (even down to trivial coding
> >> > style issues).
> >> 
> >> I'll just repeat that the key move to get this driver out of staging is
> >> to get away from the WEXT interface to CFG80211. Otherwise no chance
> >> that wireless maintainers will even look at it. This is a huge change
> >> but once it is done, features like Michael MIC come with it for free
> >> (from what I recall, I am not a wireless expert myself).
> >
> > That would explain why I could not find more than the Orinoco driver
> > using the Michael MIC module directly.
> 
> I think cfg80211 and mac80211 got mixed up. mac80211 (the full IEEE
> 802.11 stack for "softmac" devices) provides Michael MIC implementation,
> but cfg80211 (for "hardmac" devices) does not.

Cool, thanks for clarifying. Hilariously I was just sitting down
trying to figure out what was up after a day spent trying to merge
ideas from ath6kl (fullmac) and ks7010. I finally spent some time
reading the cw1200 driver (softmac) for further inspiration.

> >> Without the CFG80211 conversion, replacing the Michael custom
> >> implementation with the in-kernel one makes the driver a tad better and
> >> is good exercise. However, it will sadly not help to get the driver out
> >> of staging.
> >
> > I'll drop it then. Could you please tell me, is there any thing else
> > more I need to do to let LKML know that this RFC is dropped? Or is
> > this reply enough. I don't want to use any ones time unnecessarily.
> >
> >> 
> >> But if you want a clean WEXT driver first, this is a step in the right
> >> direction.
> >
> > Let's go for a CFG80211 driver and get out of staging :) So next step
> > is I guess study the ath6kl driver, learn how CFG80211 is done and
> > implement that interface in ks7010? Oh, and test that it works.
> 
> Please keep linux-wireless list in loop so that people on that list can
> help.

How newbie friendly is the linux-wireless list please? I am having
trouble separating the data path code from the control path. I think I
will spend a few more days on it though before asking any questions.

Except one: do you know off the top of your head of a canonical
implementation of a softmac wi-fi driver.

thanks,
Tobin.


Question about ath9k compliancy with upcoming EN 301 893 v2.0.7

2017-04-03 Thread Adrien Decostre
Dear all,

ETSI is publishing in the coming months an update of the EN 301 893
standard with major changes on the adaptivity and receiver blocking
tests behavior 
(https://www.nts.com/ntsblog/upcoming-changes-for-wireless-equipment-in-the-5-ghz-band-en-301-893/).
The adaptivity test requirements will now require the 802.11 link
being stopped in the case of some particular OFDM interference signal.
I was looking on the mailing list archive for information about the
modifications required in the ath9k in order to keep compliancy but I
did not found any relevant discussion. Would someone know if the ath9k
driver can be configured to break connection at the detection of high
enough OFDM signal not compliant with the 802.11 standard?

Many thanks in advance for any help

Best regards


Re: [PATCH 1/2] wireless: ath9k_htc: fix NULL-deref at probe

2017-04-03 Thread Johan Hovold
On Mon, Mar 13, 2017 at 01:44:20PM +0100, Johan Hovold wrote:
> Make sure to check the number of endpoints to avoid dereferencing a
> NULL-pointer or accessing memory beyond the endpoint array should a
> malicious device lack the expected endpoints.
> 
> Fixes: 36bcce430657 ("ath9k_htc: Handle storage devices")
> Cc: Sujith Manoharan 
> Signed-off-by: Johan Hovold 

Is this one still in your queue, Kalle?

As I mentioned earlier, I should have added a

Cc: stable  # 2.6.39

but left it out as I mistakingly thought the net recommendations to do
so applied also to wireless.

Thanks,
Johan