Re: [PATCH 3/4] net/rfkill: Create "airplane mode" LED trigger

2015-12-18 Thread David Miller
From: Darren Hart 
Date: Fri, 18 Dec 2015 16:22:12 -0800

> On Tue, Dec 15, 2015 at 10:30:41AM -0500, João Paulo Rechi Vita wrote:
>> For platform drivers to be able to correctly drive the "Airplane Mode"
>> indicative LED there needs to be a RFKill LED trigger tied to the global
>> state of RFKILL_TYPE_ALL (instead of to a specific RFKill) and that
>> works in an inverted manner of regular RFKill LED triggers, that is, the
>> LED is ON when the state is blocked, and OFF otherwise.
>> 
>> This commit implements such a trigger, which will be used by the
>> asus-wrc x86 platform driver.
> 
> So this will need to go through Johannes and David per get_maintainer.pl 
> before
> we can use it in platform drivers.
> 
> +Johannes
> +David
> +wireless
> +netdev

RFKILL changes go via the wireless tree.
--
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 1/1] staging: Fix bitshifts by wrong offsets in wilc1000/host_interface.c

2015-12-18 Thread Mario J. Rugiero

El 18/12/15 a las 19:50, Greg KH escribió:

On Tue, Dec 01, 2015 at 11:49:55PM -0300, Mario J. Rugiero wrote:

struct set_multicast uses (implicitly) sizeof(bool) to determine how many bytes 
to copy in
Handle_SetMulticastFilter. Since that is implementation defined, it triggered 
sparse to
rightfully complain about shifting a bigger value than supported.
Since it was used as if assuming it was 32 bits, I replaced the bool member by 
a u32.
Also, time_out and buf_size members of ba_session_info are u16, but while 
copying their
bytes into ptr in Handle_AddBASession shift 16 bits for the second byte instead 
of 8 bits.
This patch fixes those two issues.

Signed-off-by: Mario J. Rugiero 
---
  drivers/staging/wilc1000/host_interface.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)


How did you test this is correct?

Doesn't apply to my tree :(

thanks,

greg k-h



Because I lack the hardware, I only tested it built with allmodconfig 
and tried to be very careful about my reasoning. I know I *should* be 
testing it, and am sorry about it.
Should I try and update the patch? Maybe it conflicts with a different 
one. I made the changes on top of staging-testing.
In retrospect, I believe the issues should be handled in different 
patches anyway, so I would like to do a second version anyway.


Regards,
Mario.
--
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 01/12] staging: wilc1000: pass vif to hostIFthread

2015-12-18 Thread Greg KH
On Mon, Dec 14, 2015 at 02:46:52PM +0900, Glen Lee wrote:
> We will pass vif, which is currently being used as net_device, instead of
> hif_dev. This is the first step to use index of vif to pass to the driver.
> Add new argument vif to all the functions that send message to hostIFthread 
> and
> set vif to msg.vif. As a result, hostIfthread will get vif.
> In later patch, we will remove drv of host_if_msg and use vif instead of it.
> 
> Signed-off-by: Glen Lee 

Series did not apply :(

Please rebase all of your pending patches against my staging-testing
branch now and resend what I did not apply.

thanks,

greg k-h
--
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 1/1] staging: Fix bitshifts by wrong offsets in wilc1000/host_interface.c

2015-12-18 Thread Greg KH
On Tue, Dec 01, 2015 at 11:49:55PM -0300, Mario J. Rugiero wrote:
> struct set_multicast uses (implicitly) sizeof(bool) to determine how many 
> bytes to copy in
> Handle_SetMulticastFilter. Since that is implementation defined, it triggered 
> sparse to
> rightfully complain about shifting a bigger value than supported.
> Since it was used as if assuming it was 32 bits, I replaced the bool member 
> by a u32.
> Also, time_out and buf_size members of ba_session_info are u16, but while 
> copying their
> bytes into ptr in Handle_AddBASession shift 16 bits for the second byte 
> instead of 8 bits.
> This patch fixes those two issues.
> 
> Signed-off-by: Mario J. Rugiero 
> ---
>  drivers/staging/wilc1000/host_interface.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

How did you test this is correct?

Doesn't apply to my tree :(

thanks,

greg k-h
--
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/4] staging: wilc1000: Fix typo in linux_wlan.c

2015-12-18 Thread Greg KH
On Mon, Nov 23, 2015 at 10:41:19PM +0900, Masanari Iida wrote:
> This patch fix some spelling typo in wilc1000.c.
> 
> Signed-off-by: Masanari Iida 
> Acked-by: Randy Dunlap 
> ---
>  drivers/staging/wilc1000/linux_wlan.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)

Please rebase this against my staging-testing branch and resend.

thanks,

greg k-h
--
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] staging: wilc1000: remove new line around else and braces

2015-12-18 Thread Greg KH
On Sun, Nov 08, 2015 at 09:18:48PM +0200, Panayiotis Tembriotis wrote:
> Remove excess new line characters as suggested by checkpatch.pl:
> ERROR: else should follow close brace '}'
> ERROR: that open brace { should be on the previous line
> 
> Signed-off-by: Panayiotis Tembriotis 
> ---
>  drivers/staging/wilc1000/wilc_wlan.c | 10 +++---
>  1 file changed, 3 insertions(+), 7 deletions(-)

Does not apply against my latest tree :(
--
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] staging: wilc1000: fix double mutex_unlock on failure path in wilc_wlan_cleanup()

2015-12-18 Thread Greg Kroah-Hartman
On Sat, Dec 05, 2015 at 01:04:34AM +0300, Alexey Khoroshilov wrote:
> If hif_read_reg() or hif_write_reg() fail in wilc_wlan_cleanup(),
> it calls release_bus() and continues execution. But it leads to double
> release_bus() call that means double unlock of g_linux_wlan->hif_cs mutex.
> 
> The patch adds return in case of failure.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov 
> ---
>  drivers/staging/wilc1000/wilc_wlan.c | 2 ++
>  1 file changed, 2 insertions(+)

No longer applies to my tree, can you rebase it against staging-testing
and resend?

thanks,

greg k-h
--
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 2/5] staging: wilc1000: remove unneeded function

2015-12-18 Thread Greg KH
On Thu, Nov 26, 2015 at 02:04:00PM +0900, Glen Lee wrote:
> wilc_spi_init in linux_wlan_spi.c is unneeded. It just return true. Rename
> _wilc_spi_init in wlan_spi.c to wilc_spi_init.
> 
> Signed-off-by: Glen Lee 

Series did not apply :(
--
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 1/3] staging: wilc1000: move perInterface_wlan_t to wilc_vif

2015-12-18 Thread Greg KH
On Fri, Nov 27, 2015 at 03:50:31PM +0900, Glen Lee wrote:
> perInterface_wlan_t and wilc_vif are all about interface control informations.
> We will combine those two structures and maintain as one network interface
> control information.
> Move all the members of perInterface_wlan_t to wilc_vif and remove the
> structure. Rename perInterace_wlan_t to wilc_vif and rename variable name nic
> to vif which is proper name for it.
> 
> Signed-off-by: Glen Lee 

Series did not apply :(
--
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 1/4] staging: wilc1000: linux_wlan_spi.c: return linux error value

2015-12-18 Thread Greg KH
On Wed, Nov 25, 2015 at 06:35:26PM +0900, Glen Lee wrote:
> return linux error value instead of 0 or 1 and use -EINVAL. Related codes
> also changed together.
> 
> Signed-off-by: Glen Lee 
> ---
>  drivers/staging/wilc1000/linux_wlan_spi.c | 14 +++---
>  drivers/staging/wilc1000/wilc_spi.c   | 18 +-
>  2 files changed, 12 insertions(+), 20 deletions(-)

Series did not apply :(
--
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 01/10] staging: wilc1000: sdio/spi: use device print api instead of custom one

2015-12-18 Thread Greg KH
On Mon, Nov 23, 2015 at 06:47:59PM +0900, Glen Lee wrote:
> This patch use device print api instead of driver defined print. Remove
> varialbe dPrint as well. String "[wilc sdio]" and "[wilc spi]" are also 
> removed
> from all the print statment if exist because it shows which device the message
> is related to.
> 
> Signed-off-by: Glen Lee 

This series didn't apply :(
--
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/6] staging: wilc1000: wilc_wlan.c: remove hif_func of wilc_wlan_dev_t

2015-12-18 Thread Greg KH
On Fri, Nov 20, 2015 at 04:56:33PM +0900, Glen Lee wrote:
> hif_func of wilc_wlan_dev_t is duplicate because we have same struct
> wilc_hif_func ops of struct wilc which is available in wilc_wlan.c.
> Rename ops of struct wilc with hif_func and remove hif_func of 
> wilc_wlan_dev_t,
> and use wilc->hif_func instead of g_wlan.hif_func in all functions.
> 
> Signed-off-by: Glen Lee 
> ---
>  drivers/staging/wilc1000/linux_wlan.c |  18 +--
>  drivers/staging/wilc1000/wilc_wfi_netdevice.h |   2 +-
>  drivers/staging/wilc1000/wilc_wlan.c  | 161 
> --
>  3 files changed, 87 insertions(+), 94 deletions(-)

This patch didn't apply, so I stopped here in the series, please fix up
and resend.

thanks,

greg k-h
--
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] staging: wilc1000: fix bug in sdio/spi

2015-12-18 Thread Greg KH
On Thu, Nov 12, 2015 at 11:35:26AM +0900, Glen Lee wrote:
> sdio_init and wilc_spi_init always return error, so it fails everytime.
> Fix this by removing else statement.
> 
> This fixes c1af9db78950a778ec18343c5c5a6d4cfbf58a61,
> bacd388547f55eb415ce266c8723cc6f1281a25d

Please fix up how these git commit ids are referenced here and resend.

thanks,

greg k-h
--
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 1/4] staging: wilc1000: remove define COMPLEMENT_BOOT

2015-12-18 Thread Greg KH
On Thu, Nov 19, 2015 at 11:05:58AM +0900, Glen Lee wrote:
> This patch removes define COMPLEMENT_BOOT in Makefile. The feature was removed
> by the following commit but the define was not removed. So remove completely.
> 
> b46d68825c2d3af70ad18b53dfed6516e393b7fa

Please fix this up and resend the whole series.

thanks,

greg k-h
--
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/4] net/rfkill: Create "airplane mode" LED trigger

2015-12-18 Thread João Paulo Rechi Vita
On 18 December 2015 at 19:22, Darren Hart  wrote:
> On Tue, Dec 15, 2015 at 10:30:41AM -0500, João Paulo Rechi Vita wrote:
>> For platform drivers to be able to correctly drive the "Airplane Mode"
>> indicative LED there needs to be a RFKill LED trigger tied to the global
>> state of RFKILL_TYPE_ALL (instead of to a specific RFKill) and that
>> works in an inverted manner of regular RFKill LED triggers, that is, the
>> LED is ON when the state is blocked, and OFF otherwise.
>>
>> This commit implements such a trigger, which will be used by the
>> asus-wrc x86 platform driver.
>
> So this will need to go through Johannes and David per get_maintainer.pl 
> before
> we can use it in platform drivers.
>

Yes, I am aware of that. I just wanted to get feedback and validate
the new platform driver that makes use of this new RFKill LED trigger
before proposing it, since I expect that will be their first
questioning.

For those who were not in the original message, this is patch is part
of a series implementing a new platform driver for the airplane mode
hotkey and LED present in some Asus laptops, which is a separate ACPI
device (not part of WMI) with ACPI _HID "ASHS" and named "Wireless
Radio Control" by Asus.

Thanks for your feedback!

--
João Paulo Rechi Vita
http://about.me/jprvita
--
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/4] net/rfkill: Create "airplane mode" LED trigger

2015-12-18 Thread Darren Hart
On Tue, Dec 15, 2015 at 10:30:41AM -0500, João Paulo Rechi Vita wrote:
> For platform drivers to be able to correctly drive the "Airplane Mode"
> indicative LED there needs to be a RFKill LED trigger tied to the global
> state of RFKILL_TYPE_ALL (instead of to a specific RFKill) and that
> works in an inverted manner of regular RFKill LED triggers, that is, the
> LED is ON when the state is blocked, and OFF otherwise.
> 
> This commit implements such a trigger, which will be used by the
> asus-wrc x86 platform driver.

So this will need to go through Johannes and David per get_maintainer.pl before
we can use it in platform drivers.

+Johannes
+David
+wireless
+netdev

-- 
Darren Hart
Intel Open Source Technology Center

> 
> Signed-off-by: João Paulo Rechi Vita 
> ---
>  net/rfkill/core.c | 30 ++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/net/rfkill/core.c b/net/rfkill/core.c
> index b41e9ea..3effc29 100644
> --- a/net/rfkill/core.c
> +++ b/net/rfkill/core.c
> @@ -124,6 +124,26 @@ static bool rfkill_epo_lock_active;
>  
>  
>  #ifdef CONFIG_RFKILL_LEDS
> +static void airplane_mode_led_trigger_activate(struct led_classdev *led);
> +
> +static struct led_trigger airplane_mode_led_trigger = {
> + .name = "rfkill-airplane-mode",
> + .activate = airplane_mode_led_trigger_activate,
> +};
> +
> +static void airplane_mode_led_trigger_event(void)
> +{
> + if (rfkill_global_states[RFKILL_TYPE_ALL].cur & RFKILL_BLOCK_ANY)
> + led_trigger_event(&airplane_mode_led_trigger, LED_FULL);
> + else
> + led_trigger_event(&airplane_mode_led_trigger, LED_OFF);
> +}
> +
> +static void airplane_mode_led_trigger_activate(struct led_classdev *led)
> +{
> + airplane_mode_led_trigger_event();
> +}
> +
>  static void rfkill_led_trigger_event(struct rfkill *rfkill)
>  {
>   struct led_trigger *trigger;
> @@ -175,6 +195,10 @@ static void rfkill_led_trigger_unregister(struct rfkill 
> *rfkill)
>   led_trigger_unregister(&rfkill->led_trigger);
>  }
>  #else
> +static void airplane_mode_led_trigger_event(void)
> +{
> +}
> +
>  static void rfkill_led_trigger_event(struct rfkill *rfkill)
>  {
>  }
> @@ -346,6 +370,7 @@ static void __rfkill_switch_all(const enum rfkill_type 
> type, bool blocked)
>  
>   for (i = 0; i < NUM_RFKILL_TYPES; i++)
>   rfkill_global_states[i].cur = blocked;
> + airplane_mode_led_trigger_event();
>   } else {
>   rfkill_global_states[type].cur = blocked;
>   }
> @@ -1177,6 +1202,7 @@ static ssize_t rfkill_fop_write(struct file *file, 
> const char __user *buf,
>   enum rfkill_type i;
>   for (i = 0; i < NUM_RFKILL_TYPES; i++)
>   rfkill_global_states[i].cur = ev.soft;
> + airplane_mode_led_trigger_event();
>   } else {
>   rfkill_global_states[ev.type].cur = ev.soft;
>   }
> @@ -1293,6 +1319,10 @@ static int __init rfkill_init(void)
>   }
>  #endif
>  
> +#ifdef CONFIG_RFKILL_LEDS
> + led_trigger_register(&airplane_mode_led_trigger);
> +#endif
> +
>   out:
>   return error;
>  }
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe 
> platform-driver-x86" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
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] ath10k: Set SM power save disabled to default value

2015-12-18 Thread Peter Oh
Use SMPS disabled as default because FW does not indicate
any support of SMPS.

This change will help STAs out that don’t support SMPS from
sticking on 1SS, since they don’t have method to change it
back to multiple chains.

This change also should not affect power consumption of STAs
supporting SMPS, because they are capable to switch the mode
to dynamic or static either at the end of frame sequence or
by using SMPS action frame.

Signed-off-by: Peter Oh 
---
 drivers/net/wireless/ath/ath10k/mac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index b4bdeb0..6146a29 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3860,7 +3860,8 @@ static struct ieee80211_sta_ht_cap 
ath10k_get_ht_cap(struct ath10k *ar)
ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_8;
ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40;
-   ht_cap.cap |= WLAN_HT_CAP_SM_PS_STATIC << IEEE80211_HT_CAP_SM_PS_SHIFT;
+   ht_cap.cap |=
+   WLAN_HT_CAP_SM_PS_DISABLED << IEEE80211_HT_CAP_SM_PS_SHIFT;
 
if (ar->ht_cap_info & WMI_HT_CAP_HT20_SGI)
ht_cap.cap |= IEEE80211_HT_CAP_SGI_20;
-- 
1.9.1

--
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] mtd: nand: bcm47xx: use the mtd instance embedded in struct nand_chip

2015-12-18 Thread Brian Norris
On Fri, Dec 18, 2015 at 09:50:00PM +0100, Boris Brezillon wrote:
> On Fri, 18 Dec 2015 11:38:18 -0800
> Brian Norris  wrote:
> 
> > From: Boris BREZILLON 
> > 
> > struct nand_chip now embeds an mtd device. Make use of this mtd instance.
> > 
> > Signed-off-by: Boris Brezillon 
> > Signed-off-by: Brian Norris 
> 
> Looks good to me, not we can have both a SoB and an AB tag coming from
> the same person, but
> 
> Acked-by: Boris Brezillon 

Good point. I guess the ack can just assure me I didn't screw up your
work *too* badly :)

Applied without the duplicate tag
--
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] mtd: nand: bcm47xx: use the mtd instance embedded in struct nand_chip

2015-12-18 Thread Boris Brezillon
On Fri, 18 Dec 2015 11:38:18 -0800
Brian Norris  wrote:

> From: Boris BREZILLON 
> 
> struct nand_chip now embeds an mtd device. Make use of this mtd instance.
> 
> Signed-off-by: Boris Brezillon 
> Signed-off-by: Brian Norris 

Looks good to me, not we can have both a SoB and an AB tag coming from
the same person, but

Acked-by: Boris Brezillon 

> ---
> Rebased Boris's patch to l2-mtd.git
> 
>  drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |  1 -
>  drivers/mtd/nand/bcm47xxnflash/main.c  | 10 ++
>  drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |  2 +-
>  3 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h 
> b/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
> index c005a62330b1..8ea75710a854 100644
> --- a/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
> +++ b/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
> @@ -12,7 +12,6 @@ struct bcm47xxnflash {
>   struct bcma_drv_cc *cc;
>  
>   struct nand_chip nand_chip;
> - struct mtd_info mtd;
>  
>   unsigned curr_command;
>   int curr_page_addr;
> diff --git a/drivers/mtd/nand/bcm47xxnflash/main.c 
> b/drivers/mtd/nand/bcm47xxnflash/main.c
> index 0b3acc439181..2c9bffb614c5 100644
> --- a/drivers/mtd/nand/bcm47xxnflash/main.c
> +++ b/drivers/mtd/nand/bcm47xxnflash/main.c
> @@ -27,6 +27,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
>  {
>   struct bcma_nflash *nflash = dev_get_platdata(&pdev->dev);
>   struct bcm47xxnflash *b47n;
> + struct mtd_info *mtd;
>   int err = 0;
>  
>   b47n = devm_kzalloc(&pdev->dev, sizeof(*b47n), GFP_KERNEL);
> @@ -34,8 +35,9 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
>   return -ENOMEM;
>  
>   b47n->nand_chip.priv = b47n;
> - b47n->mtd.dev.parent = &pdev->dev;
> - b47n->mtd.priv = &b47n->nand_chip; /* Required */
> + mtd = nand_to_mtd(&b47n->nand_chip);
> + mtd->dev.parent = &pdev->dev;
> + mtd->priv = &b47n->nand_chip; /* Required */
>   b47n->cc = container_of(nflash, struct bcma_drv_cc, nflash);
>  
>   if (b47n->cc->core->bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) {
> @@ -51,7 +53,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
>  
>   platform_set_drvdata(pdev, b47n);
>  
> - err = mtd_device_parse_register(&b47n->mtd, probes, NULL, NULL, 0);
> + err = mtd_device_parse_register(mtd, probes, NULL, NULL, 0);
>   if (err) {
>   pr_err("Failed to register MTD device: %d\n", err);
>   return err;
> @@ -64,7 +66,7 @@ static int bcm47xxnflash_remove(struct platform_device 
> *pdev)
>  {
>   struct bcm47xxnflash *nflash = platform_get_drvdata(pdev);
>  
> - nand_release(&nflash->mtd);
> + nand_release(nand_to_mtd(&nflash->nand_chip));
>  
>   return 0;
>  }
> diff --git a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c 
> b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
> index e5b2e48658c4..652478035a7d 100644
> --- a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
> +++ b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
> @@ -421,7 +421,7 @@ int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash 
> *b47n)
>   (w4 << 24 | w3 << 18 | w2 << 12 | w1 << 6 | w0));
>  
>   /* Scan NAND */
> - err = nand_scan(&b47n->mtd, 1);
> + err = nand_scan(nand_to_mtd(&b47n->nand_chip), 1);
>   if (err) {
>   pr_err("Could not scan NAND flash: %d\n", err);
>   goto exit;



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
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 v5] mtd: nand: bcm47xx: use the mtd instance embedded in struct nand_chip

2015-12-18 Thread Brian Norris
From: Boris BREZILLON 

struct nand_chip now embeds an mtd device. Make use of this mtd instance.

Signed-off-by: Boris Brezillon 
Signed-off-by: Brian Norris 
---
Rebased Boris's patch to l2-mtd.git

 drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h |  1 -
 drivers/mtd/nand/bcm47xxnflash/main.c  | 10 ++
 drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c   |  2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h 
b/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
index c005a62330b1..8ea75710a854 100644
--- a/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
+++ b/drivers/mtd/nand/bcm47xxnflash/bcm47xxnflash.h
@@ -12,7 +12,6 @@ struct bcm47xxnflash {
struct bcma_drv_cc *cc;
 
struct nand_chip nand_chip;
-   struct mtd_info mtd;
 
unsigned curr_command;
int curr_page_addr;
diff --git a/drivers/mtd/nand/bcm47xxnflash/main.c 
b/drivers/mtd/nand/bcm47xxnflash/main.c
index 0b3acc439181..2c9bffb614c5 100644
--- a/drivers/mtd/nand/bcm47xxnflash/main.c
+++ b/drivers/mtd/nand/bcm47xxnflash/main.c
@@ -27,6 +27,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
 {
struct bcma_nflash *nflash = dev_get_platdata(&pdev->dev);
struct bcm47xxnflash *b47n;
+   struct mtd_info *mtd;
int err = 0;
 
b47n = devm_kzalloc(&pdev->dev, sizeof(*b47n), GFP_KERNEL);
@@ -34,8 +35,9 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
return -ENOMEM;
 
b47n->nand_chip.priv = b47n;
-   b47n->mtd.dev.parent = &pdev->dev;
-   b47n->mtd.priv = &b47n->nand_chip; /* Required */
+   mtd = nand_to_mtd(&b47n->nand_chip);
+   mtd->dev.parent = &pdev->dev;
+   mtd->priv = &b47n->nand_chip; /* Required */
b47n->cc = container_of(nflash, struct bcma_drv_cc, nflash);
 
if (b47n->cc->core->bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) {
@@ -51,7 +53,7 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, b47n);
 
-   err = mtd_device_parse_register(&b47n->mtd, probes, NULL, NULL, 0);
+   err = mtd_device_parse_register(mtd, probes, NULL, NULL, 0);
if (err) {
pr_err("Failed to register MTD device: %d\n", err);
return err;
@@ -64,7 +66,7 @@ static int bcm47xxnflash_remove(struct platform_device *pdev)
 {
struct bcm47xxnflash *nflash = platform_get_drvdata(pdev);
 
-   nand_release(&nflash->mtd);
+   nand_release(nand_to_mtd(&nflash->nand_chip));
 
return 0;
 }
diff --git a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c 
b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
index e5b2e48658c4..652478035a7d 100644
--- a/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
+++ b/drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
@@ -421,7 +421,7 @@ int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash 
*b47n)
(w4 << 24 | w3 << 18 | w2 << 12 | w1 << 6 | w0));
 
/* Scan NAND */
-   err = nand_scan(&b47n->mtd, 1);
+   err = nand_scan(nand_to_mtd(&b47n->nand_chip), 1);
if (err) {
pr_err("Could not scan NAND flash: %d\n", err);
goto exit;
-- 
2.6.0.rc2.230.g3dd15c0

--
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


pull-request: mac80211-next 2015-12-18

2015-12-18 Thread Johannes Berg
Hi Dave,

Before we all go on vacation/holidays, I have a few bugfixes for
net-next. The remain-on-channel ones are quite necessary since Ilan's
patch broke things quite a bit, causing crashes.

If the issue with the strange mail formatting persists let me know and
I'll send these through some other client in the future.

Enjoy the holidays and happy New Year :)

Thanks,
johannes


The following changes since commit 1b894521e60c1b91db1e8ba1278660e5c89f1b5f:

  mac80211: handle HW ROC expired properly (2015-12-07 11:06:37 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git 
tags/mac80211-next-for-davem-2015-12-18

for you to fetch changes up to c45932df56120a73b05f391be9730185eb51eecf:

  regulatory: fix world regulatory domain data (2015-12-11 17:42:06 +0100)


A few more updates for the next cycle:
 * remove pretty much unused and useless REG_DEBUG option
 * make regdomain messages debugging only
 * fix two bugs in the new remain-on-channel code
 * fix the world regdomain data for consistency


Dave Young (1):
  wireless: change cfg80211 regulatory domain info as debug messages

Johannes Berg (4):
  mac80211: recalculate SW ROC only when needed
  mac80211: fix remain-on-channel cancellation
  cfg80211: remove CFG80211_REG_DEBUG
  regulatory: fix world regulatory domain data

 net/mac80211/offchannel.c |  12 ++--
 net/wireless/Kconfig  |  13 
 net/wireless/reg.c| 167 --
 3 files changed, 64 insertions(+), 128 deletions(-)
--
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 v3] bcma: switch GPIO portions to use GPIOLIB_IRQCHIP

2015-12-18 Thread Hauke Mehrtens
On 12/18/2015 07:27 AM, Rafał Miłecki wrote:
> I'm afraid it wasn't tested on BCM47XX (MIPS) :(

Yes, you are probably right.

> On 14 August 2015 at 00:21, Hauke Mehrtens  wrote:
>> @@ -218,9 +187,8 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
>> chip->set   = bcma_gpio_set_value;
>> chip->direction_input   = bcma_gpio_direction_input;
>> chip->direction_output  = bcma_gpio_direction_output;
>> -#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X)
>> -   chip->to_irq= bcma_gpio_to_irq;
>> -#endif
>> +   chip->owner = THIS_MODULE;
>> +   chip->dev   = bcma_bus_get_host_dev(bus);
> 
> This assigns &bus->host_pdev->dev which is NULL.

hmm, how do we fix this, as long as bcma does not have a device on mips
this is a problem. Should we create a new device for mips?

>> @@ -248,13 +216,13 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
>> else
>> chip->base  = -1;
>>
>> -   err = bcma_gpio_irq_domain_init(cc);
>> +   err = gpiochip_add(chip);
>> if (err)
>> return err;
>>
>> -   err = gpiochip_add(chip);
>> +   err = bcma_gpio_irq_init(cc);
> 
> This results in:
> [0.157054] missing gpiochip .dev parent pointer
> (coming from gpiochip_irqchip_add) and
> [0.157287] bcma: bus0: Error registering GPIO driver: -22


--
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 000/182] Rid struct gpio_chip from container_of() usage

2015-12-18 Thread Linus Walleij
On Tue, Dec 15, 2015 at 8:25 AM, Dmitry Torokhov
 wrote:
> On Mon, Dec 14, 2015 at 1:18 AM, Linus Walleij  
> wrote:

>> At this point we have to cross-reference the pointer to my chip to
>> find the chip to remove. This goes for anything that takes the struct
>> gpio_chip *
>> as parameter, like gpiochip_add_pin_range(), gpiochip_request_own_desc()
>> etc etc. So something inside gpiolib must take a gpio_chip * pointer and
>> turn that into the actual state container, e.g, a struct gpio_device.
>> Since struct gpio_chip needs to be static and stateless, it cannot contain
>> a pointer back to its struct gpio_device.
>
> Why does gpio_chip have to be stateless? I am not saying that it
> should or should not, I just want to better understand what you are
> trying to achieve.

Because the allocation of gpio_chip is currently inside each driver
(often as part of their own state struct) and will go away with the
driver. I want to make that const parameter that the drivers supply
to the core gpiolib, and the gpiolib handled all states using something
like that struct gpio_device you suggested or a more elaborate
solution.

>> If I compare to how struct input_dev is done, you appear to also use the
>> pattern Russell suggested with input_dev_allocate() akin to
>> netdev_alloc(), and the allocated struct holds all the vtable and states etc,
>> and I think it is a good pattern, and that GPIO should conform.
>
> The main difference between gpio_chip (at least as it stands
> currently) and input devices and corresponding private driver data is
> that input device and driver data has different lifetimes; input
> devices may stick around even though driver is unbound from
> corresponding device and driver's private data freed.

I would like to achieve something similar for GPIO devices.

Yours,
Linus Walleij
--
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 000/182] Rid struct gpio_chip from container_of() usage

2015-12-18 Thread Linus Walleij
On Mon, Dec 14, 2015 at 1:46 PM, Johan Hovold  wrote:

> Ok, but let's take a step back. So you have all this in place and a
> consumer calls gpiod_get_value() that returns an errno because the device
> is gone. Note that this wasn't even possible before e20538b82f1f ("gpio:
> Propagate errors from chip->get()") that went into *v4.3*, and I assume
> most drivers would need to be updated to even handle that that gpio
> call, and all future calls, are now suddenly failing.

I actually have a revert of that in my fixes queue. So another step back
and two forward for v4.5 (hopefully): audit all drivers to respect this.

Yours,
Linus Walleij
--
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: refactor HT/VHT to chandef code

2015-12-18 Thread Johannes Berg
From: Johannes Berg 

The station MLME and IBSS/mesh ones use entirely different
code for interpreting HT and VHT operation elements. Change
the code that interprets them a bit - it now modifies an
existing chandef - and use it also in the MLME code.

Signed-off-by: Johannes Berg 
---
 net/mac80211/ibss.c| 10 -
 net/mac80211/ieee80211_i.h | 10 -
 net/mac80211/mesh.c|  9 
 net/mac80211/mlme.c| 41 ---
 net/mac80211/util.c| 54 +-
 5 files changed, 46 insertions(+), 78 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index f7fc0e00497f..e5e8a317b865 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1050,9 +1050,8 @@ static void ieee80211_update_sta_info(struct 
ieee80211_sub_if_data *sdata,
struct cfg80211_chan_def chandef;
enum ieee80211_sta_rx_bandwidth bw = sta->sta.bandwidth;
 
-   ieee80211_ht_oper_to_chandef(channel,
-elems->ht_operation,
-&chandef);
+   cfg80211_chandef_create(&chandef, channel, NL80211_CHAN_NO_HT);
+   ieee80211_chandef_ht_oper(elems->ht_operation, &chandef);
 
memcpy(&htcap_ie, elems->ht_cap_elem, sizeof(htcap_ie));
rates_updated |= ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
@@ -1066,9 +1065,8 @@ static void ieee80211_update_sta_info(struct 
ieee80211_sub_if_data *sdata,
struct ieee80211_vht_cap cap_ie;
struct ieee80211_sta_vht_cap cap = sta->sta.vht_cap;
 
-   ieee80211_vht_oper_to_chandef(channel,
- elems->vht_operation,
- &chandef);
+   ieee80211_chandef_vht_oper(elems->vht_operation,
+  &chandef);
memcpy(&cap_ie, elems->vht_cap_elem, sizeof(cap_ie));
ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
&cap_ie, sta);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index c30b6842ed9f..2094e07ce9ae 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1986,12 +1986,10 @@ int ieee80211_add_ext_srates_ie(struct 
ieee80211_sub_if_data *sdata,
 u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo);
 
 /* channel management */
-void ieee80211_ht_oper_to_chandef(struct ieee80211_channel *control_chan,
- const struct ieee80211_ht_operation *ht_oper,
- struct cfg80211_chan_def *chandef);
-void ieee80211_vht_oper_to_chandef(struct ieee80211_channel *control_chan,
-  const struct ieee80211_vht_operation *oper,
-  struct cfg80211_chan_def *chandef);
+bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper,
+  struct cfg80211_chan_def *chandef);
+bool ieee80211_chandef_vht_oper(const struct ieee80211_vht_operation *oper,
+   struct cfg80211_chan_def *chandef);
 u32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c);
 
 int __must_check
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index fa28500f28fd..9a8e7b57c86e 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -91,11 +91,10 @@ bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
if (sdata->vif.bss_conf.basic_rates != basic_rates)
return false;
 
-   ieee80211_ht_oper_to_chandef(sdata->vif.bss_conf.chandef.chan,
-ie->ht_operation, &sta_chan_def);
-
-   ieee80211_vht_oper_to_chandef(sdata->vif.bss_conf.chandef.chan,
- ie->vht_operation, &sta_chan_def);
+   cfg80211_chandef_create(&sta_chan_def, sdata->vif.bss_conf.chandef.chan,
+   NL80211_CHAN_NO_HT);
+   ieee80211_chandef_ht_oper(ie->ht_operation, &sta_chan_def);
+   ieee80211_chandef_vht_oper(ie->vht_operation, &sta_chan_def);
 
if (!cfg80211_chandef_compatible(&sdata->vif.bss_conf.chandef,
 &sta_chan_def))
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 123b26d177e8..ebc9b997529d 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -196,16 +196,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data 
*sdata,
 
/* check 40 MHz support, if we have it */
if (sta_ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
-   switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
-   case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
-   chandef->width = NL80211_CHAN_

Re: [PATCH v1 0/2] wil6210 patches

2015-12-18 Thread Kalle Valo
Maya Erez  writes:

> Chanes in V1:
> - Fixed patches author and sign-off.
>
> Those patches fix wil6210 issue and add support for platform specific
> recovery after FW crash

These looks better, thanks. I'll deal with these soon.

No need for any changes in this patchset but the second submitted
version is normally called "v2", not "v1". See more here:

http://kernelnewbies.org/FirstKernelPatch#head-5c81b3c517a1d0bbc24f92594cb734e155fcbbcb

-- 
Kalle Valo
--
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: pull request: iwlwifi 2015-12-16

2015-12-18 Thread Kalle Valo
"Grumbach, Emmanuel"  writes:

> This is a pull request with small fixes for 4.4.
> Note that due to the large number of files being renamed, you need to
> set merge.renameLimit to a big number to merge wl-drv into wl-drv-next
> but you probably noticed that already :)
>
> The following changes since commit 9513c5e18a0dc55a1fc9c890715098ba2315830b:
>
>   iwlwifi: mvm: Avoid dereferencing sta if it was already flushed
> (2015-11-15 21:18:01 +0200)
>
> are available in the git repository at:
>
>  
> https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-fixes.git 
> tags/iwlwifi-for-kalle-2015-12-16

Pulled, thanks.

-- 
Kalle Valo
--
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: [RFC/RFT v2] mac80211: Add NEED_ALIGNED4_SKBS hw flag

2015-12-18 Thread Janusz Dziedzic
On 18 December 2015 at 13:07, Johannes Berg  wrote:
> On Fri, 2015-12-18 at 12:57 +0100, Janusz Dziedzic wrote:
>> HW/driver should set NEED_ALIGNED4_SKBS flag in case require
>> aligned skbs to four-byte boundaries.
>>
>> Before we have to do memmove() in the driver before
>> pass this to HW and memmove() back in tx completion.
>> This patch allow to save CPU and skip such memmoves.
>> For each skb we call memmove(ieee80211_hdrsize()) twice.
>>
>> Currently this was tested with ath9k, both hw/sw crypt for
>> tkip/ccmp.
>> For sure more tests required (eg. fast path isn't used for
>> ath9k STA, wep sw crypt).
>>
>> Signed-off-by: Janusz Dziedzic 
>> ---
>>  include/net/mac80211.h |  4 
>>  net/mac80211/debugfs.c |  1 +
>>  net/mac80211/ieee80211_i.h |  1 +
>>  net/mac80211/sta_info.h|  4 ++--
>>  net/mac80211/tkip.c| 15 ---
>>  net/mac80211/tx.c  | 38 +---
>> --
>>  net/mac80211/util.c|  7 ++-
>>  net/mac80211/wep.c | 11 ++-
>>  net/mac80211/wep.h |  1 +
>>  net/mac80211/wpa.c | 14 ++
>>  10 files changed, 72 insertions(+), 24 deletions(-)
>>
> Btw, how can you get away without changing the status path?
>
Yes, this is still missed.

> johannes
--
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: [RFC/RFT v2] mac80211: Add NEED_ALIGNED4_SKBS hw flag

2015-12-18 Thread Johannes Berg
On Fri, 2015-12-18 at 12:57 +0100, Janusz Dziedzic wrote:
> HW/driver should set NEED_ALIGNED4_SKBS flag in case require
> aligned skbs to four-byte boundaries.
> 
> Before we have to do memmove() in the driver before
> pass this to HW and memmove() back in tx completion.
> This patch allow to save CPU and skip such memmoves.
> For each skb we call memmove(ieee80211_hdrsize()) twice.
> 
> Currently this was tested with ath9k, both hw/sw crypt for
> tkip/ccmp.
> For sure more tests required (eg. fast path isn't used for
> ath9k STA, wep sw crypt).
> 
> Signed-off-by: Janusz Dziedzic 
> ---
>  include/net/mac80211.h |  4 
>  net/mac80211/debugfs.c |  1 +
>  net/mac80211/ieee80211_i.h |  1 +
>  net/mac80211/sta_info.h|  4 ++--
>  net/mac80211/tkip.c| 15 ---
>  net/mac80211/tx.c  | 38 +---
> --
>  net/mac80211/util.c|  7 ++-
>  net/mac80211/wep.c | 11 ++-
>  net/mac80211/wep.h |  1 +
>  net/mac80211/wpa.c | 14 ++
>  10 files changed, 72 insertions(+), 24 deletions(-)
> 
Btw, how can you get away without changing the status path?

johannes
--
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/RFT v2] mac80211: Add NEED_ALIGNED4_SKBS hw flag

2015-12-18 Thread Janusz Dziedzic
HW/driver should set NEED_ALIGNED4_SKBS flag in case require
aligned skbs to four-byte boundaries.

Before we have to do memmove() in the driver before
pass this to HW and memmove() back in tx completion.
This patch allow to save CPU and skip such memmoves.
For each skb we call memmove(ieee80211_hdrsize()) twice.

Currently this was tested with ath9k, both hw/sw crypt for
tkip/ccmp.
For sure more tests required (eg. fast path isn't used for
ath9k STA, wep sw crypt).

Signed-off-by: Janusz Dziedzic 
---
 include/net/mac80211.h |  4 
 net/mac80211/debugfs.c |  1 +
 net/mac80211/ieee80211_i.h |  1 +
 net/mac80211/sta_info.h|  4 ++--
 net/mac80211/tkip.c| 15 ---
 net/mac80211/tx.c  | 38 +-
 net/mac80211/util.c|  7 ++-
 net/mac80211/wep.c | 11 ++-
 net/mac80211/wep.h |  1 +
 net/mac80211/wpa.c | 14 ++
 10 files changed, 72 insertions(+), 24 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 7c30faf..0ea9b51 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1910,6 +1910,9 @@ struct ieee80211_txq {
  * by just its MAC address; this prevents, for example, the same station
  * from connecting to two virtual AP interfaces at the same time.
  *
+ * @IEEE80211_HW_NEEDS_ALIGNED4_SKBS: Driver need aligned skbs to four-byte.
+ * Padding will be added after ieee80211_hdr.
+ *
  * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  */
 enum ieee80211_hw_flags {
@@ -1946,6 +1949,7 @@ enum ieee80211_hw_flags {
IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,
IEEE80211_HW_BEACON_TX_STATUS,
IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
+   IEEE80211_HW_NEEDS_ALIGNED4_SKBS,
 
/* keep last, obviously */
NUM_IEEE80211_HW_FLAGS
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index abbdff0..fd45830 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -126,6 +126,7 @@ static const char *hw_flag_names[NUM_IEEE80211_HW_FLAGS + 
1] = {
FLAG(SUPPORTS_AMSDU_IN_AMPDU),
FLAG(BEACON_TX_STATUS),
FLAG(NEEDS_UNIQUE_STA_ADDR),
+   FLAG(NEEDS_ALIGNED4_SKBS),
 
/* keep last for the build bug below */
(void *)0x1
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index c30b684..c5e1b46 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -172,6 +172,7 @@ struct ieee80211_tx_data {
struct ieee80211_tx_rate rate;
 
unsigned int flags;
+   unsigned int hdrlen;
 };
 
 
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index d605162..3e1cd70 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -268,8 +268,8 @@ struct ieee80211_fast_tx {
u8 hdr_len;
u8 sa_offs, da_offs, pn_offs;
u8 band;
-   u8 hdr[30 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
-  sizeof(rfc1042_header)];
+   u8 hdr[round_up(30 + 2 + IEEE80211_FAST_XMIT_MAX_IV +
+   sizeof(rfc1042_header), 4)];
 
struct rcu_head rcu_head;
 };
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
index 0ae2077..26b2663 100644
--- a/net/mac80211/tkip.c
+++ b/net/mac80211/tkip.c
@@ -204,9 +204,18 @@ void ieee80211_get_tkip_p2k(struct ieee80211_key_conf 
*keyconf,
const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY];
struct tkip_ctx *ctx = &key->u.tkip.tx;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
-   const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
-   u32 iv32 = get_unaligned_le32(&data[4]);
-   u16 iv16 = data[2] | (data[0] << 8);
+   unsigned int hdrlen;
+   const u8 *data;
+   u32 iv32;
+   u16 iv16;
+
+   hdrlen = ieee80211_hdrlen(hdr->frame_control);
+   if (ieee80211_hw_check(&key->local->hw, NEEDS_ALIGNED4_SKBS))
+   hdrlen += hdrlen & 3;
+
+   data = (u8 *)hdr + hdrlen;
+   iv32 = get_unaligned_le32(&data[4]);
+   iv16 = data[2] | (data[0] << 8);
 
spin_lock(&key->u.tkip.txlock);
ieee80211_compute_tkip_p1k(key, iv32);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 3311ce0..a512c4b 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -205,6 +205,20 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data 
*tx,
 
 /* tx handlers */
 static ieee80211_tx_result debug_noinline
+ieee80211_tx_h_hdrlen_add(struct ieee80211_tx_data *tx)
+{
+   struct ieee80211_hw *hw = &tx->local->hw;
+   struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
+
+   tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
+
+   if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS))
+   tx->hdrlen += tx->hdrlen & 3;
+
+   return TX_CONTINUE;
+}
+
+static ieee80211_tx_result debug_noinline
 ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
 {
struct ie

[PATCH] ath9k: Enable support for cloned SKBS

2015-12-18 Thread Pawel Kulakowski
Ath9k driver does not modify tx skbs, so SUPPORTS_CLONED_SKBS
flag can be set. Enabling this flag significant reduce number
of copy operation during TCP Tx. This is especially noticeable
on platforms with slower CPU (lower CPU usage brings
profits in better TCP Tx troughput results).

Tested on MIPS with 560 MHz clock
Without CLONED_SKBS flag:
TCP Tx 145 Mb/s (iperf result)
__copy_user_common consumes 12.9% of CPU (result from perf tool)
0% CPU Idle

With CLONED_SKBS flag:
TCP Tx 170 Mb/s (iperf result)
__copy_user_common consumes 1.8% of CPU (result from perf tool)
12% CPU Idle

Signed-off-by: Pawel Kulakowski 
---
 drivers/net/wireless/ath/ath9k/init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index 2e2b92b..ab7a1ac 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -828,6 +828,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct 
ieee80211_hw *hw)
ieee80211_hw_set(hw, RX_INCLUDES_FCS);
ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
+   ieee80211_hw_set(hw, SUPPORTS_CLONED_SKBS);
 
if (ath9k_ps_enable)
ieee80211_hw_set(hw, SUPPORTS_PS);
-- 
1.9.1

--
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] staging: wilc1000: fix a bug when unload driver

2015-12-18 Thread Glen Lee
kernel crashes when load and unload driver several times. I used git bisect to
track down and found that removing NULL setting caused the panic.
This reverts only related codes of the patch(a4ab1ade75a3).

Fixes: a4ab1ade75a3 ("staging: wilc1000: replace drvHandler and hWFIDrv with 
hif_drv")
Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0125e3d..851560f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1366,9 +1366,12 @@ static s32 Handle_ConnectTimeout(struct wilc_vif *vif)
 
hif_drv->usr_conn_req.ssid_len = 0;
kfree(hif_drv->usr_conn_req.pu8ssid);
+   hif_drv->usr_conn_req.pu8ssid = NULL;
kfree(hif_drv->usr_conn_req.pu8bssid);
+   hif_drv->usr_conn_req.pu8bssid = NULL;
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);
+   hif_drv->usr_conn_req.ies = NULL;
 
eth_zero_addr(wilc_connected_ssid);
 
@@ -1624,9 +1627,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
strConnectInfo.pu8ReqIEs = NULL;
hif_drv->usr_conn_req.ssid_len = 0;
kfree(hif_drv->usr_conn_req.pu8ssid);
+   hif_drv->usr_conn_req.pu8ssid = NULL;
kfree(hif_drv->usr_conn_req.pu8bssid);
+   hif_drv->usr_conn_req.pu8bssid = NULL;
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);
+   hif_drv->usr_conn_req.ies = NULL;
} else if ((u8MacStatus == MAC_DISCONNECTED) &&
   (hif_drv->hif_state == HOST_IF_CONNECTED)) {
PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from 
the FW\n");
@@ -1660,9 +1666,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
 
hif_drv->usr_conn_req.ssid_len = 0;
kfree(hif_drv->usr_conn_req.pu8ssid);
+   hif_drv->usr_conn_req.pu8ssid = NULL;
kfree(hif_drv->usr_conn_req.pu8bssid);
+   hif_drv->usr_conn_req.pu8bssid = NULL;
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);
+   hif_drv->usr_conn_req.ies = NULL;
 
if (join_req && join_req_vif == vif) {
kfree(join_req);
@@ -2034,9 +2043,12 @@ static void Handle_Disconnect(struct wilc_vif *vif)
 
hif_drv->usr_conn_req.ssid_len = 0;
kfree(hif_drv->usr_conn_req.pu8ssid);
+   hif_drv->usr_conn_req.pu8ssid = NULL;
kfree(hif_drv->usr_conn_req.pu8bssid);
+   hif_drv->usr_conn_req.pu8bssid = NULL;
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);
+   hif_drv->usr_conn_req.ies = NULL;
 
if (join_req && join_req_vif == vif) {
kfree(join_req);
-- 
1.9.1

--
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: [RFC/RFT 1/2] mac80211: Add NEED_ALIGNED4_SKBS hw flag

2015-12-18 Thread Janusz Dziedzic
On 17 December 2015 at 11:12, Felix Fietkau  wrote:
> On 2015-12-17 10:20, Janusz Dziedzic wrote:
>> HW/driver should set NEED_ALIGNED4_SKBS flag in case require
>> aligned skbs to four-byte boundaries.
>>
>> Before we have to do memmove() in the driver before
>> pass this to HW and memmove() back in tx completion.
>> This patch allow to save CPU and skip such memmoves.
>> For each skb we called memmove(ieee80211_hdrsize()) twice.
>>
>> Currently this was tested with ath9k, both hw/sw crypt for
>> tkip/ccmp.
>> For sure more tests required.
>>
>> Signed-off-by: Janusz Dziedzic 
>> ---
>>  include/net/mac80211.h |  4 
>>  net/mac80211/debugfs.c |  1 +
>>  net/mac80211/tkip.c| 15 ---
>>  net/mac80211/tx.c  | 21 +++--
>>  net/mac80211/wep.c |  6 ++
>>  net/mac80211/wpa.c | 35 +++
>>  6 files changed, 69 insertions(+), 13 deletions(-)
>>
>> diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
>> index 0ae2077..26b2663 100644
>> --- a/net/mac80211/tkip.c
>> +++ b/net/mac80211/tkip.c
>> @@ -204,9 +204,18 @@ void ieee80211_get_tkip_p2k(struct ieee80211_key_conf 
>> *keyconf,
>>   const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY];
>>   struct tkip_ctx *ctx = &key->u.tkip.tx;
>>   struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
>> - const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
>> - u32 iv32 = get_unaligned_le32(&data[4]);
>> - u16 iv16 = data[2] | (data[0] << 8);
>> + unsigned int hdrlen;
>> + const u8 *data;
>> + u32 iv32;
>> + u16 iv16;
>> +
>> + hdrlen = ieee80211_hdrlen(hdr->frame_control);
>> + if (ieee80211_hw_check(&key->local->hw, NEEDS_ALIGNED4_SKBS))
>> + hdrlen += hdrlen & 3;
> I think this check is duplicated way too often, maybe you should
> implement a wrapper for ieee80211_hdrlen and convert all relevant call
> sites. Makes it easier to spot places where this was forgotten.
>
Or other option is to add this to ieee80211_tx_data - while this param
we pass to most of encrypt funtions ...
>From other side I see ieee80211_tx_data skbs list could be used -
seems only for fragmentation?

@Johannes - will be safe add "real" hdrlen to ieee80211_tx_data?

Other option I see is ieee80211_tx_info or like Felix suggest new
hdrlen() function.

BR
Janusz

> - Felix
--
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