* Re: [PKT_SCHED]: Add stateless NAT
From: Evgeniy Polyakov @ 2007-09-27 13:10 UTC (permalink / raw)
To: Herbert Xu; +Cc: David S. Miller, netdev, Alexey Kuznetsov, jamal
In-Reply-To: <20070927124515.GA16706@gondor.apana.org.au>
On Thu, Sep 27, 2007 at 08:45:15PM +0800, Herbert Xu (herbert@gondor.apana.org.au) wrote:
> On Thu, Sep 27, 2007 at 04:41:21PM +0400, Evgeniy Polyakov wrote:
> >
> > I've attached simple patch which moves checksum helpers out of
> > CONFIG_NETFILTER option but still in the same linux/netfilter.h header.
> > This should be enough for removing 'select NETFILTER' in your patch.
>
> Close but no cigar :)
:) take 2.
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 1dd075e..5313739 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -40,6 +40,41 @@
#endif
#ifdef __KERNEL__
+
+static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to)
+{
+ __be32 diff[] = { ~from, to };
+
+ *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
+}
+
+static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to)
+{
+ nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to);
+}
+
+static inline void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
+ __be32 from, __be32 to, int pseudohdr)
+{
+ __be32 diff[] = { ~from, to };
+ if (skb->ip_summed != CHECKSUM_PARTIAL) {
+ *sum = csum_fold(csum_partial(diff, sizeof(diff),
+ ~csum_unfold(*sum)));
+ if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
+ skb->csum = ~csum_partial(diff, sizeof(diff),
+ ~skb->csum);
+ } else if (pseudohdr)
+ *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
+ csum_unfold(*sum)));
+}
+
+static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
+ __be16 from, __be16 to, int pseudohdr)
+{
+ nf_proto_csum_replace4(sum, skb, (__force __be32)from,
+ (__force __be32)to, pseudohdr);
+}
+
#ifdef CONFIG_NETFILTER
extern void netfilter_init(void);
@@ -289,28 +324,6 @@ extern void nf_invalidate_cache(int pf);
Returns true or false. */
extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len);
-static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to)
-{
- __be32 diff[] = { ~from, to };
-
- *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
-}
-
-static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to)
-{
- nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to);
-}
-
-extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
- __be32 from, __be32 to, int pseudohdr);
-
-static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
- __be16 from, __be16 to, int pseudohdr)
-{
- nf_proto_csum_replace4(sum, skb, (__force __be32)from,
- (__force __be32)to, pseudohdr);
-}
-
struct nf_afinfo {
unsigned short family;
__sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 381a77c..9ffbbe2 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -226,22 +226,6 @@ copy_skb:
}
EXPORT_SYMBOL(skb_make_writable);
-void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
- __be32 from, __be32 to, int pseudohdr)
-{
- __be32 diff[] = { ~from, to };
- if (skb->ip_summed != CHECKSUM_PARTIAL) {
- *sum = csum_fold(csum_partial(diff, sizeof(diff),
- ~csum_unfold(*sum)));
- if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
- skb->csum = ~csum_partial(diff, sizeof(diff),
- ~skb->csum);
- } else if (pseudohdr)
- *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
- csum_unfold(*sum)));
-}
-EXPORT_SYMBOL(nf_proto_csum_replace4);
-
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
/* This does not belong here, but locally generated errors need it if connection
tracking in use: without this, connection may not be in hash table, and hence
--
Evgeniy Polyakov
^ permalink raw reply related
* RTL8111 PCI Express Gigabit driver r8169 produces slow file transfers
From: Achim Frase @ 2007-09-27 13:14 UTC (permalink / raw)
To: netdev
Dear Linux r8169 crew,
I have got your e-mail address from the modinfo of the r8196 module.
I am not sure if this is the right way to contact you, but I hope you
could help me.
The current driver in Kernel 2.6.22 produces very bad network speeds.
I only geht 100 kb/s.
Maybe you could take a look at this bug-report at launchpad.net.
https://bugs.launchpad.net/ubuntu/+source/linux-ubuntu-modules-2.6.22/+bug/114171
The latest driver from realtek is working very well.
ftp://210.51.181.211/cn/nic/r8168-8.003.00.tar.bz2
What I would like to know, is, if the latest realtek driver will make it
into the kernel, or if the problems with the r8196 module are already
solved.
If there are any questions feel free to contact me.
Thanks in Advanced
Achim Frase
^ permalink raw reply
* Re: [PKT_SCHED]: Add stateless NAT
From: jamal @ 2007-09-27 13:16 UTC (permalink / raw)
To: Herbert Xu; +Cc: Stephen Hemminger, David S. Miller, netdev, Alexey Kuznetsov
In-Reply-To: <20070927130104.GA16881@gondor.apana.org.au>
On Thu, 2007-27-09 at 21:01 +0800, Herbert Xu wrote:
> On Thu, Sep 27, 2007 at 08:39:45AM -0400, jamal wrote:
> >
> > Do you have plans to do the iproute bits? If you do it will be nice to
> > also update the doc/examples with some simple example(s).
>
> Oh yes, I didn't test this by poking bits in the kernel
> you know :)
Trust me - it has been done before ;->
Thanks Herbert, looks good to me.
cheers,
jamal
^ permalink raw reply
* Re: [PKT_SCHED]: Add stateless NAT
From: Patrick McHardy @ 2007-09-27 13:16 UTC (permalink / raw)
To: Evgeniy Polyakov
Cc: Herbert Xu, David S. Miller, netdev, Alexey Kuznetsov, jamal
In-Reply-To: <20070927131008.GA15997@2ka.mipt.ru>
Evgeniy Polyakov wrote:
> +static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to)
> +{
> + __be32 diff[] = { ~from, to };
> +
> + *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
> +}
> +
> +static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to)
> +{
> + nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to);
> +}
> +
> +static inline void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
> + __be32 from, __be32 to, int pseudohdr)
> +{
> + __be32 diff[] = { ~from, to };
> + if (skb->ip_summed != CHECKSUM_PARTIAL) {
> + *sum = csum_fold(csum_partial(diff, sizeof(diff),
> + ~csum_unfold(*sum)));
> + if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
> + skb->csum = ~csum_partial(diff, sizeof(diff),
> + ~skb->csum);
> + } else if (pseudohdr)
> + *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
> + csum_unfold(*sum)));
> +}
> +
> +static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
> + __be16 from, __be16 to, int pseudohdr)
> +{
> + nf_proto_csum_replace4(sum, skb, (__force __be32)from,
> + (__force __be32)to, pseudohdr);
> +}
These are way too large to get inlined, please move somewhere below
net/core.
^ permalink raw reply
* Re: [PKT_SCHED]: Add stateless NAT
From: Herbert Xu @ 2007-09-27 13:20 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: David S. Miller, netdev, Alexey Kuznetsov, jamal
In-Reply-To: <20070927131008.GA15997@2ka.mipt.ru>
On Thu, Sep 27, 2007 at 05:10:08PM +0400, Evgeniy Polyakov wrote:
>
> +static inline void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
> + __be32 from, __be32 to, int pseudohdr)
> +{
> + __be32 diff[] = { ~from, to };
> + if (skb->ip_summed != CHECKSUM_PARTIAL) {
> + *sum = csum_fold(csum_partial(diff, sizeof(diff),
> + ~csum_unfold(*sum)));
> + if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
> + skb->csum = ~csum_partial(diff, sizeof(diff),
> + ~skb->csum);
> + } else if (pseudohdr)
> + *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
> + csum_unfold(*sum)));
> +}
The embedded people are going to hate you for this :)
How about putting it in net/core/utils.c?
Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [PKT_SCHED]: Add stateless NAT
From: Evgeniy Polyakov @ 2007-09-27 13:25 UTC (permalink / raw)
To: Patrick McHardy
Cc: Herbert Xu, David S. Miller, netdev, Alexey Kuznetsov, jamal
In-Reply-To: <46FBAD40.8040806@trash.net>
On Thu, Sep 27, 2007 at 03:16:48PM +0200, Patrick McHardy (kaber@trash.net) wrote:
> Evgeniy Polyakov wrote:
> > +static inline void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
> > + __be32 from, __be32 to, int pseudohdr)
> > +{
> > + __be32 diff[] = { ~from, to };
> > + if (skb->ip_summed != CHECKSUM_PARTIAL) {
> > + *sum = csum_fold(csum_partial(diff, sizeof(diff),
> > + ~csum_unfold(*sum)));
> > + if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
> > + skb->csum = ~csum_partial(diff, sizeof(diff),
> > + ~skb->csum);
> > + } else if (pseudohdr)
> > + *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
> > + csum_unfold(*sum)));
> > +}
> > +
> > +static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
> > + __be16 from, __be16 to, int pseudohdr)
> > +{
> > + nf_proto_csum_replace4(sum, skb, (__force __be32)from,
> > + (__force __be32)to, pseudohdr);
> > +}
>
>
> These are way too large to get inlined, please move somewhere below
> net/core.
I knew that... :)
I'm pretty sure new files called net/core/helpers.c which will host that
helper is not a good solution too?
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 1dd075e..624d78b 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -40,6 +40,29 @@
#endif
#ifdef __KERNEL__
+
+static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to)
+{
+ __be32 diff[] = { ~from, to };
+
+ *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
+}
+
+static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to)
+{
+ nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to);
+}
+
+extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
+ __be32 from, __be32 to, int pseudohdr);
+
+static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
+ __be16 from, __be16 to, int pseudohdr)
+{
+ nf_proto_csum_replace4(sum, skb, (__force __be32)from,
+ (__force __be32)to, pseudohdr);
+}
+
#ifdef CONFIG_NETFILTER
extern void netfilter_init(void);
@@ -289,28 +312,6 @@ extern void nf_invalidate_cache(int pf);
Returns true or false. */
extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len);
-static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to)
-{
- __be32 diff[] = { ~from, to };
-
- *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
-}
-
-static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to)
-{
- nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to);
-}
-
-extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
- __be32 from, __be32 to, int pseudohdr);
-
-static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
- __be16 from, __be16 to, int pseudohdr)
-{
- nf_proto_csum_replace4(sum, skb, (__force __be32)from,
- (__force __be32)to, pseudohdr);
-}
-
struct nf_afinfo {
unsigned short family;
__sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
diff --git a/net/core/Makefile b/net/core/Makefile
index 4751613..5757323 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -3,7 +3,7 @@
#
obj-y := sock.o request_sock.o skbuff.o iovec.o datagram.o stream.o scm.o \
- gen_stats.o gen_estimator.o
+ gen_stats.o gen_estimator.o helpers.o
obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
diff --git a/net/core/helpers.c b/net/core/helpers.c
new file mode 100644
index 0000000..d3c8d97
--- /dev/null
+++ b/net/core/helpers.c
@@ -0,0 +1,23 @@
+/*
+ * Generic helper functions.
+ */
+
+#include <linux/types.h>
+#include <linux/skbuff.h>
+
+#include <net/checksum.h>
+
+void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
+ __be32 from, __be32 to, int pseudohdr)
+{
+ __be32 diff[] = { ~from, to };
+ if (skb->ip_summed != CHECKSUM_PARTIAL) {
+ *sum = csum_fold(csum_partial(diff, sizeof(diff),
+ ~csum_unfold(*sum)));
+ if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
+ skb->csum = ~csum_partial(diff, sizeof(diff),
+ ~skb->csum);
+ } else if (pseudohdr)
+ *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
+ csum_unfold(*sum)));
+}
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 381a77c..9ffbbe2 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -226,22 +226,6 @@ copy_skb:
}
EXPORT_SYMBOL(skb_make_writable);
-void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
- __be32 from, __be32 to, int pseudohdr)
-{
- __be32 diff[] = { ~from, to };
- if (skb->ip_summed != CHECKSUM_PARTIAL) {
- *sum = csum_fold(csum_partial(diff, sizeof(diff),
- ~csum_unfold(*sum)));
- if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
- skb->csum = ~csum_partial(diff, sizeof(diff),
- ~skb->csum);
- } else if (pseudohdr)
- *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
- csum_unfold(*sum)));
-}
-EXPORT_SYMBOL(nf_proto_csum_replace4);
-
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
/* This does not belong here, but locally generated errors need it if connection
tracking in use: without this, connection may not be in hash table, and hence
--
Evgeniy Polyakov
^ permalink raw reply related
* Re: [PKT_SCHED]: Add stateless NAT
From: Evgeniy Polyakov @ 2007-09-27 13:29 UTC (permalink / raw)
To: Herbert Xu; +Cc: David S. Miller, netdev, Alexey Kuznetsov, jamal
In-Reply-To: <20070927132037.GA17056@gondor.apana.org.au>
On Thu, Sep 27, 2007 at 09:20:37PM +0800, Herbert Xu (herbert@gondor.apana.org.au) wrote:
> How about putting it in net/core/utils.c?
I knew, that was a bad idea to try to fix netfilter dependency :)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 1dd075e..51b5a22 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -40,6 +40,35 @@
#endif
#ifdef __KERNEL__
+
+static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to)
+{
+ __be32 diff[] = { ~from, to };
+
+ *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
+}
+
+static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to)
+{
+ nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to);
+}
+
+extern void proto_csum_replace(__sum16 *sum, struct sk_buff *skb,
+ __be32 from, __be32 to, int pseudohdr);
+
+static inline void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
+ __be32 from, __be32 to, int pseudohdr)
+{
+ proto_csum_replace(sum, skb, from, to, pseudohdr);
+}
+
+static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
+ __be16 from, __be16 to, int pseudohdr)
+{
+ nf_proto_csum_replace4(sum, skb, (__force __be32)from,
+ (__force __be32)to, pseudohdr);
+}
+
#ifdef CONFIG_NETFILTER
extern void netfilter_init(void);
@@ -289,28 +318,6 @@ extern void nf_invalidate_cache(int pf);
Returns true or false. */
extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len);
-static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to)
-{
- __be32 diff[] = { ~from, to };
-
- *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
-}
-
-static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to)
-{
- nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to);
-}
-
-extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
- __be32 from, __be32 to, int pseudohdr);
-
-static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
- __be16 from, __be16 to, int pseudohdr)
-{
- nf_proto_csum_replace4(sum, skb, (__force __be32)from,
- (__force __be32)to, pseudohdr);
-}
-
struct nf_afinfo {
unsigned short family;
__sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
diff --git a/net/core/utils.c b/net/core/utils.c
index 0bf17da..2f6d4d2 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -293,3 +293,20 @@ out:
}
EXPORT_SYMBOL(in6_pton);
+
+void proto_csum_replace(__sum16 *sum, struct sk_buff *skb,
+ __be32 from, __be32 to, int pseudohdr)
+{
+ __be32 diff[] = { ~from, to };
+ if (skb->ip_summed != CHECKSUM_PARTIAL) {
+ *sum = csum_fold(csum_partial(diff, sizeof(diff),
+ ~csum_unfold(*sum)));
+ if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
+ skb->csum = ~csum_partial(diff, sizeof(diff),
+ ~skb->csum);
+ } else if (pseudohdr)
+ *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
+ csum_unfold(*sum)));
+}
+
+EXPORT_SYMBOL(proto_csum_replace);
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 381a77c..9ffbbe2 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -226,22 +226,6 @@ copy_skb:
}
EXPORT_SYMBOL(skb_make_writable);
-void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
- __be32 from, __be32 to, int pseudohdr)
-{
- __be32 diff[] = { ~from, to };
- if (skb->ip_summed != CHECKSUM_PARTIAL) {
- *sum = csum_fold(csum_partial(diff, sizeof(diff),
- ~csum_unfold(*sum)));
- if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
- skb->csum = ~csum_partial(diff, sizeof(diff),
- ~skb->csum);
- } else if (pseudohdr)
- *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
- csum_unfold(*sum)));
-}
-EXPORT_SYMBOL(nf_proto_csum_replace4);
-
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
/* This does not belong here, but locally generated errors need it if connection
tracking in use: without this, connection may not be in hash table, and hence
--
Evgeniy Polyakov
^ permalink raw reply related
* Re: [PKT_SCHED]: Add stateless NAT
From: Patrick McHardy @ 2007-09-27 13:30 UTC (permalink / raw)
To: Evgeniy Polyakov
Cc: Herbert Xu, David S. Miller, netdev, Alexey Kuznetsov, jamal
In-Reply-To: <20070927132507.GA25353@2ka.mipt.ru>
Evgeniy Polyakov wrote:
> On Thu, Sep 27, 2007 at 03:16:48PM +0200, Patrick McHardy (kaber@trash.net) wrote:
>
>>
>>These are way too large to get inlined, please move somewhere below
>>net/core.
>
>
> I knew that... :)
> I'm pretty sure new files called net/core/helpers.c which will host that
> helper is not a good solution too?
I like Herbert's suggestion of net/core/utils.c better (and without the
nf_ prefix please).
^ permalink raw reply
* Re: [PKT_SCHED]: Add stateless NAT
From: Evgeniy Polyakov @ 2007-09-27 13:33 UTC (permalink / raw)
To: Patrick McHardy
Cc: Herbert Xu, David S. Miller, netdev, Alexey Kuznetsov, jamal
In-Reply-To: <46FBB064.6070508@trash.net>
On Thu, Sep 27, 2007 at 03:30:12PM +0200, Patrick McHardy (kaber@trash.net) wrote:
> Evgeniy Polyakov wrote:
> > On Thu, Sep 27, 2007 at 03:16:48PM +0200, Patrick McHardy (kaber@trash.net) wrote:
> >
> >>
> >>These are way too large to get inlined, please move somewhere below
> >>net/core.
> >
> >
> > I knew that... :)
> > I'm pretty sure new files called net/core/helpers.c which will host that
> > helper is not a good solution too?
>
>
> I like Herbert's suggestion of net/core/utils.c better (and without the
> nf_ prefix please).
I've put it there without nf_ prefix and updated netfilter header to
create new inlune function with that prefix for private netfilter usage.
--
Evgeniy Polyakov
^ permalink raw reply
* Re: [PKT_SCHED]: Add stateless NAT
From: jamal @ 2007-09-27 13:34 UTC (permalink / raw)
To: Patrick McHardy
Cc: Evgeniy Polyakov, Herbert Xu, David S. Miller, netdev,
Alexey Kuznetsov
In-Reply-To: <46FBB064.6070508@trash.net>
On Thu, 2007-27-09 at 15:30 +0200, Patrick McHardy wrote:
>
> I like Herbert's suggestion of net/core/utils.c better (and without the
> nf_ prefix please).
me too. Evgeniy, you are the man if you "finish the whole cow" as some
wise Africans would say;->
cheers,
jamal
^ permalink raw reply
* Re: [PKT_SCHED]: Add stateless NAT
From: Patrick McHardy @ 2007-09-27 13:39 UTC (permalink / raw)
To: Evgeniy Polyakov
Cc: Herbert Xu, David S. Miller, netdev, Alexey Kuznetsov, jamal
In-Reply-To: <20070927132941.GB25353@2ka.mipt.ru>
Evgeniy Polyakov wrote:
> On Thu, Sep 27, 2007 at 09:20:37PM +0800, Herbert Xu (herbert@gondor.apana.org.au) wrote:
>
>>How about putting it in net/core/utils.c?
>
>
> I knew, that was a bad idea to try to fix netfilter dependency :)
>
> diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
This looks good to me.
^ permalink raw reply
* [PATCH] various dst_ifdown routines to catch refcounting bugs
From: Denis V. Lunev @ 2007-09-27 13:47 UTC (permalink / raw)
To: davem; +Cc: devel, netdev, containers, ebiederm
Moving dst entries into init_net.loopback_dev is not a good thing.
This hides obvious and non-obvious ref-counting bugs.
This patch uses net_ns loopback instead of init_net loopback.
This allowes to catch various bugs like recent one in IPv6 DAD handling.
Signed-off-by: Denis V. Lunev <den@openvz.org>
--- ./net/core/dst.c.loop 2007-08-26 19:30:38.000000000 +0400
+++ ./net/core/dst.c 2007-08-26 19:30:38.000000000 +0400
@@ -279,11 +279,11 @@ static inline void dst_ifdown(struct dst
if (!unregister) {
dst->input = dst->output = dst_discard;
} else {
- dst->dev = init_net.loopback_dev;
+ dst->dev = dst->dev->nd_net->loopback_dev;
dev_hold(dst->dev);
dev_put(dev);
if (dst->neighbour && dst->neighbour->dev == dev) {
- dst->neighbour->dev = init_net.loopback_dev;
+ dst->neighbour->dev = dst->dev;
dev_put(dev);
dev_hold(dst->neighbour->dev);
}
--- ./net/ipv4/route.c.loop 2007-08-26 19:30:38.000000000 +0400
+++ ./net/ipv4/route.c 2007-08-26 19:30:38.000000000 +0400
@@ -1402,8 +1402,9 @@ static void ipv4_dst_ifdown(struct dst_e
{
struct rtable *rt = (struct rtable *) dst;
struct in_device *idev = rt->idev;
- if (dev != init_net.loopback_dev && idev && idev->dev == dev) {
- struct in_device *loopback_idev = in_dev_get(init_net.loopback_dev);
+ if (dev != dev->nd_net->loopback_dev && idev && idev->dev == dev) {
+ struct in_device *loopback_idev =
+ in_dev_get(dev->nd_net->loopback_dev);
if (loopback_idev) {
rt->idev = loopback_idev;
in_dev_put(idev);
--- ./net/ipv4/xfrm4_policy.c.loop 2007-08-26 19:30:38.000000000 +0400
+++ ./net/ipv4/xfrm4_policy.c 2007-08-26 19:30:38.000000000 +0400
@@ -306,7 +306,8 @@ static void xfrm4_dst_ifdown(struct dst_
xdst = (struct xfrm_dst *)dst;
if (xdst->u.rt.idev->dev == dev) {
- struct in_device *loopback_idev = in_dev_get(init_net.loopback_dev);
+ struct in_device *loopback_idev =
+ in_dev_get(dev->nd_net->loopback_dev);
BUG_ON(!loopback_idev);
do {
--- ./net/ipv6/route.c.loop 2007-08-26 19:30:38.000000000 +0400
+++ ./net/ipv6/route.c 2007-08-26 19:30:38.000000000 +0400
@@ -220,9 +220,12 @@ static void ip6_dst_ifdown(struct dst_en
{
struct rt6_info *rt = (struct rt6_info *)dst;
struct inet6_dev *idev = rt->rt6i_idev;
+ struct net_device *loopback_dev =
+ dev->nd_net->loopback_dev;
- if (dev != init_net.loopback_dev && idev != NULL && idev->dev == dev) {
- struct inet6_dev *loopback_idev = in6_dev_get(init_net.loopback_dev);
+ if (dev != loopback_dev && idev != NULL && idev->dev == dev) {
+ struct inet6_dev *loopback_idev =
+ in6_dev_get(loopback_dev);
if (loopback_idev != NULL) {
rt->rt6i_idev = loopback_idev;
in6_dev_put(idev);
@@ -1185,12 +1188,12 @@ int ip6_route_add(struct fib6_config *cf
if ((cfg->fc_flags & RTF_REJECT) ||
(dev && (dev->flags&IFF_LOOPBACK) && !(addr_type&IPV6_ADDR_LOOPBACK))) {
/* hold loopback dev/idev if we haven't done so. */
- if (dev != init_net.loopback_dev) {
+ if (dev != dev->nd_net->loopback_dev) {
if (dev) {
dev_put(dev);
in6_dev_put(idev);
}
- dev = init_net.loopback_dev;
+ dev = dev->nd_net->loopback_dev;
dev_hold(dev);
idev = in6_dev_get(dev);
if (!idev) {
@@ -1894,13 +1897,13 @@ struct rt6_info *addrconf_dst_alloc(stru
if (rt == NULL)
return ERR_PTR(-ENOMEM);
- dev_hold(init_net.loopback_dev);
+ dev_hold(idev->dev->nd_net->loopback_dev);
in6_dev_hold(idev);
rt->u.dst.flags = DST_HOST;
rt->u.dst.input = ip6_input;
rt->u.dst.output = ip6_output;
- rt->rt6i_dev = init_net.loopback_dev;
+ rt->rt6i_dev = idev->dev->nd_net->loopback_dev;
rt->rt6i_idev = idev;
rt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(rt->rt6i_dev);
rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dst_mtu(&rt->u.dst));
--- ./net/ipv6/xfrm6_policy.c.loop 2007-08-26 19:30:38.000000000 +0400
+++ ./net/ipv6/xfrm6_policy.c 2007-08-26 19:30:38.000000000 +0400
@@ -375,7 +375,8 @@ static void xfrm6_dst_ifdown(struct dst_
xdst = (struct xfrm_dst *)dst;
if (xdst->u.rt6.rt6i_idev->dev == dev) {
- struct inet6_dev *loopback_idev = in6_dev_get(init_net.loopback_dev);
+ struct inet6_dev *loopback_idev =
+ in6_dev_get(dev->nd_net->loopback_dev);
BUG_ON(!loopback_idev);
do {
--- ./net/xfrm/xfrm_policy.c.loop 2007-08-26 19:30:38.000000000 +0400
+++ ./net/xfrm/xfrm_policy.c 2007-08-26 19:30:38.000000000 +0400
@@ -1949,7 +1949,7 @@ static int stale_bundle(struct dst_entry
void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev)
{
while ((dst = dst->child) && dst->xfrm && dst->dev == dev) {
- dst->dev = init_net.loopback_dev;
+ dst->dev = dev->nd_net->loopback_dev;
dev_hold(dst->dev);
dev_put(dev);
}
^ permalink raw reply
* Re: [PATCH] sky2: sky2 FE+ receive status workaround
From: Stephen Hemminger @ 2007-09-27 13:58 UTC (permalink / raw)
To: Jochen Voß; +Cc: Jeff Garzik, netdev
In-Reply-To: <4C6E8545-ADDC-456E-B17B-B3512A6047D1@seehuhn.de>
On Thu, 27 Sep 2007 09:14:11 +0100
Jochen Voß <voss@seehuhn.de> wrote:
> Hi Stephen,
>
> On 27 Sep 2007, at 01:58, Stephen Hemminger wrote:
> > + /* This chip has hardware problems that generates bogus status.
> > + * So do only marginal checking and expect higher level protocols
> > + * to handle crap frames.
> > + */
> > + if (sky2->hw->chip_id == CHIP_ID_YUKON_FE_P &&
> > + sky2->hw->chip_rev == CHIP_REV_YU_FE2_A0 &&
> > + length != count)
> > + goto okay;
>
> Shouldn't the condition be "length == count"?
>
No, the code is correct as is. Basically if length == count, then
the status field is correct, and the driver can go ahead and use it.
If length != count, then the status is bogus but the data is okay.
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* IPSec on Linux Kernel
From: Fabio Souto @ 2007-09-27 14:04 UTC (permalink / raw)
To: netdev
Hi,
I'm currently doing some research work and I thought that maybe you guys
could help me out on this.
I'm currently trying to find where can I understand more about the IPSec
implementation on the current Linux Kernel (2.6.22). I need to find where
the AH calls are made so I can reroute those functions calls to an external
module, for a safer AH generation.
It would be helpful to find the source code files where I can study the
IPSec stack in detail, and reroute the function call.
Any hints on these topics?
Thanks in advance
Fabio Souto
Portugal
--
View this message in context: http://www.nabble.com/IPSec-on-Linux-Kernel-tf4528613.html#a12922013
Sent from the netdev mailing list archive at Nabble.com.
^ permalink raw reply
* Re: TCP Spike
From: Stephen Hemminger @ 2007-09-27 14:33 UTC (permalink / raw)
To: Majumder, Rajib
Cc: 'netdev@vger.kernel.org',
'linux-kernel@vger.kernel.org'
In-Reply-To: <F444CAE5E62A714C9F45AA292785BED3223F7283@esng11p33001.sg.csfb.com>
On Thu, 27 Sep 2007 11:58:01 +0800
"Majumder, Rajib" <rajib.majumder@credit-suisse.com> wrote:
> Hi,
>
> We have observed 40ms latency spikes in TCP connections in "burst" type of traffic. This affects regular TCP sockets. We observed this issue in kernels of 2.4.21 and kernel 2.6.5.
Unfortunately, 2.6.5 is out of my short term memory at this point. I do remember that 2.6.5
used BIC for congestion control, and there were some math errors in the congestion control
logic that caused it to be way to aggressive.
>
> Aparently, this seems to be fixed in 2.6.19.
>
> Can someone throw some light on this?
My guess is that the addition of the SACK hinting might be the major win. The code
takes 3 passes over the SACK list, so with large outstanding data that was a major
bottleneck, not sure if it was 4ms worth though.
>
> Is this a congestion control/avoidance issue? What congestion control algorithm is used before 2.6.8?
Default congestion control in early 2.6 was BIC, then after CUBIC stabilized it was made the default in 2.6.19.
Another thing that may cause changes in latency is Appropriate Byte Counting (ABC).
It was added in 2.6.14, but then turned off by default in 2.6.18. The problem is
that ABC caused performance problems with some applications that sent messages
as many small writes.
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* Re: [RFC] af_packet: allow disabling timestamps
From: Unai Uribarri @ 2007-09-27 14:34 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David S. Miller, Evgeniy Polyakov, netdev
In-Reply-To: <20070913124253.60da52f2@oldman>
This small modification to Stephen's patch timestamps the skb when
needed, so the timestamp can be reused by other af_packet sockets.
Signed-off-by: Unai Uribarri <unai.uribarri@optenet.com>
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -259,7 +259,8 @@ static void sock_disable_timestamp(struct sock *sk)
{
if (sock_flag(sk, SOCK_TIMESTAMP)) {
sock_reset_flag(sk, SOCK_TIMESTAMP);
- net_disable_timestamp();
+ if (sk->sk_family != PF_PACKET)
+ net_disable_timestamp();
}
}
@@ -1655,7 +1656,8 @@ void sock_enable_timestamp(struct sock *sk)
{
if (!sock_flag(sk, SOCK_TIMESTAMP)) {
sock_set_flag(sk, SOCK_TIMESTAMP);
- net_enable_timestamp();
+ if (sk->sk_family != PF_PACKET)
+ net_enable_timestamp();
}
}
EXPORT_SYMBOL(sock_enable_timestamp);
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -570,7 +570,6 @@ static int tpacket_rcv(struct sk_buff *skb, struct
net_device *dev, struct packe
unsigned long status = TP_STATUS_LOSING|TP_STATUS_USER;
unsigned short macoff, netoff;
struct sk_buff *copy_skb = NULL;
- struct timeval tv;
if (dev->nd_net != &init_net)
goto drop;
@@ -648,12 +647,18 @@ static int tpacket_rcv(struct sk_buff *skb, struct
net_device *dev, struct packe
h->tp_snaplen = snaplen;
h->tp_mac = macoff;
h->tp_net = netoff;
- if (skb->tstamp.tv64)
+
+ if (sock_flag(sk, SOCK_TIMESTAMP)) {
+ struct timeval tv;
+ if (skb->tstamp.tv64 == 0)
+ __net_timestamp(skb);
tv = ktime_to_timeval(skb->tstamp);
- else
- do_gettimeofday(&tv);
- h->tp_sec = tv.tv_sec;
- h->tp_usec = tv.tv_usec;
+ h->tp_sec = tv.tv_sec;
+ h->tp_usec = tv.tv_usec;
+ } else {
+ h->tp_sec = 0;
+ h->tp_usec = 0;
+ }
sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h)));
sll->sll_halen = dev_parse_header(skb, sll->sll_addr);
@@ -1004,6 +1009,7 @@ static int packet_create(struct net *net, struct
socket *sock, int protocol)
sock->ops = &packet_ops_spkt;
sock_init_data(sock, sk);
+ sock_set_flag(sk, SOCK_TIMESTAMP);
po = pkt_sk(sk);
sk->sk_family = PF_PACKET;
On jue, 2007-09-13 at 12:42 +0200, Stephen Hemminger wrote:
> Currently, af_packet does not allow disabling timestamps. This patch changes
> that but doesn't force global timestamps on.
>
> This shows up in bugzilla as:
> http://bugzilla.kernel.org/show_bug.cgi?id=4809
>
> Patch against net-2.6.24 tree.
>
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
>
> --- a/net/core/sock.c 2007-09-12 15:08:43.000000000 +0200
> +++ b/net/core/sock.c 2007-09-13 12:10:19.000000000 +0200
> @@ -259,7 +259,8 @@ static void sock_disable_timestamp(struc
> {
> if (sock_flag(sk, SOCK_TIMESTAMP)) {
> sock_reset_flag(sk, SOCK_TIMESTAMP);
> - net_disable_timestamp();
> + if (sk->sk_family != PF_PACKET)
> + net_disable_timestamp();
> }
> }
>
> @@ -1645,7 +1646,8 @@ void sock_enable_timestamp(struct sock *
> {
> if (!sock_flag(sk, SOCK_TIMESTAMP)) {
> sock_set_flag(sk, SOCK_TIMESTAMP);
> - net_enable_timestamp();
> + if (sk->sk_family != PF_PACKET)
> + net_enable_timestamp();
> }
> }
> EXPORT_SYMBOL(sock_enable_timestamp);
> --- a/net/packet/af_packet.c 2007-09-12 17:07:00.000000000 +0200
> +++ b/net/packet/af_packet.c 2007-09-13 12:09:10.000000000 +0200
> @@ -572,7 +572,6 @@ static int tpacket_rcv(struct sk_buff *s
> unsigned long status = TP_STATUS_LOSING|TP_STATUS_USER;
> unsigned short macoff, netoff;
> struct sk_buff *copy_skb = NULL;
> - struct timeval tv;
>
> if (dev->nd_net != &init_net)
> goto drop;
> @@ -650,12 +649,19 @@ static int tpacket_rcv(struct sk_buff *s
> h->tp_snaplen = snaplen;
> h->tp_mac = macoff;
> h->tp_net = netoff;
> - if (skb->tstamp.tv64)
> - tv = ktime_to_timeval(skb->tstamp);
> - else
> - do_gettimeofday(&tv);
> - h->tp_sec = tv.tv_sec;
> - h->tp_usec = tv.tv_usec;
> +
> + if (sock_flag(sk, SOCK_TIMESTAMP)) {
> + struct timeval tv;
> + if (skb->tstamp.tv64)
> + tv = ktime_to_timeval(skb->tstamp);
> + else
> + do_gettimeofday(&tv);
> + h->tp_sec = tv.tv_sec;
> + h->tp_usec = tv.tv_usec;
> + } else {
> + h->tp_sec = 0;
> + h->tp_usec = 0;
> + }
>
> sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h)));
> sll->sll_halen = 0;
> @@ -1014,6 +1020,7 @@ static int packet_create(struct net *net
> sock->ops = &packet_ops_spkt;
>
> sock_init_data(sock, sk);
> + sock_set_flag(sk, SOCK_TIMESTAMP);
>
> po = pkt_sk(sk);
> sk->sk_family = PF_PACKET;
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [RFC] af_packet: allow disabling timestamps
From: Unai Uribarri @ 2007-09-27 14:08 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Eric Dumazet, David S. Miller, Evgeniy Polyakov, netdev
In-Reply-To: <20070914122642.5343b128@oldman>
On vie, 2007-09-14 at 12:26 +0200, Stephen Hemminger wrote:
> On Thu, 13 Sep 2007 14:24:06 +0200
> Eric Dumazet <dada1@cosmosbay.com> wrote:
>
> > On Thu, 13 Sep 2007 12:42:53 +0200
> > Stephen Hemminger <shemminger@linux-foundation.org> wrote:
> >
> > > Currently, af_packet does not allow disabling timestamps. This patch changes
> > > that but doesn't force global timestamps on.
> > >
> > > This shows up in bugzilla as:
> > > http://bugzilla.kernel.org/show_bug.cgi?id=4809
> > >
> > > Patch against net-2.6.24 tree.
> > >
> >
> > I am not sure I understood this patch.
> >
> > This means that tcpdump/ethereal wont get precise timestamps
> > (gathered when packet is received), but imprecise ones (gathered when the sniffer reads the packet)
> >
> > I added some time ago ktime infrastructure to eventually get nanosecond
> > precision in libpcap, so I would prefer a step in the right direction :)
> >
> > Should'nt we use something like :
> >
> > [PATCH] af_packet : allow disabling timestamps, or requesting nanosecond precision.
> >
> > Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
> >
> > diff --git a/net/core/sock.c b/net/core/sock.c
> > index 5a16e38..1c10b9d 100644
> > --- a/net/core/sock.c
> > +++ b/net/core/sock.c
> > @@ -563,6 +563,7 @@ set_rcvbuf:
> > } else {
> > sock_reset_flag(sk, SOCK_RCVTSTAMP);
> > sock_reset_flag(sk, SOCK_RCVTSTAMPNS);
> > + sock_disable_timestamp(sk);
> > }
> > break;
> >
> > diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> > index 745e2cb..409de44 100644
> > --- a/net/packet/af_packet.c
> > +++ b/net/packet/af_packet.c
> > @@ -650,12 +650,27 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
> > h->tp_snaplen = snaplen;
> > h->tp_mac = macoff;
> > h->tp_net = netoff;
> > - if (skb->tstamp.tv64)
> > - tv = ktime_to_timeval(skb->tstamp);
> > - else
> > - do_gettimeofday(&tv);
> > - h->tp_sec = tv.tv_sec;
> > - h->tp_usec = tv.tv_usec;
> > + h->tp_sec = 0;
> > + h->tp_usec = 0;
> > + if ((sock_flag(sk, SOCK_TIMESTAMP))) {
> > + if (sock_flag(sk, SOCK_RCVTSTAMPNS)) {
> > + struct timespec ts;
> > + if (skb->tstamp.tv64)
> > + ts = ktime_to_timespec(skb->tstamp);
> > + else
> > + getnstimeofday(&ts);
> > + h->tp_sec = ts.tv_sec;
> > + h->tp_usec = ts.tv_nsec; /* cheat a litle bit */
> > + }
> > + else {
> > + if (skb->tstamp.tv64)
> > + tv = ktime_to_timeval(skb->tstamp);
> > + else
> > + do_gettimeofday(&tv);
> > + h->tp_sec = tv.tv_sec;
> > + h->tp_usec = tv.tv_usec;
> > + }
> > + }
> >
> > sll = (struct sockaddr_ll*)((u8*)h + TPACKET_ALIGN(sizeof(*h)));
> > sll->sll_halen = 0;
> > @@ -1014,6 +1029,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol)
> > sock->ops = &packet_ops_spkt;
> >
> > sock_init_data(sock, sk);
> > + sock_enable_timestamp(sk);
> >
> > po = pkt_sk(sk);
> > sk->sk_family = PF_PACKET;
>
> No, then we end up timestamping all the packets, even if they get dropped by
> packet filter. The change in 2.6.24 allows dhclient (and rstp) to only call
> hires clock source for packets they want, not all packets.
>
> Perhaps the timestamping needs to change into a tristate flag?
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Eric's patch has a feature your previous patch hasn't: a way to disable
timestamping from userspace (the changes at net/core/sock.c). But it
changes the userspace API.
I really think that any developer that sets SO_TIMESTAMP to 0 and still
expect to receive valid timestamp is terminally insane and doesn't
deserve any mercy. But we should take pity of these poor souls that uses
(suffers) closed software and found another way that doesn't changes the
API.
Bye.
^ permalink raw reply
* Re: [PATCH] sky2: sky2 FE+ receive status workaround
From: Jochen Voss @ 2007-09-27 15:23 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Jeff Garzik, netdev
In-Reply-To: <20070927065807.7a71ae89@freepuppy.rosehill>
[-- Attachment #1: Type: text/plain, Size: 931 bytes --]
Hi,
On Thu, Sep 27, 2007 at 06:58:07AM -0700, Stephen Hemminger wrote:
> On Thu, 27 Sep 2007 09:14:11 +0100 Jochen Voß <voss@seehuhn.de> wrote:
> > On 27 Sep 2007, at 01:58, Stephen Hemminger wrote:
> > > + /* This chip has hardware problems that generates bogus status.
> > > + * So do only marginal checking and expect higher level protocols
> > > + * to handle crap frames.
> > > + */
> > > + if (sky2->hw->chip_id == CHIP_ID_YUKON_FE_P &&
> > > + sky2->hw->chip_rev == CHIP_REV_YU_FE2_A0 &&
> > > + length != count)
> > > + goto okay;
> >
> > Shouldn't the condition be "length == count"?
>
> No, the code is correct as is. Basically if length == count, then
> the status field is correct, and the driver can go ahead and use it.
> If length != count, then the status is bogus but the data is okay.
Oh, I see. Thanks for the explanation.
All the best,
Jochen
--
http://seehuhn.de/
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: IPSec on Linux Kernel
From: Rami Rosen @ 2007-09-27 15:23 UTC (permalink / raw)
To: netdev
Hi,Fabio,
- Assuming that you intend to deal with IPV4, I suggest that you will
start by looking at the ah4.ko module sources, which are in net/ipv4/ah.c,
especially at the ah_output() and the ah_input() methods.
(for ipv6 there are the ah6.c in net/ipv6).
- May I ask: are you aware that the Authentication Header protocol deals
only with authentication and not with encryption? and as a result, the ESP
protocol, which supports authentication and also, when needed, encryption, is
much more widely used?
Regards,
Rosen Rami
^ permalink raw reply
* Re: [PATCH 5/7] CAN: Add virtual CAN netdevice driver
From: Eric W. Biederman @ 2007-09-27 15:54 UTC (permalink / raw)
To: Urs Thuermann
Cc: netdev, David Miller, Patrick McHardy, Thomas Gleixner,
Oliver Hartkopp, Oliver Hartkopp, Urs Thuermann, Daniel Lezcano
In-Reply-To: <20070920184533.3795.5@janus.isnogud.escape.de>
Urs Thuermann <urs@isnogud.escape.de> writes:
> This patch adds the virtual CAN bus (vcan) network driver.
> The vcan device is just a loopback device for CAN frames, no
> real CAN hardware is involved.
I'm trying to wrap my head around the CAN use of IFF_LOOPBACK.
> 6.2 loopback
>
> As described in chapter 3.2 the CAN network device driver should
> support a local loopback functionality. In this case the driver flag
> IFF_LOOPBACK has to be set to cause the PF_CAN core to not perform the
> loopback as fallback solution:
>
> dev->flags = (IFF_NOARP | IFF_LOOPBACK);
>
Currently IFF_LOOPBACK set in dev->flags means we are dealing
with drivers/net/loopback.c.
In other networking layers loopback functionality (i.e. for broadcast)
is never expected to be provided by the drivers and is instead
always provided by the networking layer. Keeping the drivers
simpler. Further you already have this functionality in the
generic CAN layer for doing loopback without driver support.
So at a first glance the CAN usage of IFF_LOOPBACK looks completely
broken, and likely to confuse other networking layers if they see
a CAN device. Say if someone attempts to run IP over CAN or
something like that.
Do you think you can remove this incompatible usage of IFF_LOOPBACK
from the can code?
If I have read your documentation properly the only reason you are
doing this is so that the timing of frames to cansniffer more
accurately reflects when the frame hits the wire. If CAN runs over a
very slow medium I guess I can see where that can be a concern. But
the usage of IFF_LOOPBACK to do this still feels fairly hackish
to me.
Eric
^ permalink raw reply
* Re: [PATCH 3/4] net ipv4: When possible test for IFF_LOOPBACK and not dev == loopback_dev
From: Eric W. Biederman @ 2007-09-27 16:10 UTC (permalink / raw)
To: Daniel Lezcano; +Cc: David Miller, Linux Containers, netdev, urs
In-Reply-To: <46FB873C.6060200@fr.ibm.com>
Daniel Lezcano <dlezcano@fr.ibm.com> writes:
> Eric W. Biederman wrote:
>> Now that multiple loopback devices are becoming possible it makes
>> the code a little cleaner and more maintainable to test if a deivice
>> is th a loopback device by testing dev->flags & IFF_LOOPBACK instead
>> of dev == loopback_dev.
>>
>> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
>
>
> Urs Thuermann posted the patch:
>
> [PATCH 5/7] CAN: Add virtual CAN netdevice driver
>
> This network driver set its flag to IFF_LOOPBACK for testing.
> Is it possible this can be a collision with your patch ?
I have brought it up on that thread. As best as I tell the CAN usage
of IFF_LOOPBACK will be a problem even without my patch. Assuming
something other then the CAN layer will see the CAN devices.
The CAN documentations IFF_LOOPBACK should be set on all CAN devices.
It seems that the people who want high performance predictable CAN
don't want this and the people who want something they can trace
easily want this.
It sounds to me like CAN routers don't exist.
Anyway hopefully that usage can be resolved as that code is reviewed,
and made ready to merge.
Eric
^ permalink raw reply
* Re: [PATCH 5/7] CAN: Add virtual CAN netdevice driver
From: Eric W. Biederman @ 2007-09-27 16:16 UTC (permalink / raw)
To: Urs Thuermann
Cc: netdev, David Miller, Patrick McHardy, Thomas Gleixner,
Oliver Hartkopp, Oliver Hartkopp, Urs Thuermann, Daniel Lezcano
In-Reply-To: <m1hclgm7dr.fsf@ebiederm.dsl.xmission.com>
I guess in particular IFF_LOOPBACK means that all packets from
a device will come right back to the current machine, and go
nowhere else.
That usage sounds completely different then the CAN usage which
appears to mean. Broadcast packets will be returned to this machine
as well as being sent out onto the wire.
Eric
^ permalink raw reply
* Re: [PATCH] various dst_ifdown routines to catch refcounting bugs
From: Eric W. Biederman @ 2007-09-27 16:27 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: davem, devel, netdev, containers, ebiederm
In-Reply-To: <20070927134724.GA11531@iris.sw.ru>
"Denis V. Lunev" <den@openvz.org> writes:
> Moving dst entries into init_net.loopback_dev is not a good thing.
> This hides obvious and non-obvious ref-counting bugs.
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
To be clear using init_net.loopback is currently safe because we don't
have any destination cache entries for anything except the initial
network namespace.
I have not yet made this change simply because I haven't gotten around
to this part in my patches.
I do have a question I would like to bring up, because I like avoiding
explicit references to loopback_dev when I can.
/* Dirty hack. We did it in 2.2 (in __dst_free),
* we have _very_ good reasons not to repeat
* this mistake in 2.3, but we have no choice
* now. _It_ _is_ _explicit_ _deliberate_
* _race_ _condition_.
*
* Commented and originally written by Alexey.
*/
What is the race that is talked about in that comment. Can we just
assign NULL instead of the loopback device when we bring a route down.
My gut feeling is that something like:
dst->input = dst->output = dst_discard;
may be enough. But I don't know where the deliberate race is.
I haven't traced this all of the way through but from the obvious
parts I just get this nagging feeling that something isn't quite
right.
Eric
^ permalink raw reply
* Re: [Devel] [PATCH 4/4] net: Make the loopback device per network namespace
From: Eric W. Biederman @ 2007-09-27 16:48 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: David Miller, Linux Containers, netdev
In-Reply-To: <46FB9EB1.5070908@sw.ru>
"Denis V. Lunev" <den@sw.ru> writes:
> Eric W. Biederman wrote:
>> This patch makes loopback_dev per network namespace. Adding
>> code to create a different loopback device for each network
>> namespace and adding the code to free a loopback device
>> when a network namespace exits.
>>
>> This patch modifies all users the loopback_dev so they
>> access it as init_net.loopback_dev, keeping all of the
>> code compiling and working. A later pass will be needed to
>> update the users to use something other than the initial network
>> namespace.
>
> A pity that an important bit of explanation is missed. The
> initialization of loopback_dev is moved from a chain of devices
> (init_module) to a subsystem initialization to keep proper order, i.e.
> we must be sure that the initialization order is correct.
That didn't happen in the patch you mentioned. That happened
when we started dynamically allocating the loopback device.
That was the patch Daniel sent out a bit ago.
There are certainly some ordering issues and it may have helped
to talk about them. But they are because things assume the
loopback device is present. We have various bits of code that
is around such as the dst_ifdown case that assumes if another
network device is present the loopback device is present. To
fulfill that assumption I guess that means we have both an
initialization order dependency and a destruction order dependency.
The fact we were using module_init before actually appears to
me to have been racy, but we got away with it because the actual
data structure was statically allocated.
Since it appears that for a dynamically allocated loopback
registering it first and unregistering it last is necessary
for routing. It is likely worth looking at this a little
more closely and making a guarantee. So we can make it easier
for networking layers like ipv6, that want to memorize which
device is the loopback device.
Eric
^ permalink raw reply
* Re: [PATCH] net: Add network namespace clone & unshare support.
From: Eric W. Biederman @ 2007-09-27 17:14 UTC (permalink / raw)
To: Cedric Le Goater; +Cc: David Miller, Linux Containers, netdev, Andrew Morton
In-Reply-To: <46FB6F1E.8070105@fr.ibm.com>
Cedric Le Goater <clg@fr.ibm.com> writes:
>> diff --git a/include/linux/sched.h b/include/linux/sched.h
>> index a01ac6d..e10a0a8 100644
>> --- a/include/linux/sched.h
>> +++ b/include/linux/sched.h
>> @@ -27,6 +27,7 @@
>> #define CLONE_NEWUTS 0x04000000 /* New utsname group? */
>> #define CLONE_NEWIPC 0x08000000 /* New ipcs */
>> #define CLONE_NEWUSER 0x10000000 /* New user namespace */
>> +#define CLONE_NEWNET 0x20000000 /* New network namespace */
>
> This new flag is going to conflict with the pid namespace flag
> CLONE_NEWPID in -mm. It might be worth changing it to:
>
> #define CLONE_NEWNET 0x40000000
Interesting, it would have been nice if someone had caught this
detail earlier. Oh well.
Thanks for pointing this out, it's on my todo list to look into,
and ensure we resolve.
I'm confused because my notes have 0x80000000 for the pid namespace,
and 0x40000000 for the time namespace.
> The changes in nxproxy.c and fork.c will also conflict but I don't
> think we can do much about it for now.
They should also be fairly easy conflicts to resolve.
I guess we are likely to hit this conflict in the next -mm or the
merge window, which ever comes first.
Eric
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox