All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amitkumar Karwar <akarwar@marvell.com>
To: Belisko Marek <marek.belisko@gmail.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	Avinash Patil <patila@marvell.com>
Subject: RE: mwifiex_usb_submit_rx_urb: dev_alloc_skb failed when conected to 5GHz
Date: Thu, 30 Oct 2014 03:01:03 -0700	[thread overview]
Message-ID: <5FF020A1CFFEEC49BD1E09530C4FF5951821B4843B@SC-VEXCH1.marvell.com> (raw)
In-Reply-To: <CAAfyv35oXYBqQsPzLWz4k6cM44+GSmPC6TTgVoELEjM_FAoYQw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 411 bytes --]

Hi Marek,

Thanks a lot for testing. I have added flow control logic to limit pending Rx packets. Could you please check if attached patch fixes out of memory issue?
You can also backport below patch to your 3.9 kernel for rx_pending count imbalance issue.

http://www.spinics.net/lists/linux-wireless/msg115536.html

Your hacks to decrement rx_pending count won't be needed now.

Regards,
Amitkumar

[-- Attachment #2: 0001-mwifiex-add-flow-control-logic-to-Rx-data-on-USB-int.patch --]
[-- Type: application/octet-stream, Size: 3524 bytes --]

From 3d5a91fa8b17a0634276d32b2b40a847a6f6279d Mon Sep 17 00:00:00 2001
From: Amitkumar Karwar <akarwar@marvell.com>
Date: Thu, 30 Oct 2014 01:28:10 -0700
Subject: [PATCH] mwifiex: add flow control logic to Rx data on USB interface

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
---
 drivers/net/wireless/mwifiex/main.c |    8 ++++++--
 drivers/net/wireless/mwifiex/main.h |    3 +++
 drivers/net/wireless/mwifiex/usb.c  |   23 ++++++++++++++++++++++-
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 121443a..5f25855 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -199,9 +199,13 @@ process_start:
 		}
 
 		/* Check Rx data for USB */
-		if (adapter->iface_type == MWIFIEX_USB)
-			while ((skb = skb_dequeue(&adapter->usb_rx_data_q)))
+		if (adapter->iface_type == MWIFIEX_USB) {
+			while ((skb = skb_dequeue(&adapter->usb_rx_data_q))) {
 				mwifiex_handle_rx_packet(adapter, skb);
+				if (atomic_read(&adapter->rx_pending) < LOW_RX_PENDING)
+					adapter->if_ops.submit_rem_rx_urb(adapter);
+			}
+		}
 
 		/* Check for Cmd Resp */
 		if (adapter->cmd_resp_received) {
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index cab8a85..247b2a6 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -222,6 +222,8 @@ struct mwifiex_tid_tbl {
 #define HIGH_PRIO_TID				7
 #define LOW_PRIO_TID				0
 #define NO_PKT_PRIO_TID				(-1)
+#define LOW_RX_PENDING			20
+#define HIGH_RX_PENDING			50
 
 struct mwifiex_wmm_desc {
 	struct mwifiex_tid_tbl tid_tbl_ptr[MAX_NUM_TID];
@@ -616,6 +618,7 @@ struct mwifiex_if_ops {
 	int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
 	void (*card_reset) (struct mwifiex_adapter *);
 	int (*clean_pcie_ring) (struct mwifiex_adapter *adapter);
+	void (*submit_rem_rx_urb) (struct mwifiex_adapter *adapter);
 };
 
 struct mwifiex_adapter {
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c
index e3e2c62..7791748 100644
--- a/drivers/net/wireless/mwifiex/usb.c
+++ b/drivers/net/wireless/mwifiex/usb.c
@@ -226,7 +226,13 @@ setup_for_next:
 	else
 		size = MWIFIEX_RX_DATA_BUF_SIZE;
 
-	mwifiex_usb_submit_rx_urb(context, size);
+	if (card->rx_cmd_ep == context->ep) {
+		mwifiex_usb_submit_rx_urb(context, size);
+	} else {
+		context->skb = NULL;
+		if (atomic_read(&adapter->rx_pending) <= HIGH_RX_PENDING)
+			mwifiex_usb_submit_rx_urb(context, size);
+	}
 
 	return;
 }
@@ -985,6 +991,20 @@ static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter)
 	return 0;
 }
 
+static void mwifiex_usb_submit_rem_rx_urb(struct mwifiex_adapter *adapter)
+{
+	struct usb_card_rec *card = (struct usb_card_rec *)adapter->card;
+	int i;
+	struct urb_context *ctx;
+
+	for (i = 0; i < MWIFIEX_RX_DATA_URB; i++) {
+		if (card->rx_data_list[i].skb)
+			continue;
+		ctx = &card->rx_data_list[i];
+		mwifiex_usb_submit_rx_urb(ctx, MWIFIEX_RX_DATA_BUF_SIZE);
+	}
+}
+
 static struct mwifiex_if_ops usb_ops = {
 	.register_dev =		mwifiex_register_dev,
 	.wakeup =		mwifiex_pm_wakeup_card,
@@ -996,6 +1016,7 @@ static struct mwifiex_if_ops usb_ops = {
 	.event_complete =	mwifiex_usb_cmd_event_complete,
 	.data_complete =	mwifiex_usb_data_complete,
 	.host_to_card =		mwifiex_usb_host_to_card,
+	.submit_rem_rx_urb =	mwifiex_usb_submit_rem_rx_urb,
 };
 
 /* This function initializes the USB driver module.
-- 
1.7.3.4


  reply	other threads:[~2014-10-30 10:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11  8:57 mwifiex_usb_submit_rx_urb: dev_alloc_skb failed when conected to 5GHz Belisko Marek
2014-09-11 15:09 ` Amitkumar Karwar
2014-09-11 19:14   ` Belisko Marek
2014-09-17  9:57   ` Belisko Marek
2014-09-17 10:52     ` Amitkumar Karwar
2014-09-17 12:07       ` Belisko Marek
2014-09-17 12:18         ` Belisko Marek
2014-09-17 21:57       ` James Cameron
2014-10-09  8:31       ` Belisko Marek
2014-10-09  9:30         ` Amitkumar Karwar
2014-10-09 11:57           ` Belisko Marek
2014-10-13 13:41             ` Amitkumar Karwar
2014-10-14  6:37               ` Belisko Marek
2014-10-14  7:08                 ` Amitkumar Karwar
2014-10-14  8:25                   ` Belisko Marek
2014-10-14 10:20                     ` James Cameron
2014-10-14 10:48                       ` Belisko Marek
2014-10-14 20:44                         ` James Cameron
2014-10-22 13:36                     ` Belisko Marek
2014-10-23 12:40                       ` Amitkumar Karwar
2014-10-28 12:35                         ` Belisko Marek
2014-10-29  9:54                           ` Amitkumar Karwar
2014-10-29 10:50                             ` Belisko Marek
2014-10-30 10:01                               ` Amitkumar Karwar [this message]
2014-10-30 13:56                                 ` Belisko Marek
2014-10-30 16:21                                   ` Amitkumar Karwar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5FF020A1CFFEEC49BD1E09530C4FF5951821B4843B@SC-VEXCH1.marvell.com \
    --to=akarwar@marvell.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=marek.belisko@gmail.com \
    --cc=patila@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.