Re: [PATCH] mac80211_hwsim: Added vendor echo command

2016-06-24 Thread Jouni Malinen
On Fri, Jun 24, 2016 at 10:13:54AM +0200, Erik Stromdahl wrote:
> The purpose of the echo command is to provide a test
> facility for user space programs.

> diff --git a/drivers/net/wireless/mac80211_hwsim.c 
> b/drivers/net/wireless/mac80211_hwsim.c
> @@ -332,14 +332,16 @@ static const struct ieee80211_rate hwsim_rates[] = {
>  #define QCA_NL80211_SUBCMD_TEST 1
> +#define QCA_NL80211_SUBCMD_ECHO 2

NAK. That QCA vendor specific value has not been assigned nor have I
even seen a request to assign such a value.

>  enum qca_nl80211_vendor_subcmds {
>   QCA_WLAN_VENDOR_ATTR_TEST = 8,
> - QCA_WLAN_VENDOR_ATTR_MAX = QCA_WLAN_VENDOR_ATTR_TEST
> + QCA_WLAN_VENDOR_ATTR_ECHO,

And this vendor attribute value has already been assigned for another
purpose.

It is no acceptable to pick arbitrary values of identifiers without
proper request to the owner of the OUI that is used to assign the
values.

As far as the QCA vendor specific identifiers are concerned, their
assignment process is described here:
http://w1.fi/cgit/hostap/plain/src/common/qca-vendor.h

Please do not submit kernel changes that use any unassigned vendor
identifier or even worse, a value that have already been assigned for a
completely different purpose.
 
-- 
Jouni MalinenPGP id EFC895FA
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/8] wireless: ipw2200: fix old-style declaration

2016-06-24 Thread Stanislav Yakovlev
On 16 June 2016 at 17:52, Arnd Bergmann  wrote:
> Modern C standards expect the 'inline' keyword to come before the return
> type in a declaration, and we get a warning for this with "make W=1":
>
> drivers/net/wireless/intel/ipw2x00/ipw2200.c:4096:1: error: 'inline' is not 
> at beginning of declaration [-Werror=old-style-declaration]
>
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/net/wireless/intel/ipw2x00/ipw2200.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Acked-by: Stanislav Yakovlev 

Stanislav.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ldv-project] [net] rtl8188ee: a potential race condition

2016-06-24 Thread Larry Finger

On 06/24/2016 09:17 AM, Vaishali Thakkar wrote:



On Friday 10 June 2016 01:51 PM, Pavel Andrianov wrote:

Hi!

There is a potential data race in 
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rtl8188ee.ko.

In the function rtl88ee_gpio_radio_on_off_checking the flag 
ppsc->rfchange_inprogress is set with a spinlock protection. In the function 
rtl_ps_set_rf_state the flag is read also under a spinlock. But the function 
rtl88e_dm_watchdog read it without any locks. As a result rtl88e_dm_watchdog may 
execute the succeeding code while changing (with the flag rfchange_inprogress == 
true). I do not exactly determine the consequences, but likely they are not good 
if there exists such check. Could anybody more confident confirm this?

The function rtl_ps_set_rf_state is always called with its parameter 
[protect_or_not == false]. Is this flag really necessary, if the value 'true' is 
never used? The function is also set the flag ppsc->rfchange_inprogress and may 
affect the rtl88e_dm_watchdog as in the previous case.


I think the patch was sent sometime ago for removing the parameter. But I am 
not sure why it's not applied.
May be Larry can have better idea about this.

Here, is link to the patch: 
http://linux-wireless.vger.kernel.narkive.com/mu4t9xxr/patch-3-4-rtlwifi-rtl8192cu-remove-unused-parameter


The patch for rtl8192cu was applied as commit 4b9d8d67b44a on Jun 20 2011, but 
the unused parameter was reintroduced as part of an update of the power-save 
code with commit d3feae41a347 on Sep 22 2014. My recollection is that Realtek 
envisioned a driver that needed this parameter to be true. As none has yet been 
introduced, I will prepare a patch to remove it again.


I am also testing a patch to remove the race condition in rtl8188ee.

Larry

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ldv-project] [net] rtl8188ee: a potential race condition

2016-06-24 Thread Vaishali Thakkar


On Friday 10 June 2016 01:51 PM, Pavel Andrianov wrote:
> Hi!
> 
> There is a potential data race in 
> drivers/net/wireless/realtek/rtlwifi/rtl8188ee/rtl8188ee.ko.
> 
> In the function rtl88ee_gpio_radio_on_off_checking the flag 
> ppsc->rfchange_inprogress is set with a spinlock protection. In the function 
> rtl_ps_set_rf_state the flag is read also under a spinlock. But the function 
> rtl88e_dm_watchdog read it without any locks. As a result rtl88e_dm_watchdog 
> may execute the succeeding code while changing (with the flag 
> rfchange_inprogress == true). I do not exactly determine the consequences, 
> but likely they are not good if there exists such check. Could anybody more 
> confident confirm this?
> 
> The function rtl_ps_set_rf_state is always called with its parameter 
> [protect_or_not == false]. Is this flag really necessary, if the value 'true' 
> is never used? The function is also set the flag ppsc->rfchange_inprogress 
> and may affect the rtl88e_dm_watchdog as in the previous case.

I think the patch was sent sometime ago for removing the parameter. But I am 
not sure why it's not applied.
May be Larry can have better idea about this.

Here, is link to the patch: 
http://linux-wireless.vger.kernel.narkive.com/mu4t9xxr/patch-3-4-rtlwifi-rtl8192cu-remove-unused-parameter

-- 
Vaishali
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/3] ath9k: add a helper to get the string representation of ath_bus_type

2016-06-24 Thread Martin Blumenstingl
Signed-off-by: Martin Blumenstingl 
---
this is a new patch which didn't exist in v2 yet, it prepares the new
function ath_bus_type_to_string which will be used in patch #3

 drivers/net/wireless/ath/ath.h  |  2 ++
 drivers/net/wireless/ath/main.c | 15 +++
 2 files changed, 17 insertions(+)

diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
index da7a7c8..be0d292 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -327,4 +327,6 @@ static inline const char *ath_opmode_to_string(enum 
nl80211_iftype opmode)
 }
 #endif
 
+const char *ath_bus_type_to_string(enum ath_bus_type bustype);
+
 #endif /* ATH_H */
diff --git a/drivers/net/wireless/ath/main.c b/drivers/net/wireless/ath/main.c
index 338d723..90427cb 100644
--- a/drivers/net/wireless/ath/main.c
+++ b/drivers/net/wireless/ath/main.c
@@ -90,3 +90,18 @@ void ath_printk(const char *level, const struct ath_common* 
common,
va_end(args);
 }
 EXPORT_SYMBOL(ath_printk);
+
+const char *ath_bus_type_to_string(enum ath_bus_type bustype)
+{
+   switch (bustype) {
+   case ATH_PCI:
+   return "pci";
+   case ATH_AHB:
+   return "ahb";
+   case ATH_USB:
+   return "usb";
+   default:
+   return "unknown";
+   }
+}
+EXPORT_SYMBOL(ath_bus_type_to_string);
-- 
2.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC v3 3/3] ath9k: parse the device configuration from an OF node

2016-06-24 Thread Martin Blumenstingl
This makes it possible to configure ath9k based devices using
devicetree. That makes some out-of-tree "convert devicetree to
ath9k_platform_data glue"-code obsolete.

Signed-off-by: Martin Blumenstingl 
---
changes in v2 -> v3:
- replaced qca,eeprom-name with a boolean "qca,no-eeprom". The name of the
  eeprom firmware file is now generated based on the following pattern:
  ath9k-eeprom--.bin

 drivers/net/wireless/ath/ath9k/init.c | 68 +++
 1 file changed, 68 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index a0f4a52..9521bc8 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -20,6 +20,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
@@ -555,6 +557,68 @@ static int ath9k_init_platform(struct ath_softc *sc)
return 0;
 }
 
+static int ath9k_of_init(struct ath_softc *sc)
+{
+   struct device_node *np = sc->dev->of_node;
+   struct ath_hw *ah = sc->sc_ah;
+   struct ath_common *common = ath9k_hw_common(ah);
+   enum ath_bus_type bus_type = common->bus_ops->ath_bus_type;
+   const char *mac;
+   char eeprom_name[100];
+   int led_pin, ret;
+   u32 gpio_data;
+
+   if (!of_device_is_available(np))
+   return 0;
+
+   ath_dbg(common, CONFIG, "parsing configuration from OF node\n");
+
+   if (!of_property_read_u32(np, "qca,led-pin", _pin))
+   ah->led_pin = led_pin;
+
+   if (!of_property_read_u32(np, "qca,gpio-mask", _data))
+   ah->gpio_mask = gpio_data;
+
+   if (!of_property_read_u32(np, "qca,gpio-val", _data))
+   ah->gpio_val = gpio_data;
+
+   if (of_property_read_bool(np, "qca,clk-25mhz"))
+   ah->is_clk_25mhz = true;
+
+   if (of_property_read_bool(np, "qca,led-active-high"))
+   ah->config.led_active_high = true;
+
+   if (of_property_read_bool(np, "qca,disable-2ghz"))
+   ah->disable_2ghz = true;
+
+   if (of_property_read_bool(np, "qca,disable-5ghz"))
+   ah->disable_5ghz = true;
+
+   if (of_property_read_bool(np, "qca,check-eeprom-endianness"))
+   ah->ah_flags &= ~AH_NO_EEP_SWAP;
+   else
+   ah->ah_flags |= AH_NO_EEP_SWAP;
+
+   if (of_property_read_bool(np, "qca,no-eeprom")) {
+   /* ath9k-eeprom--.bin */
+   scnprintf(eeprom_name, sizeof(eeprom_name),
+ "ath9k-eeprom-%s-%s.bin",
+ ath_bus_type_to_string(bus_type), dev_name(ah->dev));
+
+   ret = ath9k_eeprom_request(sc, eeprom_name);
+   if (ret)
+   return ret;
+   }
+
+   mac = of_get_mac_address(np);
+   if (mac)
+   ether_addr_copy(common->macaddr, mac);
+
+   ah->ah_flags &= ~AH_USE_EEPROM;
+
+   return 0;
+}
+
 static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
const struct ath_bus_ops *bus_ops)
 {
@@ -611,6 +675,10 @@ static int ath9k_init_softc(u16 devid, struct ath_softc 
*sc,
if (ret)
return ret;
 
+   ret = ath9k_of_init(sc);
+   if (ret)
+   return ret;
+
if (ath9k_led_active_high != -1)
ah->config.led_active_high = ath9k_led_active_high == 1;
 
-- 
2.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC v3 1/3] Documentation: dt: net: add ath9k wireless device binding

2016-06-24 Thread Martin Blumenstingl
Add documentation how devicetree can be used to configure ath9k based
devices.

Signed-off-by: Martin Blumenstingl 
---
changes in v2 -> v3:
- improved wording of the qca,disable-2ghz and qca,disable-5ghz properties
- replaced qca,eeprom-name with qca,no-eeprom (the eeprom name is now
  built automatically within ath9k). The naming was chosen to stay
  consistent with other drivers (such as davicom-dm9000 and via-velocity)
- added reference to the mac-address and local-mac-address properties
- removed invalid device_type property from the example

 .../devicetree/bindings/net/wireless/qca,ath9k.txt | 46 ++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/qca,ath9k.txt

diff --git a/Documentation/devicetree/bindings/net/wireless/qca,ath9k.txt 
b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.txt
new file mode 100644
index 000..ff83fd4
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/qca,ath9k.txt
@@ -0,0 +1,46 @@
+* Qualcomm Atheros ath9k wireless devices
+
+This node provides properties for configuring the ath9k wireless device. The
+node is expected to be specified as a child node of the PCI controller to
+which the wireless chip is connected.
+
+Required properties:
+- compatible: Should be "qca,ath9k"
+
+Optional properties:
+- reg: Address and length of the register set for the device.
+- qca,gpio-mask: The GPIO mask
+- qca,gpio-val: The GPIO value
+- qca,led-pin: The GPIO number to which the LED is connected
+- qca,led-active-high: The LED is active when the GPIO is HIGH
+- qca,clk-25mhz: Defines that at 25MHz clock is used
+- qca,no-eeprom: Indicates that there is on physical EEPROM connected
+   to the ath9k wireless chip (in this case the
+   calibration / EEPROM data will be loaded from
+   userspace using the firmware mechanism)
+- qca,check-eeprom-endianness: Allow checking the EEPROM endianness and
+   swapping of the EEPROM data if required
+- qca,disable-2ghz: Overrides the settings from the EEPROM and disables
+   the 2.4GHz band, even if enabled in the EEPROM
+- qca,disable-5ghz: Overrides the settings from the EEPROM and disables
+   the 5GHz band, even if enabled in the EEPROM
+- mac-address: See ethernet.txt in the parent directory
+- local-mac-address: See ethernet.txt in the parent directory
+
+In this example, the node is defined as child node of the PCI controller.
+
+pci {
+   pcie@0 {
+   reg = <0 0 0 0 0>;
+   #interrupt-cells = <1>;
+   #size-cells = <2>;
+   #address-cells = <3>;
+   device_type = "pci";
+
+   ath9k@0,0 {
+   compatible = "qca,ath9k";
+   reg = <0 0 0 0 0>;
+   qca,disable-5ghz;
+   };
+   };
+};
-- 
2.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC v3] ath9k: add devicetree support to ath9k

2016-06-24 Thread Martin Blumenstingl
This series adds support for configuring ath9k based devices via
devicetree. This was tested on PCI(e) based devices. This should work
for AHB based devices as well as soon as the ath79 platform is ready
to populate the ath9k wmac via devicetree.

This series depends on my previous series:
"ath9k: extend and improve handling of ath9k_platform_data"

changes in v1 -> v2:
This addresses all issues found by Christian Lamparter (thanks!), the
detailed changes are documented in each patch.

changes in v2 -> v3:
The qca,eeprom-name was property was replaced by qca,no-eeprom, which
moves the filename for the eeprom firmware from the devicetree to ath9k
(where the filename is now auto-generated). Additionally this contains
fixes for the documentation (some properties were missing, an invalid
property in the example, etc.). The detailed changes are documented in
each patch.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mac80211_hwsim: Added vendor echo command

2016-06-24 Thread Erik Stromdahl
The purpose of the echo command is to provide a test
facility for user space programs.

Signed-off-by: Erik Stromdahl 
---
 drivers/net/wireless/mac80211_hwsim.c |   27 +--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c 
b/drivers/net/wireless/mac80211_hwsim.c
index 4dd5adc..2e17bf1 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -332,14 +332,16 @@ static const struct ieee80211_rate hwsim_rates[] = {
 
 #define OUI_QCA 0x001374
 #define QCA_NL80211_SUBCMD_TEST 1
+#define QCA_NL80211_SUBCMD_ECHO 2
 enum qca_nl80211_vendor_subcmds {
QCA_WLAN_VENDOR_ATTR_TEST = 8,
-   QCA_WLAN_VENDOR_ATTR_MAX = QCA_WLAN_VENDOR_ATTR_TEST
+   QCA_WLAN_VENDOR_ATTR_ECHO,
+   QCA_WLAN_VENDOR_ATTR_MAX = QCA_WLAN_VENDOR_ATTR_ECHO
 };
 
 static const struct nla_policy
 hwsim_vendor_test_policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] = {
-   [QCA_WLAN_VENDOR_ATTR_MAX] = { .type = NLA_U32 },
+   [QCA_WLAN_VENDOR_ATTR_TEST] = { .type = NLA_U32 },
 };
 
 static int mac80211_hwsim_vendor_cmd_test(struct wiphy *wiphy,
@@ -393,12 +395,33 @@ static int mac80211_hwsim_vendor_cmd_test(struct wiphy 
*wiphy,
return cfg80211_vendor_cmd_reply(skb);
 }
 
+static int mac80211_hwsim_vendor_cmd_echo(struct wiphy *wiphy,
+ struct wireless_dev *wdev,
+ const void *data, int data_len)
+{
+   struct sk_buff *skb;
+
+   skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, data_len);
+   if (!skb)
+   return -ENOMEM;
+
+   nla_put(skb, QCA_WLAN_VENDOR_ATTR_ECHO, data_len, data);
+
+   return cfg80211_vendor_cmd_reply(skb);
+}
+
 static struct wiphy_vendor_command mac80211_hwsim_vendor_commands[] = {
{
.info = { .vendor_id = OUI_QCA,
  .subcmd = QCA_NL80211_SUBCMD_TEST },
.flags = WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = mac80211_hwsim_vendor_cmd_test,
+   },
+   {
+   .info = { .vendor_id = OUI_QCA,
+ .subcmd = QCA_NL80211_SUBCMD_ECHO },
+   .flags = WIPHY_VENDOR_CMD_NEED_NETDEV,
+   .doit = mac80211_hwsim_vendor_cmd_echo,
}
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mwifiex: Fixed endianness for event TLV type TLV_BTCOEX_WL_SCANTIME

2016-06-24 Thread Prasun Maiti
On Thu, Jun 16, 2016 at 9:49 AM, Prasun Maiti  wrote:
> The two members min_scan_time and max_scan_time of structure
> "mwifiex_ie_types_btcoex_scan_time" are of two bytes each. The values
> are assigned directtly from firmware without endian conversion handling.
> So, wrong datas will get saved in big-endian systems.
>
> This patch converts the values into cpu's byte order before assigning them
> into the local members.
>
> Signed-off-by: Prasun Maiti 
> ---
>  drivers/net/wireless/marvell/mwifiex/sta_event.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c 
> b/drivers/net/wireless/marvell/mwifiex/sta_event.c
> index 0104108..7dff452 100644
> --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c
> +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c
> @@ -474,8 +474,8 @@ void mwifiex_bt_coex_wlan_param_update_event(struct 
> mwifiex_private *priv,
> scantlv =
> (struct mwifiex_ie_types_btcoex_scan_time *)tlv;
> adapter->coex_scan = scantlv->coex_scan;
> -   adapter->coex_min_scan_time = scantlv->min_scan_time;
> -   adapter->coex_max_scan_time = scantlv->max_scan_time;
> +   adapter->coex_min_scan_time = 
> le16_to_cpu(scantlv->min_scan_time);
> +   adapter->coex_max_scan_time = 
> le16_to_cpu(scantlv->max_scan_time);
> break;
>
> default:
> --
> 1.9.1
>

Hi Amitkumar,

Please let me know your opinion about this patch.

-- 
Thanks,
Prasun
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html