aboutsummaryrefslogtreecommitdiffstats
path: root/net/ax25/af_ax25.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ax25/af_ax25.c')
-rw-r--r--net/ax25/af_ax25.c73
1 files changed, 41 insertions, 32 deletions
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