netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] [IrDA] Updates for net-2.6
@ 2007-06-09  1:08 samuel
  2007-06-09  1:08 ` [PATCH 1/2] [IrDA] Fix Rx/Tx path race samuel-jcdQHdrhKHMdnm+yROfE0A
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: samuel @ 2007-06-09  1:08 UTC (permalink / raw)
  To: davem; +Cc: irda-users, netdev

Hi Dave,

These 2 patches are bug fixes and should thus be considered for net-2.6
inclusion.

Cheers,
Samuel.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] [IrDA] Fix Rx/Tx path race
  2007-06-09  1:08 [PATCH 0/2] [IrDA] Updates for net-2.6 samuel
@ 2007-06-09  1:08 ` samuel-jcdQHdrhKHMdnm+yROfE0A
  2007-06-09  1:08 ` [PATCH 2/2] [IrDA] f-timer reloading when sending rejected frames samuel-jcdQHdrhKHMdnm+yROfE0A
       [not found] ` <20070609010815.963618030-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
  2 siblings, 0 replies; 4+ messages in thread
From: samuel-jcdQHdrhKHMdnm+yROfE0A @ 2007-06-09  1:08 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
  Cc: irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, G. Liakhovetski,
	netdev-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 0010-IrDA-Fix-Rx-Tx-path-race.patch --]
[-- Type: text/plain, Size: 3435 bytes --]

From: G. Liakhovetski <gl-o/hVf8ie6tKzQB+pC5nmwQ@public.gmane.org>

We need to switch to NRM _before_ sending the final packet otherwise we might hit a race condition where we get the first packet from the peer while we're still in LAP_XMIT_P.

Cc: G. Liakhovetski <gl-o/hVf8ie6tKzQB+pC5nmwQ@public.gmane.org>
Signed-off-by: Samuel Ortiz <samuel-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
---
 include/net/irda/irlap.h |   17 +++++++++++++++++
 net/irda/irlap_event.c   |   18 ------------------
 net/irda/irlap_frame.c   |    3 +++
 3 files changed, 20 insertions(+), 18 deletions(-)

Index: net-2.6-quilt/include/net/irda/irlap.h
===================================================================
--- net-2.6-quilt.orig/include/net/irda/irlap.h	2007-05-10 19:23:04.000000000 +0300
+++ net-2.6-quilt/include/net/irda/irlap.h	2007-05-10 19:24:57.000000000 +0300
@@ -289,4 +289,21 @@
 	self->disconnect_pending = FALSE;
 }
 
+/*
+ * Function irlap_next_state (self, state)
+ *
+ *    Switches state and provides debug information
+ *
+ */
+static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
+{
+	/*
+	if (!self || self->magic != LAP_MAGIC)
+		return;
+
+	IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]);
+	*/
+	self->state = state;
+}
+
 #endif
Index: net-2.6-quilt/net/irda/irlap_event.c
===================================================================
--- net-2.6-quilt.orig/net/irda/irlap_event.c	2007-05-10 19:23:04.000000000 +0300
+++ net-2.6-quilt/net/irda/irlap_event.c	2007-05-10 19:23:09.000000000 +0300
@@ -317,23 +317,6 @@
 }
 
 /*
- * Function irlap_next_state (self, state)
- *
- *    Switches state and provides debug information
- *
- */
-static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
-{
-	/*
-	if (!self || self->magic != LAP_MAGIC)
-		return;
-
-	IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]);
-	*/
-	self->state = state;
-}
-
-/*
  * Function irlap_state_ndm (event, skb, frame)
  *
  *    NDM (Normal Disconnected Mode) state
@@ -1086,7 +1069,6 @@
 			} else {
 				/* Final packet of window */
 				irlap_send_data_primary_poll(self, skb);
-				irlap_next_state(self, LAP_NRM_P);
 
 				/*
 				 * Make sure state machine does not try to send
Index: net-2.6-quilt/net/irda/irlap_frame.c
===================================================================
--- net-2.6-quilt.orig/net/irda/irlap_frame.c	2007-05-10 19:23:04.000000000 +0300
+++ net-2.6-quilt/net/irda/irlap_frame.c	2007-05-10 19:25:59.000000000 +0300
@@ -798,16 +798,19 @@
 		self->vs = (self->vs + 1) % 8;
 		self->ack_required = FALSE;
 
+		irlap_next_state(self, LAP_NRM_P);
 		irlap_send_i_frame(self, tx_skb, CMD_FRAME);
 	} else {
 		IRDA_DEBUG(4, "%s(), sending unreliable frame\n", __FUNCTION__);
 
 		if (self->ack_required) {
 			irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME);
+			irlap_next_state(self, LAP_NRM_P);
 			irlap_send_rr_frame(self, CMD_FRAME);
 			self->ack_required = FALSE;
 		} else {
 			skb->data[1] |= PF_BIT;
+			irlap_next_state(self, LAP_NRM_P);
 			irlap_send_ui_frame(self, skb_get(skb), self->caddr, CMD_FRAME);
 		}
 	}

-- 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] [IrDA] f-timer reloading when sending rejected frames
  2007-06-09  1:08 [PATCH 0/2] [IrDA] Updates for net-2.6 samuel
  2007-06-09  1:08 ` [PATCH 1/2] [IrDA] Fix Rx/Tx path race samuel-jcdQHdrhKHMdnm+yROfE0A
@ 2007-06-09  1:08 ` samuel-jcdQHdrhKHMdnm+yROfE0A
       [not found] ` <20070609010815.963618030-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
  2 siblings, 0 replies; 4+ messages in thread
From: samuel-jcdQHdrhKHMdnm+yROfE0A @ 2007-06-09  1:08 UTC (permalink / raw)
  To: davem-fT/PcQaiUtIeIZ0/mPfg9Q
  Cc: irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, G. Liakhovetski,
	netdev-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: final-timer-recharge.patch --]
[-- Type: text/plain, Size: 1764 bytes --]

Jean II was right: you have to re-charge the final timer when resending 
rejected frames. Otherwise it triggers at a wrong time and can break the 
currently running communication. Reproducible under rt-preempt.

Signed-off-by: G. Liakhovetski <gl-o/hVf8ie6tKzQB+pC5nmwQ@public.gmane.org>
Signed-off-by: Samuel Ortiz <samuel-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>

Index: net-2.6-quilt/net/irda/irlap_event.c
===================================================================
--- net-2.6-quilt.orig/net/irda/irlap_event.c	2007-05-29 09:36:09.000000000 +0300
+++ net-2.6-quilt/net/irda/irlap_event.c	2007-05-29 09:38:19.000000000 +0300
@@ -1418,14 +1418,14 @@
 		 */
 		self->remote_busy = FALSE;
 
+		/* Stop final timer */
+		del_timer(&self->final_timer);
+
 		/*
 		 *  Nr as expected?
 		 */
 		ret = irlap_validate_nr_received(self, info->nr);
 		if (ret == NR_EXPECTED) {
-			/* Stop final timer */
-			del_timer(&self->final_timer);
-
 			/* Update Nr received */
 			irlap_update_nr_received(self, info->nr);
 
@@ -1457,14 +1457,12 @@
 
 			/* Resend rejected frames */
 			irlap_resend_rejected_frames(self, CMD_FRAME);
-
-			/* Final timer ??? Jean II */
+			irlap_start_final_timer(self, self->final_timeout * 2);
 
 			irlap_next_state(self, LAP_NRM_P);
 		} else if (ret == NR_INVALID) {
 			IRDA_DEBUG(1, "%s(), Received RR with "
 				   "invalid nr !\n", __FUNCTION__);
-			del_timer(&self->final_timer);
 
 			irlap_next_state(self, LAP_RESET_WAIT);
 

-- 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] [IrDA] Updates for net-2.6
       [not found] ` <20070609010815.963618030-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
@ 2007-06-09  2:17   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2007-06-09  2:17 UTC (permalink / raw)
  To: samuel-jcdQHdrhKHMdnm+yROfE0A
  Cc: irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	netdev-u79uwXL29TY76Z2rM5mHXA

From: samuel-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org
Date: Sat, 09 Jun 2007 04:08:15 +0300

> These 2 patches are bug fixes and should thus be considered for net-2.6
> inclusion.

Both patches applied, thanks Sam.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-09  2:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-09  1:08 [PATCH 0/2] [IrDA] Updates for net-2.6 samuel
2007-06-09  1:08 ` [PATCH 1/2] [IrDA] Fix Rx/Tx path race samuel-jcdQHdrhKHMdnm+yROfE0A
2007-06-09  1:08 ` [PATCH 2/2] [IrDA] f-timer reloading when sending rejected frames samuel-jcdQHdrhKHMdnm+yROfE0A
     [not found] ` <20070609010815.963618030-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
2007-06-09  2:17   ` [PATCH 0/2] [IrDA] Updates for net-2.6 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).