Re: [PATCH] cfg80211/nl80211: add wifi tx power mode switching support

2016-07-07 Thread Wei-Ning Huang
Hi Johannes,

Thanks for the reply.

You are right that the physical antenna does not change.
When I refer to 'calibration data', it actually corresponding to how
mwifiex adjust the per-band tx power. For mwifiex, the per-band tx
power is pre-calculated based on need, and stored in DT, a vendor
command or std nl80211 message is sent
to tell the driver to switch between two set of "calibration data".
I'm aware that iwl7000 is using a vendor command to do this as well,
but instead of pre-calculate required tx power info, the tx value can
be passed along with the vendor command message.

This patch was sent originally to standardize the requirement of
sending a vendor command to the driver (so it'll be a standard nl80211
message). However, we have decided to move along with vendor command
for both mwifiex and nl80211, so this patch is not needed anymore.
Thanks for the comments!

Wei-Ning

On Tue, Jun 28, 2016 at 6:57 PM, Johannes Berg
 wrote:
> On Thu, 2016-05-12 at 17:34 +0800, Wei-Ning Huang wrote:
>>
>> Johannes, I feel like being able to set calibration data at runtime
>> is something common to all wireless drivers, so instead of using
>> vendor commands what do you think if I pass the calibration data name
>> instead of using those magic constants? This way, userspace does not
>> need to know the details of what band/range power limit the driver
>> supports. It allows for flexible driver side implementation and
>> easier for userspace to control.
>>
>
> Sorry - I dropped this thread accidentally.
>
> I'm not really sure I understand the situation fully, but right now to
> me this seems very strange.
>
> The physical antennas probably don't really change between "clamshell"
> and "tablet" mode, do the physical radiation properties change enough
> to actually require different *calibration*? To me, that sounds very
> strange.
>
> Assuming they don't really change fundamentally, then I understand the
> need to set different power levels, per band/channel/whatever
> granularity. But that can be achieved in very different ways, and in
> fact if you look at Chrome then for our iwl7000 driver there we do have
> a command to do something similar (currently a vendor command, but that
> can be changed) without ever changing the *calibration*.
>
> So to me, the whole premise of the patch is confusing and/or wrong.
>
> johannes



-- 
Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
wnhu...@google.com | Cell: +886 910-380678
--
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 v2] mwifiex: fix race condition when downloading firmware

2016-05-27 Thread Wei-Ning Huang
The action 'check for winner' and 'download firmware' should be an
atomic action. This is true for btmrvl driver but not mwmfiex, which
cause firmware download to fail when the following scenario happens:

1) mwifiex check winner status: true
2) btmrvl check winner status: true, and start downloading firmware
3) mwifiex tries to download firmware, but failed because btmrvl is
already downloading.

This won't happen if 1) and 3) is an atomic action. This patch adds
sdio_claim/release_host call around those two actions to make sure it's
atomic.

Signed-off-by: Wei-Ning Huang 
---
 drivers/net/wireless/marvell/mwifiex/init.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/init.c 
b/drivers/net/wireless/marvell/mwifiex/init.c
index 78c532f..7703438 100644
--- a/drivers/net/wireless/marvell/mwifiex/init.c
+++ b/drivers/net/wireless/marvell/mwifiex/init.c
@@ -24,6 +24,7 @@
 #include "main.h"
 #include "wmm.h"
 #include "11n.h"
+#include "sdio.h"
 
 /*
  * This function adds a BSS priority table to the table list.
@@ -737,16 +738,20 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
 int mwifiex_dnld_fw(struct mwifiex_adapter *adapter,
struct mwifiex_fw_image *pmfw)
 {
+   struct sdio_mmc_card *card = adapter->card;
int ret;
u32 poll_num = 1;
 
+   if (adapter->iface_type == MWIFIEX_SDIO)
+   sdio_claim_host(card->func);
+
if (adapter->if_ops.check_fw_status) {
/* check if firmware is already running */
ret = adapter->if_ops.check_fw_status(adapter, poll_num);
if (!ret) {
mwifiex_dbg(adapter, MSG,
"WLAN FW already running! Skip FW dnld\n");
-   return 0;
+   goto release_host;
}
}
 
@@ -759,7 +764,7 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter,
if (ret) {
mwifiex_dbg(adapter, MSG,
"WLAN read winner status failed!\n");
-   return ret;
+   goto release_host;
}
 
if (!adapter->winner) {
@@ -775,7 +780,7 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter,
if (ret) {
mwifiex_dbg(adapter, ERROR,
"prog_fw failed ret=%#x\n", ret);
-   return ret;
+   goto release_host;
}
}
 
@@ -785,6 +790,9 @@ poll_fw:
if (ret)
mwifiex_dbg(adapter, ERROR,
"FW failed to be active in time\n");
+release_host:
+   if (adapter->iface_type == MWIFIEX_SDIO)
+   sdio_release_host(card->func);
 
return ret;
 }
-- 
2.1.2

--
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] mwifiex: fix racing condition when downloading firmware

2016-05-18 Thread Wei-Ning Huang
The action 'check for winner' and 'download firmware' should be an
atomic action. This is true for btmrvl driver but not mwmfiex, which
cause firmware download to fail when the following senerio happens:

1) mwifiex check winner status: true
2) btmrvl check winner status: true, and start downloading firmware
3) mwfieix tries to download firmware, but failed because btmrvl is
already downloading.

This won't happen if 1) and 3) is an atomic action. This patch adds
sdio_claim/release_host call around those two actions to make sure it's
atomic.

Signed-off-by: Wei-Ning Huang 
---
 drivers/net/wireless/marvell/mwifiex/main.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/main.c 
b/drivers/net/wireless/marvell/mwifiex/main.c
index 8b67a55..2b65334 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -21,6 +21,7 @@
 #include "wmm.h"
 #include "cfg80211.h"
 #include "11n.h"
+#include "sdio.h"
 
 #define VERSION"1.0"
 
@@ -514,6 +515,7 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, 
void *context)
struct semaphore *sem = adapter->card_sem;
bool init_failed = false;
struct wireless_dev *wdev;
+   struct sdio_mmc_card *card = adapter->card;
 
if (!firmware) {
mwifiex_dbg(adapter, ERROR,
@@ -526,10 +528,16 @@ static void mwifiex_fw_dpc(const struct firmware 
*firmware, void *context)
fw.fw_buf = (u8 *) adapter->firmware->data;
fw.fw_len = adapter->firmware->size;
 
-   if (adapter->if_ops.dnld_fw)
+   if (adapter->if_ops.dnld_fw) {
ret = adapter->if_ops.dnld_fw(adapter, &fw);
-   else
+   } else {
+   if (adapter->iface_type == MWIFIEX_SDIO)
+   sdio_claim_host(card->func);
ret = mwifiex_dnld_fw(adapter, &fw);
+   if (adapter->iface_type == MWIFIEX_SDIO)
+   sdio_release_host(card->func);
+   }
+
if (ret == -1)
goto err_dnld_fw;
 
-- 
2.1.2

--
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] cfg80211/nl80211: add wifi tx power mode switching support

2016-05-12 Thread Wei-Ning Huang
On Fri, May 13, 2016 at 6:02 AM, Arend van Spriel
 wrote:
> On 12-05-16 11:34, Wei-Ning Huang wrote:
>> On Thu, May 12, 2016 at 2:33 AM, Dan Williams  wrote:
>>> On Wed, 2016-05-11 at 13:03 +0800, Wei-Ning Huang wrote:
>>>> On Fri, May 6, 2016 at 4:19 PM, Wei-Ning Huang 
>>>> wrote:
>>>>>
>>>>> On Fri, May 6, 2016 at 12:07 AM, Dan Williams 
>>>>> wrote:
>>>>>>
>>>>>>
>>>>>> On Thu, 2016-05-05 at 14:44 +0800, Wei-Ning Huang wrote:
>>>>>>>
>>>>>>> Recent new hardware has the ability to switch between tablet
>>>>>>> mode and
>>>>>>> clamshell mode. To optimize WiFi performance, we want to be
>>>>>>> able to
>>>>>>> use
>>>>>>> different power table between modes. This patch adds a new
>>>>>>> netlink
>>>>>>> message type and cfg80211_ops function to allow userspace to
>>>>>>> trigger
>>>>>>> a
>>>>>>> power mode switch for a given wireless interface.
>>>>>>>
>>>>>>> Signed-off-by: Wei-Ning Huang 
>>>>>>> ---
>>>>>>>  include/net/cfg80211.h   | 11 +++
>>>>>>>  include/uapi/linux/nl80211.h | 21 +
>>>>>>>  net/wireless/nl80211.c   | 16 
>>>>>>>  net/wireless/rdev-ops.h  | 22 ++
>>>>>>>  net/wireless/trace.h | 20 
>>>>>>>  5 files changed, 90 insertions(+)
>>>>>>>
>>>>>>> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
>>>>>>> index 9e1b24c..aa77fa0 100644
>>>>>>> --- a/include/net/cfg80211.h
>>>>>>> +++ b/include/net/cfg80211.h
>>>>>>> @@ -2370,6 +2370,12 @@ struct cfg80211_qos_map {
>>>>>>>   * @get_tx_power: store the current TX power into the dbm
>>>>>>> variable;
>>>>>>>   *   return 0 if successful
>>>>>>>   *
>>>>>>> + * @set_tx_power_mode: set the transmit power mode. Some
>>>>>>> device have
>>>>>>> the ability
>>>>>>> + *   to transform between different mode such as clamshell and
>>>>>>> tablet mode.
>>>>>>> + *   set_tx_power_mode allows setting of different TX power
>>>>>>> mode at runtime.
>>>>>>> + * @get_tx_power_mode: store the current TX power mode into
>>>>>>> the mode
>>>>>>> variable;
>>>>>>> + *   return 0 if successful
>>>>>>> + *
>>>>>>>   * @set_wds_peer: set the WDS peer for a WDS interface
>>>>>>>   *
>>>>>>>   * @rfkill_poll: polls the hw rfkill line, use cfg80211
>>>>>>> reporting
>>>>>>> @@ -2631,6 +2637,11 @@ struct cfg80211_ops {
>>>>>>>   int (*get_tx_power)(struct wiphy *wiphy, struct
>>>>>>> wireless_dev *wdev,
>>>>>>>   int *dbm);
>>>>>>>
>>>>>>> + int (*set_tx_power_mode)(struct wiphy *wiphy,
>>>>>>> +  enum nl80211_tx_power_mode
>>>>>>> mode);
>>>>>>> + int (*get_tx_power_mode)(struct wiphy *wiphy,
>>>>>>> +  enum nl80211_tx_power_mode
>>>>>>> *mode);
>>>>>>> +
>>>>>>>   int (*set_wds_peer)(struct wiphy *wiphy, struct
>>>>>>> net_device *dev,
>>>>>>>   const u8 *addr);
>>>>>>>
>>>>>>> diff --git a/include/uapi/linux/nl80211.h
>>>>>>> b/include/uapi/linux/nl80211.h
>>>>>>> index 5a30a75..9b1888a 100644
>>>>>>> --- a/include/uapi/linux/nl80211.h
>>>>>>> +++ b/include/uapi/linux/nl80211.h
>>>>>>> @@ -1796,6 +1796,9 @@ enum nl80211_commands {
>>>>>>>   *   connecting to a PCP, and in %NL80211_CMD_START_AP to
>>>>>>> start
>>>>>>>   *   a PCP instead of AP. Relevant for DMG networks only

Re: [PATCH] cfg80211/nl80211: add wifi tx power mode switching support

2016-05-12 Thread Wei-Ning Huang
On Thu, May 12, 2016 at 2:33 AM, Dan Williams  wrote:
> On Wed, 2016-05-11 at 13:03 +0800, Wei-Ning Huang wrote:
>> On Fri, May 6, 2016 at 4:19 PM, Wei-Ning Huang 
>> wrote:
>> >
>> > On Fri, May 6, 2016 at 12:07 AM, Dan Williams 
>> > wrote:
>> > >
>> > >
>> > > On Thu, 2016-05-05 at 14:44 +0800, Wei-Ning Huang wrote:
>> > > >
>> > > > Recent new hardware has the ability to switch between tablet
>> > > > mode and
>> > > > clamshell mode. To optimize WiFi performance, we want to be
>> > > > able to
>> > > > use
>> > > > different power table between modes. This patch adds a new
>> > > > netlink
>> > > > message type and cfg80211_ops function to allow userspace to
>> > > > trigger
>> > > > a
>> > > > power mode switch for a given wireless interface.
>> > > >
>> > > > Signed-off-by: Wei-Ning Huang 
>> > > > ---
>> > > >  include/net/cfg80211.h   | 11 +++
>> > > >  include/uapi/linux/nl80211.h | 21 +
>> > > >  net/wireless/nl80211.c   | 16 
>> > > >  net/wireless/rdev-ops.h  | 22 ++
>> > > >  net/wireless/trace.h | 20 
>> > > >  5 files changed, 90 insertions(+)
>> > > >
>> > > > diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
>> > > > index 9e1b24c..aa77fa0 100644
>> > > > --- a/include/net/cfg80211.h
>> > > > +++ b/include/net/cfg80211.h
>> > > > @@ -2370,6 +2370,12 @@ struct cfg80211_qos_map {
>> > > >   * @get_tx_power: store the current TX power into the dbm
>> > > > variable;
>> > > >   *   return 0 if successful
>> > > >   *
>> > > > + * @set_tx_power_mode: set the transmit power mode. Some
>> > > > device have
>> > > > the ability
>> > > > + *   to transform between different mode such as clamshell and
>> > > > tablet mode.
>> > > > + *   set_tx_power_mode allows setting of different TX power
>> > > > mode at runtime.
>> > > > + * @get_tx_power_mode: store the current TX power mode into
>> > > > the mode
>> > > > variable;
>> > > > + *   return 0 if successful
>> > > > + *
>> > > >   * @set_wds_peer: set the WDS peer for a WDS interface
>> > > >   *
>> > > >   * @rfkill_poll: polls the hw rfkill line, use cfg80211
>> > > > reporting
>> > > > @@ -2631,6 +2637,11 @@ struct cfg80211_ops {
>> > > >   int (*get_tx_power)(struct wiphy *wiphy, struct
>> > > > wireless_dev *wdev,
>> > > >   int *dbm);
>> > > >
>> > > > + int (*set_tx_power_mode)(struct wiphy *wiphy,
>> > > > +  enum nl80211_tx_power_mode
>> > > > mode);
>> > > > + int (*get_tx_power_mode)(struct wiphy *wiphy,
>> > > > +  enum nl80211_tx_power_mode
>> > > > *mode);
>> > > > +
>> > > >   int (*set_wds_peer)(struct wiphy *wiphy, struct
>> > > > net_device *dev,
>> > > >   const u8 *addr);
>> > > >
>> > > > diff --git a/include/uapi/linux/nl80211.h
>> > > > b/include/uapi/linux/nl80211.h
>> > > > index 5a30a75..9b1888a 100644
>> > > > --- a/include/uapi/linux/nl80211.h
>> > > > +++ b/include/uapi/linux/nl80211.h
>> > > > @@ -1796,6 +1796,9 @@ enum nl80211_commands {
>> > > >   *   connecting to a PCP, and in %NL80211_CMD_START_AP to
>> > > > start
>> > > >   *   a PCP instead of AP. Relevant for DMG networks only.
>> > > >   *
>> > > > + * @NL80211_ATTR_WIPHY_TX_POWER_MODE: Transmit power mode. See
>> > > > + *  &enum nl80211_tx_power_mode for possible values.
>> > > > + *
>> > > >   * @NUM_NL80211_ATTR: total number of nl80211_attrs available
>> > > >   * @NL80211_ATTR_MAX: highest attribute number currently
>> > > > defined
>> > > >   * @__NL80211_ATTR_AFTER_LAST: internal use
>> > > > @@ -2172,6 +2175,8

Re: [PATCH] cfg80211/nl80211: add wifi tx power mode switching support

2016-05-10 Thread Wei-Ning Huang
On Fri, May 6, 2016 at 4:19 PM, Wei-Ning Huang  wrote:
> On Fri, May 6, 2016 at 12:07 AM, Dan Williams  wrote:
>>
>> On Thu, 2016-05-05 at 14:44 +0800, Wei-Ning Huang wrote:
>> > Recent new hardware has the ability to switch between tablet mode and
>> > clamshell mode. To optimize WiFi performance, we want to be able to
>> > use
>> > different power table between modes. This patch adds a new netlink
>> > message type and cfg80211_ops function to allow userspace to trigger
>> > a
>> > power mode switch for a given wireless interface.
>> >
>> > Signed-off-by: Wei-Ning Huang 
>> > ---
>> >  include/net/cfg80211.h   | 11 +++
>> >  include/uapi/linux/nl80211.h | 21 +
>> >  net/wireless/nl80211.c   | 16 
>> >  net/wireless/rdev-ops.h  | 22 ++
>> >  net/wireless/trace.h | 20 
>> >  5 files changed, 90 insertions(+)
>> >
>> > diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
>> > index 9e1b24c..aa77fa0 100644
>> > --- a/include/net/cfg80211.h
>> > +++ b/include/net/cfg80211.h
>> > @@ -2370,6 +2370,12 @@ struct cfg80211_qos_map {
>> >   * @get_tx_power: store the current TX power into the dbm variable;
>> >   *   return 0 if successful
>> >   *
>> > + * @set_tx_power_mode: set the transmit power mode. Some device have
>> > the ability
>> > + *   to transform between different mode such as clamshell and
>> > tablet mode.
>> > + *   set_tx_power_mode allows setting of different TX power
>> > mode at runtime.
>> > + * @get_tx_power_mode: store the current TX power mode into the mode
>> > variable;
>> > + *   return 0 if successful
>> > + *
>> >   * @set_wds_peer: set the WDS peer for a WDS interface
>> >   *
>> >   * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
>> > @@ -2631,6 +2637,11 @@ struct cfg80211_ops {
>> >   int (*get_tx_power)(struct wiphy *wiphy, struct
>> > wireless_dev *wdev,
>> >   int *dbm);
>> >
>> > + int (*set_tx_power_mode)(struct wiphy *wiphy,
>> > +  enum nl80211_tx_power_mode
>> > mode);
>> > + int (*get_tx_power_mode)(struct wiphy *wiphy,
>> > +  enum nl80211_tx_power_mode
>> > *mode);
>> > +
>> >   int (*set_wds_peer)(struct wiphy *wiphy, struct
>> > net_device *dev,
>> >   const u8 *addr);
>> >
>> > diff --git a/include/uapi/linux/nl80211.h
>> > b/include/uapi/linux/nl80211.h
>> > index 5a30a75..9b1888a 100644
>> > --- a/include/uapi/linux/nl80211.h
>> > +++ b/include/uapi/linux/nl80211.h
>> > @@ -1796,6 +1796,9 @@ enum nl80211_commands {
>> >   *   connecting to a PCP, and in %NL80211_CMD_START_AP to start
>> >   *   a PCP instead of AP. Relevant for DMG networks only.
>> >   *
>> > + * @NL80211_ATTR_WIPHY_TX_POWER_MODE: Transmit power mode. See
>> > + *  &enum nl80211_tx_power_mode for possible values.
>> > + *
>> >   * @NUM_NL80211_ATTR: total number of nl80211_attrs available
>> >   * @NL80211_ATTR_MAX: highest attribute number currently defined
>> >   * @__NL80211_ATTR_AFTER_LAST: internal use
>> > @@ -2172,6 +2175,8 @@ enum nl80211_attrs {
>> >
>> >   NL80211_ATTR_PBSS,
>> >
>> > + NL80211_ATTR_WIPHY_TX_POWER_MODE,
>> > +
>> >   /* add attributes here, update the policy in nl80211.c */
>> >
>> >   __NL80211_ATTR_AFTER_LAST,
>> > @@ -3703,6 +3708,22 @@ enum nl80211_tx_power_setting {
>> >  };
>> >
>> >  /**
>> > + * enum nl80211_tx_power_mode - TX power mode setting
>> > + * @NL80211_TX_POWER_LOW: general low TX power mode
>> > + * @NL80211_TX_POWER_MEDIUM: general medium TX power mode
>> > + * @NL80211_TX_POWER_HIGH: general high TX power mode
>> > + * @NL80211_TX_POWER_CLAMSHELL: clamshell mode TX power mode
>> > + * @NL80211_TX_POWER_TABLET: tablet mode TX power mode
>> > + */
>> > +enum nl80211_tx_power_mode {
>> > + NL80211_TX_POWER_LOW,
>> > + NL80211_TX_POWER_MEDIUM,
>> > + NL80211_TX_POWER_HIGH,
>> > + NL80211_TX_POWER_CLAMSHELL,
>> > + NL80211_TX_POWER_TABLET,
>>
>
>> "clamshell

[PATCH] mwifiex: fixup error messages

2016-05-09 Thread Wei-Ning Huang
Use dev_err instead of pr_err and add newline character at the end.

Signed-off-by: Wei-Ning Huang 
---
 drivers/net/wireless/marvell/mwifiex/sdio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 099722e..bdc51ff 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -104,7 +104,7 @@ static int mwifiex_sdio_probe_of(struct device *dev, struct 
sdio_mmc_card *card)
 
if (!dev->of_node ||
!of_match_node(mwifiex_sdio_of_match_table, dev->of_node)) {
-   pr_err("sdio platform data not available");
+   dev_err(dev, "sdio platform data not available\n");
return -1;
}
 
@@ -115,7 +115,8 @@ static int mwifiex_sdio_probe_of(struct device *dev, struct 
sdio_mmc_card *card)
if (cfg && card->plt_of_node) {
cfg->irq_wifi = irq_of_parse_and_map(card->plt_of_node, 0);
if (!cfg->irq_wifi) {
-   dev_err(dev, "fail to parse irq_wifi from device tree");
+   dev_err(dev,
+   "fail to parse irq_wifi from device tree\n");
} else {
ret = devm_request_irq(dev, cfg->irq_wifi,
   mwifiex_wake_irq_wifi,
-- 
2.1.2

--
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] cfg80211/nl80211: add wifi tx power mode switching support

2016-05-06 Thread Wei-Ning Huang
On Fri, May 6, 2016 at 12:07 AM, Dan Williams  wrote:
>
> On Thu, 2016-05-05 at 14:44 +0800, Wei-Ning Huang wrote:
> > Recent new hardware has the ability to switch between tablet mode and
> > clamshell mode. To optimize WiFi performance, we want to be able to
> > use
> > different power table between modes. This patch adds a new netlink
> > message type and cfg80211_ops function to allow userspace to trigger
> > a
> > power mode switch for a given wireless interface.
> >
> > Signed-off-by: Wei-Ning Huang 
> > ---
> >  include/net/cfg80211.h   | 11 +++
> >  include/uapi/linux/nl80211.h | 21 +
> >  net/wireless/nl80211.c   | 16 
> >  net/wireless/rdev-ops.h  | 22 ++
> >  net/wireless/trace.h | 20 
> >  5 files changed, 90 insertions(+)
> >
> > diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> > index 9e1b24c..aa77fa0 100644
> > --- a/include/net/cfg80211.h
> > +++ b/include/net/cfg80211.h
> > @@ -2370,6 +2370,12 @@ struct cfg80211_qos_map {
> >   * @get_tx_power: store the current TX power into the dbm variable;
> >   *   return 0 if successful
> >   *
> > + * @set_tx_power_mode: set the transmit power mode. Some device have
> > the ability
> > + *   to transform between different mode such as clamshell and
> > tablet mode.
> > + *   set_tx_power_mode allows setting of different TX power
> > mode at runtime.
> > + * @get_tx_power_mode: store the current TX power mode into the mode
> > variable;
> > + *   return 0 if successful
> > + *
> >   * @set_wds_peer: set the WDS peer for a WDS interface
> >   *
> >   * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
> > @@ -2631,6 +2637,11 @@ struct cfg80211_ops {
> >   int (*get_tx_power)(struct wiphy *wiphy, struct
> > wireless_dev *wdev,
> >   int *dbm);
> >
> > + int (*set_tx_power_mode)(struct wiphy *wiphy,
> > +  enum nl80211_tx_power_mode
> > mode);
> > + int (*get_tx_power_mode)(struct wiphy *wiphy,
> > +  enum nl80211_tx_power_mode
> > *mode);
> > +
> >   int (*set_wds_peer)(struct wiphy *wiphy, struct
> > net_device *dev,
> >   const u8 *addr);
> >
> > diff --git a/include/uapi/linux/nl80211.h
> > b/include/uapi/linux/nl80211.h
> > index 5a30a75..9b1888a 100644
> > --- a/include/uapi/linux/nl80211.h
> > +++ b/include/uapi/linux/nl80211.h
> > @@ -1796,6 +1796,9 @@ enum nl80211_commands {
> >   *   connecting to a PCP, and in %NL80211_CMD_START_AP to start
> >   *   a PCP instead of AP. Relevant for DMG networks only.
> >   *
> > + * @NL80211_ATTR_WIPHY_TX_POWER_MODE: Transmit power mode. See
> > + *  &enum nl80211_tx_power_mode for possible values.
> > + *
> >   * @NUM_NL80211_ATTR: total number of nl80211_attrs available
> >   * @NL80211_ATTR_MAX: highest attribute number currently defined
> >   * @__NL80211_ATTR_AFTER_LAST: internal use
> > @@ -2172,6 +2175,8 @@ enum nl80211_attrs {
> >
> >   NL80211_ATTR_PBSS,
> >
> > + NL80211_ATTR_WIPHY_TX_POWER_MODE,
> > +
> >   /* add attributes here, update the policy in nl80211.c */
> >
> >   __NL80211_ATTR_AFTER_LAST,
> > @@ -3703,6 +3708,22 @@ enum nl80211_tx_power_setting {
> >  };
> >
> >  /**
> > + * enum nl80211_tx_power_mode - TX power mode setting
> > + * @NL80211_TX_POWER_LOW: general low TX power mode
> > + * @NL80211_TX_POWER_MEDIUM: general medium TX power mode
> > + * @NL80211_TX_POWER_HIGH: general high TX power mode
> > + * @NL80211_TX_POWER_CLAMSHELL: clamshell mode TX power mode
> > + * @NL80211_TX_POWER_TABLET: tablet mode TX power mode
> > + */
> > +enum nl80211_tx_power_mode {
> > + NL80211_TX_POWER_LOW,
> > + NL80211_TX_POWER_MEDIUM,
> > + NL80211_TX_POWER_HIGH,
> > + NL80211_TX_POWER_CLAMSHELL,
> > + NL80211_TX_POWER_TABLET,
>

> "clamshell" and "tablet" probably mean many different things to many
> different people with respect to whether or not they should do anything
> with power saving or wifi.  I feel like a more generic interface is
> needed here.
We could probably drop those two CLAMSHELL and TABLET constant or
describing what they mean
in more detail?

>
> Could this be already done by:
> @NL80211_ATTR_WIPHY_TX_POWER_SETTING = NL80211_TX_POWER_LIMITED
>

[PATCH] cfg80211/nl80211: add wifi tx power mode switching support

2016-05-04 Thread Wei-Ning Huang
Recent new hardware has the ability to switch between tablet mode and
clamshell mode. To optimize WiFi performance, we want to be able to use
different power table between modes. This patch adds a new netlink
message type and cfg80211_ops function to allow userspace to trigger a
power mode switch for a given wireless interface.

Signed-off-by: Wei-Ning Huang 
---
 include/net/cfg80211.h   | 11 +++
 include/uapi/linux/nl80211.h | 21 +
 net/wireless/nl80211.c   | 16 
 net/wireless/rdev-ops.h  | 22 ++
 net/wireless/trace.h | 20 
 5 files changed, 90 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9e1b24c..aa77fa0 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2370,6 +2370,12 @@ struct cfg80211_qos_map {
  * @get_tx_power: store the current TX power into the dbm variable;
  * return 0 if successful
  *
+ * @set_tx_power_mode: set the transmit power mode. Some device have the 
ability
+ * to transform between different mode such as clamshell and tablet mode.
+ * set_tx_power_mode allows setting of different TX power mode at runtime.
+ * @get_tx_power_mode: store the current TX power mode into the mode variable;
+ * return 0 if successful
+ *
  * @set_wds_peer: set the WDS peer for a WDS interface
  *
  * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
@@ -2631,6 +2637,11 @@ struct cfg80211_ops {
int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
int *dbm);
 
+   int (*set_tx_power_mode)(struct wiphy *wiphy,
+enum nl80211_tx_power_mode mode);
+   int (*get_tx_power_mode)(struct wiphy *wiphy,
+enum nl80211_tx_power_mode *mode);
+
int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
const u8 *addr);
 
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 5a30a75..9b1888a 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1796,6 +1796,9 @@ enum nl80211_commands {
  * connecting to a PCP, and in %NL80211_CMD_START_AP to start
  * a PCP instead of AP. Relevant for DMG networks only.
  *
+ * @NL80211_ATTR_WIPHY_TX_POWER_MODE: Transmit power mode. See
+ *  &enum nl80211_tx_power_mode for possible values.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2172,6 +2175,8 @@ enum nl80211_attrs {
 
NL80211_ATTR_PBSS,
 
+   NL80211_ATTR_WIPHY_TX_POWER_MODE,
+
/* add attributes here, update the policy in nl80211.c */
 
__NL80211_ATTR_AFTER_LAST,
@@ -3703,6 +3708,22 @@ enum nl80211_tx_power_setting {
 };
 
 /**
+ * enum nl80211_tx_power_mode - TX power mode setting
+ * @NL80211_TX_POWER_LOW: general low TX power mode
+ * @NL80211_TX_POWER_MEDIUM: general medium TX power mode
+ * @NL80211_TX_POWER_HIGH: general high TX power mode
+ * @NL80211_TX_POWER_CLAMSHELL: clamshell mode TX power mode
+ * @NL80211_TX_POWER_TABLET: tablet mode TX power mode
+ */
+enum nl80211_tx_power_mode {
+   NL80211_TX_POWER_LOW,
+   NL80211_TX_POWER_MEDIUM,
+   NL80211_TX_POWER_HIGH,
+   NL80211_TX_POWER_CLAMSHELL,
+   NL80211_TX_POWER_TABLET,
+};
+
+/**
  * enum nl80211_packet_pattern_attr - packet pattern attribute
  * @__NL80211_PKTPAT_INVALID: invalid number for nested attribute
  * @NL80211_PKTPAT_PATTERN: the pattern, values where the mask has
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 056a730..61b474d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -402,6 +402,7 @@ static const struct nla_policy 
nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
[NL80211_ATTR_REG_INDOOR] = { .type = NLA_FLAG },
[NL80211_ATTR_PBSS] = { .type = NLA_FLAG },
+   [NL80211_ATTR_WIPHY_TX_POWER_MODE] = { .type = NLA_U32 },
 };
 
 /* policy for the key attributes */
@@ -2218,6 +2219,21 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct 
genl_info *info)
return result;
}
 
+   if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_MODE]) {
+   enum nl80211_tx_power_mode mode;
+   int idx = 0;
+
+   if (!rdev->ops->set_tx_power_mode)
+   return -EOPNOTSUPP;
+
+   idx = NL80211_ATTR_WIPHY_TX_POWER_MODE;
+   mode = nla_get_u32(info->attrs[idx]);
+
+   result = rdev_set_tx_power_mode(rdev, mode);
+   if (result)
+   return result;
+   }
+
if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX] &&
info->attrs[NL80211_ATTR_WIPHY_ANTE

Re: [PATCH RESEND] mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Wei-Ning Huang
On Wed, Mar 30, 2016 at 8:00 PM, Kalle Valo  wrote:
> Wei-Ning Huang  writes:
>
>> Kalle, can you help amend the message if this patch is accepted?
>
> Sure, I'll fix the typo in the commit log.
>
> But please try to avoid top posting, it makes it more difficult to
> follow the threads.
>
> --
> Kalle Valo

Noted, thanks for the reminder :)

Wei-Ning


-- 
Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
wnhu...@google.com | Cell: +886 910-380678
--
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 RESEND] mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Wei-Ning Huang
ah.. thanks.

Kalle, can you help amend the message if this patch is accepted?
Thanks a lot.

Wei-Ning

On Wed, Mar 30, 2016 at 6:26 PM, Sedat Dilek  wrote:
> On Wed, Mar 30, 2016 at 12:14 PM, Wei-Ning Huang  wrote:
>> In mwifiex_enable_hs, we need to check if
>> priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.
>
> it's... its member (not it's) :-).
>
> - Sedat -
>
>> This sometimes cause kernel panic when suspend/resume.
>>
>> Signed-off-by: Wei-Ning Huang 
>> ---
>>  drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c 
>> b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>> index d5c56eb..d8de432 100644
>> --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>> +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
>> @@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
>>
>> if (priv && priv->sched_scanning) {
>>  #ifdef CONFIG_PM
>> -   if (!priv->wdev.wiphy->wowlan_config->nd_config) {
>> +   if (priv->wdev.wiphy->wowlan_config &&
>> +   !priv->wdev.wiphy->wowlan_config->nd_config) {
>>  #endif
>> mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
>> mwifiex_stop_bg_scan(priv);
>> --
>> 2.1.2
>>
>> --
>> 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



-- 
Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
wnhu...@google.com | Cell: +886 910-380678
--
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 RESEND] mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Wei-Ning Huang
In mwifiex_enable_hs, we need to check if
priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.
This sometimes cause kernel panic when suspend/resume.

Signed-off-by: Wei-Ning Huang 
---
 drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c 
b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
index d5c56eb..d8de432 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
 
if (priv && priv->sched_scanning) {
 #ifdef CONFIG_PM
-   if (!priv->wdev.wiphy->wowlan_config->nd_config) {
+   if (priv->wdev.wiphy->wowlan_config &&
+   !priv->wdev.wiphy->wowlan_config->nd_config) {
 #endif
mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
mwifiex_stop_bg_scan(priv);
-- 
2.1.2

--
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] CHROMIUM: mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Wei-Ning Huang
Sorry, please ignore this one. I forgot to strip the CHROMIUM: tag.

Wei-Ning

On Wed, Mar 30, 2016 at 6:08 PM, Wei-Ning Huang  wrote:
> In mwifiex_enable_hs, we need to check if
> priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.
> This sometimes cause kernel panic when suspend/resume.
>
> Signed-off-by: Wei-Ning Huang 
> ---
>  drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c 
> b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
> index d5c56eb..d8de432 100644
> --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
> +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
> @@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
>
> if (priv && priv->sched_scanning) {
>  #ifdef CONFIG_PM
> -   if (!priv->wdev.wiphy->wowlan_config->nd_config) {
> +   if (priv->wdev.wiphy->wowlan_config &&
> +   !priv->wdev.wiphy->wowlan_config->nd_config) {
>  #endif
> mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
> mwifiex_stop_bg_scan(priv);
> --
> 2.1.2
>



-- 
Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
wnhu...@google.com | Cell: +886 910-380678
--
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] CHROMIUM: mwifiex: fix NULL pointer dereference error

2016-03-30 Thread Wei-Ning Huang
In mwifiex_enable_hs, we need to check if
priv->wdev.wiphy->wowlan_config is NULL before accessing it's member.
This sometimes cause kernel panic when suspend/resume.

Signed-off-by: Wei-Ning Huang 
---
 drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c 
b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
index d5c56eb..d8de432 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
@@ -509,7 +509,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
 
if (priv && priv->sched_scanning) {
 #ifdef CONFIG_PM
-   if (!priv->wdev.wiphy->wowlan_config->nd_config) {
+   if (priv->wdev.wiphy->wowlan_config &&
+   !priv->wdev.wiphy->wowlan_config->nd_config) {
 #endif
mwifiex_dbg(adapter, CMD, "aborting bgscan!\n");
mwifiex_stop_bg_scan(priv);
-- 
2.1.2

--
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: advertise low priority scan feature

2016-03-29 Thread Wei-Ning Huang
I've resent the patch here: https://patchwork.kernel.org/patch/8637861/
Thanks!

Wei-Ning

On Tue, Mar 22, 2016 at 12:12 PM, Wei-Ning Huang  wrote:
> Hi Kalle,
>
> Thanks for the review. I accidentally removed the s-o-b line from
> akarwar in this version.
> The original patch can be found at:
> https://chromium-review.googlesource.com/#/c/246052/
> I've resent a new one.
>
> Wei-Ning
>
> On Mon, Mar 21, 2016 at 6:28 PM, Kalle Valo  wrote:
>> Wei-Ning Huang  writes:
>>
>>> From: Amitkumar Karwar 
>>>
>>> Low priority scan handling code which delays or aborts scan
>>> operation based on Tx traffic is removed recently. The reason
>>> is firmware already takes care of it in our new feature scan
>>> channel gap. Hence we should advertise low priority scan
>>> support to cfg80211.
>>>
>>> This patch fixes a problem in which OBSS scan request from
>>> wpa_supplicant was being rejected by cfg80211.
>>>
>>> Signed-off-by: Wei-Ning Huang 
>>
>> The From line states that this is written by Amitkumar but there's no
>> Signed-off-By line from him. I can't take this without that, please
>> resend.
>>
>> (Wei-Ning's s-o-b line is correct, I just need also Amitkumar's line.)
>>
>> --
>> Kalle Valo
>
>
>
> --
> Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
> wnhu...@google.com | Cell: +886 910-380678



-- 
Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
wnhu...@google.com | Cell: +886 910-380678
--
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: add __GFP_REPEAT to skb allocation call

2016-03-29 Thread Wei-Ning Huang
Adding some chromium devs to the thread.

In, http://lxr.free-electrons.com/source/mm/page_alloc.c#L3152

The default mm retry allocation when 'order <=
PAGE_ALLOC_COSTLY_ORDER' of gfp_mask contains __GFP_REPEAT.
PAGE_ALLOC_COSTLY_ORDER is defined to be 3. On systems with page size
= 4K, this means memory compaction and retry is only done when the
size of allocation is <= 32K
In mwifiex, the allocation size is 64K. When we have system with
memory fragmentation and allocation failed, there will be no retry.
This is why we need to add __GFP_REPEAT here to allow the system to
perform memory compaction and retry allocation.

Maybe Amit@marvell can comment on if this is a good fix on this issue.
I'm also aware that marvell is the progress of implementing
scatter/gatter for mwifiex, which can also fix the issue.

Wei-Ning

On Tue, Mar 29, 2016 at 4:37 PM, Kalle Valo  wrote:
> Wei-Ning Huang  writes:
>
>> "single skb allocation failure" happens when system is under heavy
>> memory pressure.  Add __GFP_REPEAT to skb allocation call so kernel
>> attempts to reclaim pages and retry the allocation.
>>
>> Signed-off-by: Wei-Ning Huang 
>
> Is this really a proper way to fix the issue? This is the first time I'm
> hearing about the flag and there isn't even a single user in
> drivers/net. I would like to get confirmation from others that
> __GFP_REPEAT is really ok to use in a wireless driver before I can take
> this.
>
> --
> Kalle Valo



-- 
Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
wnhu...@google.com | Cell: +886 910-380678
--
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] mwifiex: add __GFP_REPEAT to skb allocation call

2016-03-28 Thread Wei-Ning Huang
"single skb allocation failure" happens when system is under heavy
memory pressure.  Add __GFP_REPEAT to skb allocation call so kernel
attempts to reclaim pages and retry the allocation.

Signed-off-by: Wei-Ning Huang 
---
 drivers/net/wireless/marvell/mwifiex/sdio.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
b/drivers/net/wireless/marvell/mwifiex/sdio.c
index b2c839a..c64989c 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -1124,7 +1124,8 @@ static void mwifiex_deaggr_sdio_pkt(struct 
mwifiex_adapter *adapter,
break;
}
skb_deaggr = mwifiex_alloc_dma_align_buf(pkt_len,
-GFP_KERNEL | GFP_DMA);
+GFP_KERNEL | GFP_DMA |
+__GFP_REPEAT);
if (!skb_deaggr)
break;
skb_put(skb_deaggr, pkt_len);
@@ -1374,7 +1375,8 @@ static int mwifiex_sdio_card_to_host_mp_aggr(struct 
mwifiex_adapter *adapter,
/* copy pkt to deaggr buf */
skb_deaggr = mwifiex_alloc_dma_align_buf(len_arr[pind],
 GFP_KERNEL |
-GFP_DMA);
+GFP_DMA |
+__GFP_REPEAT);
if (!skb_deaggr) {
mwifiex_dbg(adapter, ERROR, "skb allocation 
failure\t"
"drop pkt len=%d type=%d\n",
@@ -1416,7 +1418,8 @@ rx_curr_single:
mwifiex_dbg(adapter, INFO, "info: RX: port: %d, rx_len: %d\n",
port, rx_len);
 
-   skb = mwifiex_alloc_dma_align_buf(rx_len, GFP_KERNEL | GFP_DMA);
+   skb = mwifiex_alloc_dma_align_buf(rx_len, GFP_KERNEL | GFP_DMA |
+ __GFP_REPEAT);
if (!skb) {
mwifiex_dbg(adapter, ERROR,
"single skb allocated fail,\t"
@@ -1521,7 +1524,8 @@ static int mwifiex_process_int_status(struct 
mwifiex_adapter *adapter)
rx_len = (u16) (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE);
mwifiex_dbg(adapter, INFO, "info: rx_len = %d\n", rx_len);
 
-   skb = mwifiex_alloc_dma_align_buf(rx_len, GFP_KERNEL | GFP_DMA);
+   skb = mwifiex_alloc_dma_align_buf(rx_len, GFP_KERNEL | GFP_DMA |
+ __GFP_REPEAT);
if (!skb)
return -1;
 
-- 
2.8.0.rc3.226.g39d4020

--
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 v2] mwifiex: advertise low priority scan feature

2016-03-21 Thread Wei-Ning Huang
Tested-by: Wei-Ning Huang 

On Tue, Mar 22, 2016 at 12:09 PM, Wei-Ning Huang  wrote:
> From: Amitkumar Karwar 
>
> Low priority scan handling code which delays or aborts scan
> operation based on Tx traffic is removed recently. The reason
> is firmware already takes care of it in our new feature scan
> channel gap. Hence we should advertise low priority scan
> support to cfg80211.
>
> This patch fixes a problem in which OBSS scan request from
> wpa_supplicant was being rejected by cfg80211.
>
> Signed-off-by: Amitkumar Karwar 
> Signed-off-by: Wei-Ning Huang 
> ---
>  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
> b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> index bb7235e..7dafc5b 100644
> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> @@ -4086,6 +4086,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter 
> *adapter)
>
> wiphy->features |= NL80211_FEATURE_HT_IBSS |
>NL80211_FEATURE_INACTIVITY_TIMER |
> +  NL80211_FEATURE_LOW_PRIORITY_SCAN |
>NL80211_FEATURE_NEED_OBSS_SCAN;
>
>     if (ISSUPP_TDLS_ENABLED(adapter->fw_cap_info))
> --
> 2.8.0.rc3.226.g39d4020
>



-- 
Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
wnhu...@google.com | Cell: +886 910-380678
--
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: advertise low priority scan feature

2016-03-21 Thread Wei-Ning Huang
Hi Kalle,

Thanks for the review. I accidentally removed the s-o-b line from
akarwar in this version.
The original patch can be found at:
https://chromium-review.googlesource.com/#/c/246052/
I've resent a new one.

Wei-Ning

On Mon, Mar 21, 2016 at 6:28 PM, Kalle Valo  wrote:
> Wei-Ning Huang  writes:
>
>> From: Amitkumar Karwar 
>>
>> Low priority scan handling code which delays or aborts scan
>> operation based on Tx traffic is removed recently. The reason
>> is firmware already takes care of it in our new feature scan
>> channel gap. Hence we should advertise low priority scan
>> support to cfg80211.
>>
>> This patch fixes a problem in which OBSS scan request from
>> wpa_supplicant was being rejected by cfg80211.
>>
>> Signed-off-by: Wei-Ning Huang 
>
> The From line states that this is written by Amitkumar but there's no
> Signed-off-By line from him. I can't take this without that, please
> resend.
>
> (Wei-Ning's s-o-b line is correct, I just need also Amitkumar's line.)
>
> --
> Kalle Valo



-- 
Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
wnhu...@google.com | Cell: +886 910-380678
--
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 v2] mwifiex: advertise low priority scan feature

2016-03-21 Thread Wei-Ning Huang
From: Amitkumar Karwar 

Low priority scan handling code which delays or aborts scan
operation based on Tx traffic is removed recently. The reason
is firmware already takes care of it in our new feature scan
channel gap. Hence we should advertise low priority scan
support to cfg80211.

This patch fixes a problem in which OBSS scan request from
wpa_supplicant was being rejected by cfg80211.

Signed-off-by: Amitkumar Karwar 
Signed-off-by: Wei-Ning Huang 
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index bb7235e..7dafc5b 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -4086,6 +4086,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter 
*adapter)
 
wiphy->features |= NL80211_FEATURE_HT_IBSS |
   NL80211_FEATURE_INACTIVITY_TIMER |
+  NL80211_FEATURE_LOW_PRIORITY_SCAN |
   NL80211_FEATURE_NEED_OBSS_SCAN;
 
if (ISSUPP_TDLS_ENABLED(adapter->fw_cap_info))
-- 
2.8.0.rc3.226.g39d4020

--
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: advertise low priority scan feature

2016-03-21 Thread Wei-Ning Huang
Tested-by: Wei-Ning Huang 

On Mon, Mar 21, 2016 at 4:07 PM, Wei-Ning Huang  wrote:
> From: Amitkumar Karwar 
>
> Low priority scan handling code which delays or aborts scan
> operation based on Tx traffic is removed recently. The reason
> is firmware already takes care of it in our new feature scan
> channel gap. Hence we should advertise low priority scan
> support to cfg80211.
>
> This patch fixes a problem in which OBSS scan request from
> wpa_supplicant was being rejected by cfg80211.
>
> Signed-off-by: Wei-Ning Huang 
> ---
>  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
> b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> index bb7235e..7dafc5b 100644
> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> @@ -4086,6 +4086,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter 
> *adapter)
>
> wiphy->features |= NL80211_FEATURE_HT_IBSS |
>NL80211_FEATURE_INACTIVITY_TIMER |
> +  NL80211_FEATURE_LOW_PRIORITY_SCAN |
>NL80211_FEATURE_NEED_OBSS_SCAN;
>
>         if (ISSUPP_TDLS_ENABLED(adapter->fw_cap_info))
> --
> 2.8.0.rc3.226.g39d4020
>



-- 
Wei-Ning Huang, 黃偉寧 | Software Engineer, Google Inc., Taiwan |
wnhu...@google.com | Cell: +886 910-380678
--
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] mwifiex: advertise low priority scan feature

2016-03-21 Thread Wei-Ning Huang
From: Amitkumar Karwar 

Low priority scan handling code which delays or aborts scan
operation based on Tx traffic is removed recently. The reason
is firmware already takes care of it in our new feature scan
channel gap. Hence we should advertise low priority scan
support to cfg80211.

This patch fixes a problem in which OBSS scan request from
wpa_supplicant was being rejected by cfg80211.

Signed-off-by: Wei-Ning Huang 
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c 
b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index bb7235e..7dafc5b 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -4086,6 +4086,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter 
*adapter)
 
wiphy->features |= NL80211_FEATURE_HT_IBSS |
   NL80211_FEATURE_INACTIVITY_TIMER |
+  NL80211_FEATURE_LOW_PRIORITY_SCAN |
   NL80211_FEATURE_NEED_OBSS_SCAN;
 
if (ISSUPP_TDLS_ENABLED(adapter->fw_cap_info))
-- 
2.8.0.rc3.226.g39d4020

--
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 v5 2/4] mwifiex: add platform specific wakeup interrupt support

2016-03-18 Thread Wei-Ning Huang
Reviewed-by: Wei-Ning Huang 
Tested-by: Wei-Ning Huang 

On Fri, Mar 18, 2016 at 7:03 PM, Amitkumar Karwar  wrote:
> From: Xinming Hu 
>
> On some arm-based platforms, we need to configure platform specific
> parameters by device tree node and also define our node as a child
> node of parent SDIO host controller.
> This patch parses these parameters from device tree. It includes
> calibration data dowoload to firmware, wakeup pin configured to firmware,
> and soc specific wake up gpio, which will be set as wakeup interrupt pin.
>
> Signed-off-by: Xinming Hu 
> Signed-off-by: Amitkumar Karwar 
> ---
>  drivers/net/wireless/marvell/mwifiex/main.h| 11 
>  drivers/net/wireless/marvell/mwifiex/sdio.c| 77 
> ++
>  drivers/net/wireless/marvell/mwifiex/sdio.h|  7 +++
>  drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 14 -
>  4 files changed, 106 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/main.h 
> b/drivers/net/wireless/marvell/mwifiex/main.h
> index eb2c90c..9da27cf 100644
> --- a/drivers/net/wireless/marvell/mwifiex/main.h
> +++ b/drivers/net/wireless/marvell/mwifiex/main.h
> @@ -37,6 +37,17 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
>
>  #include "decl.h"
>  #include "ioctl.h"
> diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
> b/drivers/net/wireless/marvell/mwifiex/sdio.c
> index 901c064..c55e69b 100644
> --- a/drivers/net/wireless/marvell/mwifiex/sdio.c
> +++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
> @@ -73,6 +73,66 @@ static struct memory_type_mapping mem_type_mapping_tbl[] = 
> {
> {"EXTLAST", NULL, 0, 0xFE},
>  };
>
> +static const struct of_device_id mwifiex_sdio_of_match_table[] = {
> +   { .compatible = "marvell,sd8897" },
> +   { .compatible = "marvell,sd8997" },
> +   { }
> +};
> +
> +static irqreturn_t mwifiex_wake_irq_wifi(int irq, void *priv)
> +{
> +   struct mwifiex_plt_wake_cfg *cfg = priv;
> +
> +   if (cfg->irq_wifi >= 0) {
> +   pr_info("%s: wake by wifi", __func__);
> +   cfg->wake_by_wifi = true;
> +   disable_irq_nosync(irq);
> +   }
> +
> +   return IRQ_HANDLED;
> +}
> +
> +/* This function parse device tree node using mmc subnode devicetree API.
> + * The device node is saved in card->plt_of_node.
> + * if the device tree node exist and include interrupts attributes, this
> + * function will also request platform specific wakeup interrupt.
> + */
> +static int mwifiex_sdio_probe_of(struct device *dev, struct sdio_mmc_card 
> *card)
> +{
> +   struct mwifiex_plt_wake_cfg *cfg;
> +   int ret;
> +
> +   if (!dev->of_node ||
> +   !of_match_node(mwifiex_sdio_of_match_table, dev->of_node)) {
> +   pr_err("sdio platform data not available");
> +   return -1;
> +   }
> +
> +   card->plt_of_node = dev->of_node;
> +   card->plt_wake_cfg = devm_kzalloc(dev, sizeof(*card->plt_wake_cfg),
> + GFP_KERNEL);
> +   cfg = card->plt_wake_cfg;
> +   if (cfg && card->plt_of_node) {
> +   cfg->irq_wifi = irq_of_parse_and_map(card->plt_of_node, 0);
> +   if (!cfg->irq_wifi) {
> +   dev_err(dev, "fail to parse irq_wifi from device 
> tree");
> +   } else {
> +   ret = devm_request_irq(dev, cfg->irq_wifi,
> +  mwifiex_wake_irq_wifi,
> +  IRQF_TRIGGER_LOW,
> +  "wifi_wake", cfg);
> +   if (ret) {
> +   dev_err(dev,
> +   "Failed to request irq_wifi %d 
> (%d)\n",
> +   cfg->irq_wifi, ret);
> +   }
> +   disable_irq(cfg->irq_wifi);
> +   }
> +   }
> +
> +   return 0;
> +}
> +
>  /*
>   * SDIO probe.
>   *
> @@ -127,6 +187,9 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct 
> sdio_device_id *id)
> return -EIO;
> }
>
> +   /* device tree node parsing and platform specific configuration*/
> +   mwifiex_sdio_probe_of(&func->dev, card);
> +
>