Linux wireless drivers development
 help / color / mirror / Atom feed
* Re: [PATCH v2 31/37] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer
From: Thomas Gleixner @ 2017-10-23 10:33 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Anna-Maria Gleixner, LKML, Peter Zijlstra, Ingo Molnar, keescook,
	Christoph Hellwig, John Stultz, Kalle Valo, linux-wireless
In-Reply-To: <1508754350.2639.12.camel@sipsolutions.net>

On Mon, 23 Oct 2017, Johannes Berg wrote:
> On Mon, 2017-10-23 at 12:23 +0200, Thomas Gleixner wrote:
> > On Mon, 23 Oct 2017, Johannes Berg wrote:
> > 
> > > On Sun, 2017-10-22 at 23:40 +0200, Anna-Maria Gleixner wrote:
> > > > From: Thomas Gleixner <tglx@linutronix.de>
> > > > 
> > > > Switch the timer to HRTIMER_MODE_SOFT, which executed the timer
> > > > callback in softirq context and remove the hrtimer_tasklet.
> > 
> > I can't build as its part of the whole hrtimer rework series.
> 
> I guess you mean you *can* build it? Surely you're introducing the new
> HR timer modes in some patch that I didn't see? :-)

Sorry, we did not want to expose you to 30 patches fiddling with the core
code. They are on LKML though.

> > > > +       hrtimer_init(&data->beacon_timer, CLOCK_MONOTONIC,
> > > > +                    HRTIMER_MODE_ABS_SOFT);
> > 
> > Sure, though it does not matter in that case. Will fix that up.
> 
> Right. Then again, why even pass it to init() and start()? Can you
> start without going through start()?

There is a subtle magic with CLOCK_REALTIME timers.

CLOCK_REALTIME timers differentiate between ABS and REL modes. ABS timers
are exposed to clock modifications (settimeofday() ...), REL timers are
not. We solve that by associating them to different clock bases, which has
to be done at init time, but the start function needs the REL/ABS
information as well.

For CLOCK_MONOTONIC this is not really required, but the function is used
for all clock bases, so we require the mode bits for all.

Thanks,

	tglx

^ permalink raw reply

* Re: [PATCH v2 31/37] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer
From: Johannes Berg @ 2017-10-23 10:25 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Anna-Maria Gleixner, LKML, Peter Zijlstra, Ingo Molnar, keescook,
	Christoph Hellwig, John Stultz, Kalle Valo, linux-wireless
In-Reply-To: <alpine.DEB.2.20.1710231221520.4241@nanos>

On Mon, 2017-10-23 at 12:23 +0200, Thomas Gleixner wrote:
> On Mon, 23 Oct 2017, Johannes Berg wrote:
> 
> > On Sun, 2017-10-22 at 23:40 +0200, Anna-Maria Gleixner wrote:
> > > From: Thomas Gleixner <tglx@linutronix.de>
> > > 
> > > Switch the timer to HRTIMER_MODE_SOFT, which executed the timer
> > > callback in softirq context and remove the hrtimer_tasklet.
> 
> I can't build as its part of the whole hrtimer rework series.

I guess you mean you *can* build it? Surely you're introducing the new
HR timer modes in some patch that I didn't see? :-)

> > > +       hrtimer_init(&data->beacon_timer, CLOCK_MONOTONIC,
> > > +                    HRTIMER_MODE_ABS_SOFT);
> 
> Sure, though it does not matter in that case. Will fix that up.

Right. Then again, why even pass it to init() and start()? Can you
start without going through start()?

johannes

^ permalink raw reply

* Re: [PATCH v2 31/37] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer
From: Thomas Gleixner @ 2017-10-23 10:23 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Anna-Maria Gleixner, LKML, Peter Zijlstra, Ingo Molnar, keescook,
	Christoph Hellwig, John Stultz, Kalle Valo, linux-wireless
In-Reply-To: <1508753691.2639.10.camel@sipsolutions.net>

On Mon, 23 Oct 2017, Johannes Berg wrote:

> On Sun, 2017-10-22 at 23:40 +0200, Anna-Maria Gleixner wrote:
> > From: Thomas Gleixner <tglx@linutronix.de>
> > 
> > Switch the timer to HRTIMER_MODE_SOFT, which executed the timer
> > callback in softirq context and remove the hrtimer_tasklet.

I can't build as its part of the whole hrtimer rework series.

> This doesn't build on my tree, due to HRTIMER_MODE_REL_SOFT not
> existing. Neither does HRTIMER_MODE_SOFT mentioned above, but that's
> just a commit log mistake.

Oops.

> (It also didn't apply on my tree, but that was a trivial context
> change.)
> 
> I don't understand why you initialize it with HRTIMER_MODE_ABS_SOFT
> either though:
> 
> > +       hrtimer_init(&data->beacon_timer, CLOCK_MONOTONIC,
> > +                    HRTIMER_MODE_ABS_SOFT);

Sure, though it does not matter in that case. Will fix that up.

Thanks,

	tglx

^ permalink raw reply

* Re: [PATCH v2 31/37] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer
From: Johannes Berg @ 2017-10-23 10:14 UTC (permalink / raw)
  To: Anna-Maria Gleixner, LKML
  Cc: Thomas Gleixner, Peter Zijlstra, Ingo Molnar, keescook,
	Christoph Hellwig, John Stultz, Kalle Valo, linux-wireless
In-Reply-To: <20171022214053.576969587@linutronix.de>

On Sun, 2017-10-22 at 23:40 +0200, Anna-Maria Gleixner wrote:
> From: Thomas Gleixner <tglx@linutronix.de>
> 
> Switch the timer to HRTIMER_MODE_SOFT, which executed the timer
> callback in softirq context and remove the hrtimer_tasklet.

This doesn't build on my tree, due to HRTIMER_MODE_REL_SOFT not
existing. Neither does HRTIMER_MODE_SOFT mentioned above, but that's
just a commit log mistake.

(It also didn't apply on my tree, but that was a trivial context
change.)

I don't understand why you initialize it with HRTIMER_MODE_ABS_SOFT
either though:

> +       hrtimer_init(&data->beacon_timer, CLOCK_MONOTONIC,
> +                    HRTIMER_MODE_ABS_SOFT);

shouldn't that already be REL?

johannes

^ permalink raw reply

* Re: [PATCH] net: wireless: mark expected switch fall-throughs
From: Johannes Berg @ 2017-10-23  6:48 UTC (permalink / raw)
  To: Gustavo A. R. Silva, David S. Miller; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <20171020172145.GA5366@embeddedor.com>

On Fri, 2017-10-20 at 12:21 -0500, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
> 
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> This code was tested by compilation only (GCC 7.2.0 was used).
> Please, verify if the actual intention of the code is to fall through.

Please, if you're proposing patches, do that yourself.

johannes

^ permalink raw reply

* Re: [PATCH V6 1/5] mac80211: Enable TDLS peer buffer STA feature
From: Johannes Berg @ 2017-10-23  6:29 UTC (permalink / raw)
  To: Yingying Tang, ath10k@lists.infradead.org; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <ad23308b0865465daeba02cd416e22cb@aptaiexm02b.ap.qualcomm.com>

On Fri, 2017-10-20 at 03:34 +0000, Yingying Tang wrote:
> Hi Johannes,
> 
> I have built and tested it, it can work

No, you haven't, at least not comprehensively. Try to enable debugfs.

johannes

^ permalink raw reply

* [PATCH v2 31/37] mac80211_hwsim: Replace hrtimer tasklet with softirq hrtimer
From: Anna-Maria Gleixner @ 2017-10-22 21:40 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, Peter Zijlstra, Ingo Molnar, keescook,
	Christoph Hellwig, John Stultz, Johannes Berg, Kalle Valo,
	linux-wireless
In-Reply-To: <20171022213938.940451689@linutronix.de>

From: Thomas Gleixner <tglx@linutronix.de>

Switch the timer to HRTIMER_MODE_SOFT, which executed the timer
callback in softirq context and remove the hrtimer_tasklet.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org

---
 drivers/net/wireless/mac80211_hwsim.c |   44 +++++++++++++++-------------------
 1 file changed, 20 insertions(+), 24 deletions(-)

--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -537,7 +537,7 @@ struct mac80211_hwsim_data {
 	unsigned int rx_filter;
 	bool started, idle, scanning;
 	struct mutex mutex;
-	struct tasklet_hrtimer beacon_timer;
+	struct hrtimer beacon_timer;
 	enum ps_mode {
 		PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL
 	} ps;
@@ -1418,7 +1418,7 @@ static void mac80211_hwsim_stop(struct i
 {
 	struct mac80211_hwsim_data *data = hw->priv;
 	data->started = false;
-	tasklet_hrtimer_cancel(&data->beacon_timer);
+	hrtimer_cancel(&data->beacon_timer);
 	wiphy_debug(hw->wiphy, "%s\n", __func__);
 }
 
@@ -1541,14 +1541,12 @@ static enum hrtimer_restart
 mac80211_hwsim_beacon(struct hrtimer *timer)
 {
 	struct mac80211_hwsim_data *data =
-		container_of(timer, struct mac80211_hwsim_data,
-			     beacon_timer.timer);
+		container_of(timer, struct mac80211_hwsim_data, beacon_timer);
 	struct ieee80211_hw *hw = data->hw;
 	u64 bcn_int = data->beacon_int;
-	ktime_t next_bcn;
 
 	if (!data->started)
-		goto out;
+		return HRTIMER_NORESTART;
 
 	ieee80211_iterate_active_interfaces_atomic(
 		hw, IEEE80211_IFACE_ITER_NORMAL,
@@ -1560,11 +1558,9 @@ mac80211_hwsim_beacon(struct hrtimer *ti
 		data->bcn_delta = 0;
 	}
 
-	next_bcn = ktime_add(hrtimer_get_expires(timer),
-			     ns_to_ktime(bcn_int * 1000));
-	tasklet_hrtimer_start(&data->beacon_timer, next_bcn, HRTIMER_MODE_ABS);
-out:
-	return HRTIMER_NORESTART;
+	hrtimer_forward(&data->beacon_timer, hrtimer_get_expires(timer),
+			ns_to_ktime(bcn_int * NSEC_PER_USEC));
+	return HRTIMER_RESTART;
 }
 
 static const char * const hwsim_chanwidths[] = {
@@ -1638,15 +1634,15 @@ static int mac80211_hwsim_config(struct
 	mutex_unlock(&data->mutex);
 
 	if (!data->started || !data->beacon_int)
-		tasklet_hrtimer_cancel(&data->beacon_timer);
-	else if (!hrtimer_is_queued(&data->beacon_timer.timer)) {
+		hrtimer_cancel(&data->beacon_timer);
+	else if (!hrtimer_is_queued(&data->beacon_timer)) {
 		u64 tsf = mac80211_hwsim_get_tsf(hw, NULL);
 		u32 bcn_int = data->beacon_int;
 		u64 until_tbtt = bcn_int - do_div(tsf, bcn_int);
 
-		tasklet_hrtimer_start(&data->beacon_timer,
-				      ns_to_ktime(until_tbtt * 1000),
-				      HRTIMER_MODE_REL);
+		hrtimer_start(&data->beacon_timer,
+			      ns_to_ktime(until_tbtt * 1000),
+			      HRTIMER_MODE_REL_SOFT);
 	}
 
 	return 0;
@@ -1709,7 +1705,7 @@ static void mac80211_hwsim_bss_info_chan
 			    info->enable_beacon, info->beacon_int);
 		vp->bcn_en = info->enable_beacon;
 		if (data->started &&
-		    !hrtimer_is_queued(&data->beacon_timer.timer) &&
+		    !hrtimer_is_queued(&data->beacon_timer) &&
 		    info->enable_beacon) {
 			u64 tsf, until_tbtt;
 			u32 bcn_int;
@@ -1717,9 +1713,9 @@ static void mac80211_hwsim_bss_info_chan
 			tsf = mac80211_hwsim_get_tsf(hw, vif);
 			bcn_int = data->beacon_int;
 			until_tbtt = bcn_int - do_div(tsf, bcn_int);
-			tasklet_hrtimer_start(&data->beacon_timer,
-					      ns_to_ktime(until_tbtt * 1000),
-					      HRTIMER_MODE_REL);
+			hrtimer_start(&data->beacon_timer,
+				      ns_to_ktime(until_tbtt * 1000),
+				      HRTIMER_MODE_REL_SOFT);
 		} else if (!info->enable_beacon) {
 			unsigned int count = 0;
 			ieee80211_iterate_active_interfaces_atomic(
@@ -1728,7 +1724,7 @@ static void mac80211_hwsim_bss_info_chan
 			wiphy_debug(hw->wiphy, "  beaconing vifs remaining: %u",
 				    count);
 			if (count == 0) {
-				tasklet_hrtimer_cancel(&data->beacon_timer);
+				hrtimer_cancel(&data->beacon_timer);
 				data->beacon_int = 0;
 			}
 		}
@@ -2720,9 +2716,9 @@ static int mac80211_hwsim_new_radio(stru
 				    data->debugfs,
 				    data, &hwsim_simulate_radar);
 
-	tasklet_hrtimer_init(&data->beacon_timer,
-			     mac80211_hwsim_beacon,
-			     CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
+	hrtimer_init(&data->beacon_timer, CLOCK_MONOTONIC,
+		     HRTIMER_MODE_ABS_SOFT);
+	data->beacon_timer.function = mac80211_hwsim_beacon;
 
 	spin_lock_bh(&hwsim_radio_lock);
 	list_add_tail(&data->list, &hwsim_radios);

^ permalink raw reply

* Re: After upgrading to 4.11.1, wifi driver refuses to load after being unloaded once.
From: Marc MERLIN @ 2017-10-21 10:22 UTC (permalink / raw)
  To: Luca Coelho; +Cc: Kalle Valo, linux-wireless, linuxwifi
In-Reply-To: <20171021005038.mykrmhyrhxhzyztw@merlins.org>

On Fri, Oct 20, 2017 at 05:50:38PM -0700, Marc MERLIN wrote:
> Mmmh, still seem to have a problem when I reload the module
> 
> what now?

I've entered bug https://bugzilla.kernel.org/show_bug.cgi?id=197341

But I'm still curious what firmware I'm supposed to use:

-rw-rw-r-- 1 merlin merlin 1745176 Jun 18  2015 /lib/firmware/iwlwifi-8000C-13.ucode
-rw-r--r-- 1 root   root   2345768 Dec  6  2015 /lib/firmware/iwlwifi-8000C-14.ucode
-rw-r--r-- 1 root   root   2351636 Dec  6  2015 /lib/firmware/iwlwifi-8000C-16.ucode
-rw-r--r-- 1 root   root   2390004 Feb 12  2016 /lib/firmware/iwlwifi-8000C-17.ucode
-rw-r--r-- 1 merlin merlin 2382972 Feb 25  2016 /lib/firmware/iwlwifi-8000C-19.ucode
-rw-r--r-- 1 merlin merlin 2227284 Jun  3 09:46 /lib/firmware/iwlwifi-8000C-27.ucode

https://www.intel.com/content/www/us/en/support/articles/000005511/network-and-i-o/wireless-networking.html
still says to install
iwlwifi-8000-ucode-25.30.13.0.tgz
which in turn installs
iwlwifi-8000C-13.ucode
while the driver looks for iwlwifi-8000C-30.ucode iwlwifi-8000C-29.ucode iwlwifi-8000C-28.ucode
before loading iwlwifi-8000C-27.ucode

Do I have the right firmware?
loaded firmware version 27.455470.0 op_mode iwlmvm

I'm still getting
[95473.169147] iwlwifi 0000:04:00.0: Refused to change power state, currently in D3
[95473.185656] Timeout waiting for hardware access (CSR_GP_CNTRL 0xffffffff)

Marc
-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901

^ permalink raw reply

* Re: [BUG] ssb: Possible sleep-in-atomic bugs in ssb_pcmcia_read8
From: Michael Büsch @ 2017-10-21  9:09 UTC (permalink / raw)
  To: Jia-Ju Bai
  Cc: gregkh, sudipm.mukherjee, akpm, johannes, dahinds, linux-pcmcia,
	Linux Kernel Mailing List, linux-wireless
In-Reply-To: <b3252056-573d-2c69-81d6-dde291246748@163.com>

[-- Attachment #1: Type: text/plain, Size: 1287 bytes --]

On Mon, 9 Oct 2017 09:29:17 +0800
Jia-Ju Bai <baijiaju1990@163.com> wrote:

> According to pcmcia.c, the driver may sleep under a spinlock.
> The function call paths are:
> ssb_pcmcia_read8 (acquire the spinlock)
>    select_core_and_segment
>      ssb_pcmcia_switch_segment
>        ssb_pcmcia_cfg_write
>          pcmcia_write_config_byte
>            pcmcia_access_config (drivers/pcmcia/pcmcia_resource.c)
>              mutex_lock --> may sleep
> 
> ssb_pcmcia_read8 (acquire the spinlock)
>    select_core_and_segment
>      ssb_pcmcia_switch_segment
>        sssb_pcmcia_cfg_read
>          pcmcia_read_config_byte
>            pcmcia_access_config (drivers/pcmcia/pcmcia_resource.c)
>              mutex_lock --> may sleep
> 
> A possible fix is to use spinlock instead of mutex lock in 
> pcmcia_access_config in drivers/pcmcia/pcmcia_resource.c.
> 
> These bugs are found by my static analysis tool and my code review.



Thanks for scanning and your resulting bug notification.
I currently don't have the hardware at hand to develop and test a
proper fix for this.
That said, I'm not so sure anymore why bar_lock is a spinlock instead
of a mutex. It might be possible to convert this to mutex.

I will try to look into this.

-- 
Michael

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH] ath10k: rebuild crypto header in RX data frames
From: Sebastian Gottschall @ 2017-10-21  7:58 UTC (permalink / raw)
  To: Kalle Valo, Jasmine Strong; +Cc: ath10k, linux-wireless@vger.kernel.org
In-Reply-To: <877evpdscc.fsf@kamboji.qca.qualcomm.com>

even if he used my patch. my patch should have no influence to wpa2 
ccmp. it just adds the new ccmp 256 + gcmp modes

Am 21.10.2017 um 06:42 schrieb Kalle Valo:
> Jasmine Strong <jas@eero.com> writes:
>
>> When we tried this patch, it completely broke all wpa2-ccmp-aes
>> traffic.
> Which patch, Vasanth's or Sebastian's? I even tested myself, with both
> CCMP and TKIP on both AP and client modes, and didn't see see any
> problems. What kind of setup you have?
>
> I tested on a x86 laptop and current ath.git master branch:
>
> ath10k_pci 0000:02:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0
> ath10k_pci 0000:02:00.0: qca988x hw2.0 target 0x4100016c chip_id 0x043202ff sub 0000:0000
> ath10k_pci 0000:02:00.0: kconfig debug 1 debugfs 1 tracing 1 dfs 1 testmode 1
> ath10k_pci 0000:02:00.0: firmware ver 10.2.4.70.66 api 5 features no-p2p,raw-mode,mfp,allows-mesh-bcast crc32 c2dd2ad5
> ath10k_pci 0000:02:00.0: board_file api 1 bmi_id N/A crc32 bebc7c08
>
> And my hostapd.conf:
>
> driver=nl80211
> hw_mode=a
> channel=36
> ieee80211n=1
> interface=wlan0
> ctrl_interface=/var/run/hostapd
> ctrl_interface_group=adm
> ssid=test-psk
> wpa=2
> wpa_key_mgmt=WPA-PSK
> wpa_pairwise=CCMP
> wpa_passphrase=12345678
>
>

-- 
Mit freundlichen Grüssen / Regards

Sebastian Gottschall / CTO

NewMedia-NET GmbH - DD-WRT
Firmensitz:  Stubenwaldallee 21a, 64625 Bensheim
Registergericht: Amtsgericht Darmstadt, HRB 25473
Geschäftsführer: Peter Steinhäuser, Christian Scheele
http://www.dd-wrt.com
email: s.gottschall@dd-wrt.com
Tel.: +496251-582650 / Fax: +496251-5826565

^ permalink raw reply

* Re: [PATCH] ath10k: rebuild crypto header in RX data frames
From: Kalle Valo @ 2017-10-21  4:42 UTC (permalink / raw)
  To: Jasmine Strong
  Cc: Sebastian Gottschall, ath10k, linux-wireless@vger.kernel.org
In-Reply-To: <CAGyitvP0wquoo_8_ma3rcj+riJ5Wgfo7+pmbUOx9pQRwFcQHYA@mail.gmail.com>

Jasmine Strong <jas@eero.com> writes:

> When we tried this patch, it completely broke all wpa2-ccmp-aes
> traffic.

Which patch, Vasanth's or Sebastian's? I even tested myself, with both
CCMP and TKIP on both AP and client modes, and didn't see see any
problems. What kind of setup you have?

I tested on a x86 laptop and current ath.git master branch:

ath10k_pci 0000:02:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode =
0
ath10k_pci 0000:02:00.0: qca988x hw2.0 target 0x4100016c chip_id 0x043202ff=
 sub 0000:0000
ath10k_pci 0000:02:00.0: kconfig debug 1 debugfs 1 tracing 1 dfs 1 testmode=
 1
ath10k_pci 0000:02:00.0: firmware ver 10.2.4.70.66 api 5 features no-p2p,ra=
w-mode,mfp,allows-mesh-bcast crc32 c2dd2ad5
ath10k_pci 0000:02:00.0: board_file api 1 bmi_id N/A crc32 bebc7c08

And my hostapd.conf:

driver=3Dnl80211
hw_mode=3Da
channel=3D36
ieee80211n=3D1
interface=3Dwlan0
ctrl_interface=3D/var/run/hostapd
ctrl_interface_group=3Dadm
ssid=3Dtest-psk
wpa=3D2
wpa_key_mgmt=3DWPA-PSK
wpa_pairwise=3DCCMP
wpa_passphrase=3D12345678


--=20
Kalle Valo=

^ permalink raw reply

* Re: After upgrading to 4.11.1, wifi driver refuses to load after being unloaded once.
From: Marc MERLIN @ 2017-10-21  0:50 UTC (permalink / raw)
  To: Luca Coelho; +Cc: Kalle Valo, linux-wireless, linuxwifi
In-Reply-To: <1508322176.5497.152.camel@coelho.fi>

Mmmh, still seem to have a problem when I reload the module

what now?

saruman:~$ grep IWL /boot/config-4.12.10-amd64-preempt-sysrq-20171018 
CONFIG_IWLEGACY=m
CONFIG_IWL4965=m
CONFIG_IWL3945=m
CONFIG_IWLEGACY_DEBUG=y
CONFIG_IWLWIFI=m
CONFIG_IWLWIFI_LEDS=y
CONFIG_IWLDVM=m
CONFIG_IWLMVM=m
CONFIG_IWLWIFI_OPMODE_MODULAR=y
# CONFIG_IWLWIFI_BCAST_FILTERING is not set
# CONFIG_IWLWIFI_PCIE_RTPM is not set
CONFIG_IWLWIFI_DEBUG=y
CONFIG_IWLWIFI_DEVICE_TRACING=y


[95473.132319] Intel(R) Wireless WiFi driver for Linux
[95473.132322] Copyright(c) 2003- 2015 Intel Corporation
[95473.169147] iwlwifi 0000:04:00.0: Refused to change power state, currently in D3
[95473.185656] Timeout waiting for hardware access (CSR_GP_CNTRL 0xffffffff)
[95473.185668] ------------[ cut here ]------------
[95473.185695] WARNING: CPU: 1 PID: 512 at drivers/net/wireless/intel/iwlwifi/pcie/trans.c:1855 iwl_trans_pcie_grab_nic_access+0xc0/0xd7 [iwlwifi]
[95473.185696] Modules linked in: iwlwifi(+) cfg80211 rndis_host cdc_ether usbnet cmac e1000e msr rfcomm uas usb_storage ipt_MASQUERADE nf_nat_masquerade_ipv4 ipt_REJECT nf_reject_ipv4 xt_tcpudp xt_conntrack nf_log_ipv4 nf_log_common xt_LOG iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables x_tables bnep pci_stub vboxpci(OE) vboxnetadp(OE) vboxnetflt(OE) vboxdrv(OE) autofs4 binfmt_misc uinput nfsd auth_rpcgss nfs_acl nfs lockd grace fscache sunrpc nls_utf8 nls_cp437 vfat fat configs input_polldev loop firewire_sbp2 firewire_core crc_itu_t cuse ecryptfs ppdev parport_pc lp parport uvcvideo btusb videobuf2_vmalloc videobuf2_memops btrtl hid_generic videobuf2_v4l2 btbcm videobuf2_core btintel
[95473.185728]  videodev bluetooth media usbhid hid ecdh_generic joydev arc4 coretemp x86_pkg_temp_thermal intel_powerclamp snd_hda_codec_realtek snd_hda_codec_generic kvm_intel rtsx_pci_ms memstick rtsx_pci_sdmmc iTCO_wdt kvm iTCO_vendor_support mei_wdt irqbypass crct10dif_pclmul crc32_pclmul snd_hda_intel ghash_clmulni_intel xhci_pci intel_cstate snd_hda_codec xhci_hcd snd_hda_core efi_pstore intel_rapl_perf pcspkr psmouse snd_seq snd_hwdep thinkpad_acpi snd_pcm snd_seq_device efivars i2c_i801 sg rtsx_pci nvram nvidiafb snd_timer usbcore vgastate fb_ddc snd mei_me intel_pch_thermal soundcore rfkill hwmon battery ac wmi tpm_crb tpm_tis tpm_tis_core tpm sata_sil24 r8169 mii fuse fan raid456 multipath mmc_block mmc_core dm_snapshot dm_bufio dm_mirror dm_region_hash dm_log dm_crypt dm_mod async_raid6_recov
[95473.185759]  async_pq async_xor async_memcpy async_tx blowfish_x86_64 blowfish_common crc32c_intel bcache aesni_intel input_leds aes_x86_64 crypto_simd ptp cryptd i915 glue_helper serio_raw pps_core shpchp thermal evdev [last unloaded: cfg80211]
[95473.185770] CPU: 1 PID: 512 Comm: modprobe Tainted: G        W  OE   4.12.10-amd64-preempt-sysrq-20171018 #2
[95473.185771] Hardware name: LENOVO 20ERCTO1WW/20ERCTO1WW, BIOS N1DET41W (1.15 ) 12/31/2015
[95473.185772] task: ffff9c0990188000 task.stack: ffffa815102b4000
[95473.185782] RIP: 0010:iwl_trans_pcie_grab_nic_access+0xc0/0xd7 [iwlwifi]
[95473.185783] RSP: 0018:ffffa815102b7a30 EFLAGS: 00010086
[95473.185784] RAX: 000000000000003d RBX: ffff9c06d2da0018 RCX: 0000000000000007
[95473.185785] RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff9c0f6144dd60
[95473.185786] RBP: ffffa815102b7a48 R08: 0000000000000002 R09: 0000000000000000
[95473.185787] R10: 0000000000000000 R11: ffffffffa8f34e67 R12: ffff9c06d2da8f20
[95473.185788] R13: ffffa815102b7a68 R14: ffff9c0f3c62e0a0 R15: 0000000000000000
[95473.185789] FS:  00007fa1d9ede700(0000) GS:ffff9c0f61440000(0000) knlGS:0000000000000000
[95473.185790] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[95473.185792] CR2: 00007fcbb5ecf5dc CR3: 0000000361d10000 CR4: 00000000003406e0
[95473.185793] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[95473.185794] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[95473.185795] Call Trace:
[95473.185804]  iwl_trans_pcie_alloc+0x2f2/0x7ac [iwlwifi]
[95473.185807]  ? mutex_unlock+0x22/0x34
[95473.185817]  iwl_pci_probe+0x21/0x2ce [iwlwifi]
[95473.185820]  ? _raw_spin_unlock_irqrestore+0x14/0x24
[95473.185822]  ? __pm_runtime_resume+0x4d/0x58
[95473.185824]  local_pci_probe+0x3d/0x80
[95473.185827]  pci_device_probe+0x10c/0x13b
[95473.185829]  driver_probe_device+0x19b/0x3f6
[95473.185831]  __driver_attach+0x80/0xdb
[95473.185834]  ? driver_probe_device+0x3f6/0x3f6
[95473.185835]  bus_for_each_dev+0x5d/0x85
[95473.185838]  driver_attach+0x1e/0x20
[95473.185840]  bus_add_driver+0xfd/0x239
[95473.185842]  driver_register+0x88/0xbf
[95473.185844]  ? 0xffffffffc0795000
[95473.185845]  __pci_register_driver+0x4c/0x4e
[95473.185853]  iwl_pci_register_driver+0x24/0x3b [iwlwifi]
[95473.185854]  ? 0xffffffffc0795000
[95473.185862]  iwl_drv_init+0x65/0x67 [iwlwifi]
[95473.185864]  do_one_initcall+0x9f/0x156
[95473.185866]  ? slab_pre_alloc_hook+0x1a/0x44
[95473.185868]  ? slab_post_alloc_hook.isra.47+0xe/0x1d
[95473.185870]  ? kmem_cache_alloc_trace+0xec/0xfc
[95473.185873]  do_init_module+0x5f/0x1f7
[95473.185874]  load_module+0x1e53/0x257a
[95473.185876]  ? strstarts+0x28/0x28
[95473.185879]  SYSC_finit_module+0x8c/0xb9
[95473.185880]  ? SYSC_finit_module+0x8c/0xb9
[95473.185882]  SyS_finit_module+0xe/0x10
[95473.185884]  do_syscall_64+0x6b/0x7d
[95473.185886]  entry_SYSCALL64_slow_path+0x25/0x25
[95473.185887] RIP: 0033:0x7fa1d9a4c119
[95473.185888] RSP: 002b:00007ffde7ac7c38 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[95473.185889] RAX: ffffffffffffffda RBX: 0000560413f35370 RCX: 00007fa1d9a4c119
[95473.185890] RDX: 0000000000000000 RSI: 00005604139b2246 RDI: 0000000000000004
[95473.185891] RBP: 00005604139b2246 R08: 0000000000000000 R09: 0000000000000000
[95473.185892] R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000000000
[95473.185893] R13: 0000560413f37690 R14: 0000000000040000 R15: 0000000000040000
[95473.185896] Code: 80 3d 0a 9a 01 00 00 75 24 48 89 df be 24 00 00 00 c6 05 f9 99 01 00 01 e8 da 38 ff ff 48 c7 c7 7a 10 88 c0 89 c6 e8 6f e5 8c e7 <0f> ff 49 8b 75 00 4c 89 e7 e8 1e cb e8 e7 31 c0 5b 41 5c 41 5d 
[95473.185916] ---[ end trace 6b63fed5320656d4 ]---
[95473.185963] iwlwifi 0000:04:00.0: pci_enable_msi failed - -22
[95473.186841] iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-30.ucode failed with error -2
[95473.186844] iwlwifi 0000:04:00.0: Falling back to user helper
[95473.187284] iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-29.ucode failed with error -2
[95473.187287] iwlwifi 0000:04:00.0: Falling back to user helper
[95473.187629] iwlwifi 0000:04:00.0: Direct firmware load for iwlwifi-8000C-28.ucode failed with error -2
[95473.187632] iwlwifi 0000:04:00.0: Falling back to user helper
[95473.189268] iwlwifi 0000:04:00.0: capa flags index 3 larger than supported by driver
[95473.190270] iwlwifi 0000:04:00.0: loaded firmware version 27.455470.0 op_mode iwlmvm
[95473.929483] e1000e 0000:00:1f.6 eth0: Error reading PHY register
[95473.934735] iwlwifi 0000:04:00.0: Detected Intel(R) Dual Band Wireless AC 8260, REV=0xFFFC
[95473.936779] iwlwifi 0000:04:00.0: L1 Enabled - LTR Enabled
[95473.936877] iwlwifi 0000:04:00.0: L1 Enabled - LTR Enabled
[95474.171371] EXT4-fs (sda1): re-mounted. Opts: stripe=128,data=ordered,commit=600
[95474.824009] e1000e 0000:00:1f.6 eth0: Error reading PHY register
[95474.991769] iwlwifi 0000:04:00.0: Could not load the [0] uCode section
[95474.991809] iwlwifi 0000:04:00.0: Failed to start INIT ucode: -5
[95475.624341] e1000e 0000:00:1f.6 eth0: Error reading PHY register
[95476.424545] e1000e 0000:00:1f.6 eth0: Error reading PHY register
[95477.223796] e1000e 0000:00:1f.6 eth0: Error reading PHY register
[95477.397905] iwlwifi 0000:04:00.0: Failed to run INIT ucode: -5
[95477.397933] iwlwifi 0000:04:00.0: L1 Enabled - LTR Enabled
-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901

^ permalink raw reply

* Re: [PATCH] ath10k: rebuild crypto header in RX data frames
From: Sebastian Gottschall @ 2017-10-20 20:11 UTC (permalink / raw)
  To: Kalle Valo, ath10k; +Cc: linux-wireless
In-Reply-To: <150851690590.5158.11970481736247725763.stgit@potku.adurom.net>

i suggest the following patch on top of yours. please tell me if my 
thoughts are correct here. its mainly a guess

--- htt_rx.c    (revision 3656)
+++ htt_rx.c    (working copy)
@@ -550,6 +550,11 @@
                 return IEEE80211_TKIP_IV_LEN;
         case HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2:
                 return IEEE80211_CCMP_HDR_LEN;
+       case HTT_RX_MPDU_ENCRYPT_AES_CCMP_256:
+               return IEEE80211_CCMP_256_HDR_LEN;
+       case HTT_RX_MPDU_ENCRYPT_AES_GCMP_128:
+       case HTT_RX_MPDU_ENCRYPT_AES_GCMP_256:
+               return IEEE80211_GCMP_HDR_LEN;
         case HTT_RX_MPDU_ENCRYPT_WEP128:
         case HTT_RX_MPDU_ENCRYPT_WAPI:
                 break;
@@ -575,6 +580,11 @@
                 return IEEE80211_TKIP_ICV_LEN;
         case HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2:
                 return IEEE80211_CCMP_MIC_LEN;
+       case HTT_RX_MPDU_ENCRYPT_AES_CCMP_256:
+               return IEEE80211_CCMP_256_MIC_LEN;
+       case HTT_RX_MPDU_ENCRYPT_AES_GCMP_128:
+       case HTT_RX_MPDU_ENCRYPT_AES_GCMP_256:
+               return IEEE80211_GCMP_MIC_LEN;
         case HTT_RX_MPDU_ENCRYPT_WEP128:
         case HTT_RX_MPDU_ENCRYPT_WAPI:
                 break;
@@ -1012,6 +1022,7 @@
                 return;
         case HTT_RX_MPDU_ENCRYPT_WEP40:
         case HTT_RX_MPDU_ENCRYPT_WEP104:
+       case HTT_RX_MPDU_ENCRYPT_WEP128:
                 hdr = skb_push(msdu, IEEE80211_WEP_IV_LEN);
                 memcpy(hdr, rxd->mpdu_start.pn, IEEE80211_WEP_IV_LEN - 1);
                 hdr[3] = rxd->msdu_end.common.key_id_octet;
@@ -1032,7 +1043,21 @@
                 hdr[3] = 0x20 | (rxd->msdu_end.common.key_id_octet << 6);
                 memcpy(hdr + 4, rxd->mpdu_start.pn + 2, 4);
                 return;
-       case HTT_RX_MPDU_ENCRYPT_WEP128:
+       case HTT_RX_MPDU_ENCRYPT_AES_CCMP_256:
+               hdr = skb_push(msdu, IEEE80211_CCMP_256_HDR_LEN);
+               memcpy(hdr, rxd->mpdu_start.pn, 2);
+               hdr[2] = 0;
+               hdr[3] = 0x20 | (rxd->msdu_end.common.key_id_octet << 6);
+               memcpy(hdr + 4, rxd->mpdu_start.pn + 2, 4);
+               return;
+       case HTT_RX_MPDU_ENCRYPT_AES_GCMP_128:
+       case HTT_RX_MPDU_ENCRYPT_AES_GCMP_256:
+               hdr = skb_push(msdu, IEEE80211_GCMP_HDR_LEN);
+               memcpy(hdr, rxd->mpdu_start.pn, 2);
+               hdr[2] = 0;
+               hdr[3] = 0x20 | (rxd->msdu_end.common.key_id_octet << 6);
+               memcpy(hdr + 4, rxd->mpdu_start.pn + 2, 4);
+               return;
         case HTT_RX_MPDU_ENCRYPT_WAPI:
                 return;
         default:
@@ -1098,16 +1123,41 @@
         hdr = (void *)msdu->data;

         /* MIC */
-       if ((status->flag & RX_FLAG_MIC_STRIPPED) &&
-           enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2)
-               skb_trim(msdu, msdu->len - 8);
-
+       if (status->flag & RX_FLAG_MIC_STRIPPED) {
+           switch(enctype)
+           {
+           case HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2:
+           skb_trim(msdu, msdu->len - IEEE80211_CCMP_MIC_LEN);
+           break;
+           case HTT_RX_MPDU_ENCRYPT_AES_CCMP_256:
+           skb_trim(msdu, msdu->len - IEEE80211_CCMP_256_MIC_LEN);
+           break;
+           case HTT_RX_MPDU_ENCRYPT_AES_GCMP_128:
+           skb_trim(msdu, msdu->len - IEEE80211_GCMP_MIC_LEN);
+           break;
+           case HTT_RX_MPDU_ENCRYPT_AES_GCMP_256:
+           skb_trim(msdu, msdu->len - IEEE80211_GCMP_MIC_LEN);
+           break;
+           default:
+           break;
+           }
+       }
         /* ICV */
-       if (status->flag & RX_FLAG_ICV_STRIPPED &&
-           enctype != HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2)
+       if (status->flag & RX_FLAG_ICV_STRIPPED) {
+           switch(enctype)
+           {
+           case HTT_RX_MPDU_ENCRYPT_WEP40:
+           case HTT_RX_MPDU_ENCRYPT_WEP104:
+           case HTT_RX_MPDU_ENCRYPT_TKIP_WITHOUT_MIC:
+           case HTT_RX_MPDU_ENCRYPT_WEP128:
+           case HTT_RX_MPDU_ENCRYPT_TKIP_WPA:
                 skb_trim(msdu, msdu->len -
                          ath10k_htt_rx_crypto_tail_len(ar, enctype));
-
+           break;
+           default:
+           break;
+           }
+       }
         /* MMIC */
         if ((status->flag & RX_FLAG_MMIC_STRIPPED) &&
             !ieee80211_has_morefrags(hdr->frame_control) &&
Index: rx_desc.h
===================================================================
--- rx_desc.h   (revision 3656)
+++ rx_desc.h   (working copy)
@@ -239,6 +239,9 @@
         HTT_RX_MPDU_ENCRYPT_WAPI             = 5,
         HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2     = 6,
         HTT_RX_MPDU_ENCRYPT_NONE             = 7,
+       HTT_RX_MPDU_ENCRYPT_AES_CCMP_256     = 8,
+       HTT_RX_MPDU_ENCRYPT_AES_GCMP_128     = 9,
+       HTT_RX_MPDU_ENCRYPT_AES_GCMP_256     = 10,
  };

  #define RX_MPDU_START_INFO0_PEER_IDX_MASK     0x000007ff



Am 20.10.2017 um 18:28 schrieb Kalle Valo:
> From: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
>
> RX data frames notified through HTT_T2H_MSG_TYPE_RX_IND and
> HTT_T2H_MSG_TYPE_RX_FRAG_IND expect PN/TSC check to be done
> on host (mac80211) rather than firmware. Rebuild cipher header
> in every received data frames (that are notified through those
> HTT interfaces) from the PN/TSC and key_id information available
> from rx descriptor of the first msdu of each mpdu. Skip setting
> RX_FLAG_IV_STRIPPED flag for the packets which requires mac80211
> PN/TSC check support and set appropriate RX_FLAG for stripped
> crypto tail. QCA988X, QCA9887, QCA99X0, QCA9984, QCA9888 and
> QCA4019 currently need the rebuilding of cipher header to perform
> PN/TSC check for replay attack.
>
> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
> ---
>   drivers/net/wireless/ath/ath10k/htt_rx.c |  120 ++++++++++++++++++++++++++----
>   1 file changed, 104 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
> index a3f5dc78353f..9a070ad05179 100644
> --- a/drivers/net/wireless/ath/ath10k/htt_rx.c
> +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
> @@ -995,8 +995,55 @@ static int ath10k_htt_rx_nwifi_hdrlen(struct ath10k *ar,
>   	return len;
>   }
>   
> +static void ath10k_htt_rx_build_crypto_hdr(struct ath10k *ar,
> +					   struct sk_buff *msdu,
> +					   struct htt_rx_desc *rxd,
> +					   struct ieee80211_rx_status *status,
> +					   enum htt_rx_mpdu_encrypt_type type)
> +{
> +	u8 *hdr;
> +
> +	if (!(status->flag & RX_FLAG_DECRYPTED) ||
> +	    status->flag & RX_FLAG_IV_STRIPPED)
> +		return;
> +
> +	switch (type) {
> +	case HTT_RX_MPDU_ENCRYPT_NONE:
> +		return;
> +	case HTT_RX_MPDU_ENCRYPT_WEP40:
> +	case HTT_RX_MPDU_ENCRYPT_WEP104:
> +		hdr = skb_push(msdu, IEEE80211_WEP_IV_LEN);
> +		memcpy(hdr, rxd->mpdu_start.pn, IEEE80211_WEP_IV_LEN - 1);
> +		hdr[3] = rxd->msdu_end.common.key_id_octet;
> +		return;
> +	case HTT_RX_MPDU_ENCRYPT_TKIP_WITHOUT_MIC:
> +	case HTT_RX_MPDU_ENCRYPT_TKIP_WPA:
> +		hdr = skb_push(msdu, IEEE80211_TKIP_IV_LEN);
> +		hdr[0] = rxd->mpdu_start.pn[1];
> +		hdr[1] = 0;
> +		hdr[2] = rxd->mpdu_start.pn[0];
> +		hdr[3] = 0x20 | (rxd->msdu_end.common.key_id_octet << 6);
> +		memcpy(hdr + 4, rxd->mpdu_start.pn + 2, 4);
> +		return;
> +	case HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2:
> +		hdr = skb_push(msdu, IEEE80211_CCMP_HDR_LEN);
> +		memcpy(hdr, rxd->mpdu_start.pn, 2);
> +		hdr[2] = 0;
> +		hdr[3] = 0x20 | (rxd->msdu_end.common.key_id_octet << 6);
> +		memcpy(hdr + 4, rxd->mpdu_start.pn + 2, 4);
> +		return;
> +	case HTT_RX_MPDU_ENCRYPT_WEP128:
> +	case HTT_RX_MPDU_ENCRYPT_WAPI:
> +		return;
> +	default:
> +		ath10k_warn(ar, "unsupported encryption type %d\n", type);
> +		return;
> +	}
> +}
> +
>   static void ath10k_htt_rx_h_undecap_raw(struct ath10k *ar,
>   					struct sk_buff *msdu,
> +					struct htt_rx_desc *first_rxd,
>   					struct ieee80211_rx_status *status,
>   					enum htt_rx_mpdu_encrypt_type enctype,
>   					bool is_decrypted)
> @@ -1050,8 +1097,14 @@ static void ath10k_htt_rx_h_undecap_raw(struct ath10k *ar,
>   
>   	hdr = (void *)msdu->data;
>   
> -	/* Tail */
> -	if (status->flag & RX_FLAG_IV_STRIPPED)
> +	/* MIC */
> +	if ((status->flag & RX_FLAG_MIC_STRIPPED) &&
> +	    enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2)
> +		skb_trim(msdu, msdu->len - 8);
> +
> +	/* ICV */
> +	if (status->flag & RX_FLAG_ICV_STRIPPED &&
> +	    enctype != HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2)
>   		skb_trim(msdu, msdu->len -
>   			 ath10k_htt_rx_crypto_tail_len(ar, enctype));
>   
> @@ -1075,7 +1128,9 @@ static void ath10k_htt_rx_h_undecap_raw(struct ath10k *ar,
>   static void ath10k_htt_rx_h_undecap_nwifi(struct ath10k *ar,
>   					  struct sk_buff *msdu,
>   					  struct ieee80211_rx_status *status,
> -					  const u8 first_hdr[64])
> +					  struct htt_rx_desc *first_rxd,
> +					  const u8 first_hdr[64],
> +					  enum htt_rx_mpdu_encrypt_type enctype)
>   {
>   	struct ieee80211_hdr *hdr;
>   	struct htt_rx_desc *rxd;
> @@ -1108,6 +1163,8 @@ static void ath10k_htt_rx_h_undecap_nwifi(struct ath10k *ar,
>   	ether_addr_copy(sa, ieee80211_get_SA(hdr));
>   	skb_pull(msdu, hdr_len);
>   
> +	ath10k_htt_rx_build_crypto_hdr(ar, msdu, first_rxd, status, enctype);
> +
>   	/* push original 802.11 header */
>   	hdr = (struct ieee80211_hdr *)first_hdr;
>   	hdr_len = ieee80211_hdrlen(hdr->frame_control);
> @@ -1160,6 +1217,7 @@ static void *ath10k_htt_rx_h_find_rfc1042(struct ath10k *ar,
>   static void ath10k_htt_rx_h_undecap_eth(struct ath10k *ar,
>   					struct sk_buff *msdu,
>   					struct ieee80211_rx_status *status,
> +					struct htt_rx_desc *first_rxd,
>   					const u8 first_hdr[64],
>   					enum htt_rx_mpdu_encrypt_type enctype)
>   {
> @@ -1196,6 +1254,8 @@ static void ath10k_htt_rx_h_undecap_eth(struct ath10k *ar,
>   	memcpy(skb_push(msdu, sizeof(struct rfc1042_hdr)), rfc1042,
>   	       sizeof(struct rfc1042_hdr));
>   
> +	ath10k_htt_rx_build_crypto_hdr(ar, msdu, first_rxd, status, enctype);
> +
>   	/* push original 802.11 header */
>   	hdr = (struct ieee80211_hdr *)first_hdr;
>   	hdr_len = ieee80211_hdrlen(hdr->frame_control);
> @@ -1212,7 +1272,9 @@ static void ath10k_htt_rx_h_undecap_eth(struct ath10k *ar,
>   static void ath10k_htt_rx_h_undecap_snap(struct ath10k *ar,
>   					 struct sk_buff *msdu,
>   					 struct ieee80211_rx_status *status,
> -					 const u8 first_hdr[64])
> +					 struct htt_rx_desc *first_rxd,
> +					 const u8 first_hdr[64],
> +					 enum htt_rx_mpdu_encrypt_type enctype)
>   {
>   	struct ieee80211_hdr *hdr;
>   	size_t hdr_len;
> @@ -1231,6 +1293,8 @@ static void ath10k_htt_rx_h_undecap_snap(struct ath10k *ar,
>   	skb_put(msdu, l3_pad_bytes);
>   	skb_pull(msdu, sizeof(struct amsdu_subframe_hdr) + l3_pad_bytes);
>   
> +	ath10k_htt_rx_build_crypto_hdr(ar, msdu, first_rxd, status, enctype);
> +
>   	hdr = (struct ieee80211_hdr *)first_hdr;
>   	hdr_len = ieee80211_hdrlen(hdr->frame_control);
>   	memcpy(skb_push(msdu, hdr_len), hdr, hdr_len);
> @@ -1240,6 +1304,7 @@ static void ath10k_htt_rx_h_undecap(struct ath10k *ar,
>   				    struct sk_buff *msdu,
>   				    struct ieee80211_rx_status *status,
>   				    u8 first_hdr[64],
> +				    struct htt_rx_desc *first_rxd,
>   				    enum htt_rx_mpdu_encrypt_type enctype,
>   				    bool is_decrypted)
>   {
> @@ -1263,17 +1328,20 @@ static void ath10k_htt_rx_h_undecap(struct ath10k *ar,
>   
>   	switch (decap) {
>   	case RX_MSDU_DECAP_RAW:
> -		ath10k_htt_rx_h_undecap_raw(ar, msdu, status, enctype,
> -					    is_decrypted);
> +		ath10k_htt_rx_h_undecap_raw(ar, msdu, first_rxd, status,
> +					    enctype, is_decrypted);
>   		break;
>   	case RX_MSDU_DECAP_NATIVE_WIFI:
> -		ath10k_htt_rx_h_undecap_nwifi(ar, msdu, status, first_hdr);
> +		ath10k_htt_rx_h_undecap_nwifi(ar, msdu, status, first_rxd,
> +					      first_hdr, enctype);
>   		break;
>   	case RX_MSDU_DECAP_ETHERNET2_DIX:
> -		ath10k_htt_rx_h_undecap_eth(ar, msdu, status, first_hdr, enctype);
> +		ath10k_htt_rx_h_undecap_eth(ar, msdu, status, first_rxd,
> +					    first_hdr, enctype);
>   		break;
>   	case RX_MSDU_DECAP_8023_SNAP_LLC:
> -		ath10k_htt_rx_h_undecap_snap(ar, msdu, status, first_hdr);
> +		ath10k_htt_rx_h_undecap_snap(ar, msdu, status, first_rxd,
> +					     first_hdr, enctype);
>   		break;
>   	}
>   }
> @@ -1316,7 +1384,8 @@ static void ath10k_htt_rx_h_csum_offload(struct sk_buff *msdu)
>   
>   static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
>   				 struct sk_buff_head *amsdu,
> -				 struct ieee80211_rx_status *status)
> +				 struct ieee80211_rx_status *status,
> +				 bool fill_crypt_header)
>   {
>   	struct sk_buff *first;
>   	struct sk_buff *last;
> @@ -1406,14 +1475,20 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
>   		status->flag |= RX_FLAG_DECRYPTED;
>   
>   		if (likely(!is_mgmt))
> -			status->flag |= RX_FLAG_IV_STRIPPED |
> -					RX_FLAG_MMIC_STRIPPED;
> +			status->flag |= RX_FLAG_MMIC_STRIPPED;
> +
> +		if (fill_crypt_header)
> +			status->flag |= RX_FLAG_MIC_STRIPPED |
> +					RX_FLAG_ICV_STRIPPED;
> +		else
> +			status->flag |= RX_FLAG_IV_STRIPPED;
>   }
>   
>   	skb_queue_walk(amsdu, msdu) {
>   		ath10k_htt_rx_h_csum_offload(msdu);
> -		ath10k_htt_rx_h_undecap(ar, msdu, status, first_hdr, enctype,
> -					is_decrypted);
> +		ath10k_htt_rx_h_undecap(ar, msdu, status, first_hdr,
> +					(void *)first->data - sizeof(*rxd),
> +					enctype, is_decrypted);
>   
>   		/* Undecapping involves copying the original 802.11 header back
>   		 * to sk_buff. If frame is protected and hardware has decrypted
> @@ -1424,6 +1499,9 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
>   		if (is_mgmt)
>   			continue;
>   
> +		if (fill_crypt_header)
> +			continue;
> +
>   		hdr = (void *)msdu->data;
>   		hdr->frame_control &= ~__cpu_to_le16(IEEE80211_FCTL_PROTECTED);
>   	}
> @@ -1434,6 +1512,9 @@ static void ath10k_htt_rx_h_deliver(struct ath10k *ar,
>   				    struct ieee80211_rx_status *status)
>   {
>   	struct sk_buff *msdu;
> +	struct sk_buff *first_subframe;
> +
> +	first_subframe = skb_peek(amsdu);
>   
>   	while ((msdu = __skb_dequeue(amsdu))) {
>   		/* Setup per-MSDU flags */
> @@ -1442,6 +1523,13 @@ static void ath10k_htt_rx_h_deliver(struct ath10k *ar,
>   		else
>   			status->flag |= RX_FLAG_AMSDU_MORE;
>   
> +		if (msdu == first_subframe) {
> +			first_subframe = NULL;
> +			status->flag &= ~RX_FLAG_ALLOW_SAME_PN;
> +		} else {
> +			status->flag |= RX_FLAG_ALLOW_SAME_PN;
> +		}
> +
>   		ath10k_process_rx(ar, status, msdu);
>   	}
>   }
> @@ -1584,7 +1672,7 @@ static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
>   		ath10k_htt_rx_h_unchain(ar, &amsdu);
>   
>   	ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
> -	ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
> +	ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status, true);
>   	ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
>   
>   	return num_msdus;
> @@ -1923,7 +2011,7 @@ static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb,
>   			budget_left -= skb_queue_len(&amsdu);
>   			ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id);
>   			ath10k_htt_rx_h_filter(ar, &amsdu, status);
> -			ath10k_htt_rx_h_mpdu(ar, &amsdu, status);
> +			ath10k_htt_rx_h_mpdu(ar, &amsdu, status, false);
>   			ath10k_htt_rx_h_deliver(ar, &amsdu, status);
>   			break;
>   		case -EAGAIN:
>
>

-- 
Mit freundlichen Grüssen / Regards

Sebastian Gottschall / CTO

NewMedia-NET GmbH - DD-WRT
Firmensitz:  Stubenwaldallee 21a, 64625 Bensheim
Registergericht: Amtsgericht Darmstadt, HRB 25473
Geschäftsführer: Peter Steinhäuser, Christian Scheele
http://www.dd-wrt.com
email: s.gottschall@dd-wrt.com
Tel.: +496251-582650 / Fax: +496251-5826565

^ permalink raw reply

* Re: [PATCH] ath10k: rebuild crypto header in RX data frames
From: Sebastian Gottschall @ 2017-10-20 19:43 UTC (permalink / raw)
  To: Kalle Valo, ath10k; +Cc: linux-wireless
In-Reply-To: <150851690590.5158.11970481736247725763.stgit@potku.adurom.net>

maybe this small patch hint here should help to make this patch better

--- rx_desc.h   (revision 3655)
+++ rx_desc.h   (working copy)
@@ -239,6 +239,9 @@
         HTT_RX_MPDU_ENCRYPT_WAPI             = 5,
         HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2     = 6,
         HTT_RX_MPDU_ENCRYPT_NONE             = 7,
+       HTT_RX_MPDU_ENCRYPT_AES_CCMP_256     = 8,
+       HTT_RX_MPDU_ENCRYPT_AES_GCMP_128     = 9,
+       HTT_RX_MPDU_ENCRYPT_AES_GCMP_256     = 10,

Am 20.10.2017 um 18:28 schrieb Kalle Valo:
> From: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
>
> RX data frames notified through HTT_T2H_MSG_TYPE_RX_IND and
> HTT_T2H_MSG_TYPE_RX_FRAG_IND expect PN/TSC check to be done
> on host (mac80211) rather than firmware. Rebuild cipher header
> in every received data frames (that are notified through those
> HTT interfaces) from the PN/TSC and key_id information available
> from rx descriptor of the first msdu of each mpdu. Skip setting
> RX_FLAG_IV_STRIPPED flag for the packets which requires mac80211
> PN/TSC check support and set appropriate RX_FLAG for stripped
> crypto tail. QCA988X, QCA9887, QCA99X0, QCA9984, QCA9888 and
> QCA4019 currently need the rebuilding of cipher header to perform
> PN/TSC check for replay attack.
>
> Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
> ---
>   drivers/net/wireless/ath/ath10k/htt_rx.c |  120 ++++++++++++++++++++++++++----
>   1 file changed, 104 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
> index a3f5dc78353f..9a070ad05179 100644
> --- a/drivers/net/wireless/ath/ath10k/htt_rx.c
> +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
> @@ -995,8 +995,55 @@ static int ath10k_htt_rx_nwifi_hdrlen(struct ath10k *ar,
>   	return len;
>   }
>   
> +static void ath10k_htt_rx_build_crypto_hdr(struct ath10k *ar,
> +					   struct sk_buff *msdu,
> +					   struct htt_rx_desc *rxd,
> +					   struct ieee80211_rx_status *status,
> +					   enum htt_rx_mpdu_encrypt_type type)
> +{
> +	u8 *hdr;
> +
> +	if (!(status->flag & RX_FLAG_DECRYPTED) ||
> +	    status->flag & RX_FLAG_IV_STRIPPED)
> +		return;
> +
> +	switch (type) {
> +	case HTT_RX_MPDU_ENCRYPT_NONE:
> +		return;
> +	case HTT_RX_MPDU_ENCRYPT_WEP40:
> +	case HTT_RX_MPDU_ENCRYPT_WEP104:
> +		hdr = skb_push(msdu, IEEE80211_WEP_IV_LEN);
> +		memcpy(hdr, rxd->mpdu_start.pn, IEEE80211_WEP_IV_LEN - 1);
> +		hdr[3] = rxd->msdu_end.common.key_id_octet;
> +		return;
> +	case HTT_RX_MPDU_ENCRYPT_TKIP_WITHOUT_MIC:
> +	case HTT_RX_MPDU_ENCRYPT_TKIP_WPA:
> +		hdr = skb_push(msdu, IEEE80211_TKIP_IV_LEN);
> +		hdr[0] = rxd->mpdu_start.pn[1];
> +		hdr[1] = 0;
> +		hdr[2] = rxd->mpdu_start.pn[0];
> +		hdr[3] = 0x20 | (rxd->msdu_end.common.key_id_octet << 6);
> +		memcpy(hdr + 4, rxd->mpdu_start.pn + 2, 4);
> +		return;
> +	case HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2:
> +		hdr = skb_push(msdu, IEEE80211_CCMP_HDR_LEN);
> +		memcpy(hdr, rxd->mpdu_start.pn, 2);
> +		hdr[2] = 0;
> +		hdr[3] = 0x20 | (rxd->msdu_end.common.key_id_octet << 6);
> +		memcpy(hdr + 4, rxd->mpdu_start.pn + 2, 4);
> +		return;
> +	case HTT_RX_MPDU_ENCRYPT_WEP128:
> +	case HTT_RX_MPDU_ENCRYPT_WAPI:
> +		return;
> +	default:
> +		ath10k_warn(ar, "unsupported encryption type %d\n", type);
> +		return;
> +	}
> +}
> +
>   static void ath10k_htt_rx_h_undecap_raw(struct ath10k *ar,
>   					struct sk_buff *msdu,
> +					struct htt_rx_desc *first_rxd,
>   					struct ieee80211_rx_status *status,
>   					enum htt_rx_mpdu_encrypt_type enctype,
>   					bool is_decrypted)
> @@ -1050,8 +1097,14 @@ static void ath10k_htt_rx_h_undecap_raw(struct ath10k *ar,
>   
>   	hdr = (void *)msdu->data;
>   
> -	/* Tail */
> -	if (status->flag & RX_FLAG_IV_STRIPPED)
> +	/* MIC */
> +	if ((status->flag & RX_FLAG_MIC_STRIPPED) &&
> +	    enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2)
> +		skb_trim(msdu, msdu->len - 8);
> +
> +	/* ICV */
> +	if (status->flag & RX_FLAG_ICV_STRIPPED &&
> +	    enctype != HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2)
>   		skb_trim(msdu, msdu->len -
>   			 ath10k_htt_rx_crypto_tail_len(ar, enctype));
>   
> @@ -1075,7 +1128,9 @@ static void ath10k_htt_rx_h_undecap_raw(struct ath10k *ar,
>   static void ath10k_htt_rx_h_undecap_nwifi(struct ath10k *ar,
>   					  struct sk_buff *msdu,
>   					  struct ieee80211_rx_status *status,
> -					  const u8 first_hdr[64])
> +					  struct htt_rx_desc *first_rxd,
> +					  const u8 first_hdr[64],
> +					  enum htt_rx_mpdu_encrypt_type enctype)
>   {
>   	struct ieee80211_hdr *hdr;
>   	struct htt_rx_desc *rxd;
> @@ -1108,6 +1163,8 @@ static void ath10k_htt_rx_h_undecap_nwifi(struct ath10k *ar,
>   	ether_addr_copy(sa, ieee80211_get_SA(hdr));
>   	skb_pull(msdu, hdr_len);
>   
> +	ath10k_htt_rx_build_crypto_hdr(ar, msdu, first_rxd, status, enctype);
> +
>   	/* push original 802.11 header */
>   	hdr = (struct ieee80211_hdr *)first_hdr;
>   	hdr_len = ieee80211_hdrlen(hdr->frame_control);
> @@ -1160,6 +1217,7 @@ static void *ath10k_htt_rx_h_find_rfc1042(struct ath10k *ar,
>   static void ath10k_htt_rx_h_undecap_eth(struct ath10k *ar,
>   					struct sk_buff *msdu,
>   					struct ieee80211_rx_status *status,
> +					struct htt_rx_desc *first_rxd,
>   					const u8 first_hdr[64],
>   					enum htt_rx_mpdu_encrypt_type enctype)
>   {
> @@ -1196,6 +1254,8 @@ static void ath10k_htt_rx_h_undecap_eth(struct ath10k *ar,
>   	memcpy(skb_push(msdu, sizeof(struct rfc1042_hdr)), rfc1042,
>   	       sizeof(struct rfc1042_hdr));
>   
> +	ath10k_htt_rx_build_crypto_hdr(ar, msdu, first_rxd, status, enctype);
> +
>   	/* push original 802.11 header */
>   	hdr = (struct ieee80211_hdr *)first_hdr;
>   	hdr_len = ieee80211_hdrlen(hdr->frame_control);
> @@ -1212,7 +1272,9 @@ static void ath10k_htt_rx_h_undecap_eth(struct ath10k *ar,
>   static void ath10k_htt_rx_h_undecap_snap(struct ath10k *ar,
>   					 struct sk_buff *msdu,
>   					 struct ieee80211_rx_status *status,
> -					 const u8 first_hdr[64])
> +					 struct htt_rx_desc *first_rxd,
> +					 const u8 first_hdr[64],
> +					 enum htt_rx_mpdu_encrypt_type enctype)
>   {
>   	struct ieee80211_hdr *hdr;
>   	size_t hdr_len;
> @@ -1231,6 +1293,8 @@ static void ath10k_htt_rx_h_undecap_snap(struct ath10k *ar,
>   	skb_put(msdu, l3_pad_bytes);
>   	skb_pull(msdu, sizeof(struct amsdu_subframe_hdr) + l3_pad_bytes);
>   
> +	ath10k_htt_rx_build_crypto_hdr(ar, msdu, first_rxd, status, enctype);
> +
>   	hdr = (struct ieee80211_hdr *)first_hdr;
>   	hdr_len = ieee80211_hdrlen(hdr->frame_control);
>   	memcpy(skb_push(msdu, hdr_len), hdr, hdr_len);
> @@ -1240,6 +1304,7 @@ static void ath10k_htt_rx_h_undecap(struct ath10k *ar,
>   				    struct sk_buff *msdu,
>   				    struct ieee80211_rx_status *status,
>   				    u8 first_hdr[64],
> +				    struct htt_rx_desc *first_rxd,
>   				    enum htt_rx_mpdu_encrypt_type enctype,
>   				    bool is_decrypted)
>   {
> @@ -1263,17 +1328,20 @@ static void ath10k_htt_rx_h_undecap(struct ath10k *ar,
>   
>   	switch (decap) {
>   	case RX_MSDU_DECAP_RAW:
> -		ath10k_htt_rx_h_undecap_raw(ar, msdu, status, enctype,
> -					    is_decrypted);
> +		ath10k_htt_rx_h_undecap_raw(ar, msdu, first_rxd, status,
> +					    enctype, is_decrypted);
>   		break;
>   	case RX_MSDU_DECAP_NATIVE_WIFI:
> -		ath10k_htt_rx_h_undecap_nwifi(ar, msdu, status, first_hdr);
> +		ath10k_htt_rx_h_undecap_nwifi(ar, msdu, status, first_rxd,
> +					      first_hdr, enctype);
>   		break;
>   	case RX_MSDU_DECAP_ETHERNET2_DIX:
> -		ath10k_htt_rx_h_undecap_eth(ar, msdu, status, first_hdr, enctype);
> +		ath10k_htt_rx_h_undecap_eth(ar, msdu, status, first_rxd,
> +					    first_hdr, enctype);
>   		break;
>   	case RX_MSDU_DECAP_8023_SNAP_LLC:
> -		ath10k_htt_rx_h_undecap_snap(ar, msdu, status, first_hdr);
> +		ath10k_htt_rx_h_undecap_snap(ar, msdu, status, first_rxd,
> +					     first_hdr, enctype);
>   		break;
>   	}
>   }
> @@ -1316,7 +1384,8 @@ static void ath10k_htt_rx_h_csum_offload(struct sk_buff *msdu)
>   
>   static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
>   				 struct sk_buff_head *amsdu,
> -				 struct ieee80211_rx_status *status)
> +				 struct ieee80211_rx_status *status,
> +				 bool fill_crypt_header)
>   {
>   	struct sk_buff *first;
>   	struct sk_buff *last;
> @@ -1406,14 +1475,20 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
>   		status->flag |= RX_FLAG_DECRYPTED;
>   
>   		if (likely(!is_mgmt))
> -			status->flag |= RX_FLAG_IV_STRIPPED |
> -					RX_FLAG_MMIC_STRIPPED;
> +			status->flag |= RX_FLAG_MMIC_STRIPPED;
> +
> +		if (fill_crypt_header)
> +			status->flag |= RX_FLAG_MIC_STRIPPED |
> +					RX_FLAG_ICV_STRIPPED;
> +		else
> +			status->flag |= RX_FLAG_IV_STRIPPED;
>   }
>   
>   	skb_queue_walk(amsdu, msdu) {
>   		ath10k_htt_rx_h_csum_offload(msdu);
> -		ath10k_htt_rx_h_undecap(ar, msdu, status, first_hdr, enctype,
> -					is_decrypted);
> +		ath10k_htt_rx_h_undecap(ar, msdu, status, first_hdr,
> +					(void *)first->data - sizeof(*rxd),
> +					enctype, is_decrypted);
>   
>   		/* Undecapping involves copying the original 802.11 header back
>   		 * to sk_buff. If frame is protected and hardware has decrypted
> @@ -1424,6 +1499,9 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
>   		if (is_mgmt)
>   			continue;
>   
> +		if (fill_crypt_header)
> +			continue;
> +
>   		hdr = (void *)msdu->data;
>   		hdr->frame_control &= ~__cpu_to_le16(IEEE80211_FCTL_PROTECTED);
>   	}
> @@ -1434,6 +1512,9 @@ static void ath10k_htt_rx_h_deliver(struct ath10k *ar,
>   				    struct ieee80211_rx_status *status)
>   {
>   	struct sk_buff *msdu;
> +	struct sk_buff *first_subframe;
> +
> +	first_subframe = skb_peek(amsdu);
>   
>   	while ((msdu = __skb_dequeue(amsdu))) {
>   		/* Setup per-MSDU flags */
> @@ -1442,6 +1523,13 @@ static void ath10k_htt_rx_h_deliver(struct ath10k *ar,
>   		else
>   			status->flag |= RX_FLAG_AMSDU_MORE;
>   
> +		if (msdu == first_subframe) {
> +			first_subframe = NULL;
> +			status->flag &= ~RX_FLAG_ALLOW_SAME_PN;
> +		} else {
> +			status->flag |= RX_FLAG_ALLOW_SAME_PN;
> +		}
> +
>   		ath10k_process_rx(ar, status, msdu);
>   	}
>   }
> @@ -1584,7 +1672,7 @@ static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
>   		ath10k_htt_rx_h_unchain(ar, &amsdu);
>   
>   	ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
> -	ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
> +	ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status, true);
>   	ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
>   
>   	return num_msdus;
> @@ -1923,7 +2011,7 @@ static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb,
>   			budget_left -= skb_queue_len(&amsdu);
>   			ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id);
>   			ath10k_htt_rx_h_filter(ar, &amsdu, status);
> -			ath10k_htt_rx_h_mpdu(ar, &amsdu, status);
> +			ath10k_htt_rx_h_mpdu(ar, &amsdu, status, false);
>   			ath10k_htt_rx_h_deliver(ar, &amsdu, status);
>   			break;
>   		case -EAGAIN:
>
>

-- 
Mit freundlichen Grüssen / Regards

Sebastian Gottschall / CTO

NewMedia-NET GmbH - DD-WRT
Firmensitz:  Stubenwaldallee 21a, 64625 Bensheim
Registergericht: Amtsgericht Darmstadt, HRB 25473
Geschäftsführer: Peter Steinhäuser, Christian Scheele
http://www.dd-wrt.com
email: s.gottschall@dd-wrt.com
Tel.: +496251-582650 / Fax: +496251-5826565

^ permalink raw reply

* [PATCH] net: wireless: mark expected switch fall-throughs
From: Gustavo A. R. Silva @ 2017-10-20 17:21 UTC (permalink / raw)
  To: Johannes Berg, David S. Miller
  Cc: linux-wireless, netdev, linux-kernel, Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
This code was tested by compilation only (GCC 7.2.0 was used).
Please, verify if the actual intention of the code is to fall through.

 net/wireless/chan.c        |  2 ++
 net/wireless/nl80211.c     | 10 ++++++++++
 net/wireless/scan.c        |  3 ++-
 net/wireless/wext-compat.c |  2 ++
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index eb82427..6072613 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -741,6 +741,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
 	case NL80211_CHAN_WIDTH_20:
 		if (!ht_cap->ht_supported)
 			return false;
+		/* fall through */
 	case NL80211_CHAN_WIDTH_20_NOHT:
 		prohibited_flags |= IEEE80211_CHAN_NO_20MHZ;
 		width = 20;
@@ -763,6 +764,7 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
 		cap = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
 		if (cap != IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
 			return false;
+		/* fall through */
 	case NL80211_CHAN_WIDTH_80:
 		if (!vht_cap->vht_supported)
 			return false;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index fce2cbe..a8bbb6c 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1509,6 +1509,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 		state->split_start++;
 		if (state->split)
 			break;
+		/* fall through */
 	case 1:
 		if (nla_put(msg, NL80211_ATTR_CIPHER_SUITES,
 			    sizeof(u32) * rdev->wiphy.n_cipher_suites,
@@ -1555,6 +1556,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 		state->split_start++;
 		if (state->split)
 			break;
+		/* fall through */
 	case 2:
 		if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES,
 					rdev->wiphy.interface_modes))
@@ -1562,6 +1564,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 		state->split_start++;
 		if (state->split)
 			break;
+		/* fall through */
 	case 3:
 		nl_bands = nla_nest_start(msg, NL80211_ATTR_WIPHY_BANDS);
 		if (!nl_bands)
@@ -1587,6 +1590,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 				state->chan_start++;
 				if (state->split)
 					break;
+				/* fall through */
 			default:
 				/* add frequencies */
 				nl_freqs = nla_nest_start(
@@ -1640,6 +1644,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 			state->split_start++;
 		if (state->split)
 			break;
+		/* fall through */
 	case 4:
 		nl_cmds = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_COMMANDS);
 		if (!nl_cmds)
@@ -1666,6 +1671,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 		state->split_start++;
 		if (state->split)
 			break;
+		/* fall through */
 	case 5:
 		if (rdev->ops->remain_on_channel &&
 		    (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) &&
@@ -1683,6 +1689,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 		state->split_start++;
 		if (state->split)
 			break;
+		/* fall through */
 	case 6:
 #ifdef CONFIG_PM
 		if (nl80211_send_wowlan(msg, rdev, state->split))
@@ -1693,6 +1700,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 #else
 		state->split_start++;
 #endif
+		/* fall through */
 	case 7:
 		if (nl80211_put_iftypes(msg, NL80211_ATTR_SOFTWARE_IFTYPES,
 					rdev->wiphy.software_iftypes))
@@ -1705,6 +1713,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
 		state->split_start++;
 		if (state->split)
 			break;
+		/* fall through */
 	case 8:
 		if ((rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME) &&
 		    nla_put_u32(msg, NL80211_ATTR_DEVICE_AP_SME,
@@ -4192,6 +4201,7 @@ static int parse_station_flags(struct genl_info *info,
 		params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHENTICATED) |
 					 BIT(NL80211_STA_FLAG_MFP) |
 					 BIT(NL80211_STA_FLAG_AUTHORIZED);
+		/* fall through */
 	default:
 		return -EINVAL;
 	}
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 9f0901f..ebfb6d8 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -1139,7 +1139,8 @@ cfg80211_inform_bss_data(struct wiphy *wiphy,
 	switch (ftype) {
 	case CFG80211_BSS_FTYPE_BEACON:
 		ies->from_beacon = true;
-		/* fall through to assign */
+		/* to assign */
+		/* fall through */
 	case CFG80211_BSS_FTYPE_UNKNOWN:
 		rcu_assign_pointer(tmp.pub.beacon_ies, ies);
 		break;
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 5d4a02c..a8d96e7 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -1333,6 +1333,7 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
 			wstats.qual.qual = sig + 110;
 			break;
 		}
+		/* fall through */
 	case CFG80211_SIGNAL_TYPE_UNSPEC:
 		if (sinfo.filled & BIT(NL80211_STA_INFO_SIGNAL)) {
 			wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
@@ -1341,6 +1342,7 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
 			wstats.qual.qual = sinfo.signal;
 			break;
 		}
+		/* fall through */
 	default:
 		wstats.qual.updated |= IW_QUAL_LEVEL_INVALID;
 		wstats.qual.updated |= IW_QUAL_QUAL_INVALID;
-- 
2.7.4

^ permalink raw reply related

* [PATCH] ath10k: rebuild crypto header in RX data frames
From: Kalle Valo @ 2017-10-20 16:28 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless

From: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>

RX data frames notified through HTT_T2H_MSG_TYPE_RX_IND and
HTT_T2H_MSG_TYPE_RX_FRAG_IND expect PN/TSC check to be done
on host (mac80211) rather than firmware. Rebuild cipher header
in every received data frames (that are notified through those
HTT interfaces) from the PN/TSC and key_id information available
from rx descriptor of the first msdu of each mpdu. Skip setting
RX_FLAG_IV_STRIPPED flag for the packets which requires mac80211
PN/TSC check support and set appropriate RX_FLAG for stripped
crypto tail. QCA988X, QCA9887, QCA99X0, QCA9984, QCA9888 and
QCA4019 currently need the rebuilding of cipher header to perform
PN/TSC check for replay attack.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c |  120 ++++++++++++++++++++++++++----
 1 file changed, 104 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index a3f5dc78353f..9a070ad05179 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -995,8 +995,55 @@ static int ath10k_htt_rx_nwifi_hdrlen(struct ath10k *ar,
 	return len;
 }
 
+static void ath10k_htt_rx_build_crypto_hdr(struct ath10k *ar,
+					   struct sk_buff *msdu,
+					   struct htt_rx_desc *rxd,
+					   struct ieee80211_rx_status *status,
+					   enum htt_rx_mpdu_encrypt_type type)
+{
+	u8 *hdr;
+
+	if (!(status->flag & RX_FLAG_DECRYPTED) ||
+	    status->flag & RX_FLAG_IV_STRIPPED)
+		return;
+
+	switch (type) {
+	case HTT_RX_MPDU_ENCRYPT_NONE:
+		return;
+	case HTT_RX_MPDU_ENCRYPT_WEP40:
+	case HTT_RX_MPDU_ENCRYPT_WEP104:
+		hdr = skb_push(msdu, IEEE80211_WEP_IV_LEN);
+		memcpy(hdr, rxd->mpdu_start.pn, IEEE80211_WEP_IV_LEN - 1);
+		hdr[3] = rxd->msdu_end.common.key_id_octet;
+		return;
+	case HTT_RX_MPDU_ENCRYPT_TKIP_WITHOUT_MIC:
+	case HTT_RX_MPDU_ENCRYPT_TKIP_WPA:
+		hdr = skb_push(msdu, IEEE80211_TKIP_IV_LEN);
+		hdr[0] = rxd->mpdu_start.pn[1];
+		hdr[1] = 0;
+		hdr[2] = rxd->mpdu_start.pn[0];
+		hdr[3] = 0x20 | (rxd->msdu_end.common.key_id_octet << 6);
+		memcpy(hdr + 4, rxd->mpdu_start.pn + 2, 4);
+		return;
+	case HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2:
+		hdr = skb_push(msdu, IEEE80211_CCMP_HDR_LEN);
+		memcpy(hdr, rxd->mpdu_start.pn, 2);
+		hdr[2] = 0;
+		hdr[3] = 0x20 | (rxd->msdu_end.common.key_id_octet << 6);
+		memcpy(hdr + 4, rxd->mpdu_start.pn + 2, 4);
+		return;
+	case HTT_RX_MPDU_ENCRYPT_WEP128:
+	case HTT_RX_MPDU_ENCRYPT_WAPI:
+		return;
+	default:
+		ath10k_warn(ar, "unsupported encryption type %d\n", type);
+		return;
+	}
+}
+
 static void ath10k_htt_rx_h_undecap_raw(struct ath10k *ar,
 					struct sk_buff *msdu,
+					struct htt_rx_desc *first_rxd,
 					struct ieee80211_rx_status *status,
 					enum htt_rx_mpdu_encrypt_type enctype,
 					bool is_decrypted)
@@ -1050,8 +1097,14 @@ static void ath10k_htt_rx_h_undecap_raw(struct ath10k *ar,
 
 	hdr = (void *)msdu->data;
 
-	/* Tail */
-	if (status->flag & RX_FLAG_IV_STRIPPED)
+	/* MIC */
+	if ((status->flag & RX_FLAG_MIC_STRIPPED) &&
+	    enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2)
+		skb_trim(msdu, msdu->len - 8);
+
+	/* ICV */
+	if (status->flag & RX_FLAG_ICV_STRIPPED &&
+	    enctype != HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2)
 		skb_trim(msdu, msdu->len -
 			 ath10k_htt_rx_crypto_tail_len(ar, enctype));
 
@@ -1075,7 +1128,9 @@ static void ath10k_htt_rx_h_undecap_raw(struct ath10k *ar,
 static void ath10k_htt_rx_h_undecap_nwifi(struct ath10k *ar,
 					  struct sk_buff *msdu,
 					  struct ieee80211_rx_status *status,
-					  const u8 first_hdr[64])
+					  struct htt_rx_desc *first_rxd,
+					  const u8 first_hdr[64],
+					  enum htt_rx_mpdu_encrypt_type enctype)
 {
 	struct ieee80211_hdr *hdr;
 	struct htt_rx_desc *rxd;
@@ -1108,6 +1163,8 @@ static void ath10k_htt_rx_h_undecap_nwifi(struct ath10k *ar,
 	ether_addr_copy(sa, ieee80211_get_SA(hdr));
 	skb_pull(msdu, hdr_len);
 
+	ath10k_htt_rx_build_crypto_hdr(ar, msdu, first_rxd, status, enctype);
+
 	/* push original 802.11 header */
 	hdr = (struct ieee80211_hdr *)first_hdr;
 	hdr_len = ieee80211_hdrlen(hdr->frame_control);
@@ -1160,6 +1217,7 @@ static void *ath10k_htt_rx_h_find_rfc1042(struct ath10k *ar,
 static void ath10k_htt_rx_h_undecap_eth(struct ath10k *ar,
 					struct sk_buff *msdu,
 					struct ieee80211_rx_status *status,
+					struct htt_rx_desc *first_rxd,
 					const u8 first_hdr[64],
 					enum htt_rx_mpdu_encrypt_type enctype)
 {
@@ -1196,6 +1254,8 @@ static void ath10k_htt_rx_h_undecap_eth(struct ath10k *ar,
 	memcpy(skb_push(msdu, sizeof(struct rfc1042_hdr)), rfc1042,
 	       sizeof(struct rfc1042_hdr));
 
+	ath10k_htt_rx_build_crypto_hdr(ar, msdu, first_rxd, status, enctype);
+
 	/* push original 802.11 header */
 	hdr = (struct ieee80211_hdr *)first_hdr;
 	hdr_len = ieee80211_hdrlen(hdr->frame_control);
@@ -1212,7 +1272,9 @@ static void ath10k_htt_rx_h_undecap_eth(struct ath10k *ar,
 static void ath10k_htt_rx_h_undecap_snap(struct ath10k *ar,
 					 struct sk_buff *msdu,
 					 struct ieee80211_rx_status *status,
-					 const u8 first_hdr[64])
+					 struct htt_rx_desc *first_rxd,
+					 const u8 first_hdr[64],
+					 enum htt_rx_mpdu_encrypt_type enctype)
 {
 	struct ieee80211_hdr *hdr;
 	size_t hdr_len;
@@ -1231,6 +1293,8 @@ static void ath10k_htt_rx_h_undecap_snap(struct ath10k *ar,
 	skb_put(msdu, l3_pad_bytes);
 	skb_pull(msdu, sizeof(struct amsdu_subframe_hdr) + l3_pad_bytes);
 
+	ath10k_htt_rx_build_crypto_hdr(ar, msdu, first_rxd, status, enctype);
+
 	hdr = (struct ieee80211_hdr *)first_hdr;
 	hdr_len = ieee80211_hdrlen(hdr->frame_control);
 	memcpy(skb_push(msdu, hdr_len), hdr, hdr_len);
@@ -1240,6 +1304,7 @@ static void ath10k_htt_rx_h_undecap(struct ath10k *ar,
 				    struct sk_buff *msdu,
 				    struct ieee80211_rx_status *status,
 				    u8 first_hdr[64],
+				    struct htt_rx_desc *first_rxd,
 				    enum htt_rx_mpdu_encrypt_type enctype,
 				    bool is_decrypted)
 {
@@ -1263,17 +1328,20 @@ static void ath10k_htt_rx_h_undecap(struct ath10k *ar,
 
 	switch (decap) {
 	case RX_MSDU_DECAP_RAW:
-		ath10k_htt_rx_h_undecap_raw(ar, msdu, status, enctype,
-					    is_decrypted);
+		ath10k_htt_rx_h_undecap_raw(ar, msdu, first_rxd, status,
+					    enctype, is_decrypted);
 		break;
 	case RX_MSDU_DECAP_NATIVE_WIFI:
-		ath10k_htt_rx_h_undecap_nwifi(ar, msdu, status, first_hdr);
+		ath10k_htt_rx_h_undecap_nwifi(ar, msdu, status, first_rxd,
+					      first_hdr, enctype);
 		break;
 	case RX_MSDU_DECAP_ETHERNET2_DIX:
-		ath10k_htt_rx_h_undecap_eth(ar, msdu, status, first_hdr, enctype);
+		ath10k_htt_rx_h_undecap_eth(ar, msdu, status, first_rxd,
+					    first_hdr, enctype);
 		break;
 	case RX_MSDU_DECAP_8023_SNAP_LLC:
-		ath10k_htt_rx_h_undecap_snap(ar, msdu, status, first_hdr);
+		ath10k_htt_rx_h_undecap_snap(ar, msdu, status, first_rxd,
+					     first_hdr, enctype);
 		break;
 	}
 }
@@ -1316,7 +1384,8 @@ static void ath10k_htt_rx_h_csum_offload(struct sk_buff *msdu)
 
 static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
 				 struct sk_buff_head *amsdu,
-				 struct ieee80211_rx_status *status)
+				 struct ieee80211_rx_status *status,
+				 bool fill_crypt_header)
 {
 	struct sk_buff *first;
 	struct sk_buff *last;
@@ -1406,14 +1475,20 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
 		status->flag |= RX_FLAG_DECRYPTED;
 
 		if (likely(!is_mgmt))
-			status->flag |= RX_FLAG_IV_STRIPPED |
-					RX_FLAG_MMIC_STRIPPED;
+			status->flag |= RX_FLAG_MMIC_STRIPPED;
+
+		if (fill_crypt_header)
+			status->flag |= RX_FLAG_MIC_STRIPPED |
+					RX_FLAG_ICV_STRIPPED;
+		else
+			status->flag |= RX_FLAG_IV_STRIPPED;
 }
 
 	skb_queue_walk(amsdu, msdu) {
 		ath10k_htt_rx_h_csum_offload(msdu);
-		ath10k_htt_rx_h_undecap(ar, msdu, status, first_hdr, enctype,
-					is_decrypted);
+		ath10k_htt_rx_h_undecap(ar, msdu, status, first_hdr,
+					(void *)first->data - sizeof(*rxd),
+					enctype, is_decrypted);
 
 		/* Undecapping involves copying the original 802.11 header back
 		 * to sk_buff. If frame is protected and hardware has decrypted
@@ -1424,6 +1499,9 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
 		if (is_mgmt)
 			continue;
 
+		if (fill_crypt_header)
+			continue;
+
 		hdr = (void *)msdu->data;
 		hdr->frame_control &= ~__cpu_to_le16(IEEE80211_FCTL_PROTECTED);
 	}
@@ -1434,6 +1512,9 @@ static void ath10k_htt_rx_h_deliver(struct ath10k *ar,
 				    struct ieee80211_rx_status *status)
 {
 	struct sk_buff *msdu;
+	struct sk_buff *first_subframe;
+
+	first_subframe = skb_peek(amsdu);
 
 	while ((msdu = __skb_dequeue(amsdu))) {
 		/* Setup per-MSDU flags */
@@ -1442,6 +1523,13 @@ static void ath10k_htt_rx_h_deliver(struct ath10k *ar,
 		else
 			status->flag |= RX_FLAG_AMSDU_MORE;
 
+		if (msdu == first_subframe) {
+			first_subframe = NULL;
+			status->flag &= ~RX_FLAG_ALLOW_SAME_PN;
+		} else {
+			status->flag |= RX_FLAG_ALLOW_SAME_PN;
+		}
+
 		ath10k_process_rx(ar, status, msdu);
 	}
 }
@@ -1584,7 +1672,7 @@ static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt)
 		ath10k_htt_rx_h_unchain(ar, &amsdu);
 
 	ath10k_htt_rx_h_filter(ar, &amsdu, rx_status);
-	ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status);
+	ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status, true);
 	ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status);
 
 	return num_msdus;
@@ -1923,7 +2011,7 @@ static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb,
 			budget_left -= skb_queue_len(&amsdu);
 			ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id);
 			ath10k_htt_rx_h_filter(ar, &amsdu, status);
-			ath10k_htt_rx_h_mpdu(ar, &amsdu, status);
+			ath10k_htt_rx_h_mpdu(ar, &amsdu, status, false);
 			ath10k_htt_rx_h_deliver(ar, &amsdu, status);
 			break;
 		case -EAGAIN:

^ permalink raw reply related

* [PATCH v2] wireless-regdb: Add 5 Ghz rules for Kazakhstan (KZ)
From: Seth Forshee @ 2017-10-20 15:06 UTC (permalink / raw)
  To: wireless-regdb, linux-wireless
  Cc: Андрей Иванов

Add rules for 5150-5250 MHz, 5250-5350 MHz, and 5470-5725 Mhz
based on the documents at [1] and [2].

v2: Also add DFS region

[1] http://mic.gov.kz/sites/default/files/pages/pravila_prisvoeniya_polos_chastot_no34.pdf
[2] http://adilet.zan.kz/rus/docs/P000001379_

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 db.txt | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/db.txt b/db.txt
index 9d129f2e542b..10c84ee1ca5d 100644
--- a/db.txt
+++ b/db.txt
@@ -691,8 +691,14 @@ country KY: DFS-FCC
 	(5490 - 5730 @ 160), (24), DFS
 	(5735 - 5835 @ 80), (30)
 
-country KZ:
+# Source:
+# http://mic.gov.kz/sites/default/files/pages/pravila_prisvoeniya_polos_chastot_no34.pdf
+# http://adilet.zan.kz/rus/docs/P000001379_
+country KZ: DFS-ETSI
 	(2402 - 2482 @ 40), (20)
+	(5150 - 5250 @ 80), (20), NO-OUTDOOR, AUTO-BW
+	(5250 - 5350 @ 80), (20), NO-OUTDOOR, DFS, AUTO-BW
+	(5470 - 5725 @ 80), (20), NO-OUTDOOR, DFS
 
 country LB: DFS-FCC
 	(2402 - 2482 @ 40), (20)
-- 
2.14.1

^ permalink raw reply related

* Re: pull-request: iwlwifi-next 2017-10-18
From: Kalle Valo @ 2017-10-20 12:51 UTC (permalink / raw)
  To: Luca Coelho; +Cc: linux-wireless, linuxwifi
In-Reply-To: <1508322604.5497.156.camel@coelho.fi>

Luca Coelho <luca@coelho.fi> writes:

> Hi Kalle,
>
> Here's the second batch of patches intended for v4.15.  It contains the
> last patch set I send out with v2 of the lq_color patch.
>
> I have sent this out before and kbuildbot reported success.
>
> Please let me know if there are any issues.
>
> Cheers,
> Luca.
>
>
> The following changes since commit 66cc044249603e12e1dbba347f03bdbc9f171fdf:
>
>   bcma: use bcma_debug and pr_cont in MIPS driver (2017-10-17 17:22:07 +0300)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git tags/iwlwifi-next-for-kalle-2017-10-18
>
> for you to fetch changes up to 3c798a45318e098e9937b0fee1e0cf986174fbbe:
>
>   iwlwifi: pcie: remove set but not used variable tcph (2017-10-18 13:02:01 +0300)
>
> ----------------------------------------------------------------
> Second batch of iwlwifi patches for 4.15
>
> * Allocate reorder buffer dynamically to save memory;
> * Fix a FW dump problem in the A000 family;
> * Fix for a statistics gathering issue (v2);
> * Sort the list of 9000 devices to make it easier to find entries;
> * A couple of cleanups in the FW dump code;
> * Remove some unnecessary variables and fields and calculations;
>
> ----------------------------------------------------------------

Pulled, thanks.

-- 
Kalle Valo

^ permalink raw reply

* Re: [wireless-regdb] [PATCH] wireless-regdb: Add 5 Ghz rules for Kazakhstan (KZ)
From: Seth Forshee @ 2017-10-20 12:38 UTC (permalink / raw)
  To: Ryan Mounce
  Cc: wireless-regdb, linux-wireless,
	Андрей Иванов
In-Reply-To: <CAN+fvRZo6UtqDZN2Mhukx8EOiO+JcpSBvbM3RRka4kzscWjLDA@mail.gmail.com>

On Fri, Oct 20, 2017 at 09:48:25AM +1030, Ryan Mounce wrote:
> This is missing the DFS domain, which is almost certainly DFS-ETSI as
> KZ is in ITU region 1.

D'oh, I did forget that, good catch. I'll send out an update.

> 
> Regards,
> Ryan Mounce
> 
> On 20 October 2017 at 08:08, Seth Forshee <seth.forshee@canonical.com> wrote:
> > Add rules for 5150-5250 MHz, 5250-5350 MHz, and 5470-5725 Mhz
> > based on the documents at [1] and [2].
> >
> > [1] http://mic.gov.kz/sites/default/files/pages/pravila_prisvoeniya_polos_chastot_no34.pdf
> > [2] http://adilet.zan.kz/rus/docs/P000001379_
> >
> > Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> > ---
> >  db.txt | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/db.txt b/db.txt
> > index e48f9a619651..96d8fda44284 100644
> > --- a/db.txt
> > +++ b/db.txt
> > @@ -689,8 +689,14 @@ country KY: DFS-FCC
> >         (5490 - 5730 @ 160), (24), DFS
> >         (5735 - 5835 @ 80), (30)
> >
> > +# Source:
> > +# http://mic.gov.kz/sites/default/files/pages/pravila_prisvoeniya_polos_chastot_no34.pdf
> > +# http://adilet.zan.kz/rus/docs/P000001379_
> >  country KZ:
> >         (2402 - 2482 @ 40), (20)
> > +       (5150 - 5250 @ 80), (20), NO-OUTDOOR, AUTO-BW
> > +       (5250 - 5350 @ 80), (20), NO-OUTDOOR, DFS, AUTO-BW
> > +       (5470 - 5725 @ 80), (20), NO-OUTDOOR, DFS
> >
> >  country LB: DFS-FCC
> >         (2402 - 2482 @ 40), (20)
> > --
> > 2.14.1
> >
> >
> > _______________________________________________
> > wireless-regdb mailing list
> > wireless-regdb@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/wireless-regdb

^ permalink raw reply

* Re: wireless-regdb: Update regulatory rules for Kazakhstan (KZ) on 5GHz
From: Seth Forshee @ 2017-10-20 12:37 UTC (permalink / raw)
  To: Андрей Иванов
  Cc: wireless-regdb, linux-wireless
In-Reply-To: <1508468195.404356859@f451.i.mail.ru>

On Fri, Oct 20, 2017 at 05:56:35AM +0300, Андрей Иванов wrote:
> Thank you very much, I'm so glad. Last question how many days this patch will appear here :  https://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git/tree/db.txt  

I'll probably leave the patch out a few working days to see if anyone
has feedback. Given that today's Friday that means probably mid next
week.

^ permalink raw reply

* Re: pull-request: wireless-drivers-next 2017-10-18
From: David Miller @ 2017-10-20  7:37 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <87fuagiygo.fsf@kamboji.qca.qualcomm.com>

From: Kalle Valo <kvalo@codeaurora.org>
Date: Wed, 18 Oct 2017 12:42:31 +0300

> this for 4.15 stream to net-next tree. Please let me know if there are
> any problems.

Pulled, thanks Kalle.

^ permalink raw reply

* Re: After upgrading to 4.11.1, wifi driver refuses to load after being unloaded once.
From: Kalle Valo @ 2017-10-20  6:35 UTC (permalink / raw)
  To: Luca Coelho; +Cc: Marc MERLIN, linux-wireless, linuxwifi
In-Reply-To: <1508322176.5497.152.camel@coelho.fi>

Luca Coelho <luca@coelho.fi> writes:

> On Wed, 2017-10-18 at 12:50 +0300, Kalle Valo wrote:
>> Luca Coelho <luca@coelho.fi> writes:
>> 
>> > On Wed, 2017-10-18 at 07:59 +0300, Kalle Valo wrote:
>> > > Luca Coelho <luca@coelho.fi> writes:
>> > > 
>> > > > On Tue, 2017-10-17 at 14:23 -0700, Marc MERLIN wrote:
>> > > > 
>> > > > > I don't know how or why, but I seem to:
>> > > > > saruman:~# grep IWLWIFI /boot/config-4.12.10-amd64-preempt-
>> > > > > sysrq-
>> > > > > 20170406 
>> > > > > CONFIG_IWLWIFI=m
>> > > > > CONFIG_IWLWIFI_LEDS=y
>> > > > > CONFIG_IWLWIFI_OPMODE_MODULAR=y
>> > > > > # CONFIG_IWLWIFI_BCAST_FILTERING is not set
>> > > > > CONFIG_IWLWIFI_PCIE_RTPM=y
>> > > > > CONFIG_IWLWIFI_DEBUG=y
>> > > > > CONFIG_IWLWIFI_DEVICE_TRACING=y
>> > > > > 
>> > > > > I'll remove that, thanks.
>> > > > 
>> > > > Cool, I think that might help.  If it doesn't, please report a
>> > > > bug
>> > > > in
>> > > > buzilla. ;)
>> > > 
>> > > But a Kconfig option should never break functionality, so IMHO
>> > > this
>> > > still sounds like a bug in iwlwifi.
>> > 
>> > The problem is that to get this to work, some changes need to be
>> > made
>> > in the platform side.  In this case, the rootport is not configured
>> > properly so it won't work.
>> 
>> Yeah, but users or distros might accidentally enable this Kconfig
>> option and break the driver unintentionally. And subtle bugs like
>> this
>> are even worse as the user will not realise that it's because of a
>> new
>> Kconfig option.
>> 
>> So I guess you can't automatically detect it the platform supports
>> RTPM,
>> right? Maybe there should be a module parameter which has to be set
>> to
>> enable this? And at least a big fat warning to the user that RTPM is
>> enabled, bugs are likely and the user has to know what she's doing.
>
> I thought this was what EXPERT was used for:
>
> menuconfig EXPERT
>         bool "Configure standard kernel features (expert users)"
>         # Unhide debug options, to make the on-by-default options visible
>         select DEBUG_KERNEL
>         help
>           This option allows certain base kernel options and settings
>           to be disabled or tweaked. This is for specialized
>           environments which can tolerate a "non-standard" kernel.
>           Only use this if you really know what you are doing.
>
>
> But it seems that it's widely used even by people/distros who don't
> know what they are doing. :(

Yeah, people seem to just blindly enable kconfig options. I don't blame
them, there are so many options and difficult to know what to choose.

> Would it be okay if we just add a printk(KERN_ERR, ...)?

I think we at least we should do that, preferably even something else to
prevent accidental use if the feature is so fragile.

-- 
Kalle Valo

^ permalink raw reply

* Re: [PATCH] ath10k: fix build errors with !CONFIG_PM
From: Kalle Valo @ 2017-10-20  6:29 UTC (permalink / raw)
  To: Brian Norris
  Cc: Ryan Hsu, Grant Grundler, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org, ath10k@lists.infradead.org,
	Arnd Bergmann
In-Reply-To: <20171019184517.GA76422@google.com>

Brian Norris <briannorris@chromium.org> writes:

> Build errors have been reported with CONFIG_PM=3Dn:
>
> drivers/net/wireless/ath/ath10k/pci.c:3416:8: error: implicit
> declaration of function 'ath10k_pci_suspend'
> [-Werror=3Dimplicit-function-declaration]
>
> drivers/net/wireless/ath/ath10k/pci.c:3428:8: error: implicit
> declaration of function 'ath10k_pci_resume'
> [-Werror=3Dimplicit-function-declaration]
>
> These are caused by the combination of the following two commits:
>
> 6af1de2e4ec4 ("ath10k: mark PM functions as __maybe_unused")
> 96378bd2c6cd ("ath10k: fix core PCI suspend when WoWLAN is supported but
> disabled")
>
> Both build fine on their own.
>
> But now that ath10k_pci_pm_{suspend,resume}() is compiled
> unconditionally, we should also compile ath10k_pci_{suspend,resume}()
> unconditionally.
>
> And drop the #ifdef around ath10k_pci_hif_{suspend,resume}() too; they
> are trivial (empty), so we're not saving much space by compiling them
> out. And the alternatives would be to sprinkle more __maybe_unused, or
> spread the #ifdef's further.
>
> Build tested with the following combinations:
> CONFIG_PM=3Dy && CONFIG_PM_SLEEP=3Dy
> CONFIG_PM=3Dy && CONFIG_PM_SLEEP=3Dn
> CONFIG_PM=3Dn
>
> Fixes: 96378bd2c6cd ("ath10k: fix core PCI suspend when WoWLAN is
> supported but disabled")
> Fixes: 096ad2a15fd8 ("Merge branch 'ath-next'")
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---
>  drivers/net/wireless/ath/ath10k/pci.c | 5 -----
>  1 file changed, 5 deletions(-)
>
> On Thu, Oct 19, 2017 at 10:12:25AM -0700, Brian Norris wrote:
>> The solution would seem to be either to kill the #ifdefs around
>> ath10k_pci_{suspend,resume}() and friends (and use __maybe_unused
>> instead, to further extend Arnd's patch), or else revert Arnd's stuff
>> and go with CONFIG_PM_SLEEP everywhere, which would resolve the original
>> warning (promoted to error) that Arnd was resolving.
>>=20
>> I can send out one of these if you'd like.
>
> Here you go :)

Thanks! As this an unusual merge problem between two branches I applied
this manually to ath.git master-pending branch for now. Let's see if
kbuild bot is happy now.

--=20
Kalle Valo=

^ permalink raw reply

* Re: ath10k: fix core PCI suspend when WoWLAN is supported but disabled
From: Kalle Valo @ 2017-10-20  6:24 UTC (permalink / raw)
  To: Brian Norris
  Cc: Ryan Hsu, Grant Grundler, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org, ath10k@lists.infradead.org,
	Arnd Bergmann
In-Reply-To: <20171019171224.GA46096@google.com>

Brian Norris <briannorris@chromium.org> writes:

> + Arnd
>
> On Thu, Oct 19, 2017 at 02:32:45PM +0000, Kalle Valo wrote:
>> Kalle Valo <kvalo@qca.qualcomm.com> writes:
>>=20
>> > Brian Norris <briannorris@chromium.org> wrote:
>> >
>> >> For devices where the FW supports WoWLAN but user-space has not
>> >> configured it, we don't do any PCI-specific suspend/resume operations=
,
>> >> because mac80211 doesn't call drv_suspend() when !wowlan. This has
>> >> particularly bad effects for some platforms, because we don't stop th=
e
>> >> power-save timer, and if this timer goes off after the PCI controller
>> >> has suspended the link, Bad Things will happen.
>> >>=20
>> >> Commit 32faa3f0ee50 ("ath10k: add the PCI PM core suspend/resume ops"=
)
>> >> got some of this right, in that it understood there was a problem on
>> >> non-WoWLAN firmware. But it forgot the $subject case.
>> >>=20
>> >> Fix this by moving all the PCI driver suspend/resume logic exclusivel=
y
>> >> into the driver PM hooks. This shouldn't affect WoWLAN support much
>> >> (this just gets executed later on).
>> >>=20
>> >> I would just as well kill the entirety of ath10k_hif_suspend(), as it=
's
>> >> not even implemented on the USB or SDIO drivers. I expect that we don=
't
>> >> need the callback, except to return "supported" (i.e., 0) or "not
>> >> supported" (i.e., -EOPNOTSUPP).
>> >>=20
>> >> Fixes: 32faa3f0ee50 ("ath10k: add the PCI PM core suspend/resume ops"=
)
>> >> Fixes: 77258d409ce4 ("ath10k: enable pci soc powersaving")
>> >> Signed-off-by: Brian Norris <briannorris@chromium.org>
>> >> Cc: Ryan Hsu <ryanhsu@qti.qualcomm.com>
>> >> Cc: Kalle Valo <kvalo@qca.qualcomm.com>
>> >> Cc: Michal Kazior <michal.kazior@tieto.com>
>> >> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
>> >
>> > Patch applied to ath-next branch of ath.git, thanks.
>> >
>> > 96378bd2c6cd ath10k: fix core PCI suspend when WoWLAN is supported but=
 disabled
>>=20
>> Kbuild found a build problem, I suspect it's caused by this patch:
>
> Actually, it's the interaction of this patch and Arnd's patch:
>
> 6af1de2e4ec4 ath10k: mark PM functions as __maybe_unused
>
> I see that's now in these branches:
>
>   ath/ath-current
>   ath/ath-qca
>   ath/master
>   ath/master-pending
>   wireless-drivers-next/master
>   wireless-drivers-next/pending
>
> Whereas mine got applied to:
>
>   ath/ath-next
>
> So technically, the problem is in your merge here :)
>
> 096ad2a15fd8 Merge branch 'ath-next'

Ah, that's why kbuild bot didn't report about this problem while your
patch was in my pending branch. And I was also really puzzled why it
claimed that my merge was at fault :) Thanks for the good explanation.

Just to clarify: ath-current is for patches going to 4.14 and ath-next
to 4.15, that's why they were applied to a different branch.

>> drivers/net/wireless/ath/ath10k/pci.c:3416:8: error: implicit
>> declaration of function 'ath10k_pci_suspend'
>> [-Werror=3Dimplicit-function-declaration]
>>=20
>> drivers/net/wireless/ath/ath10k/pci.c:3428:8: error: implicit
>> declaration of function 'ath10k_pci_resume'
>> [-Werror=3Dimplicit-function-declaration]
>>=20
>> http://lists.infradead.org/pipermail/ath10k/2017-October/010269.html
>>=20
>> The .config.gz there doesn't have CONFIG_PM set, maybe that's the
>> problem?
>
> Yes, indirectly that's also the problem.
>
> The solution would seem to be either to kill the #ifdefs around
> ath10k_pci_{suspend,resume}() and friends (and use __maybe_unused
> instead, to further extend Arnd's patch), or else revert Arnd's stuff
> and go with CONFIG_PM_SLEEP everywhere, which would resolve the original
> warning (promoted to error) that Arnd was resolving.
>
> I can send out one of these if you'd like.

I see that you already sent the patch, thanks!

--=20
Kalle Valo=

^ permalink raw reply

* RE: [PATCH V6 1/5] mac80211: Enable TDLS peer buffer STA feature
From: Yingying Tang @ 2017-10-20  3:34 UTC (permalink / raw)
  To: Johannes Berg, ath10k@lists.infradead.org; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <1508322936.2674.19.camel@sipsolutions.net>

SGkgSm9oYW5uZXMsDQoNCkkgaGF2ZSBidWlsdCBhbmQgdGVzdGVkIGl0LCBpdCBjYW4gd29yaw0K
DQotLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KRnJvbTogSm9oYW5uZXMgQmVyZyBbbWFpbHRv
OmpvaGFubmVzQHNpcHNvbHV0aW9ucy5uZXRdIA0KU2VudDogV2VkbmVzZGF5LCBPY3RvYmVyIDE4
LCAyMDE3IDY6MzYgUE0NClRvOiBZaW5neWluZyBUYW5nIDx5aW50YW5nQHF0aS5xdWFsY29tbS5j
b20+OyBhdGgxMGtAbGlzdHMuaW5mcmFkZWFkLm9yZw0KQ2M6IGxpbnV4LXdpcmVsZXNzQHZnZXIu
a2VybmVsLm9yZw0KU3ViamVjdDogUmU6IFtQQVRDSCBWNiAxLzVdIG1hYzgwMjExOiBFbmFibGUg
VERMUyBwZWVyIGJ1ZmZlciBTVEEgZmVhdHVyZQ0KDQpPbiBNb24sIDIwMTctMTAtMTYgYXQgMTQ6
MDAgKzA4MDAsIHlpbnRhbmdAcXRpLnF1YWxjb21tLmNvbSB3cm90ZToNCj4gRnJvbTogWWluZ3lp
bmcgVGFuZyA8eWludGFuZ0BxdGkucXVhbGNvbW0uY29tPg0KPiANCj4gRW5hYmxlIFRETFMgcGVl
ciBidWZmZXIgU1RBIGZlYXR1cmUuDQo+IFNldCBleHRlbmRlZCBjYXBhYmlsaXR5IGJpdCB0byBl
bmFibGUgYnVmZmVyIFNUQSB3aGVuIGRyaXZlciBzdXBwb3J0IA0KPiBpdC4NCg0KSXQgd291bGQg
aGVscCBpZiB5b3UgY291bGQgKGJ1aWxkKSB0ZXN0IHlvdXIgY2hhbmdlcyA6LSkNCg0Kam9oYW5u
ZXMNCg==

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox