patch-2.1.22 linux/net/netrom/nr_subr.c
Next file: linux/net/netrom/nr_timer.c
Previous file: linux/net/netrom/nr_route.c
Back to the patch index
Back to the overall index
- Lines: 149
- Date:
Sun Jan 19 15:47:29 1997
- Orig file:
v2.1.21/linux/net/netrom/nr_subr.c
- Orig date:
Thu Jan 2 15:55:28 1997
diff -u --recursive --new-file v2.1.21/linux/net/netrom/nr_subr.c linux/net/netrom/nr_subr.c
@@ -16,7 +16,7 @@
* NET/ROM 001 Jonathan(G4KLX) Cloned from ax25_subr.c
* NET/ROM 003 Jonathan(G4KLX) Added G8BPQ NET/ROM extensions.
*/
-
+
#include <linux/config.h>
#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE)
#include <linux/errno.h>
@@ -48,23 +48,17 @@
{
struct sk_buff *skb;
- while ((skb = skb_dequeue(&sk->write_queue)) != NULL) {
- skb->sk = sk;
+ while ((skb = skb_dequeue(&sk->write_queue)) != NULL)
kfree_skb(skb, FREE_WRITE);
- }
- while ((skb = skb_dequeue(&sk->protinfo.nr->ack_queue)) != NULL) {
- skb->sk = sk;
+ while ((skb = skb_dequeue(&sk->protinfo.nr->ack_queue)) != NULL)
kfree_skb(skb, FREE_WRITE);
- }
- while ((skb = skb_dequeue(&sk->protinfo.nr->reseq_queue)) != NULL) {
+ while ((skb = skb_dequeue(&sk->protinfo.nr->reseq_queue)) != NULL)
kfree_skb(skb, FREE_READ);
- }
- while ((skb = skb_dequeue(&sk->protinfo.nr->frag_queue)) != NULL) {
+ while ((skb = skb_dequeue(&sk->protinfo.nr->frag_queue)) != NULL)
kfree_skb(skb, FREE_READ);
- }
}
/*
@@ -82,7 +76,6 @@
if (sk->protinfo.nr->va != nr) {
while (skb_peek(&sk->protinfo.nr->ack_queue) != NULL && sk->protinfo.nr->va != nr) {
skb = skb_dequeue(&sk->protinfo.nr->ack_queue);
- skb->sk = sk;
kfree_skb(skb, FREE_WRITE);
sk->protinfo.nr->va = (sk->protinfo.nr->va + 1) % NR_MODULUS;
}
@@ -119,7 +112,7 @@
if (nr == vc) return 1;
vc = (vc + 1) % NR_MODULUS;
}
-
+
if (nr == sk->protinfo.nr->vs) return 1;
return 0;
@@ -152,7 +145,7 @@
int len, timeout;
len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + NR_NETWORK_LEN + NR_TRANSPORT_LEN;
-
+
switch (frametype & 0x0F) {
case NR_CONNREQ:
len += 17;
@@ -168,7 +161,7 @@
printk(KERN_ERR "nr_write_internal: invalid frame type %d\n", frametype);
return;
}
-
+
if ((skb = alloc_skb(len, GFP_ATOMIC)) == NULL)
return;
@@ -182,7 +175,7 @@
switch (frametype & 0x0F) {
case NR_CONNREQ:
- timeout = (sk->protinfo.nr->rtt / PR_SLOWHZ) * 2;
+ timeout = (sk->protinfo.nr->rtt / NR_SLOWHZ) * 2;
*dptr++ = sk->protinfo.nr->my_index;
*dptr++ = sk->protinfo.nr->my_id;
*dptr++ = 0;
@@ -190,14 +183,14 @@
*dptr++ = frametype;
*dptr++ = sk->protinfo.nr->window;
memcpy(dptr, &sk->protinfo.nr->user_addr, AX25_ADDR_LEN);
- dptr[6] &= ~LAPB_C;
- dptr[6] &= ~LAPB_E;
- dptr[6] |= SSSID_SPARE;
+ dptr[6] &= ~AX25_CBIT;
+ dptr[6] &= ~AX25_EBIT;
+ dptr[6] |= AX25_SSSID_SPARE;
dptr += AX25_ADDR_LEN;
memcpy(dptr, &sk->protinfo.nr->source_addr, AX25_ADDR_LEN);
- dptr[6] &= ~LAPB_C;
- dptr[6] &= ~LAPB_E;
- dptr[6] |= SSSID_SPARE;
+ dptr[6] &= ~AX25_CBIT;
+ dptr[6] &= ~AX25_EBIT;
+ dptr[6] |= AX25_SSSID_SPARE;
dptr += AX25_ADDR_LEN;
*dptr++ = timeout % 256;
*dptr++ = timeout / 256;
@@ -254,15 +247,15 @@
dptr = skb_put(skbn, NR_NETWORK_LEN + NR_TRANSPORT_LEN);
memcpy(dptr, skb->data + 7, AX25_ADDR_LEN);
- dptr[6] &= ~LAPB_C;
- dptr[6] &= ~LAPB_E;
- dptr[6] |= SSSID_SPARE;
+ dptr[6] &= ~AX25_CBIT;
+ dptr[6] &= ~AX25_EBIT;
+ dptr[6] |= AX25_SSSID_SPARE;
dptr += AX25_ADDR_LEN;
memcpy(dptr, skb->data + 0, AX25_ADDR_LEN);
- dptr[6] &= ~LAPB_C;
- dptr[6] |= LAPB_E;
- dptr[6] |= SSSID_SPARE;
+ dptr[6] &= ~AX25_CBIT;
+ dptr[6] |= AX25_EBIT;
+ dptr[6] |= AX25_SSSID_SPARE;
dptr += AX25_ADDR_LEN;
*dptr++ = sysctl_netrom_network_ttl_initialiser;
@@ -303,19 +296,11 @@
if (sk->protinfo.nr->t1timer > 0 && sk->protinfo.nr->n2count == 0)
sk->protinfo.nr->rtt = (9 * sk->protinfo.nr->rtt + sk->protinfo.nr->t1 - sk->protinfo.nr->t1timer) / 10;
-#ifdef NR_T1CLAMPLO
- /* Don't go below one tenth of a second */
- if (sk->protinfo.nr->rtt < (NR_T1CLAMPLO))
- sk->protinfo.nr->rtt = (NR_T1CLAMPLO);
-#else /* Failsafe - some people might have sub 1/10th RTTs :-) **/
- if (sk->protinfo.nr->rtt == 0)
- sk->protinfo.nr->rtt = PR_SLOWHZ;
-#endif
-#ifdef NR_T1CLAMPHI
- /* OR above clamped seconds **/
- if (sk->protinfo.nr->rtt > (NR_T1CLAMPHI))
- sk->protinfo.nr->rtt = (NR_T1CLAMPHI);
-#endif
+ if (sk->protinfo.nr->rtt < NR_T1CLAMPLO)
+ sk->protinfo.nr->rtt = NR_T1CLAMPLO;
+
+ if (sk->protinfo.nr->rtt > NR_T1CLAMPHI)
+ sk->protinfo.nr->rtt = NR_T1CLAMPHI;
}
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov