mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jean Tourrilhes <jt@bougret.hpl.hp.com>
To: Linus Torvalds <torvalds@transmeta.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Dag Brattli <dag@brattli.net>,
	Linux kernel mailing list <linux-kernel@vger.kernel.org>,
	linux-irda@pasta.cs.uit.no
Subject: [IrDA patch] ir247_lap_keepalive.diff
Date: Thu, 13 Sep 2001 16:20:20 -0700	[thread overview]
Message-ID: <20010913162020.F7470@bougret.hpl.hp.com> (raw)

ir247_lap_keepalive.diff :
------------------------
	<Apply after ir248_disco_fixes_4.diff to avoid "offset X lines">
	o [FEATURE] Add "lap_keepalive_time" sysctl
		- Control how long LAP stay alive after last socket closed
		- Allow to test the secondary disconnect path
		- Allow to trigger LMP deadlocks fixed one month ago

diff -u -p linux/include/net/irda/irlmp.j1.h linux/include/net/irda/irlmp.h
--- linux/include/net/irda/irlmp.j1.h	Thu Sep 13 12:07:12 2001
+++ linux/include/net/irda/irlmp.h	Thu Sep 13 12:08:30 2001
@@ -247,6 +247,7 @@ extern char *lmp_reasons[];
 extern int sysctl_discovery_timeout;
 extern int sysctl_discovery_slots;
 extern int sysctl_discovery;
+extern int sysctl_lap_keepalive_time;	/* in ms, default is LM_IDLE_TIMEOUT */
 extern struct irlmp_cb *irlmp;
 
 static inline hashbin_t *irlmp_get_cachelog(void) { return irlmp->cachelog; }
diff -u -p linux/net/irda/irlmp.j1.c linux/net/irda/irlmp.c
--- linux/net/irda/irlmp.j1.c	Thu Sep 13 12:07:27 2001
+++ linux/net/irda/irlmp.c	Thu Sep 13 12:08:30 2001
@@ -49,6 +49,7 @@ struct irlmp_cb *irlmp = NULL;
 int  sysctl_discovery         = 0;
 int  sysctl_discovery_timeout = 3; /* 3 seconds by default */
 int  sysctl_discovery_slots   = 6; /* 6 slots by default */
+int  sysctl_lap_keepalive_time = LM_IDLE_TIMEOUT * 1000 / HZ;
 char sysctl_devname[65];
 
 char *lmp_reasons[] = {
diff -u -p linux/net/irda/irsysctl.j1.c linux/net/irda/irsysctl.c
--- linux/net/irda/irsysctl.j1.c	Thu Sep 13 12:07:39 2001
+++ linux/net/irda/irsysctl.c	Thu Sep 13 12:08:30 2001
@@ -33,7 +33,7 @@
 
 #define NET_IRDA 412 /* Random number */
 enum { DISCOVERY=1, DEVNAME, DEBUG, SLOTS, DISCOVERY_TIMEOUT, 
-       SLOT_TIMEOUT, MAX_BAUD_RATE, MAX_INACTIVE_TIME };
+       SLOT_TIMEOUT, MAX_BAUD_RATE, MAX_INACTIVE_TIME, LAP_KEEPALIVE_TIME, };
 
 extern int  sysctl_discovery;
 extern int  sysctl_discovery_slots;
@@ -44,6 +44,7 @@ int         sysctl_compression = 0;
 extern char sysctl_devname[];
 extern int  sysctl_max_baud_rate;
 extern int  sysctl_max_inactive_time;
+extern int  sysctl_lap_keepalive_time;
 
 #ifdef CONFIG_IRDA_DEBUG
 extern unsigned int irda_debug;
@@ -88,6 +89,8 @@ static ctl_table irda_table[] = {
 	{ MAX_BAUD_RATE, "max_baud_rate", &sysctl_max_baud_rate,
 	  sizeof(int), 0644, NULL, &proc_dointvec },
 	{ MAX_INACTIVE_TIME, "max_inactive_time", &sysctl_max_inactive_time,
+	  sizeof(int), 0644, NULL, &proc_dointvec },
+	{ LAP_KEEPALIVE_TIME, "lap_keepalive_time", &sysctl_lap_keepalive_time,
 	  sizeof(int), 0644, NULL, &proc_dointvec },
 	{ 0 }
 };
diff -u -p linux/net/irda/irlmp_event.j1.c linux/net/irda/irlmp_event.c
--- linux/net/irda/irlmp_event.j1.c	Thu Sep 13 12:07:50 2001
+++ linux/net/irda/irlmp_event.c	Thu Sep 13 12:08:30 2001
@@ -387,9 +387,15 @@ static void irlmp_state_active(struct la
 		 *  must be the one that tries to close IrLAP. It will be 
 		 *  removed later and moved to the list of unconnected LSAPs
 		 */
-		if (HASHBIN_GET_SIZE(self->lsaps) > 0)
-			irlmp_start_idle_timer(self, LM_IDLE_TIMEOUT);
-		else {
+		if (HASHBIN_GET_SIZE(self->lsaps) > 0) {
+			/* Make sure the timer has sensible value (the user
+			 * may have set it) - Jean II */
+			if(sysctl_lap_keepalive_time < 100)	/* 100ms */
+				sysctl_lap_keepalive_time = 100;
+			if(sysctl_lap_keepalive_time > 10000)	/* 10s */
+				sysctl_lap_keepalive_time = 10000;
+			irlmp_start_idle_timer(self, sysctl_lap_keepalive_time * HZ / 1000);
+		} else {
 			/* No more connections, so close IrLAP */
 
 			/* We don't want to change state just yet, because

                 reply	other threads:[~2001-09-13 23:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20010913162020.F7470@bougret.hpl.hp.com \
    --to=jt@bougret.hpl.hp.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dag@brattli.net \
    --cc=jt@hpl.hp.com \
    --cc=linux-irda@pasta.cs.uit.no \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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 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®