From: Johannes Berg <johannes@sipsolutions.net>
To: Kees Cook <keescook@chromium.org>, linux-wireless@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mac80211: aggregation: Convert timers to use timer_setup()
Date: Wed, 18 Oct 2017 12:29:26 +0200 [thread overview]
Message-ID: <1508322566.2674.17.camel@sipsolutions.net> (raw)
In-Reply-To: <20171017202545.GA115810@beast> (sfid-20171017_222550_315925_34B26DDB)
Hi,
[quoting your other email:]
> This has been the least trivial timer conversion yet. Given the use of
> RCU and other things I may not even know about, I'd love to get a close
> look at this. I *think* this is correct, as it will re-lookup the tid
> entries when firing the timer.
I'm not really sure why you're doing the lookup again? That seems
pointless, since you already have the right structure, and already rely
on it being valid. You can't really get a new struct assigned to the
same TID without the old one being destroyed.
> -static void sta_rx_agg_session_timer_expired(unsigned long data)
> +static void sta_rx_agg_session_timer_expired(struct timer_list *t)
> {
> - /* not an elegant detour, but there is no choice as the timer passes
> - * only one argument, and various sta_info are needed here, so init
> - * flow in sta_info_create gives the TID as data, while the timer_to_id
> - * array gives the sta through container_of */
> - u8 *ptid = (u8 *)data;
> - u8 *timer_to_id = ptid - *ptid;
> - struct sta_info *sta = container_of(timer_to_id, struct sta_info,
> - timer_to_tid[0]);
> + struct tid_ampdu_rx *tid_rx_timer =
> + from_timer(tid_rx_timer, t, session_timer);
> + struct sta_info *sta = tid_rx_timer->sta;
> + u16 tid = tid_rx_timer->tid;
> struct tid_ampdu_rx *tid_rx;
> unsigned long timeout;
>
> rcu_read_lock();
> - tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[*ptid]);
> + tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
> if (!tid_rx) {
> rcu_read_unlock();
So through all of this, I'm pretty sure we can just use tid_rx_timer
instead of tid_rx.
(Same for TX)
Anyway, the change here looks correct to me, so I'll apply it and then
perhaps clean up more. I've only changed "u16 tid" to "u8 tid" since
the valid range is 0-15 (in theory, in practice 0-7).
johannes
next prev parent reply other threads:[~2017-10-18 10:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 20:25 [PATCH] mac80211: aggregation: Convert timers to use timer_setup() Kees Cook
2017-10-18 10:29 ` Johannes Berg [this message]
2017-10-18 11:31 ` Johannes Berg
2017-10-18 11:37 ` Johannes Berg
2017-10-18 14:17 ` Kees Cook
2017-10-18 14:19 ` Kees Cook
2017-10-18 20:50 ` Johannes Berg
2017-10-18 21:02 ` Kees Cook
-- strict thread matches above, loose matches on Subject: below --
2017-10-16 22:08 Kees Cook
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=1508322566.2674.17.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=davem@davemloft.net \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).