aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2006-05-04 02:27:16 -0400
committerDavid S. Miller <davem@davemloft.net>2006-05-04 02:27:16 -0400
commite1fdb5b39656ea2be8cadde565e543649a988af9 (patch)
tree1e8af7a60fb23c871cd3c6db194156563bce1e18
parent4cc7c2734e2b4032103e47d8f3e8b6fa3360d3f1 (diff)
[AX.25]: Eleminate HZ from AX.25 kernel interfaces
Convert all AX.25 sysctl time values from jiffies to ms as units. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/ax25.h10
-rw-r--r--net/ax25/af_ax25.c73
-rw-r--r--net/ax25/ax25_ds_timer.c3
-rw-r--r--net/ax25/sysctl_net_ax25.c10
4 files changed, 53 insertions, 43 deletions
diff --git a/include/net/ax25.h b/include/net/ax25.h
index d052b221dbcd..5bd997487054 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -145,14 +145,14 @@ enum {
145#define AX25_DEF_CONMODE 2 /* Connected mode allowed */ 145#define AX25_DEF_CONMODE 2 /* Connected mode allowed */
146#define AX25_DEF_WINDOW 2 /* Window=2 */ 146#define AX25_DEF_WINDOW 2 /* Window=2 */
147#define AX25_DEF_EWINDOW 32 /* Module-128 Window=32 */ 147#define AX25_DEF_EWINDOW 32 /* Module-128 Window=32 */
148#define AX25_DEF_T1 (10 * HZ) /* T1=10s */ 148#define AX25_DEF_T1 10000 /* T1=10s */
149#define AX25_DEF_T2 (3 * HZ) /* T2=3s */ 149#define AX25_DEF_T2 3000 /* T2=3s */
150#define AX25_DEF_T3 (300 * HZ) /* T3=300s */ 150#define AX25_DEF_T3 300000 /* T3=300s */
151#define AX25_DEF_N2 10 /* N2=10 */ 151#define AX25_DEF_N2 10 /* N2=10 */
152#define AX25_DEF_IDLE (0 * 60 * HZ) /* Idle=None */ 152#define AX25_DEF_IDLE 0 /* Idle=None */
153#define AX25_DEF_PACLEN 256 /* Paclen=256 */ 153#define AX25_DEF_PACLEN 256 /* Paclen=256 */
154#define AX25_DEF_PROTOCOL AX25_PROTO_STD_SIMPLEX /* Standard AX.25 */ 154#define AX25_DEF_PROTOCOL AX25_PROTO_STD_SIMPLEX /* Standard AX.25 */
155#define AX25_DEF_DS_TIMEOUT (3 * 60 * HZ) /* DAMA timeout 3 minutes */ 155#define AX25_DEF_DS_TIMEOUT 180000 /* DAMA timeout 3 minutes */
156 156
157typedef struct ax25_uid_assoc { 157typedef struct ax25_uid_assoc {
158 struct hlist_node uid_node; 158 struct hlist_node uid_node;
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index a9f13dfde07e..a2e0dd047e9f 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -426,6 +426,26 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
426 return 0; 426 return 0;
427} 427}
428 428
429static void ax25_fillin_cb_from_dev(ax25_cb *ax25, ax25_dev *ax25_dev)
430{
431 ax25->rtt = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]) / 2;
432 ax25->t1 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]);
433 ax25->t2 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T2]);
434 ax25->t3 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T3]);
435 ax25->n2 = ax25_dev->values[AX25_VALUES_N2];
436 ax25->paclen = ax25_dev->values[AX25_VALUES_PACLEN];
437 ax25->idle = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_IDLE]);
438 ax25->backoff = ax25_dev->values[AX25_VALUES_BACKOFF];
439
440 if (ax25_dev->values[AX25_VALUES_AXDEFMODE]) {
441 ax25->modulus = AX25_EMODULUS;
442 ax25->window = ax25_dev->values[AX25_VALUES_EWINDOW];
443 } else {
444 ax25->modulus = AX25_MODULUS;
445 ax25->window = ax25_dev->values[AX25_VALUES_WINDOW];
446 }
447}
448
429/* 449/*
430 * Fill in a created AX.25 created control block with the default 450 * Fill in a created AX.25 created control block with the default
431 * values for a particular device. 451 * values for a particular device.
@@ -435,39 +455,28 @@ void ax25_fillin_cb(ax25_cb *ax25, ax25_dev *ax25_dev)
435 ax25->ax25_dev = ax25_dev; 455 ax25->ax25_dev = ax25_dev;
436 456
437 if (ax25->ax25_dev != NULL) { 457 if (ax25->ax25_dev != NULL) {
438 ax25->rtt = ax25_dev->values[AX25_VALUES_T1] / 2; 458 ax25_fillin_cb_from_dev(ax25, ax25_dev);
439 ax25->t1 = ax25_dev->values[AX25_VALUES_T1]; 459 return;
440 ax25->t2 = ax25_dev->values[AX25_VALUES_T2]; 460 }
441 ax25->t3 = ax25_dev->values[AX25_VALUES_T3]; 461
442 ax25->n2 = ax25_dev->values[AX25_VALUES_N2]; 462 /*
443 ax25->paclen = ax25_dev->values[AX25_VALUES_PACLEN]; 463 * No device, use kernel / AX.25 spec default values
444 ax25->idle = ax25_dev->values[AX25_VALUES_IDLE]; 464 */
445 ax25->backoff = ax25_dev->values[AX25_VALUES_BACKOFF]; 465 ax25->rtt = msecs_to_jiffies(AX25_DEF_T1) / 2;
446 466 ax25->t1 = msecs_to_jiffies(AX25_DEF_T1);
447 if (ax25_dev->values[AX25_VALUES_AXDEFMODE]) { 467 ax25->t2 = msecs_to_jiffies(AX25_DEF_T2);
448 ax25->modulus = AX25_EMODULUS; 468 ax25->t3 = msecs_to_jiffies(AX25_DEF_T3);
449 ax25->window = ax25_dev->values[AX25_VALUES_EWINDOW]; 469 ax25->n2 = AX25_DEF_N2;
450 } else { 470 ax25->paclen = AX25_DEF_PACLEN;
451 ax25->modulus = AX25_MODULUS; 471 ax25->idle = msecs_to_jiffies(AX25_DEF_IDLE);
452 ax25->window = ax25_dev->values[AX25_VALUES_WINDOW]; 472 ax25->backoff = AX25_DEF_BACKOFF;
453 } 473
474 if (AX25_DEF_AXDEFMODE) {
475 ax25->modulus = AX25_EMODULUS;
476 ax25->window = AX25_DEF_EWINDOW;
454 } else { 477 } else {
455 ax25->rtt = AX25_DEF_T1 / 2; 478 ax25->modulus = AX25_MODULUS;
456 ax25->t1 = AX25_DEF_T1; 479 ax25->window = AX25_DEF_WINDOW;
457 ax25->t2 = AX25_DEF_T2;
458 ax25->t3 = AX25_DEF_T3;
459 ax25->n2 = AX25_DEF_N2;
460 ax25->paclen = AX25_DEF_PACLEN;
461 ax25->idle = AX25_DEF_IDLE;
462 ax25->backoff = AX25_DEF_BACKOFF;
463
464 if (AX25_DEF_AXDEFMODE) {
465 ax25->modulus = AX25_EMODULUS;
466 ax25->window = AX25_DEF_EWINDOW;
467 } else {
468 ax25->modulus = AX25_MODULUS;
469 ax25->window = AX25_DEF_WINDOW;
470 }
471 } 480 }
472} 481}
473 482
diff --git a/net/ax25/ax25_ds_timer.c b/net/ax25/ax25_ds_timer.c
index 061083efc1dc..5961459935eb 100644
--- a/net/ax25/ax25_ds_timer.c
+++ b/net/ax25/ax25_ds_timer.c
@@ -61,7 +61,8 @@ void ax25_ds_set_timer(ax25_dev *ax25_dev)
61 return; 61 return;
62 62
63 del_timer(&ax25_dev->dama.slave_timer); 63 del_timer(&ax25_dev->dama.slave_timer);
64 ax25_dev->dama.slave_timeout = ax25_dev->values[AX25_VALUES_DS_TIMEOUT] / 10; 64 ax25_dev->dama.slave_timeout =
65 msecs_to_jiffies(ax25_dev->values[AX25_VALUES_DS_TIMEOUT]) / 10;
65 ax25_ds_add_timer(ax25_dev); 66 ax25_ds_add_timer(ax25_dev);
66} 67}
67 68
diff --git a/net/ax25/sysctl_net_ax25.c b/net/ax25/sysctl_net_ax25.c
index 894a22558d9d..bdb64c36df12 100644
--- a/net/ax25/sysctl_net_ax25.c
+++ b/net/ax25/sysctl_net_ax25.c
@@ -18,14 +18,14 @@ static int min_backoff[1], max_backoff[] = {2};
18static int min_conmode[1], max_conmode[] = {2}; 18static int min_conmode[1], max_conmode[] = {2};
19static int min_window[] = {1}, max_window[] = {7}; 19static int min_window[] = {1}, max_window[] = {7};
20static int min_ewindow[] = {1}, max_ewindow[] = {63}; 20static int min_ewindow[] = {1}, max_ewindow[] = {63};
21static int min_t1[] = {1}, max_t1[] = {30 * HZ}; 21static int min_t1[] = {1}, max_t1[] = {30000};
22static int min_t2[] = {1}, max_t2[] = {20 * HZ}; 22static int min_t2[] = {1}, max_t2[] = {20000};
23static int min_t3[1], max_t3[] = {3600 * HZ}; 23static int min_t3[1], max_t3[] = {3600000};
24static int min_idle[1], max_idle[] = {65535 * HZ}; 24static int min_idle[1], max_idle[] = {65535000};
25static int min_n2[] = {1}, max_n2[] = {31}; 25static int min_n2[] = {1}, max_n2[] = {31};
26static int min_paclen[] = {1}, max_paclen[] = {512}; 26static int min_paclen[] = {1}, max_paclen[] = {512};
27static int min_proto[1], max_proto[] = { AX25_PROTO_MAX }; 27static int min_proto[1], max_proto[] = { AX25_PROTO_MAX };
28static int min_ds_timeout[1], max_ds_timeout[] = {65535 * HZ}; 28static int min_ds_timeout[1], max_ds_timeout[] = {65535000};
29 29
30static struct ctl_table_header *ax25_table_header; 30static struct ctl_table_header *ax25_table_header;
31 31