Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1456376 > unrolled thread

[PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

Started byMaxim Altshul <maxim.altshul@ti.com>
First post2016-08-04 14:40 +0200
Last post2016-08-05 14:30 +0200
Articles 15 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput Maxim Altshul <maxim.altshul@ti.com> - 2016-08-04 14:40 +0200
    [PATCH 2/2] wlcore: Remove wl pointer from wl_sta structure Maxim Altshul <maxim.altshul@ti.com> - 2016-08-04 14:50 +0200
      Re: [PATCH 2/2] wlcore: Remove wl pointer from wl_sta structure John Stultz <john.stultz@linaro.org> - 2016-08-04 23:40 +0200
    Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput John Stultz <john.stultz@linaro.org> - 2016-08-04 23:40 +0200
      Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to  get_expected_throughput Johannes Berg <johannes@sipsolutions.net> - 2016-08-05 07:50 +0200
        Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput John Stultz <john.stultz@linaro.org> - 2016-08-05 08:10 +0200
    Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to  get_expected_throughput Johannes Berg <johannes@sipsolutions.net> - 2016-08-05 14:30 +0200
      RE: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to  get_expected_throughput "Altshul, Maxim" <maxim.altshul@ti.com> - 2016-08-05 15:30 +0200
        Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to  get_expected_throughput Johannes Berg <johannes@sipsolutions.net> - 2016-08-05 17:40 +0200
          RE: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to  get_expected_throughput "Altshul, Maxim" <maxim.altshul@ti.com> - 2016-08-07 15:50 +0200
            Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to  get_expected_throughput Johannes Berg <johannes@sipsolutions.net> - 2016-08-08 08:20 +0200
              RE: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to  get_expected_throughput "Altshul, Maxim" <maxim.altshul@ti.com> - 2016-08-08 12:50 +0200
                Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to  get_expected_throughput Johannes Berg <johannes@sipsolutions.net> - 2016-08-09 10:00 +0200
                  RE: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to  get_expected_throughput "Altshul, Maxim" <maxim.altshul@ti.com> - 2016-08-10 23:00 +0200
    Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to  get_expected_throughput Johannes Berg <johannes@sipsolutions.net> - 2016-08-05 14:30 +0200

#1456376 — [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

FromMaxim Altshul <maxim.altshul@ti.com>
Date2016-08-04 14:40 +0200
Subject[PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput
Message-ID<s2q6m-DV-43@gated-at.bofh.it>
- The variable is added to allow the driver an easy access
to it's own hw->priv when the op is invoked.

- Change wlcore op accordingly.

Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
---
 drivers/net/wireless/ti/wlcore/main.c | 5 +++--
 include/net/mac80211.h                | 3 ++-
 net/mac80211/driver-ops.h             | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 4573614..1ec3545 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5803,10 +5803,11 @@ out:
 	mutex_unlock(&wl->mutex);
 }
 
-static u32 wlcore_op_get_expected_throughput(struct ieee80211_sta *sta)
+static u32 wlcore_op_get_expected_throughput(struct ieee80211_hw *hw,
+					struct ieee80211_sta *sta)
 {
 	struct wl1271_station *wl_sta = (struct wl1271_station *)sta->drv_priv;
-	struct wl1271 *wl = wl_sta->wl;
+	struct wl1271 *wl = hw->priv;
 	u8 hlid = wl_sta->hlid;
 
 	/* return in units of Kbps */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c328f35..464eb97 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3484,7 +3484,8 @@ struct ieee80211_ops {
 
 	int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
 	void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
-	u32 (*get_expected_throughput)(struct ieee80211_sta *sta);
+	u32 (*get_expected_throughput)(struct ieee80211_hw *hw,
+			struct ieee80211_sta *sta);
 	int (*get_txpower)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			   int *dbm);
 
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 154ce4b..1f75195 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1081,7 +1081,7 @@ static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
 
 	trace_drv_get_expected_throughput(sta);
 	if (local->ops->get_expected_throughput)
-		ret = local->ops->get_expected_throughput(sta);
+		ret = local->ops->get_expected_throughput(&local->hw, sta);
 	trace_drv_return_u32(local, ret);
 
 	return ret;
-- 
2.9.0

[toc] | [next] | [standalone]


#1456385 — [PATCH 2/2] wlcore: Remove wl pointer from wl_sta structure

FromMaxim Altshul <maxim.altshul@ti.com>
Date2016-08-04 14:50 +0200
Subject[PATCH 2/2] wlcore: Remove wl pointer from wl_sta structure
Message-ID<s2qg1-IE-15@gated-at.bofh.it>
In reply to#1456376
No longer needed due to get_expected_throughput op change

Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
---
 drivers/net/wireless/ti/wlcore/main.c     | 1 -
 drivers/net/wireless/ti/wlcore/wlcore_i.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 1ec3545..8589e5a 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5043,7 +5043,6 @@ static int wl12xx_sta_add(struct wl1271 *wl,
 		return ret;
 
 	wl_sta = (struct wl1271_station *)sta->drv_priv;
-	wl_sta->wl = wl;
 	hlid = wl_sta->hlid;
 
 	ret = wl12xx_cmd_add_peer(wl, wlvif, sta, hlid);
diff --git a/drivers/net/wireless/ti/wlcore/wlcore_i.h b/drivers/net/wireless/ti/wlcore/wlcore_i.h
index 3875190..8ee5206 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore_i.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore_i.h
@@ -352,7 +352,6 @@ struct wl1271_station {
 	 * Used in both AP and STA mode.
 	 */
 	u64 total_freed_pkts;
-	struct wl1271 *wl;
 };
 
 struct wl12xx_vif {
-- 
2.9.0

[toc] | [prev] | [next] | [standalone]


#1456745 — Re: [PATCH 2/2] wlcore: Remove wl pointer from wl_sta structure

FromJohn Stultz <john.stultz@linaro.org>
Date2016-08-04 23:40 +0200
SubjectRe: [PATCH 2/2] wlcore: Remove wl pointer from wl_sta structure
Message-ID<s2ywW-6QT-13@gated-at.bofh.it>
In reply to#1456385
On Thu, Aug 4, 2016 at 5:43 AM, Maxim Altshul <maxim.altshul@ti.com> wrote:
> No longer needed due to get_expected_throughput op change
>
> Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>

These two patches solve the regression I was seeing with pre-v4.8-rc1
kernels on HiKey.

Tested-by: John Stultz <john.stultz@linaro.org>

thanks
-john

[toc] | [prev] | [next] | [standalone]


#1456743

FromJohn Stultz <john.stultz@linaro.org>
Date2016-08-04 23:40 +0200
Message-ID<s2ywV-6QT-1@gated-at.bofh.it>
In reply to#1456376
On Thu, Aug 4, 2016 at 5:43 AM, Maxim Altshul <maxim.altshul@ti.com> wrote:
> - The variable is added to allow the driver an easy access
> to it's own hw->priv when the op is invoked.
>
> - Change wlcore op accordingly.
>
> Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>

These two patches solve the regression I was seeing with pre-v4.8-rc1
kernels on HiKey.

Tested-by: John Stultz <john.stultz@linaro.org>

thanks
-john

[toc] | [prev] | [next] | [standalone]


#1456882 — Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

FromJohannes Berg <johannes@sipsolutions.net>
Date2016-08-05 07:50 +0200
SubjectRe: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput
Message-ID<s2Gb8-3ph-1@gated-at.bofh.it>
In reply to#1456743
On Thu, 2016-08-04 at 14:31 -0700, John Stultz wrote:
> On Thu, Aug 4, 2016 at 5:43 AM, Maxim Altshul <maxim.altshul@ti.com>
> wrote:
> > - The variable is added to allow the driver an easy access
> > to it's own hw->priv when the op is invoked.
> > 
> > - Change wlcore op accordingly.
> > 
> > Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
> 
> These two patches solve the regression I was seeing with pre-v4.8-rc1
> kernels on HiKey.
> 

Interesting, what was the regression? Was the station pointer there not
valid?

johannes

[toc] | [prev] | [next] | [standalone]


#1456883

FromJohn Stultz <john.stultz@linaro.org>
Date2016-08-05 08:10 +0200
Message-ID<s2Guu-3KE-7@gated-at.bofh.it>
In reply to#1456882
On Thu, Aug 4, 2016 at 10:40 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Thu, 2016-08-04 at 14:31 -0700, John Stultz wrote:
>> On Thu, Aug 4, 2016 at 5:43 AM, Maxim Altshul <maxim.altshul@ti.com>
>> wrote:
>> > - The variable is added to allow the driver an easy access
>> > to it's own hw->priv when the op is invoked.
>> >
>> > - Change wlcore op accordingly.
>> >
>> > Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
>>
>> These two patches solve the regression I was seeing with pre-v4.8-rc1
>> kernels on HiKey.
>>
>
> Interesting, what was the regression? Was the station pointer there not
> valid?

Yea, a null pointer deference:
https://lkml.org/lkml/2016/7/27/712

thanks
-john

[toc] | [prev] | [next] | [standalone]


#1457070 — Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

FromJohannes Berg <johannes@sipsolutions.net>
Date2016-08-05 14:30 +0200
SubjectRe: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput
Message-ID<s2Mqd-7rU-7@gated-at.bofh.it>
In reply to#1456376
On Fri, 2016-08-05 at 14:22 +0200, Johannes Berg wrote:
> On Thu, 2016-08-04 at 15:43 +0300, Maxim Altshul wrote:
> > - The variable is added to allow the driver an easy access
> > to it's own hw->priv when the op is invoked.
> > 
> > - Change wlcore op accordingly.
> > 
> I'm applying this now, with a big BUT:
> 
> 1) your changelog is crap - I've rewritten it to indicate what's
> going
> on
> 
> 2) I think the change makes sense, but as far as fixing the bug is
> concerned it's actually completely stupid
> 
> 3) I expect you to submit a proper bugfix for mac80211 ASAP, to not
> call into the driver before the station is actually known to the
> driver.

4) please indent your code properly when submitting...

johannes

[toc] | [prev] | [next] | [standalone]


#1457094 — RE: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

From"Altshul, Maxim" <maxim.altshul@ti.com>
Date2016-08-05 15:30 +0200
SubjectRE: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput
Message-ID<s2Nmi-85e-33@gated-at.bofh.it>
In reply to#1457070
Hi,
1) Sorry about the change log, I will try to be clearer next time.

2+3) The issue is not that the station is not known, it's that wl_sta->wl was null. 
wl member is now completely removed from wl_sta (PATCH 2/2) and hw is sent directly from mac80211 to the driver (so it can get hw->priv).

4) Sorry, I just saw now that everything has a space before the line. I used checkpatch.pl and it was ok. I will be more careful next time.

BR,
Max
________________________________________
From: Johannes Berg [johannes@sipsolutions.net]
Sent: Friday, August 05, 2016 3:24 PM
To: Altshul, Maxim; linux-kernel@vger.kernel.org
Cc: john.stultz@linaro.org; Kalle Valo; Eliad Peller; Machani, Yaniv
Subject: Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

On Fri, 2016-08-05 at 14:22 +0200, Johannes Berg wrote:
> On Thu, 2016-08-04 at 15:43 +0300, Maxim Altshul wrote:
> > - The variable is added to allow the driver an easy access
> > to it's own hw->priv when the op is invoked.
> >
> > - Change wlcore op accordingly.
> >
> I'm applying this now, with a big BUT:
>
> 1) your changelog is crap - I've rewritten it to indicate what's
> going
> on
>
> 2) I think the change makes sense, but as far as fixing the bug is
> concerned it's actually completely stupid
>
> 3) I expect you to submit a proper bugfix for mac80211 ASAP, to not
> call into the driver before the station is actually known to the
> driver.

4) please indent your code properly when submitting...

johannes

[toc] | [prev] | [next] | [standalone]


#1457166 — Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

FromJohannes Berg <johannes@sipsolutions.net>
Date2016-08-05 17:40 +0200
SubjectRe: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput
Message-ID<s2Po5-Va-3@gated-at.bofh.it>
In reply to#1457094
On Fri, 2016-08-05 at 13:25 +0000, Altshul, Maxim wrote:
> Hi,
> 1) Sorry about the change log, I will try to be clearer next time.

Just mention something about how the bug happens please, at least.

> 2+3) The issue is not that the station is not known, it's that
> wl_sta->wl was null. 
> wl member is now completely removed from wl_sta (PATCH 2/2) and hw is
> sent directly from mac80211 to the driver (so it can get hw->priv).

Right, I understand that wl_sta->wl was NULL. But the driver must have
some code to assign wl_sta->wl, right? And that would be called in
add_sta or sta_state. Thus the reason for the crash would be that the
station wasn't actually known to the driver yet.

Even if that wasn't quite the reason here, I think we need to take it
into account and check sta->uploaded before calling the driver, so I'd
like you to submit a patch for that.

johannes

[toc] | [prev] | [next] | [standalone]


#1457454 — RE: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

From"Altshul, Maxim" <maxim.altshul@ti.com>
Date2016-08-07 15:50 +0200
SubjectRE: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput
Message-ID<s3wCK-4si-25@gated-at.bofh.it>
In reply to#1457166
Hi Johaness,
I have prepared a patch for the issue and it is waiting for me to send it, but I feel that maybe I have not explained the previous issue well enough or I did not understand your request fully.
I would like to clarify about the previous patch (the one that you applied) again:

a. The bug occurred because I have added a member called wl to the structure wl_sta, but it turned to be NULL when the function drv_get_expected_throughput was called.
b. This member was NULL because it was initialized in the wrong place (sta_add instead of update_sta_state), and thus the regression has failed. 
c. Even so, wl_sta itself was not NULL at any point.
d. This is why I have created two patches:
First patch (the one that you have applied) made it easy for the driver to access hw->priv (the problematic access to hw->priv was the reason I added wl to wl_sta in the first place, which was a mistake).
Second patch reverted the addition of wl member to wl_sta.
 
2. From what I have seen, other ops that take ieee80211_sta as a parameter do not check for sta->uploaded, which is why it feels a little odd to do it in drv_get_expected_throughput and nowhere else.

Please tell me how to proceed. If you still think that a patch is needed, I will send it right away!

Max


-----Original Message-----
From: Johannes Berg [mailto:johannes@sipsolutions.net] 
Sent: Friday, August 05, 2016 6:34 PM
To: Altshul, Maxim; linux-kernel@vger.kernel.org
Cc: john.stultz@linaro.org; Kalle Valo; Eliad Peller; Machani, Yaniv
Subject: Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

On Fri, 2016-08-05 at 13:25 +0000, Altshul, Maxim wrote:
> Hi,
> 1) Sorry about the change log, I will try to be clearer next time.

Just mention something about how the bug happens please, at least.

> 2+3) The issue is not that the station is not known, it's that
> wl_sta->wl was null.
> wl member is now completely removed from wl_sta (PATCH 2/2) and hw is 
> sent directly from mac80211 to the driver (so it can get hw->priv).

Right, I understand that wl_sta->wl was NULL. But the driver must have some code to assign wl_sta->wl, right? And that would be called in add_sta or sta_state. Thus the reason for the crash would be that the station wasn't actually known to the driver yet.

Even if that wasn't quite the reason here, I think we need to take it into account and check sta->uploaded before calling the driver, so I'd like you to submit a patch for that.

johannes

[toc] | [prev] | [next] | [standalone]


#1457552 — Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

FromJohannes Berg <johannes@sipsolutions.net>
Date2016-08-08 08:20 +0200
SubjectRe: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput
Message-ID<s3M4O-68L-3@gated-at.bofh.it>
In reply to#1457454
On Sun, 2016-08-07 at 13:42 +0000, Altshul, Maxim wrote:
> Hi Johaness,
> I have prepared a patch for the issue and it is waiting for me to
> send it, but I feel that maybe I have not explained the previous
> issue well enough or I did not understand your request fully.
> I would like to clarify about the previous patch (the one that you
> applied) again:
> 
> a. The bug occurred because I have added a member called wl to the
> structure wl_sta, but it turned to be NULL when the function
> drv_get_expected_throughput was called.

Right.

> b. This member was NULL because it was initialized in the wrong place
> (sta_add instead of update_sta_state), and thus the regression has
> failed. 

Ah. So you *do* in fact implement the sta_state op (op_sta_state)
instead of the sta_add op, which I thought you were using and which was
causing the error. Perhaps sta_add came from being originally called
through mac80211's sta_add op.

So in essence, in this particular case it ended up being just a driver
bug because it was initializing the pointer in the wrong place, and I
agree that the fix in mac80211 to pass the hw pointer like everywhere
else makes perfect sense.

> c. Even so, wl_sta itself was not NULL at any point.

Right.

> d. This is why I have created two patches:
> First patch (the one that you have applied) made it easy for the
> driver to access hw->priv (the problematic access to hw->priv was the
> reason I added wl to wl_sta in the first place, which was a mistake).
> Second patch reverted the addition of wl member to wl_sta.

Right.
 
> 2. From what I have seen, other ops that take ieee80211_sta as a
> parameter do not check for sta->uploaded, which is why it feels a
> little odd to do it in drv_get_expected_throughput and nowhere else.

I think most of them have a different protection; perhaps some are
lacking it?

 * set_tim: can only be called when the station is associated
 * set_key: likewise, iirc, though perhaps userspace can mess up?
 * update_tkip_key: must have a key and traffic
 * sta_notify: powersave - must be associated
 * sta_pre_rcu_remove: only pre removal etc.
 * sta_rc_update: looks partially problematic through RX action frame, 
                  if a peer messes up and sends one ... oops
 * TDLS ones look fine, I think

So I *think* that most are OK - RC update might be an issue.

get_expected_throughput is unique in that it can be called from
userspace at any time after the station is added, and that happened in
the case that John had (called immediately after ADD_STA notification,
afaict)

johannes

[toc] | [prev] | [next] | [standalone]


#1457698 — RE: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

From"Altshul, Maxim" <maxim.altshul@ti.com>
Date2016-08-08 12:50 +0200
SubjectRE: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput
Message-ID<s3Qi5-e1-5@gated-at.bofh.it>
In reply to#1457552
Yes, exactly! Should I send the patch then so that we protect get_expected_throughput?

If so, then please have a look at my previous mesh patch (not yet applied) "[PATCH v3] mac80211: mesh: Add support for HW RC implementation".

If you approve the mesh patch, then I will send two patches:
1. Check for sta->uploaded in the drv wrapper (will change the drv wrapper header to get sta_info)
2. v4 for the mesh patch with respect to header change in patch 1.

Max

-----Original Message-----
From: Johannes Berg [mailto:johannes@sipsolutions.net] 
Sent: Monday, August 08, 2016 9:11 AM
To: Altshul, Maxim; linux-kernel@vger.kernel.org
Cc: john.stultz@linaro.org; Kalle Valo; Eliad Peller; Machani, Yaniv
Subject: Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

On Sun, 2016-08-07 at 13:42 +0000, Altshul, Maxim wrote:
> Hi Johaness,
> I have prepared a patch for the issue and it is waiting for me to send 
> it, but I feel that maybe I have not explained the previous issue well 
> enough or I did not understand your request fully.
> I would like to clarify about the previous patch (the one that you
> applied) again:
> 
> a. The bug occurred because I have added a member called wl to the 
> structure wl_sta, but it turned to be NULL when the function 
> drv_get_expected_throughput was called.

Right.

> b. This member was NULL because it was initialized in the wrong place 
> (sta_add instead of update_sta_state), and thus the regression has 
> failed.

Ah. So you *do* in fact implement the sta_state op (op_sta_state) instead of the sta_add op, which I thought you were using and which was causing the error. Perhaps sta_add came from being originally called through mac80211's sta_add op.

So in essence, in this particular case it ended up being just a driver bug because it was initializing the pointer in the wrong place, and I agree that the fix in mac80211 to pass the hw pointer like everywhere else makes perfect sense.

> c. Even so, wl_sta itself was not NULL at any point.

Right.

> d. This is why I have created two patches:
> First patch (the one that you have applied) made it easy for the 
> driver to access hw->priv (the problematic access to hw->priv was the 
> reason I added wl to wl_sta in the first place, which was a mistake).
> Second patch reverted the addition of wl member to wl_sta.

Right.
 
> 2. From what I have seen, other ops that take ieee80211_sta as a 
> parameter do not check for sta->uploaded, which is why it feels a 
> little odd to do it in drv_get_expected_throughput and nowhere else.

I think most of them have a different protection; perhaps some are lacking it?

 * set_tim: can only be called when the station is associated
 * set_key: likewise, iirc, though perhaps userspace can mess up?
 * update_tkip_key: must have a key and traffic
 * sta_notify: powersave - must be associated
 * sta_pre_rcu_remove: only pre removal etc.
 * sta_rc_update: looks partially problematic through RX action frame,
                  if a peer messes up and sends one ... oops
 * TDLS ones look fine, I think

So I *think* that most are OK - RC update might be an issue.

get_expected_throughput is unique in that it can be called from userspace at any time after the station is added, and that happened in the case that John had (called immediately after ADD_STA notification,
afaict)

johannes

[toc] | [prev] | [next] | [standalone]


#1458480 — Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

FromJohannes Berg <johannes@sipsolutions.net>
Date2016-08-09 10:00 +0200
SubjectRe: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput
Message-ID<s4a77-4F7-5@gated-at.bofh.it>
In reply to#1457698
On Mon, 2016-08-08 at 10:42 +0000, Altshul, Maxim wrote:
> Yes, exactly! Should I send the patch then so that we protect
> get_expected_throughput?

Yes please.

> If so, then please have a look at my previous mesh patch (not yet
> applied) "[PATCH v3] mac80211: mesh: Add support for HW RC
> implementation".

Looks ok, I just haven't applied it because net-next was closed until
today :)

> If you approve the mesh patch, then I will send two patches:
> 1. Check for sta->uploaded in the drv wrapper (will change the drv
> wrapper header to get sta_info)
> 2. v4 for the mesh patch with respect to header change in patch 1.

I don't think adding the check changes anything wrt. the mesh patch?

johannes

[toc] | [prev] | [next] | [standalone]


#1459919 — RE: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

From"Altshul, Maxim" <maxim.altshul@ti.com>
Date2016-08-10 23:00 +0200
SubjectRE: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput
Message-ID<s4ILv-1Hq-13@gated-at.bofh.it>
In reply to#1458480
On Tue, Aug 09, 2016 at 10:58:30, Johannes Berg wrote:
> Subject: Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to 
> get_expected_throughput
> > 
> > If you approve the mesh patch, then I will send two patches:
> > 1. Check for sta->uploaded in the drv wrapper (will change the drv 
> > wrapper header to get sta_info) 2. v4 for the mesh patch with 
> > respect to header change in patch 1.
> 
> I don't think adding the check changes anything wrt. the mesh patch?
> 

I thought about changing the header of drv_get_expected_throughput to receive sta_info *sta so that I can get sta->uploaded from that.
I could use get container of &sta->sta to get sta->uploaded, but I think it's better to get the pointer directly?

Max

[toc] | [prev] | [next] | [standalone]


#1457073 — Re: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput

FromJohannes Berg <johannes@sipsolutions.net>
Date2016-08-05 14:30 +0200
SubjectRe: [PATCH 1/2] mac80211/wlcore: Add ieee80211_hw variable to get_expected_throughput
Message-ID<s2Mqd-7rU-9@gated-at.bofh.it>
In reply to#1456376
On Thu, 2016-08-04 at 15:43 +0300, Maxim Altshul wrote:
> - The variable is added to allow the driver an easy access
> to it's own hw->priv when the op is invoked.
> 
> - Change wlcore op accordingly.
> 
I'm applying this now, with a big BUT:

1) your changelog is crap - I've rewritten it to indicate what's going
on

2) I think the change makes sense, but as far as fixing the bug is
concerned it's actually completely stupid

3) I expect you to submit a proper bugfix for mac80211 ASAP, to not
call into the driver before the station is actually known to the
driver.

johannes

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web