mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rupesh Gujare <rupesh.gujare@atmel.com>
To: <devel@linuxdriverproject.org>
Cc: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<gregkh@linuxfoundation.org>
Subject: [PATCH 4/6] staging: ozwpan: Drop oldest ISOC frame instead of dropping latest.
Date: Thu, 1 Aug 2013 18:40:03 +0100	[thread overview]
Message-ID: <1375378806-17948-5-git-send-email-rupesh.gujare@atmel.com> (raw)
In-Reply-To: <1375378806-17948-1-git-send-email-rupesh.gujare@atmel.com>

In case of ISOC transfer, if TX queue is full then we start
dropping latest frame, instead we should drop oldest frame &
add latest frame to TX queue.

Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
---
 drivers/staging/ozwpan/ozpd.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c
index 86876bd..17fd7b2 100644
--- a/drivers/staging/ozwpan/ozpd.c
+++ b/drivers/staging/ozwpan/ozpd.c
@@ -844,9 +844,20 @@ int oz_send_isoc_unit(struct oz_pd *pd, u8 ep_num, const u8 *data, int len)
 			struct oz_tx_frame *isoc_unit = NULL;
 			int nb = pd->nb_queued_isoc_frames;
 			if (nb >= pd->isoc_latency) {
+				struct list_head *e;
+				struct oz_tx_frame *f;
 				oz_dbg(TX_FRAMES, "Dropping ISOC Unit nb= %d\n",
 				       nb);
-				goto out;
+				spin_lock(&pd->tx_frame_lock);
+				list_for_each(e, &pd->tx_queue) {
+					f = container_of(e, struct oz_tx_frame,
+									link);
+					if (f->skb != NULL) {
+						oz_tx_isoc_free(pd, f);
+						break;
+					}
+				}
+				spin_unlock(&pd->tx_frame_lock);
 			}
 			isoc_unit = oz_tx_frame_alloc(pd);
 			if (isoc_unit == NULL)
-- 
1.7.9.5


      parent reply	other threads:[~2013-08-01 17:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 17:39 [PATCH 0/6] staging: ozwpan: Use Kernel API & Bug fixes Rupesh Gujare
2013-08-01 17:40 ` [PATCH 1/6] staging: ozwpan: Use kernel list function for managing interface list Rupesh Gujare
2013-08-01 17:40 ` [PATCH 2/6] staging: ozwpan: Mark string as const Rupesh Gujare
2013-08-01 18:17   ` Joe Perches
2013-08-01 17:40 ` [PATCH 3/6] staging: ozwpan: Use kernel strncmp function Rupesh Gujare
2013-08-01 17:40 ` Rupesh Gujare [this message]

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=1375378806-17948-5-git-send-email-rupesh.gujare@atmel.com \
    --to=rupesh.gujare@atmel.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®