From patchwork Tue Sep 6 20:05:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Cardona X-Patchwork-Id: 1126952 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p86K5YcR026935 for ; Tue, 6 Sep 2011 20:05:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754977Ab1IFUFc (ORCPT ); Tue, 6 Sep 2011 16:05:32 -0400 Received: from mail-yi0-f46.google.com ([209.85.218.46]:49392 "EHLO mail-yi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754929Ab1IFUFb (ORCPT ); Tue, 6 Sep 2011 16:05:31 -0400 Received: by yie30 with SMTP id 30so4306091yie.19 for ; Tue, 06 Sep 2011 13:05:31 -0700 (PDT) Received: by 10.68.121.205 with SMTP id lm13mr2288213pbb.321.1315339530883; Tue, 06 Sep 2011 13:05:30 -0700 (PDT) Received: from localhost.localdomain (99-8-184-170.lightspeed.snfcca.sbcglobal.net. [99.8.184.170]) by mx.google.com with ESMTPS id u10sm2315587pbr.12.2011.09.06.13.05.29 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Sep 2011 13:05:30 -0700 (PDT) From: Javier Cardona To: "John W. Linville" Cc: Javier Cardona , Thomas Pedersen , devel@lists.open80211s.org, Johannes Berg , linux-wireless@vger.kernel.org, jlopex@gmail.com Subject: [PATCH v2] mac80211: Stop forwarding mesh traffic when tx queues are full Date: Tue, 6 Sep 2011 13:05:21 -0700 Message-Id: <1315339521-31009-1-git-send-email-javier@cozybit.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1314907533-27486-1-git-send-email-javier@cozybit.com> References: <1314907533-27486-1-git-send-email-javier@cozybit.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 06 Sep 2011 20:05:34 +0000 (UTC) Tx flow control for non-mesh modes of operation only needs to act on the net device queues: when the hardware queues are full we stop accepting traffic from the net device. In mesh, however, we also need to stop forwarding traffic. This patch checks the hardware queues before attempting to forward a mesh frame. Signed-off-by: Javier Cardona --- v2: Call ieee80211_queue_stopped, which acquires the queue lock (Johannes) net/mac80211/debugfs_netdev.c | 3 +++ net/mac80211/ieee80211_i.h | 1 + net/mac80211/rx.c | 6 ++++++ 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 6e8eab7..dd04629 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c @@ -340,6 +340,8 @@ IEEE80211_IF_FILE(fwded_mcast, u.mesh.mshstats.fwded_mcast, DEC); IEEE80211_IF_FILE(fwded_unicast, u.mesh.mshstats.fwded_unicast, DEC); IEEE80211_IF_FILE(fwded_frames, u.mesh.mshstats.fwded_frames, DEC); IEEE80211_IF_FILE(dropped_frames_ttl, u.mesh.mshstats.dropped_frames_ttl, DEC); +IEEE80211_IF_FILE(dropped_frames_congestion, + u.mesh.mshstats.dropped_frames_congestion, DEC); IEEE80211_IF_FILE(dropped_frames_no_route, u.mesh.mshstats.dropped_frames_no_route, DEC); IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC); @@ -463,6 +465,7 @@ static void add_mesh_stats(struct ieee80211_sub_if_data *sdata) MESHSTATS_ADD(fwded_frames); MESHSTATS_ADD(dropped_frames_ttl); MESHSTATS_ADD(dropped_frames_no_route); + MESHSTATS_ADD(dropped_frames_congestion); MESHSTATS_ADD(estab_plinks); #undef MESHSTATS_ADD } diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index c204cee..58bbc5e 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -261,6 +261,7 @@ struct mesh_stats { __u32 fwded_frames; /* Mesh total forwarded frames */ __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ __u32 dropped_frames_no_route; /* Not transmitted, no route found */ + __u32 dropped_frames_congestion;/* Not forwarded due to congestion */ atomic_t estab_plinks; }; diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index f45fd2f..12119f3 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -1847,6 +1847,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) /* illegal frame */ return RX_DROP_MONITOR; + if (ieee80211_queue_stopped(&local->hw, skb_get_queue_mapping(skb))) { + IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh, + dropped_frames_congestion); + return RX_DROP_MONITOR; + } + if (mesh_hdr->flags & MESH_FLAGS_AE) { struct mesh_path *mppath; char *proxied_addr;