From patchwork Mon Jan 25 13:43:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 8108711 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 875A1BEEE5 for ; Mon, 25 Jan 2016 13:42:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ABED82028D for ; Mon, 25 Jan 2016 13:42:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 150A1202D1 for ; Mon, 25 Jan 2016 13:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755678AbcAYNmp (ORCPT ); Mon, 25 Jan 2016 08:42:45 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:36616 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755405AbcAYNmn (ORCPT ); Mon, 25 Jan 2016 08:42:43 -0500 Received: by mail-lf0-f41.google.com with SMTP id h129so85432654lfh.3 for ; Mon, 25 Jan 2016 05:42:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id; bh=kMiXSTkCJgaIJ1EJuk+KYyD3psjY2nnduom0RHbTU2o=; b=C/z53RoH1FTt9kb5EjVM2pIL2bbJyRi4ArZwt058debradLZXq5jgpJ5JGYPEGKFeo axKFPDgkM2f+CAjctwkUS5nFJypx3d/lhuFd1zZ1MxiVE7F9OXS8JZJqtJ42mcGzaXQ5 FdSzubOxSSDuyb3igeCe3zYJLdIdcWaSlzuNI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=kMiXSTkCJgaIJ1EJuk+KYyD3psjY2nnduom0RHbTU2o=; b=MxtA7X6Ftmf0HmMKuFBcy0Pfdg2Rze9LK13ZeQj5eV3fACd5dGWi0NawEpTAgx8tWY OPROqD4rjCA7K5Zr1t+ZepZHewkHH9AvdAuNkUjcnUFEmgkdgUB67/j3E0lS8ifovFwR 2mUwPtJj7cJVssKF9Mc9OWSboswBeuK9fbFIVYMU7iNN8afd0a8JLacoLCGKsUqWxJxq xQWKTtIVVfDrczLtm4B6WhqYDXfxGPHhsh5ZFihR5beJC+ZM85XGQsJMFh99g2SiTcL8 Rnnm/gVM99n0nNUKbpd4LWS9HBGu/GgUHwU9vWndjJGYHifmT+hin4SCVGoqpmly2Q9t upYQ== X-Gm-Message-State: AG10YORhhXkLaTmvr+I187X/7jjvwqWEZK8jcOsOHwNvH7elIISZlADjwZuuyKAFAdLVhpxdZeCIuEzXujVTp+KnDJGNbwAIhiA9KzVjDqneJNs1kzVZwI7M8vEc1tCyVx/TNSHPQD0YFQ/8COO7C+Z8nyw2uD5V1ZO+LmWZZFVc5f/5x7K+aZ9jmaV+5A653dCVlQQ= X-Received: by 10.25.145.197 with SMTP id t188mr5198249lfd.55.1453729362121; Mon, 25 Jan 2016 05:42:42 -0800 (PST) Received: from localhost.localdomain ([91.198.246.10]) by smtp.gmail.com with ESMTPSA id 99sm2804934lfp.30.2016.01.25.05.42.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Jan 2016 05:42:41 -0800 (PST) From: Michal Kazior To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Michal Kazior Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding Date: Mon, 25 Jan 2016 14:43:24 +0100 Message-Id: <1453729404-26506-1-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 2.1.4 X-DomainID: tieto.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ieee80211_queue_stopped() expects hw queue number but it was given raw WMM AC number instead. This could cause frame drops and problems with traffic in some cases - most notably if driver doesn't map AC numbers to queue numbers 1:1 and uses ieee80211_stop_queues() and ieee80211_wake_queue() only without ever calling ieee80211_wake_queues(). On ath10k it was possible to hit this problem in the following case: 1. wlan0 uses queue 0 (ath10k maps queues per vif) 2. offchannel uses queue 15 3. queues 1-14 are unused 4. ieee80211_stop_queues() 5. ieee80211_wake_queue(q=0) 6. ieee80211_wake_queue(q=15) (other queues are not woken up because both driver and mac80211 know other queues are unused) 7. ieee80211_rx_h_mesh_fwding() 8. ieee80211_select_queue_80211() returns 2 9. ieee80211_queue_stopped(q=2) returns true 10. frame is dropped (oops!) Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping") Signed-off-by: Michal Kazior --- net/mac80211/rx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index ae993edfdecf..664e8861edbe 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) struct ieee80211_local *local = rx->local; struct ieee80211_sub_if_data *sdata = rx->sdata; struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - u16 q, hdrlen; + u16 ac, q, hdrlen; hdr = (struct ieee80211_hdr *) skb->data; hdrlen = ieee80211_hdrlen(hdr->frame_control); @@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) ether_addr_equal(sdata->vif.addr, hdr->addr3)) return RX_CONTINUE; - q = ieee80211_select_queue_80211(sdata, skb, hdr); + ac = ieee80211_select_queue_80211(sdata, skb, hdr); + q = sdata->vif.hw_queue[ac]; if (ieee80211_queue_stopped(&local->hw, q)) { IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion); return RX_DROP_MONITOR;