From patchwork Tue Mar 19 11:08:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 2300191 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 25C43DFB79 for ; Tue, 19 Mar 2013 11:08:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750971Ab3CSLI3 (ORCPT ); Tue, 19 Mar 2013 07:08:29 -0400 Received: from mail-pb0-f50.google.com ([209.85.160.50]:61599 "EHLO mail-pb0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751290Ab3CSLI2 (ORCPT ); Tue, 19 Mar 2013 07:08:28 -0400 Received: by mail-pb0-f50.google.com with SMTP id up1so338001pbc.37 for ; Tue, 19 Mar 2013 04:08:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer; bh=G8CCwyHYWwkJ4nn4eeomTyBtP7bGy5QigvbRNUtsTZ4=; b=JfKgzk48FC4ZkFKF5wn+LD/zDZh2Hm4UtZUF68uNzMSCLl/Qi1TVw6ABo1u4o1BCmr Q2nSeOX1p4FgzolZ9vQ8B+9Wj3qfOyIaNYrAf/SnjgcoDuqcAK8qeimGpzIULKNRuTDe ZQfdMRGPchCT1yCNSyyNlJPL5cfYIeNH1NWizhjHNmXTcgbBTCIwRQwkt/1KPvFh18J9 tvDMv1sZAyHXdxEy403C02MzrelIl8jdFMtpgcMmdIA36kmOd+Y914FcLIfVuOkAnl/T DFU4MB3vSgcgsxncn9hRgm4XGcMDLtNWMQhgqOV9EdGYkeaByr8+6No9kCadzpGupleK GA4w== X-Received: by 10.68.26.234 with SMTP id o10mr2307377pbg.211.1363691308052; Tue, 19 Mar 2013 04:08:28 -0700 (PDT) Received: from mcgrof@gmail.com (c-24-7-61-223.hsd1.ca.comcast.net. [24.7.61.223]) by mx.google.com with ESMTPS id tm1sm23920728pbc.11.2013.03.19.04.08.24 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Mar 2013 04:08:26 -0700 (PDT) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Tue, 19 Mar 2013 04:08:23 -0700 From: "Luis R. Rodriguez" To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, "Luis R. Rodriguez" Subject: [RFC] mac80211: avoid rearming BA session timers unnecessarily Date: Tue, 19 Mar 2013 04:08:22 -0700 Message-Id: <1363691302-11947-1-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: "Luis R. Rodriguez" If mac80211 tears down the BA sessions with del_timer_sync() technically mod_timer() can still rearm them. If mac80211 tears the BA sessions down we don't want to rearm the timers at a later time so avoid this possibility. Signed-off-by: Luis R. Rodriguez --- Figure I'd start reviewing mod_timer()/mod_timer_pending() as no one caught on. Likely not an issue on mac80211 but I suspect drivers will all be poo. net/mac80211/agg-rx.c | 2 +- net/mac80211/agg-tx.c | 2 +- net/mac80211/rx.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c index 31bf258..47d7468 100644 --- a/net/mac80211/agg-rx.c +++ b/net/mac80211/agg-rx.c @@ -153,7 +153,7 @@ static void sta_rx_agg_session_timer_expired(unsigned long data) timeout = tid_rx->last_rx + TU_TO_JIFFIES(tid_rx->timeout); if (time_is_after_jiffies(timeout)) { - mod_timer(&tid_rx->session_timer, timeout); + mod_timer_pending(&tid_rx->session_timer, timeout); rcu_read_unlock(); return; } diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index 13b7683..b15b629 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c @@ -488,7 +488,7 @@ static void sta_tx_agg_session_timer_expired(unsigned long data) timeout = tid_tx->last_tx + TU_TO_JIFFIES(tid_tx->timeout); if (time_is_after_jiffies(timeout)) { - mod_timer(&tid_tx->session_timer, timeout); + mod_timer_pending(&tid_tx->session_timer, timeout); rcu_read_unlock(); return; } diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 5b4492a..0b81653 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -2216,8 +2216,8 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx, struct sk_buff_head *frames) /* reset session timer */ if (tid_agg_rx->timeout) - mod_timer(&tid_agg_rx->session_timer, - TU_TO_EXP_TIME(tid_agg_rx->timeout)); + mod_timer_pending(&tid_agg_rx->session_timer, + TU_TO_EXP_TIME(tid_agg_rx->timeout)); spin_lock(&tid_agg_rx->reorder_lock); /* release stored frames up to start of BAR */