diff options
Diffstat (limited to 'net/decnet/dn_nsp_out.c')
-rw-r--r-- | net/decnet/dn_nsp_out.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c index b342e4e8f5f8..23d5ca88dfa3 100644 --- a/net/decnet/dn_nsp_out.c +++ b/net/decnet/dn_nsp_out.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | /****************************************************************************** | 27 | /****************************************************************************** |
28 | (c) 1995-1998 E.M. Serrat emserrat@geocities.com | 28 | (c) 1995-1998 E.M. Serrat emserrat@geocities.com |
29 | 29 | ||
30 | This program is free software; you can redistribute it and/or modify | 30 | This program is free software; you can redistribute it and/or modify |
31 | it under the terms of the GNU General Public License as published by | 31 | it under the terms of the GNU General Public License as published by |
32 | the Free Software Foundation; either version 2 of the License, or | 32 | the Free Software Foundation; either version 2 of the License, or |
@@ -55,7 +55,7 @@ | |||
55 | #include <asm/system.h> | 55 | #include <asm/system.h> |
56 | #include <linux/fcntl.h> | 56 | #include <linux/fcntl.h> |
57 | #include <linux/mm.h> | 57 | #include <linux/mm.h> |
58 | #include <linux/termios.h> | 58 | #include <linux/termios.h> |
59 | #include <linux/interrupt.h> | 59 | #include <linux/interrupt.h> |
60 | #include <linux/proc_fs.h> | 60 | #include <linux/proc_fs.h> |
61 | #include <linux/stat.h> | 61 | #include <linux/stat.h> |
@@ -176,14 +176,14 @@ static void dn_nsp_rtt(struct sock *sk, long rtt) | |||
176 | * gathering this value might turn out negative, so we make sure | 176 | * gathering this value might turn out negative, so we make sure |
177 | * that is it always positive here. | 177 | * that is it always positive here. |
178 | */ | 178 | */ |
179 | if (rtt < 0) | 179 | if (rtt < 0) |
180 | rtt = -rtt; | 180 | rtt = -rtt; |
181 | /* | 181 | /* |
182 | * Add new rtt to smoothed average | 182 | * Add new rtt to smoothed average |
183 | */ | 183 | */ |
184 | delta = ((rtt << 3) - srtt); | 184 | delta = ((rtt << 3) - srtt); |
185 | srtt += (delta >> 3); | 185 | srtt += (delta >> 3); |
186 | if (srtt >= 1) | 186 | if (srtt >= 1) |
187 | scp->nsp_srtt = (unsigned long)srtt; | 187 | scp->nsp_srtt = (unsigned long)srtt; |
188 | else | 188 | else |
189 | scp->nsp_srtt = 1; | 189 | scp->nsp_srtt = 1; |
@@ -193,7 +193,7 @@ static void dn_nsp_rtt(struct sock *sk, long rtt) | |||
193 | */ | 193 | */ |
194 | delta >>= 1; | 194 | delta >>= 1; |
195 | rttvar += ((((delta>0)?(delta):(-delta)) - rttvar) >> 2); | 195 | rttvar += ((((delta>0)?(delta):(-delta)) - rttvar) >> 2); |
196 | if (rttvar >= 1) | 196 | if (rttvar >= 1) |
197 | scp->nsp_rttvar = (unsigned long)rttvar; | 197 | scp->nsp_rttvar = (unsigned long)rttvar; |
198 | else | 198 | else |
199 | scp->nsp_rttvar = 1; | 199 | scp->nsp_rttvar = 1; |
@@ -434,7 +434,7 @@ int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff | |||
434 | * further. | 434 | * further. |
435 | */ | 435 | */ |
436 | if (xmit_count == 1) { | 436 | if (xmit_count == 1) { |
437 | if (dn_equal(segnum, acknum)) | 437 | if (dn_equal(segnum, acknum)) |
438 | dn_nsp_rtt(sk, (long)(pkttime - reftime)); | 438 | dn_nsp_rtt(sk, (long)(pkttime - reftime)); |
439 | 439 | ||
440 | if (scp->snd_window < scp->max_window) | 440 | if (scp->snd_window < scp->max_window) |
@@ -486,16 +486,16 @@ void dn_send_conn_ack (struct sock *sk) | |||
486 | { | 486 | { |
487 | struct dn_scp *scp = DN_SK(sk); | 487 | struct dn_scp *scp = DN_SK(sk); |
488 | struct sk_buff *skb = NULL; | 488 | struct sk_buff *skb = NULL; |
489 | struct nsp_conn_ack_msg *msg; | 489 | struct nsp_conn_ack_msg *msg; |
490 | 490 | ||
491 | if ((skb = dn_alloc_skb(sk, 3, sk->sk_allocation)) == NULL) | 491 | if ((skb = dn_alloc_skb(sk, 3, sk->sk_allocation)) == NULL) |
492 | return; | 492 | return; |
493 | 493 | ||
494 | msg = (struct nsp_conn_ack_msg *)skb_put(skb, 3); | 494 | msg = (struct nsp_conn_ack_msg *)skb_put(skb, 3); |
495 | msg->msgflg = 0x24; | 495 | msg->msgflg = 0x24; |
496 | msg->dstaddr = scp->addrrem; | 496 | msg->dstaddr = scp->addrrem; |
497 | 497 | ||
498 | dn_nsp_send(skb); | 498 | dn_nsp_send(skb); |
499 | } | 499 | } |
500 | 500 | ||
501 | void dn_nsp_delayed_ack(struct sock *sk) | 501 | void dn_nsp_delayed_ack(struct sock *sk) |
@@ -523,25 +523,25 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) | |||
523 | { | 523 | { |
524 | struct dn_scp *scp = DN_SK(sk); | 524 | struct dn_scp *scp = DN_SK(sk); |
525 | struct sk_buff *skb = NULL; | 525 | struct sk_buff *skb = NULL; |
526 | struct nsp_conn_init_msg *msg; | 526 | struct nsp_conn_init_msg *msg; |
527 | __u8 len = (__u8)dn_ntohs(scp->conndata_out.opt_optl); | 527 | __u8 len = (__u8)dn_ntohs(scp->conndata_out.opt_optl); |
528 | 528 | ||
529 | if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL) | 529 | if ((skb = dn_alloc_skb(sk, 50 + len, gfp)) == NULL) |
530 | return; | 530 | return; |
531 | 531 | ||
532 | msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg)); | 532 | msg = (struct nsp_conn_init_msg *)skb_put(skb, sizeof(*msg)); |
533 | msg->msgflg = 0x28; | 533 | msg->msgflg = 0x28; |
534 | msg->dstaddr = scp->addrrem; | 534 | msg->dstaddr = scp->addrrem; |
535 | msg->srcaddr = scp->addrloc; | 535 | msg->srcaddr = scp->addrloc; |
536 | msg->services = scp->services_loc; | 536 | msg->services = scp->services_loc; |
537 | msg->info = scp->info_loc; | 537 | msg->info = scp->info_loc; |
538 | msg->segsize = dn_htons(scp->segsize_loc); | 538 | msg->segsize = dn_htons(scp->segsize_loc); |
539 | 539 | ||
540 | *skb_put(skb,1) = len; | 540 | *skb_put(skb,1) = len; |
541 | 541 | ||
542 | if (len > 0) | 542 | if (len > 0) |
543 | memcpy(skb_put(skb, len), scp->conndata_out.opt_data, len); | 543 | memcpy(skb_put(skb, len), scp->conndata_out.opt_data, len); |
544 | 544 | ||
545 | 545 | ||
546 | dn_nsp_send(skb); | 546 | dn_nsp_send(skb); |
547 | 547 | ||
@@ -550,7 +550,7 @@ void dn_send_conn_conf(struct sock *sk, gfp_t gfp) | |||
550 | } | 550 | } |
551 | 551 | ||
552 | 552 | ||
553 | static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, | 553 | static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, |
554 | unsigned short reason, gfp_t gfp, | 554 | unsigned short reason, gfp_t gfp, |
555 | struct dst_entry *dst, | 555 | struct dst_entry *dst, |
556 | int ddl, unsigned char *dd, __le16 rem, __le16 loc) | 556 | int ddl, unsigned char *dd, __le16 rem, __le16 loc) |
@@ -593,7 +593,7 @@ static __inline__ void dn_nsp_do_disc(struct sock *sk, unsigned char msgflg, | |||
593 | } | 593 | } |
594 | 594 | ||
595 | 595 | ||
596 | void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg, | 596 | void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg, |
597 | unsigned short reason, gfp_t gfp) | 597 | unsigned short reason, gfp_t gfp) |
598 | { | 598 | { |
599 | struct dn_scp *scp = DN_SK(sk); | 599 | struct dn_scp *scp = DN_SK(sk); |
@@ -605,19 +605,19 @@ void dn_nsp_send_disc(struct sock *sk, unsigned char msgflg, | |||
605 | if (reason == 0) | 605 | if (reason == 0) |
606 | reason = dn_ntohs(scp->discdata_out.opt_status); | 606 | reason = dn_ntohs(scp->discdata_out.opt_status); |
607 | 607 | ||
608 | dn_nsp_do_disc(sk, msgflg, reason, gfp, sk->sk_dst_cache, ddl, | 608 | dn_nsp_do_disc(sk, msgflg, reason, gfp, sk->sk_dst_cache, ddl, |
609 | scp->discdata_out.opt_data, scp->addrrem, scp->addrloc); | 609 | scp->discdata_out.opt_data, scp->addrrem, scp->addrloc); |
610 | } | 610 | } |
611 | 611 | ||
612 | 612 | ||
613 | void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg, | 613 | void dn_nsp_return_disc(struct sk_buff *skb, unsigned char msgflg, |
614 | unsigned short reason) | 614 | unsigned short reason) |
615 | { | 615 | { |
616 | struct dn_skb_cb *cb = DN_SKB_CB(skb); | 616 | struct dn_skb_cb *cb = DN_SKB_CB(skb); |
617 | int ddl = 0; | 617 | int ddl = 0; |
618 | gfp_t gfp = GFP_ATOMIC; | 618 | gfp_t gfp = GFP_ATOMIC; |
619 | 619 | ||
620 | dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl, | 620 | dn_nsp_do_disc(NULL, msgflg, reason, gfp, skb->dst, ddl, |
621 | NULL, cb->src_port, cb->dst_port); | 621 | NULL, cb->src_port, cb->dst_port); |
622 | } | 622 | } |
623 | 623 | ||
@@ -676,8 +676,8 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) | |||
676 | 676 | ||
677 | msg->srcaddr = scp->addrloc; | 677 | msg->srcaddr = scp->addrloc; |
678 | msg->services = scp->services_loc; /* Requested flow control */ | 678 | msg->services = scp->services_loc; /* Requested flow control */ |
679 | msg->info = scp->info_loc; /* Version Number */ | 679 | msg->info = scp->info_loc; /* Version Number */ |
680 | msg->segsize = dn_htons(scp->segsize_loc); /* Max segment size */ | 680 | msg->segsize = dn_htons(scp->segsize_loc); /* Max segment size */ |
681 | 681 | ||
682 | if (scp->peer.sdn_objnum) | 682 | if (scp->peer.sdn_objnum) |
683 | type = 0; | 683 | type = 0; |
@@ -692,7 +692,7 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) | |||
692 | menuver |= DN_MENUVER_UIC; | 692 | menuver |= DN_MENUVER_UIC; |
693 | 693 | ||
694 | *skb_put(skb, 1) = menuver; /* Menu Version */ | 694 | *skb_put(skb, 1) = menuver; /* Menu Version */ |
695 | 695 | ||
696 | aux = scp->accessdata.acc_userl; | 696 | aux = scp->accessdata.acc_userl; |
697 | *skb_put(skb, 1) = aux; | 697 | *skb_put(skb, 1) = aux; |
698 | if (aux > 0) | 698 | if (aux > 0) |
@@ -718,6 +718,6 @@ void dn_nsp_send_conninit(struct sock *sk, unsigned char msgflg) | |||
718 | 718 | ||
719 | cb->rt_flags = DN_RT_F_RQR; | 719 | cb->rt_flags = DN_RT_F_RQR; |
720 | 720 | ||
721 | dn_nsp_send(skb); | 721 | dn_nsp_send(skb); |
722 | } | 722 | } |
723 | 723 | ||