diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2001-01-31 22:22:27 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2001-01-31 22:22:27 +0000 |
commit | 825423e4c4f18289df2393951cfd2a7a31fc0464 (patch) | |
tree | 4ad80e981c3d9effa910d2247d118d254f9a5d09 /net/x25 | |
parent | c4693dc4856ab907a5c02187a8d398861bebfc7e (diff) |
Merge with Linux 2.4.1.
Diffstat (limited to 'net/x25')
-rw-r--r-- | net/x25/Makefile | 2 | ||||
-rw-r--r-- | net/x25/af_x25.c | 21 | ||||
-rw-r--r-- | net/x25/x25_dev.c | 6 | ||||
-rw-r--r-- | net/x25/x25_facilities.c | 6 | ||||
-rw-r--r-- | net/x25/x25_in.c | 4 | ||||
-rw-r--r-- | net/x25/x25_link.c | 12 | ||||
-rw-r--r-- | net/x25/x25_out.c | 4 | ||||
-rw-r--r-- | net/x25/x25_route.c | 12 | ||||
-rw-r--r-- | net/x25/x25_subr.c | 18 | ||||
-rw-r--r-- | net/x25/x25_timer.c | 42 |
10 files changed, 55 insertions, 72 deletions
diff --git a/net/x25/Makefile b/net/x25/Makefile index 0890eff84..d0082933f 100644 --- a/net/x25/Makefile +++ b/net/x25/Makefile @@ -17,5 +17,3 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_x25.o include $(TOPDIR)/Rules.make -tar: - tar -cvf /dev/f1 . diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index c8f8c3e97..a938f3bc1 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -1084,6 +1084,9 @@ static int x25_recvmsg(struct socket *sock, struct msghdr *msg, int size, int fl msg->msg_namelen = sizeof(struct sockaddr_x25); skb_free_datagram(sk, skb); + lock_sock(sk); + x25_check_rbuf(sk); + release_sock(sk); return copied; } @@ -1258,8 +1261,8 @@ static int x25_get_info(char *buffer, char **start, off_t offset, int length) } struct net_proto_family x25_family_ops = { - AF_X25, - x25_create + family: AF_X25, + create: x25_create, }; static struct proto_ops SOCKOPS_WRAPPED(x25_proto_ops) = { @@ -1286,18 +1289,13 @@ static struct proto_ops SOCKOPS_WRAPPED(x25_proto_ops) = { SOCKOPS_WRAP(x25_proto, AF_X25); -static struct packet_type x25_packet_type = -{ - 0, /* MUTTER ntohs(ETH_P_X25),*/ - 0, /* copy */ - x25_lapb_receive_frame, - NULL, - NULL, +static struct packet_type x25_packet_type = { + type: __constant_htons(ETH_P_X25), + func: x25_lapb_receive_frame, }; struct notifier_block x25_dev_notifier = { - x25_device_event, - 0 + notifier_call: x25_device_event, }; void x25_kill_by_neigh(struct x25_neigh *neigh) @@ -1317,7 +1315,6 @@ static int __init x25_init(void) #endif /* MODULE */ sock_register(&x25_family_ops); - x25_packet_type.type = htons(ETH_P_X25); dev_add_pack(&x25_packet_type); register_netdevice_notifier(&x25_dev_notifier); diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c index fbc781dce..1abb28358 100644 --- a/net/x25/x25_dev.c +++ b/net/x25/x25_dev.c @@ -18,7 +18,6 @@ */ #include <linux/config.h> -#if defined(CONFIG_X25) || defined(CONFIG_X25_MODULE) #include <linux/errno.h> #include <linux/types.h> #include <linux/socket.h> @@ -249,8 +248,3 @@ void x25_send_frame(struct sk_buff *skb, struct x25_neigh *neigh) dev_queue_xmit(skb); } - -#endif - - - diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c index ad41d1cde..adf757e56 100644 --- a/net/x25/x25_facilities.c +++ b/net/x25/x25_facilities.c @@ -18,8 +18,6 @@ * negotiation. */ -#include <linux/config.h> -#if defined(CONFIG_X25) || defined(CONFIG_X25_MODULE) #include <linux/errno.h> #include <linux/types.h> #include <linux/socket.h> @@ -232,7 +230,3 @@ void x25_limit_facilities(struct x25_facilities *facilities, } } } - -#endif - - diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c index bcb5f1cf4..73a567e89 100644 --- a/net/x25/x25_in.c +++ b/net/x25/x25_in.c @@ -22,8 +22,6 @@ * i-frames. */ -#include <linux/config.h> -#if defined(CONFIG_X25) || defined(CONFIG_X25_MODULE) #include <linux/errno.h> #include <linux/types.h> #include <linux/socket.h> @@ -369,5 +367,3 @@ int x25_backlog_rcv(struct sock *sk, struct sk_buff *skb) return 0; } - -#endif diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c index d6b878371..841499325 100644 --- a/net/x25/x25_link.c +++ b/net/x25/x25_link.c @@ -20,8 +20,6 @@ * 2000-09-04 Henner Eisen dev_hold() / dev_put() for x25_neigh. */ -#include <linux/config.h> -#if defined(CONFIG_X25) || defined(CONFIG_X25_MODULE) #include <linux/errno.h> #include <linux/types.h> #include <linux/socket.h> @@ -42,9 +40,10 @@ #include <linux/fcntl.h> #include <linux/mm.h> #include <linux/interrupt.h> +#include <linux/init.h> #include <net/x25.h> -static struct x25_neigh *x25_neigh_list = NULL; +static struct x25_neigh *x25_neigh_list /* = NULL initially */; static void x25_t20timer_expiry(unsigned long); @@ -422,12 +421,11 @@ int x25_subscr_ioctl(unsigned int cmd, void *arg) return 0; } -#ifdef MODULE /* * Release all memory associated with X.25 neighbour structures. */ -void x25_link_free(void) +void __exit x25_link_free(void) { struct x25_neigh *neigh, *x25_neigh = x25_neigh_list; @@ -438,7 +436,3 @@ void x25_link_free(void) x25_remove_neigh(neigh); } } - -#endif - -#endif diff --git a/net/x25/x25_out.c b/net/x25/x25_out.c index b3ce30477..2521078a6 100644 --- a/net/x25/x25_out.c +++ b/net/x25/x25_out.c @@ -21,8 +21,6 @@ * needed cleaned seq-number fields. */ -#include <linux/config.h> -#if defined(CONFIG_X25) || defined(CONFIG_X25_MODULE) #include <linux/errno.h> #include <linux/types.h> #include <linux/socket.h> @@ -229,5 +227,3 @@ void x25_enquiry_response(struct sock *sk) x25_stop_timer(sk); } - -#endif diff --git a/net/x25/x25_route.c b/net/x25/x25_route.c index 4cb51300b..a4651699e 100644 --- a/net/x25/x25_route.c +++ b/net/x25/x25_route.c @@ -17,7 +17,6 @@ */ #include <linux/config.h> -#if defined(CONFIG_X25) || defined(CONFIG_X25_MODULE) #include <linux/errno.h> #include <linux/types.h> #include <linux/socket.h> @@ -42,9 +41,10 @@ #include <linux/mm.h> #include <linux/interrupt.h> #include <linux/notifier.h> +#include <linux/init.h> #include <net/x25.h> -static struct x25_route *x25_route_list = NULL; +static struct x25_route *x25_route_list /* = NULL initially */; /* * Add a new route. @@ -255,12 +255,10 @@ int x25_routes_get_info(char *buffer, char **start, off_t offset, int length) return len; } -#ifdef MODULE - /* * Release all memory associated with X.25 routing structures. */ -void x25_route_free(void) +void __exit x25_route_free(void) { struct x25_route *route, *x25_route = x25_route_list; @@ -271,7 +269,3 @@ void x25_route_free(void) x25_remove_route(route); } } - -#endif - -#endif diff --git a/net/x25/x25_subr.c b/net/x25/x25_subr.c index 25a700af9..635c872e5 100644 --- a/net/x25/x25_subr.c +++ b/net/x25/x25_subr.c @@ -19,8 +19,6 @@ * negotiation. */ -#include <linux/config.h> -#if defined(CONFIG_X25) || defined(CONFIG_X25_MODULE) #include <linux/errno.h> #include <linux/types.h> #include <linux/socket.h> @@ -351,4 +349,18 @@ void x25_disconnect(struct sock *sk, int reason, unsigned char cause, unsigned c sk->dead = 1; } -#endif +/* + * Clear an own-rx-busy condition and tell the peer about this, provided + * that there is a significant amount of free receive buffer space available. + */ +void x25_check_rbuf(struct sock *sk) +{ + if (atomic_read(&sk->rmem_alloc) < (sk->rcvbuf / 2) && + (sk->protinfo.x25->condition & X25_COND_OWN_RX_BUSY)) { + sk->protinfo.x25->condition &= ~X25_COND_OWN_RX_BUSY; + sk->protinfo.x25->condition &= ~X25_COND_ACK_PENDING; + sk->protinfo.x25->vl = sk->protinfo.x25->vr; + x25_write_internal(sk, X25_RR); + x25_stop_timer(sk); + } +} diff --git a/net/x25/x25_timer.c b/net/x25/x25_timer.c index 20672419e..cf9b42606 100644 --- a/net/x25/x25_timer.c +++ b/net/x25/x25_timer.c @@ -18,8 +18,6 @@ * Centralised disconnection processing. */ -#include <linux/config.h> -#if defined(CONFIG_X25) || defined(CONFIG_X25_MODULE) #include <linux/errno.h> #include <linux/types.h> #include <linux/socket.h> @@ -121,6 +119,11 @@ static void x25_heartbeat_expiry(unsigned long param) { struct sock *sk = (struct sock *)param; + bh_lock_sock(sk); + if (sk->lock.users) { /* can currently only occur in state 3 */ + goto restart_heartbeat; + } + switch (sk->protinfo.x25->state) { case X25_STATE_0: @@ -128,7 +131,7 @@ static void x25_heartbeat_expiry(unsigned long param) is accepted() it isn't 'dead' so doesn't get removed. */ if (sk->destroy || (sk->state == TCP_LISTEN && sk->dead)) { x25_destroy_socket(sk); - return; + goto unlock; } break; @@ -136,29 +139,21 @@ static void x25_heartbeat_expiry(unsigned long param) /* * Check for the state of the receive buffer. */ - if (atomic_read(&sk->rmem_alloc) < (sk->rcvbuf / 2) && - (sk->protinfo.x25->condition & X25_COND_OWN_RX_BUSY)) { - sk->protinfo.x25->condition &= ~X25_COND_OWN_RX_BUSY; - sk->protinfo.x25->condition &= ~X25_COND_ACK_PENDING; - sk->protinfo.x25->vl = sk->protinfo.x25->vr; - x25_write_internal(sk, X25_RR); - x25_stop_timer(sk); - break; - } + x25_check_rbuf(sk); break; } - + restart_heartbeat: x25_start_heartbeat(sk); + unlock: + bh_unlock_sock(sk); } /* * Timer has expired, it may have been T2, T21, T22, or T23. We can tell * by the state machine state. */ -static void x25_timer_expiry(unsigned long param) +static inline void x25_do_timer_expiry(struct sock * sk) { - struct sock *sk = (struct sock *)param; - switch (sk->protinfo.x25->state) { case X25_STATE_3: /* T2 */ @@ -181,4 +176,17 @@ static void x25_timer_expiry(unsigned long param) } } -#endif +static void x25_timer_expiry(unsigned long param) +{ + struct sock *sk = (struct sock *)param; + + bh_lock_sock(sk); + if (sk->lock.users) { /* can currently only occur in state 3 */ + if (sk->protinfo.x25->state == X25_STATE_3) { + x25_start_t2timer(sk); + } + } else { + x25_do_timer_expiry(sk); + } + bh_unlock_sock(sk); +} |