xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Re-define PKT_PROT_LEN to be bigger.
@ 2010-12-14 20:35 Paul Durrant
  2010-12-14 22:17 ` Jeremy Fitzhardinge
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Paul Durrant @ 2010-12-14 20:35 UTC (permalink / raw)
  To: xen-devel; +Cc: Paul Durrant

Re-define PKT_PROT_LEN to be big enough to handle maximal IPv4 and TCP options and phrase
the definition so that it's reasonably obvious that's what it's for.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
 drivers/xen/netback/netback.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/xen/netback/netback.c b/drivers/xen/netback/netback.c
index c448675..1a4a20e 100644
--- a/drivers/xen/netback/netback.c
+++ b/drivers/xen/netback/netback.c
@@ -128,7 +128,7 @@ static inline int netif_get_page_ext(struct page *pg, unsigned int *_group, unsi
  * packet processing on them (netfilter, routing, etc). 72 is enough
  * to cover TCP+IP headers including options.
  */
-#define PKT_PROT_LEN 72
+#define PKT_PROT_LEN    (ETH_HLEN + 4 + (15 * 4) + (15 * 4))
 
 static inline pending_ring_idx_t pending_index(unsigned i)
 {
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Re-define PKT_PROT_LEN to be bigger.
  2010-12-14 20:35 Paul Durrant
@ 2010-12-14 22:17 ` Jeremy Fitzhardinge
  2010-12-15  9:30   ` Paul Durrant
  2010-12-15  9:37 ` Ian Campbell
  2010-12-20 14:34 ` Ian Campbell
  2 siblings, 1 reply; 6+ messages in thread
From: Jeremy Fitzhardinge @ 2010-12-14 22:17 UTC (permalink / raw)
  To: Paul Durrant; +Cc: xen-devel

On 12/14/2010 12:35 PM, Paul Durrant wrote:
> Re-define PKT_PROT_LEN to be big enough to handle maximal IPv4 and TCP options and phrase
> the definition so that it's reasonably obvious that's what it's for.

Which kernel are these for?

Thanks,
    J

> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> ---
>  drivers/xen/netback/netback.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/xen/netback/netback.c b/drivers/xen/netback/netback.c
> index c448675..1a4a20e 100644
> --- a/drivers/xen/netback/netback.c
> +++ b/drivers/xen/netback/netback.c
> @@ -128,7 +128,7 @@ static inline int netif_get_page_ext(struct page *pg, unsigned int *_group, unsi
>   * packet processing on them (netfilter, routing, etc). 72 is enough
>   * to cover TCP+IP headers including options.
>   */
> -#define PKT_PROT_LEN 72
> +#define PKT_PROT_LEN    (ETH_HLEN + 4 + (15 * 4) + (15 * 4))
>  
>  static inline pending_ring_idx_t pending_index(unsigned i)
>  {

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] Re-define PKT_PROT_LEN to be bigger.
  2010-12-14 22:17 ` Jeremy Fitzhardinge
@ 2010-12-15  9:30   ` Paul Durrant
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Durrant @ 2010-12-15  9:30 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: xen-devel@lists.xensource.com

Sorry, should have said... These are patches against the pvops xen/stable-2.6.32.x branch.

  Cheers,

    Paul

> -----Original Message-----
> From: Jeremy Fitzhardinge [mailto:jeremy@goop.org]
> Sent: 14 December 2010 22:17
> To: Paul Durrant
> Cc: xen-devel@lists.xensource.com
> Subject: Re: [Xen-devel] [PATCH] Re-define PKT_PROT_LEN to be
> bigger.
> 
> On 12/14/2010 12:35 PM, Paul Durrant wrote:
> > Re-define PKT_PROT_LEN to be big enough to handle maximal IPv4 and
> TCP options and phrase
> > the definition so that it's reasonably obvious that's what it's
> for.
> 
> Which kernel are these for?
> 
> Thanks,
>     J
> 
> > Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> > ---
> >  drivers/xen/netback/netback.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/xen/netback/netback.c
> b/drivers/xen/netback/netback.c
> > index c448675..1a4a20e 100644
> > --- a/drivers/xen/netback/netback.c
> > +++ b/drivers/xen/netback/netback.c
> > @@ -128,7 +128,7 @@ static inline int netif_get_page_ext(struct
> page *pg, unsigned int *_group, unsi
> >   * packet processing on them (netfilter, routing, etc). 72 is
> enough
> >   * to cover TCP+IP headers including options.
> >   */
> > -#define PKT_PROT_LEN 72
> > +#define PKT_PROT_LEN    (ETH_HLEN + 4 + (15 * 4) + (15 * 4))
> >
> >  static inline pending_ring_idx_t pending_index(unsigned i)
> >  {

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Re-define PKT_PROT_LEN to be bigger.
  2010-12-14 20:35 Paul Durrant
  2010-12-14 22:17 ` Jeremy Fitzhardinge
@ 2010-12-15  9:37 ` Ian Campbell
  2010-12-20 14:34 ` Ian Campbell
  2 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2010-12-15  9:37 UTC (permalink / raw)
  To: Paul Durrant; +Cc: xen-devel@lists.xensource.com

On Tue, 2010-12-14 at 20:35 +0000, Paul Durrant wrote:
> Re-define PKT_PROT_LEN to be big enough to handle maximal IPv4 and TCP options and phrase
> the definition so that it's reasonably obvious that's what it's for.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> ---
>  drivers/xen/netback/netback.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/xen/netback/netback.c b/drivers/xen/netback/netback.c
> index c448675..1a4a20e 100644
> --- a/drivers/xen/netback/netback.c
> +++ b/drivers/xen/netback/netback.c
> @@ -128,7 +128,7 @@ static inline int netif_get_page_ext(struct page *pg, unsigned int *_group, unsi
>   * packet processing on them (netfilter, routing, etc). 72 is enough

Missed this comment.

>   * to cover TCP+IP headers including options.
>   */
> -#define PKT_PROT_LEN 72
> +#define PKT_PROT_LEN    (ETH_HLEN + 4 + (15 * 4) + (15 * 4))

Clearer as:
#define ETH_HLEN_VLAN_HLEN + \
	MAX_IPOPTLEN + sizeof(struct iphdr) + \
	MAX_TCP_OPTION_SPACE + sizeof(struct tcphdr)
?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] Re-define PKT_PROT_LEN to be bigger.
@ 2010-12-15  9:48 Paul Durrant
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Durrant @ 2010-12-15  9:48 UTC (permalink / raw)
  To: jeremy, xen-devel; +Cc: Paul Durrant

Re-define PKT_PROT_LEN to be big enough to handle maximal IPv4 and TCP options and phrase
the definition so that it's reasonably obvious that's what it's for.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
 drivers/xen/netback/netback.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/xen/netback/netback.c b/drivers/xen/netback/netback.c
index c448675..368daa6 100644
--- a/drivers/xen/netback/netback.c
+++ b/drivers/xen/netback/netback.c
@@ -36,9 +36,11 @@
 
 #include "common.h"
 
-#include <linux/tcp.h>
-#include <linux/udp.h>
 #include <linux/kthread.h>
+#include <linux/if_vlan.h>
+#include <linux/udp.h>
+
+#include <net/tcp.h>
 
 #include <xen/balloon.h>
 #include <xen/events.h>
@@ -125,10 +127,12 @@ static inline int netif_get_page_ext(struct page *pg, unsigned int *_group, unsi
 /*
  * This is the amount of packet we copy rather than map, so that the
  * guest can't fiddle with the contents of the headers while we do
- * packet processing on them (netfilter, routing, etc). 72 is enough
- * to cover TCP+IP headers including options.
+ * packet processing on them (netfilter, routing, etc).
  */
-#define PKT_PROT_LEN 72
+#define PKT_PROT_LEN    (ETH_HLEN + \
+			 VLAN_HLEN + \
+			 sizeof(struct iphdr) + MAX_IPOPTLEN + \
+			 sizeof(struct tcphdr) + MAX_TCP_OPTION_SPACE)
 
 static inline pending_ring_idx_t pending_index(unsigned i)
 {
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Re-define PKT_PROT_LEN to be bigger.
  2010-12-14 20:35 Paul Durrant
  2010-12-14 22:17 ` Jeremy Fitzhardinge
  2010-12-15  9:37 ` Ian Campbell
@ 2010-12-20 14:34 ` Ian Campbell
  2 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2010-12-20 14:34 UTC (permalink / raw)
  To: Paul Durrant; +Cc: xen-devel@lists.xensource.com

I applied these 5 patches (replacing this first one with the repost from
<1292406492-20516-1-git-send-email-paul.durrant@citrix.com>) to my WIP
branch for upstreaming. Not sure if they also want to go into the
next-2.6.32 branch.

Ian.

On Tue, 2010-12-14 at 20:35 +0000, Paul Durrant wrote:
> Re-define PKT_PROT_LEN to be big enough to handle maximal IPv4 and TCP options and phrase
> the definition so that it's reasonably obvious that's what it's for.
> 
> Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
> ---
>  drivers/xen/netback/netback.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/xen/netback/netback.c b/drivers/xen/netback/netback.c
> index c448675..1a4a20e 100644
> --- a/drivers/xen/netback/netback.c
> +++ b/drivers/xen/netback/netback.c
> @@ -128,7 +128,7 @@ static inline int netif_get_page_ext(struct page *pg, unsigned int *_group, unsi
>   * packet processing on them (netfilter, routing, etc). 72 is enough
>   * to cover TCP+IP headers including options.
>   */
> -#define PKT_PROT_LEN 72
> +#define PKT_PROT_LEN    (ETH_HLEN + 4 + (15 * 4) + (15 * 4))
>  
>  static inline pending_ring_idx_t pending_index(unsigned i)
>  {

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-20 14:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-15  9:48 [PATCH] Re-define PKT_PROT_LEN to be bigger Paul Durrant
  -- strict thread matches above, loose matches on Subject: below --
2010-12-14 20:35 Paul Durrant
2010-12-14 22:17 ` Jeremy Fitzhardinge
2010-12-15  9:30   ` Paul Durrant
2010-12-15  9:37 ` Ian Campbell
2010-12-20 14:34 ` Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).