From patchwork Mon Oct 30 10:13:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10032283 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D9868600C5 for ; Mon, 30 Oct 2017 10:14:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5148285A0 for ; Mon, 30 Oct 2017 10:14:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA0922881C; Mon, 30 Oct 2017 10:14:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15F5D285A0 for ; Mon, 30 Oct 2017 10:14:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932560AbdJ3KOT (ORCPT ); Mon, 30 Oct 2017 06:14:19 -0400 Received: from mail-bl2nam02on0069.outbound.protection.outlook.com ([104.47.38.69]:1922 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932549AbdJ3KOR (ORCPT ); Mon, 30 Oct 2017 06:14:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=9UTjZSjmMywc9rM8BkdUMFkHZAKdJ1lU1MrkECwPyYE=; b=NKdZwaTGZr3+IoTVyUtttncBj8FxmsjhlG38ZpPJlrj6A4i0YO40XgrrcWp0V515EstT/iNyWFCacT/6I9W9FI4gxClW8MJZ+wHR3eW5rCkwU1ghDklpkIGWdYP+0w5ikhIachxeCh6FtnmRUTqnKJHeETQ6qvWlZ/s81+8UXo8= Received: from bars.quantenna.com (195.182.157.78) by CY1PR05MB1930.namprd05.prod.outlook.com (10.162.216.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.4; Mon, 30 Oct 2017 10:14:14 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org Cc: Igor Mitsyanko , Avinash Patil , Vasily Ulyanov , Sergey Matyukevich Subject: [PATCH v2 4/5] qtnfmac: modify full Tx queue recovery Date: Mon, 30 Oct 2017 13:13:49 +0300 Message-Id: <20171030101350.21251-5-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171030101350.21251-1-sergey.matyukevich.os@quantenna.com> References: <20171030101350.21251-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: VI1PR08CA0130.eurprd08.prod.outlook.com (10.175.228.160) To CY1PR05MB1930.namprd05.prod.outlook.com (10.162.216.12) X-MS-Office365-Filtering-Correlation-Id: 6e49556b-9ef8-4da7-a906-08d51f7ef9be X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(2017052603238); SRVR:CY1PR05MB1930; X-Microsoft-Exchange-Diagnostics: 1; CY1PR05MB1930; 3:A8S5ZY51JHKye7/gZZ/+onZl5tmzAReBMvhO+QUxj0ijS+u4J8ob73tb29tWikjmoOX58vZ/zf096syL8TTR2UaqNlXsMoh7SiU9WBIqgTo0pXN1w3NO2dp/jnzsM64rImjIzUtziFMqsP4ZZxTXSbbVxs6Uq1a+gSEvh0cQlA5yBJmU1hfMtqaBaeHedgyidfX08D5pV0kQmGwxzSGloG7csEp0xnL8bNRVnZrFW4v26ScficNHT42haPnrp9SJ; 25:/uPbwvOg1wQ/rkFV/c7Rb6nb6iCIj+4A280V02LHRj1ENqkLQIydtJ72IzFYCLwQQXFsK20HVP380lWGKufmbDFJ9AkIAv3Mi66626FRK3VdppcyQw0r8VBjohE0Mu/CbwdUJ9cTyxw1F+xjBrFgLsf6iu7SR2ffAYsmKFZEp/AW+ccm6ij4MT8JNU3hAcKTHnpBgZtpm+T3KDDbWmQe8NfpYOVoqK/tShk6LgAUXqhLkoNfAF1RKwn0OZXOBiV0ZrRcDdFeWTDfj3Jb4csptet843cMp2u41A9HEsj0N6h5V7/eZZM/NwqHPw6Q/UuSQazCGXGRk5N72GfoPT8NggL55MT9Z7LMX2np74WHRzc=; 31:QNbl02jS4ArrggiCu54T6nORfH8/aQ48d60iWSkEUho2Psq95ZQVULjs4VtTEROdiziG1Aom/qVk1cHWxdEGwcTJe1eL4VWKXTcrrANOtoS27Kx8/v/Sb1lHY/lntTYOsUMLFfrMud9mgTBS/9N2OjHXCsFFxzX4H0HXC5GOw5Db2aOqezvWzX0r++ndU5+Wi1e8lbvsvlPtqRrxxRMNyQdUhndoiI4kWEEJk3tuCBA= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY1PR05MB1930: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; X-Microsoft-Exchange-Diagnostics: 1; CY1PR05MB1930; 20:dFYmLqAIV1o04l2CAKPYMv9bCTtt9hoEbbfd1sqZ7nvja3fdjzoZic8NCV6au7LHt552+WynCqB19Es+hvQJcPF0V3RrX8X4G3IcFpsEFDrhfs/wj6o8q291pHMKg7nNenRKxAzhvw3rkWVCoF+wPQFhLX7ipYtK6SaNdsgdR4JIm5nl1cir5k35TD48D/ZW6VplWfBtwzqW4fi+vCGxcXuWKUMvLGdwNWZSA866Scy0U5TsbPgvXN1hfjyM7oqgFtgC6a2viMtmYyHdNt9VL5fRytmcpTdPdJnGAPPmjk/JkaZc9Vg+4eKoFg4eIibcqz3B91hEaW1J2TJOF99vFVJOoikGIlR9uCzYNFRNr8eXB12E3T9V5Z7nzoTxdUUgVAzOs9W3HlSNer0KI1fBWb6deHYylOlQ0KBsOqjJIhEji3/TObRopou8mwvGdIR+E1RyUW2o5mL8rqRapEmtmAHVdfv94acysW0DbfXKOiX66z/djzcuFmTfXpMosqAE; 4:1a/uzf3vH8hZf3TCouERp62CefJkNJEC3DqRC1eNW8mcmg6GnKOQEgp+IPIkkT9kS5Q9epQpPAOlaZdK/QhmetF9+qTiPiQ1T8ud/eHZ/KxQ5FYgK2al8Rw7ifDx+ZaTwT4v7Lz38smpHL99Ul4vqcdhUXso9iCMkb6pI89V7+/Mr3SMcUTt10dFri5JWUDll/Rrd49svVvpjqJRDAJ5N5WRaYiribj4zUvlO+dIRKzQ1u9rjnK/nRWzcZXIorMAQ51kdXGsGXd9SxIxy/slvw== X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(3231020)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123558100)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR05MB1930; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR05MB1930; X-Forefront-PRVS: 0476D4AB88 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(39830400002)(346002)(376002)(199003)(189002)(53936002)(53416004)(2906002)(86362001)(50466002)(48376002)(305945005)(7736002)(4326008)(69596002)(8936002)(50986999)(107886003)(101416001)(76176999)(1076002)(25786009)(478600001)(8676002)(81156014)(103116003)(81166006)(36756003)(3846002)(68736007)(6486002)(6116002)(16526018)(50226002)(5003940100001)(2950100002)(54906003)(6666003)(6916009)(33646002)(16586007)(66066001)(47776003)(189998001)(5660300001)(97736004)(2351001)(2361001)(105586002)(316002)(106356001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR05MB1930; H:bars.quantenna.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR05MB1930; 23:mC8pnlg9RsO7uC+PLyLMFZcGq54v2ZDL82EXp63wq?= =?us-ascii?Q?TKpaIlGozFPxOfK35lOI12+sasXlBTsqrSaQxYnwhmmqoVOdCDoX0NEDqtL4?= =?us-ascii?Q?c/aVo/cOsJi3JhcNFsK5B3zWv6z7VQOKvAdg3Co1eT6bjpleRXTAeWBfF9+4?= =?us-ascii?Q?Gphe6kZo0rQGYOvIO4mCdpH92xIq8q3fUgo2knLZajzHYObzN1Sx/ic23rn1?= =?us-ascii?Q?3cOUZJ11bjPWf3fKAPEykRgsRLkMHKQV0ggEvRstYwDAt05RaLXe6Nyyoe1N?= =?us-ascii?Q?+Qx+UlGSdMymUWJ8R2tcK+HjLQPru3ixF42syWmccwHlWg9uY4qKCMfc3+pF?= =?us-ascii?Q?XcbiH0qIxzG+l3w+LqlD7gC1bhmHDddb9rHaE2WTHu2CJFx/C7DdCdnC3MVD?= =?us-ascii?Q?Fnd1HzcasTYWReaezvkF593oeOljU78PUVNJnOeFWRooQzu7x2D+h+jM1zfl?= =?us-ascii?Q?AyI46MpquWr+ZD+paUKJ7ukkS/E2UeKAYz20+EgNrmoxmiMTWPrsPKaQXxdI?= =?us-ascii?Q?/y6ZE1EGlQ/4+O+K7JS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BOrbVP1TH9gJD3fRi066wGp+rq+GMbgbdCyzgNf7caI2l90U7SX47r7h9l2xubA19GcFZsJ+15yIbE/a9VLSyT2lJOvLPsa6WP8/6ZjzHwheOJawnfOc+HBV3ZCxC+nu3W9ArtaWb1+95vhHAc+zOacH/Vrjyg=; 5:+VSbmfSfpi7Au1O119ye+YyTKRF3zwItFEOhx2ZiN7oooJw2dCpcDciCPLFm+EaqzrwDur6HcxGUD6176iZwy7n73lNDEp2UwTcHCLOUfSMkvVZKHhbouVM4mr4wIsA33MXsPcuV21DVVGRBUkFqnLxf24EKEI5JfleqQsXKI/8=; 24:UwakkQ1mCu5Cp5aXiPQmXTHlZw/rtMLixVWydCNM03fZ1K1G4MmzDDMy5rY6fdI/Bi1ws+g01oQBMngMT75dZeAsu9lrvRV5j2OLJ9ACD/s=; 7:lVMEXBDspKw4thlZRZvggMncckoz4sVQHmqLciTp83pAF7NejjpxzxwpGKOXvhln55cF+ozEhI6cyAvvExaclB74YsZxMQumHXbfyVsQYbCSbof8LGH1y5lRwoRYPFTJPsOSOpthOivtIT7AGA3Mhr7g42AwahZEXyA2yxNZYGRJMA1DhJEMFM9NP0LAvIpXLt8hzTnRLHstp15pcB2cxce1xDZ8vOMJuNomzs7mSCdFrJ8AEBIGhLLrBSelUUnW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2017 10:14:14.5248 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e49556b-9ef8-4da7-a906-08d51f7ef9be X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR05MB1930 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Current recovery approach is to wake s/w Tx queues for skb->dev netdevice. However this approach doesn't cover the case when h/w queue is full of packets from a single wireless interface. Suppose xmit attempt from the second wireless interface fails due to failed reclaim. Then the second interface will not have a chance to recover even if subsequent reclaims succeed. Possible solution is to attempt to wake all the s/w queues belonging to driver interfaces. Signed-off-by: Sergey Matyukevich --- drivers/net/wireless/quantenna/qtnfmac/core.c | 27 ++++++++++++++++++++++ drivers/net/wireless/quantenna/qtnfmac/core.h | 1 + .../net/wireless/quantenna/qtnfmac/pearl/pcie.c | 13 +++++++---- .../quantenna/qtnfmac/pearl/pcie_bus_priv.h | 1 + 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.c b/drivers/net/wireless/quantenna/qtnfmac/core.c index aa7f146278a7..6a6e5ffb0348 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.c +++ b/drivers/net/wireless/quantenna/qtnfmac/core.c @@ -618,6 +618,33 @@ struct net_device *qtnf_classify_skb(struct qtnf_bus *bus, struct sk_buff *skb) } EXPORT_SYMBOL_GPL(qtnf_classify_skb); +void qtnf_wake_all_queues(struct net_device *ndev) +{ + struct qtnf_vif *vif = qtnf_netdev_get_priv(ndev); + struct qtnf_wmac *mac; + struct qtnf_bus *bus; + int macid; + int i; + + if (unlikely(!vif || !vif->mac || !vif->mac->bus)) + return; + + bus = vif->mac->bus; + + for (macid = 0; macid < QTNF_MAX_MAC; macid++) { + if (!(bus->hw_info.mac_bitmap & BIT(macid))) + continue; + + mac = bus->mac[macid]; + for (i = 0; i < QTNF_MAX_INTF; i++) { + vif = &mac->iflist[i]; + if (vif->netdev && netif_queue_stopped(vif->netdev)) + netif_tx_wake_all_queues(vif->netdev); + } + } +} +EXPORT_SYMBOL_GPL(qtnf_wake_all_queues); + MODULE_AUTHOR("Quantenna Communications"); MODULE_DESCRIPTION("Quantenna 802.11 wireless LAN FullMAC driver."); MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/quantenna/qtnfmac/core.h b/drivers/net/wireless/quantenna/qtnfmac/core.h index 49ae700f66f0..da2c24e2271d 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/core.h +++ b/drivers/net/wireless/quantenna/qtnfmac/core.h @@ -153,6 +153,7 @@ int qtnf_cmd_send_get_phy_params(struct qtnf_wmac *mac); struct qtnf_wmac *qtnf_core_get_mac(const struct qtnf_bus *bus, u8 macid); struct net_device *qtnf_classify_skb(struct qtnf_bus *bus, struct sk_buff *skb); +void qtnf_wake_all_queues(struct net_device *ndev); void qtnf_virtual_intf_cleanup(struct net_device *ndev); void qtnf_netdev_updown(struct net_device *ndev, bool up); diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c index 146e42a132e7..7e487622d87d 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c @@ -617,9 +617,10 @@ static void qtnf_pcie_data_tx_reclaim(struct qtnf_pcie_bus_priv *priv) if (skb->dev) { skb->dev->stats.tx_packets++; skb->dev->stats.tx_bytes += skb->len; - - if (netif_queue_stopped(skb->dev)) - netif_wake_queue(skb->dev); + if (unlikely(priv->tx_stopped)) { + qtnf_wake_all_queues(skb->dev); + priv->tx_stopped = 0; + } } dev_kfree_skb_any(skb); @@ -669,8 +670,10 @@ static int qtnf_pcie_data_tx(struct qtnf_bus *bus, struct sk_buff *skb) spin_lock_irqsave(&priv->tx0_lock, flags); if (!qtnf_tx_queue_ready(priv)) { - if (skb->dev) - netif_stop_queue(skb->dev); + if (skb->dev) { + netif_tx_stop_all_queues(skb->dev); + priv->tx_stopped = 1; + } spin_unlock_irqrestore(&priv->tx0_lock, flags); return NETDEV_TX_BUSY; diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h index 86ac1ccedb52..397875a50fc2 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie_bus_priv.h @@ -37,6 +37,7 @@ struct qtnf_pcie_bus_priv { /* lock for tx0 operations */ spinlock_t tx0_lock; u8 msi_enabled; + u8 tx_stopped; int mps; struct workqueue_struct *workqueue;