diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-04-19 04:00:00 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-04-19 04:00:00 +0000 |
commit | 46e045034336a2cc90c1798cd7cc07af744ddfd6 (patch) | |
tree | 3b9b51fc482e729f663d25333e77fbed9aaa939a /include/net | |
parent | 31dc59d503a02e84c4de98826452acaeb56dc15a (diff) |
Merge with Linux 2.3.99-pre4.
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/sock.h | 41 | ||||
-rw-r--r-- | include/net/tcp.h | 18 |
2 files changed, 52 insertions, 7 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 6782beca0..9b7720969 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -263,10 +263,11 @@ struct tcp_opt { __u16 mss_cache; /* Cached effective mss, not including SACKS */ __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ - __u8 dup_acks; /* Consequetive duplicate acks seen from other end */ + __u8 dup_acks; /* Consecutive duplicate acks seen from other end */ __u8 retransmits; - __u16 __empty1; + __u8 __empty1; + __u8 sorry; __u8 defer_accept; /* RTT measurement */ @@ -726,7 +727,7 @@ do { spin_lock_bh(&((__sk)->lock.slock)); \ if ((__sk)->backlog.tail != NULL) \ __release_sock(__sk); \ (__sk)->lock.users = 0; \ - wake_up(&((__sk)->lock.wq)); \ + if (waitqueue_active(&((__sk)->lock.wq))) wake_up(&((__sk)->lock.wq)); \ spin_unlock_bh(&((__sk)->lock.slock)); \ } while(0) @@ -837,11 +838,19 @@ extern void sklist_insert_socket(struct sock **list, struct sock *sk); extern void sklist_destroy_socket(struct sock **list, struct sock *sk); #ifdef CONFIG_FILTER -/* + +/** + * sk_filter - run a packet through a socket filter + * @skb: buffer to filter + * @filter: filter to apply + * * Run the filter code and then cut skb->data to correct size returned by * sk_run_filter. If pkt_len is 0 we toss packet. If skb->len is smaller - * than pkt_len we keep whole skb->data. + * than pkt_len we keep whole skb->data. This is the socket level + * wrapper to sk_run_filter. It returns 0 if the packet should + * be accepted or 1 if the packet should be tossed. */ + extern __inline__ int sk_filter(struct sk_buff *skb, struct sk_filter *filter) { int pkt_len; @@ -855,6 +864,14 @@ extern __inline__ int sk_filter(struct sk_buff *skb, struct sk_filter *filter) return 0; } +/** + * sk_filter_release: Release a socket filter + * @sk: socket + * @fp: filter to remove + * + * Remove a filter from a socket and release its resources. + */ + extern __inline__ void sk_filter_release(struct sock *sk, struct sk_filter *fp) { unsigned int size = sk_filter_len(fp); @@ -1135,6 +1152,12 @@ extern __inline__ unsigned long sock_wspace(struct sock *sk) return amt; } +extern __inline__ void sk_wake_async(struct sock *sk, int how, int band) +{ + if (sk->socket && sk->socket->fasync_list) + sock_wake_async(sk->socket, how, band); +} + #define SOCK_MIN_SNDBUF 2048 #define SOCK_MIN_RCVBUF 128 /* Must be less or equal SOCK_MIN_SNDBUF */ @@ -1169,6 +1192,14 @@ extern __inline__ int sock_rcvlowat(struct sock *sk, int waitall, int len) return waitall ? len : min(sk->rcvlowat, len); } +/* Alas, with timeout socket operations are not restartable. + * Compare this to poll(). + */ +extern __inline__ int sock_intr_errno(long timeo) +{ + return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; +} + /* * Enable debug/info messages */ diff --git a/include/net/tcp.h b/include/net/tcp.h index dacdfa2a7..02b320842 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -669,8 +669,6 @@ extern void tcp_v4_send_check(struct sock *sk, struct tcphdr *th, int len, struct sk_buff *skb); -extern void tcp_v4_send_reset(struct sk_buff *skb); - extern int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); @@ -908,6 +906,13 @@ struct tcp_skb_cb { #define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0])) +/* + * Compute minimal free write space needed to queue new packets. + */ +#define tcp_min_write_space(__sk) \ + (atomic_read(&(__sk)->wmem_alloc) / 2) + + /* This determines how many packets are "in the network" to the best * of our knowledge. In many cases it is conservative, but where * detailed information is available from the receiver (via SACK @@ -1342,6 +1347,15 @@ extern __inline__ void tcp_init_buffer_space(struct sock *sk) if (sk->rcvbuf < 3*rcvbuf) sk->rcvbuf = min (3*rcvbuf, sysctl_rmem_max); + + /* Reserve slack space to reduce jitter of advertised window. */ + if (tp->window_clamp >= tcp_full_space(sk)) { + int nwin = tcp_full_space(sk) - tp->mss_clamp; + + if (nwin >= MAX_TCP_WINDOW && nwin >= 2*tp->advmss) + tp->window_clamp = nwin; + } + if (sk->sndbuf < 3*sndbuf) sk->sndbuf = min (3*sndbuf, sysctl_wmem_max); } |