From patchwork Wed Feb 28 07:38:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitkumar Karwar X-Patchwork-Id: 10246957 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 E2B7160362 for ; Wed, 28 Feb 2018 07:50:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D155F28A0E for ; Wed, 28 Feb 2018 07:50:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5F6E28B80; Wed, 28 Feb 2018 07:50:27 +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, FREEMAIL_FROM, 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 4DCC728A0E for ; Wed, 28 Feb 2018 07:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752046AbeB1HuZ (ORCPT ); Wed, 28 Feb 2018 02:50:25 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:46888 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751989AbeB1HuY (ORCPT ); Wed, 28 Feb 2018 02:50:24 -0500 Received: by mail-pf0-f195.google.com with SMTP id z10so682539pfh.13 for ; Tue, 27 Feb 2018 23:50:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gNA/CwnF1D3d+SV0U0nMrOqYbf1+odDEZs+r6T8bsOY=; b=kyP+S13YxsatgaISuQ7c/Tjhm8F+unyX+OoRtCmclqE87cQpV4WZzgq1x5b/nhojTs 9N6RCXCME1GGCs3v51HH9MKT+ZWYr2z04FiSpn7GrKfrvttSpj7cjLPfI96MqQkKEEvW Ch6s54vxjum/0gtJvn/hu6wvYPAWnFW1tcpPmxl2BjpsFACyI+vHGKinE4GSqe+tg3zL DoysL797FS3CJ3WVSVG4m7jHrUv0dtdjn82ghX6F1HlBBM93SCrX6Qm4+rVxjz58QdR9 pU9/dBoMONA5cc38KYQxjkT1Ol549yqLZXhhxCvN81mZz+VDBPjxWndvCfa3sdpnTFh3 mF/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gNA/CwnF1D3d+SV0U0nMrOqYbf1+odDEZs+r6T8bsOY=; b=qw5+2vmqlRksnWie3D4rLHtF4QnmYE/pj6z/kGHH5k9SUyhFVmXq5PVDCU8cjsa4Qw 2LkI616zlAO2tx4wvBs9c4m/TyQxf5XpalmH/2hFRBWqsPexvCb9Cr8b2y7Bu/itFZ9v 8kIgmO2jevHhmr0af9cQmFVTrLhbg5ny7TUfEsrAqcdMfbz6n5BTG/0ryeKpDU94fdUH 8UbauAreVV7ATSp9KHX6rHchTUmpTZdcMlT2Yu2yiCUGK+l5ccRdpPV2vueUKyPAmFTA vzlGN5JjgpnVEnnOx6iHhTyXbE011MFDPLXrn8LlcE39fPxwn3luw3mnZl3un37UJKeH 1U0w== X-Gm-Message-State: APf1xPCvFT/cFXMG0JPjeFuctmKH/CINxqGWeWIBB7GB9+89U/1+5e9T lQ/2CMeytyjafIxRHGepHCo= X-Google-Smtp-Source: AH8x227LF3C4jQms4gyzu2d6SBvb5hfKmuctnkkLqTUbCbKXzY6gcogaMek59kdBp4qX1BiM4TbMEA== X-Received: by 10.98.107.130 with SMTP id g124mr16696177pfc.225.1519804224170; Tue, 27 Feb 2018 23:50:24 -0800 (PST) Received: from cpu185.redpinesignals.com ([203.196.161.90]) by smtp.gmail.com with ESMTPSA id b8sm2091945pff.31.2018.02.27.23.50.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Feb 2018 23:50:23 -0800 (PST) From: Amitkumar Karwar To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Amitkumar Karwar , Siva Rebbagondla , Prameela Rani Garnepudi Subject: [PATCH 2/3] rsi: use dynamic RX control blocks instead of MAX_RX_URB Date: Wed, 28 Feb 2018 13:08:27 +0530 Message-Id: <1519803508-27737-3-git-send-email-amitkarwar@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519803508-27737-1-git-send-email-amitkarwar@gmail.com> References: <1519803508-27737-1-git-send-email-amitkarwar@gmail.com> 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 From: Prameela Rani Garnepudi Currently 2 RX control blocks are allocated by default. If wifi alone mode is used rx control block 2 is unusable. So, changes are done accordingly in all places to use RX control blocks dynamically based on coex mode check. Signed-off-by: Prameela Rani Garnepudi Signed-off-by: Amitkumar Karwar --- drivers/net/wireless/rsi/rsi_91x_usb.c | 34 ++++++++++++++++++------------ drivers/net/wireless/rsi/rsi_91x_usb_ops.c | 5 +++-- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c index 0a50cff..64781a3 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -497,15 +497,15 @@ static struct rsi_host_intf_ops usb_host_intf_ops = { */ static void rsi_deinit_usb_interface(struct rsi_hw *adapter) { - u8 idx; - struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev; rsi_kill_thread(&dev->rx_thread); - for (idx = 0; idx < MAX_RX_URBS; idx++) { - usb_free_urb(dev->rx_cb[idx].rx_urb); - kfree(dev->rx_cb[idx].rx_buffer); + usb_free_urb(dev->rx_cb[0].rx_urb); + kfree(dev->rx_cb[0].rx_buffer); + if (adapter->priv->coex_mode > 1) { + usb_free_urb(dev->rx_cb[1].rx_urb); + kfree(dev->rx_cb[1].rx_buffer); } kfree(adapter->priv->rx_data_pkt); @@ -516,9 +516,11 @@ static int rsi_usb_init_rx(struct rsi_hw *adapter) { struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev; struct rx_usb_ctrl_block *rx_cb; - u8 idx; + u8 idx, num_rx_cb; + + num_rx_cb = (adapter->priv->coex_mode > 1 ? 2 : 1); - for (idx = 0; idx < MAX_RX_URBS; idx++) { + for (idx = 0; idx < num_rx_cb; idx++) { rx_cb = &dev->rx_cb[idx]; rx_cb->rx_buffer = kzalloc(RSI_USB_BUF_SIZE * 2, @@ -538,9 +540,11 @@ static int rsi_usb_init_rx(struct rsi_hw *adapter) return 0; err: - for (idx = 0; idx < MAX_RX_URBS; idx++) { - kfree(dev->rx_cb[idx].rx_buffer); - kfree(dev->rx_cb[idx].rx_urb); + kfree(dev->rx_cb[0].rx_buffer); + usb_free_urb(dev->rx_cb[0].rx_urb); + if (adapter->priv->coex_mode > 1) { + kfree(dev->rx_cb[1].rx_buffer); + usb_free_urb(dev->rx_cb[1].rx_urb); } return -1; } @@ -557,7 +561,7 @@ static int rsi_init_usb_interface(struct rsi_hw *adapter, { struct rsi_91x_usbdev *rsi_dev; struct rsi_common *common = adapter->priv; - int status, i; + int status; rsi_dev = kzalloc(sizeof(*rsi_dev), GFP_KERNEL); if (!rsi_dev) @@ -617,9 +621,11 @@ static int rsi_init_usb_interface(struct rsi_hw *adapter, return 0; fail_thread: - for (i = 0; i < MAX_RX_URBS; i++) { - kfree(rsi_dev->rx_cb[i].rx_buffer); - kfree(rsi_dev->rx_cb[i].rx_urb); + kfree(rsi_dev->rx_cb[0].rx_buffer); + usb_free_urb(rsi_dev->rx_cb[0].rx_urb); + if (common->coex_mode > 1) { + kfree(rsi_dev->rx_cb[1].rx_buffer); + usb_free_urb(rsi_dev->rx_cb[1].rx_urb); } fail_tx: kfree(common->rx_data_pkt); diff --git a/drivers/net/wireless/rsi/rsi_91x_usb_ops.c b/drivers/net/wireless/rsi/rsi_91x_usb_ops.c index d0650ea..fc25b1b 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb_ops.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb_ops.c @@ -30,15 +30,16 @@ void rsi_usb_rx_thread(struct rsi_common *common) struct rsi_hw *adapter = common->priv; struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev; struct rx_usb_ctrl_block *rx_cb; - int status, idx; + int status, idx, num_rx_cb; + num_rx_cb = (adapter->priv->coex_mode > 1 ? 2 : 1); do { rsi_wait_event(&dev->rx_thread.event, EVENT_WAIT_FOREVER); if (atomic_read(&dev->rx_thread.thread_done)) goto out; - for (idx = 0; idx < MAX_RX_URBS; idx++) { + for (idx = 0; idx < num_rx_cb; idx++) { rx_cb = &dev->rx_cb[idx]; if (!rx_cb->pend) continue;