summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-10 23:18:26 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-10 23:18:26 +0000
commitc7c4310f7fc1485925d800628bf50b3aeab535ef (patch)
treeb12aa4be0e8fb82aaaea97fb475e793e8a347c49 /include/net
parent1ffd1d069ca4c5ffe16fea6175dab1b9bbb15820 (diff)
Merge with Linux 2.4.0-test3-pre8. Linus has accepted most of what
I've sent him, so we're very close to full integration of the MIPS port into his sources.
Diffstat (limited to 'include/net')
-rw-r--r--include/net/checksum.h5
-rw-r--r--include/net/inet_ecn.h72
-rw-r--r--include/net/ip.h6
-rw-r--r--include/net/ipv6.h5
-rw-r--r--include/net/neighbour.h13
-rw-r--r--include/net/route.h7
-rw-r--r--include/net/sock.h13
7 files changed, 118 insertions, 3 deletions
diff --git a/include/net/checksum.h b/include/net/checksum.h
index de3286944..6793f196f 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -124,5 +124,10 @@ static __inline__ unsigned int csum_and_copy_to_user
}
#endif
+static inline unsigned int csum_chain(unsigned int csum, unsigned int addend)
+{
+ csum += addend;
+ return csum + (csum < addend);
+}
#endif
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
new file mode 100644
index 000000000..2ddf7675a
--- /dev/null
+++ b/include/net/inet_ecn.h
@@ -0,0 +1,72 @@
+#ifndef _INET_ECN_H_
+#define _INET_ECN_H_
+
+#include <linux/config.h>
+
+#ifdef CONFIG_INET_ECN
+
+static inline int INET_ECN_is_ce(__u8 dsfield)
+{
+ return (dsfield&3) == 3;
+}
+
+static inline int INET_ECN_is_not_ce(__u8 dsfield)
+{
+ return (dsfield&3) == 2;
+}
+
+static inline int INET_ECN_is_capable(__u8 dsfield)
+{
+ return (dsfield&2);
+}
+
+static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
+{
+ outer &= ~3;
+ if (INET_ECN_is_capable(inner))
+ outer |= (inner & 3);
+ return outer;
+}
+
+#define INET_ECN_xmit(sk) do { (sk)->protinfo.af_inet.tos |= 2; } while (0)
+#define INET_ECN_dontxmit(sk) do { (sk)->protinfo.af_inet.tos &= ~3; } while (0)
+
+#define IP6_ECN_flow_init(label) do { \
+ (label) &= ~htonl(3<<20); \
+ } while (0)
+
+#define IP6_ECN_flow_xmit(sk, label) do { \
+ if (INET_ECN_is_capable((sk)->protinfo.af_inet.tos)) \
+ (label) |= __constant_htons(2 << 4); \
+ } while (0)
+
+
+#else
+#define INET_ECN_is_ce(x...) (0)
+#define INET_ECN_is_not_ce(x...) (0)
+#define INET_ECN_is_capable(x...) (0)
+#define INET_ECN_encapsulate(x, y) (x)
+#define IP6_ECN_flow_init(x...) do { } while (0)
+#define IP6_ECN_flow_xmit(x...) do { } while (0)
+#define INET_ECN_xmit(x...) do { } while (0)
+#define INET_ECN_dontxmit(x...) do { } while (0)
+#endif
+
+static inline void IP_ECN_set_ce(struct iphdr *iph)
+{
+ u32 check = iph->check;
+ check += __constant_htons(0xFFFE);
+ iph->check = check + (check>=0xFFFF);
+ iph->tos |= 1;
+}
+
+struct ipv6hdr;
+
+static inline void IP6_ECN_set_ce(struct ipv6hdr *iph)
+{
+ *(u32*)iph |= htonl(1<<20);
+}
+
+#define ip6_get_dsfield(iph) ((ntohs(*(u16*)(iph)) >> 4) & 0xFF)
+
+#endif
diff --git a/include/net/ip.h b/include/net/ip.h
index f3ab5ac7b..45a85abfe 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -167,12 +167,14 @@ extern __inline__ int ip_send(struct sk_buff *skb)
return ip_finish_output(skb);
}
+/* The function in 2.2 was invalid, producing wrong result for
+ * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */
extern __inline__
int ip_decrease_ttl(struct iphdr *iph)
{
u32 check = iph->check;
check += __constant_htons(0x0100);
- iph->check = check + (check>>16);
+ iph->check = check + (check>=0xFFFF);
return --iph->ttl;
}
@@ -220,6 +222,8 @@ extern int ip_call_ra_chain(struct sk_buff *skb);
*/
struct sk_buff *ip_defrag(struct sk_buff *skb);
+extern int ip_frag_nqueues;
+extern atomic_t ip_frag_mem;
/*
* Functions provided by ip_forward.c
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index aef0d2619..235ae404d 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -4,7 +4,7 @@
* Authors:
* Pedro Roque <roque@di.fc.ul.pt>
*
- * $Id: ipv6.h,v 1.20 2000/02/27 19:51:38 davem Exp $
+ * $Id: ipv6.h,v 1.21 2000/07/07 22:29:42 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -189,6 +189,9 @@ extern u8 * ipv6_parse_exthdrs(struct sk_buff **skb, u8 *nhptr);
extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt);
+extern int ip6_frag_nqueues;
+extern atomic_t ip6_frag_mem;
+
#define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */
/*
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index b63398881..c8490705f 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -259,6 +259,19 @@ __neigh_lookup(struct neigh_table *tbl, const void *pkey, struct net_device *dev
if (n || !creat)
return n;
+ n = neigh_create(tbl, pkey, dev);
+ return IS_ERR(n) ? NULL : n;
+}
+
+extern __inline__ struct neighbour *
+__neigh_lookup_errno(struct neigh_table *tbl, const void *pkey,
+ struct net_device *dev)
+{
+ struct neighbour *n = neigh_lookup(tbl, pkey, dev);
+
+ if (n)
+ return n;
+
return neigh_create(tbl, pkey, dev);
}
diff --git a/include/net/route.h b/include/net/route.h
index 180daad87..20536ca63 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -118,6 +118,13 @@ extern __inline__ void ip_rt_put(struct rtable * rt)
dst_release(&rt->u.dst);
}
+#ifdef CONFIG_INET_ECN
+#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
+#else
+#define IPTOS_RT_MASK IPTOS_TOS_MASK
+#endif
+
+
extern __u8 ip_tos2prio[16];
extern __inline__ char rt_tos2priority(u8 tos)
diff --git a/include/net/sock.h b/include/net/sock.h
index c0451c111..60756db48 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -515,6 +515,8 @@ struct sock {
broadcast,
bsdism;
unsigned char debug;
+ unsigned char rcvtstamp;
+ unsigned char userlocks;
int proc;
unsigned long lingertime;
@@ -1222,7 +1224,7 @@ extern __inline__ long sock_sndtimeo(struct sock *sk, int noblock)
extern __inline__ int sock_rcvlowat(struct sock *sk, int waitall, int len)
{
- return waitall ? len : min(sk->rcvlowat, len);
+ return (waitall ? len : min(sk->rcvlowat, len)) ? : 1;
}
/* Alas, with timeout socket operations are not restartable.
@@ -1233,6 +1235,15 @@ extern __inline__ int sock_intr_errno(long timeo)
return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR;
}
+static __inline__ void
+sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
+{
+ if (sk->rcvtstamp)
+ put_cmsg(msg, SOL_SOCKET, SO_TIMESTAMP, sizeof(skb->stamp), &skb->stamp);
+ else
+ sk->stamp = skb->stamp;
+}
+
/*
* Enable debug/info messages
*/