All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Jonas Jelonek <jelonek.jonas@gmail.com>
Cc: linux-wireless@vger.kernel.org, Felix Fietkau <nbd@nbd.name>
Subject: Re: [RFC v2 5/6] mac80211_hwsim: add TPC per packet support
Date: Tue, 28 Feb 2023 18:44:03 +0100	[thread overview]
Message-ID: <12fce295c582793e662ca322b0d3ae3b461ddb24.camel@sipsolutions.net> (raw)
In-Reply-To: <03B7A24C-D6E2-4DBB-B52D-6174539BB781@gmail.com>

On Thu, 2023-01-26 at 17:53 +0100, Jonas Jelonek wrote:
> > 
> > On Tue, 2022-09-20 at 12:40 +0200, Jonas Jelonek wrote:
> > > @@ -4846,16 +4989,32 @@ static int
> > > hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2,
> > > 
> > > tx_attempts = (struct hwsim_tx_rate *)nla_data(
> > >       info->attrs[HWSIM_ATTR_TX_INFO]);
> > > + tx_attempts_flags = (struct hwsim_tx_rate_flag *)nla_data(
> > > +     info->attrs[HWSIM_ATTR_TX_INFO_FLAGS]);
> > > + sta = (struct ieee80211_sta *)txi->rate_driver_data[1];
> > 
> > That seems dangerous - what if the STA was freed already? You don't
> > walk
> > the pending list or something if the STA goes away.
> 
> Yes, I see. Is it in general a bad idea to take the sta reference from
> ieee80211_control, put
> it in rate_driver_data and use it for tx-status? I guess I should pass
> sta to tx_status_ext whenever
> possible because it is used for several statistics.

Well you have to think about the lifetime. In most cases you do a lookup
of the STA (under RCU) etc. but 

> I could think of two ways:
> - add NULL checks for the case that the sta pointer might be freed as
> you said

How would that pointer even go NULL though? The pointer would remain,
but the STA can be freed, no?

> - get sta by using, e.g., sta_info_get_by_addrs to get the sta if it
> is available. However, this always
> loops through the sta list. Might be a performance issue?

It should use the hashtable?

> Or do you suggest something different?

Well you could keep it here and walk the list of queued skbs (?) when a
STA is removed, and kill them all at that point, or something. Not sure
it's worth it vs. the hash table lookup, this is just hwsim after all.

johannes

  reply	other threads:[~2023-02-28 17:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 10:40 [RFC v2 0/6] mac80211: add TPC support in control path Jonas Jelonek
2022-09-20 10:40 ` [RFC v2 1/6] mac80211: modify tx-power level annotation Jonas Jelonek
2022-09-21 14:54   ` Jeff Johnson
2023-01-12 10:24   ` Johannes Berg
2022-09-20 10:40 ` [RFC v2 2/6] mac80211: add tx-power annotation in control path Jonas Jelonek
2023-01-12 10:31   ` Johannes Berg
2022-09-20 10:40 ` [RFC v2 3/6] mac80211: add hardware flags for TPC support Jonas Jelonek
2022-09-20 10:40 ` [RFC v2 4/6] mac80211: add utility function for tx_rate - rate_info conversion Jonas Jelonek
2023-01-12 10:26   ` Johannes Berg
2023-01-19 11:31     ` Jonas Jelonek
2023-01-19 11:35       ` Johannes Berg
2023-01-19 14:34         ` Jonas Jelonek
2022-09-20 10:40 ` [RFC v2 5/6] mac80211_hwsim: add TPC per packet support Jonas Jelonek
2022-09-26  7:47   ` [mac80211_hwsim] 14f322748f: WARNING:at_include/net/mac80211.h:#mac80211_hwsim_monitor_rx[mac80211_hwsim] kernel test robot
2022-09-26  7:47     ` kernel test robot
2023-01-12 10:31   ` [RFC v2 5/6] mac80211_hwsim: add TPC per packet support Johannes Berg
2023-01-19 14:32     ` Jonas Jelonek
2023-01-19 15:09       ` Johannes Berg
2023-01-26 16:52         ` Jonas Jelonek
     [not found]         ` <195E1629-BC72-4968-8E61-860C80F58D8B@gmail.com>
     [not found]           ` <386f10e09c17b871df1c86ebc0c2af52938c6fb6.camel@sipsolutions.net>
2023-03-03  7:42             ` Jonas Jelonek
2023-01-26 16:53     ` Jonas Jelonek
2023-02-28 17:44       ` Johannes Berg [this message]
2023-03-03  7:46         ` Jonas Jelonek
2022-09-20 10:40 ` [RFC v2 6/6] mac80211: minstrel_ht - add debugfs entry per sta for fixed tx-power Jonas Jelonek
2023-01-12 10:32   ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12fce295c582793e662ca322b0d3ae3b461ddb24.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=jelonek.jonas@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.