Re: MPLS extension for pktgen

2006-03-23 Thread David S. Miller
From: Robert Olsson [EMAIL PROTECTED]
Date: Wed, 22 Mar 2006 13:51:48 +0100

  So I'll guess Dave will apply it. 
 
  Signed-off-by: Robert Olsson [EMAIL PROTECTED]

Yep, done.  Thanks a lot.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: MPLS extension for pktgen

2006-03-22 Thread Steven Whitehouse
Hi,

On Tue, Mar 21, 2006 at 07:38:06PM +0100, Robert Olsson wrote:
 
 Steven Whitehouse writes:
 
   I've been looking into MPLS recently and so one of the first things that
   would be useful is a testbed to generate test traffic, and hence the
   attached patch to pktgen.
   
   If you have a moment to look over it, then please let me know if you
   would give it your blessing. The patch is against davem's current
   net-2.6.17 tree,
 
  Nice. Well never thought about mpls but it seems possible too. With mpls 
  enabled it seems send something my tcpdump does not understand so I trust 
  you there. I and it does not seem to brake standard ipv4 sending. So it 
  should be OK. 

My tcpdump (3.9.4-2 according to RPM) shows:

09:05:28.751494 MPLS (label 16, exp 0, ttl 10)
(label 32, exp 0, ttl 10)
(label 0 (IPv4 explicit NULL), exp 0, [S], ttl 10)
IP (tos 0x0, ttl  32, id 257, offset 0, flags [none], proto: UDP (17), 
length: 64) men-an-tol.chygwyn.com.discard  10.10.10.2.discard: [no cksum] 
UDP, length 36[|MPLS]
0x:  0001 000a 0002 000a  010a 4500 0040
0x0010:  0101  2011 7a6e 0a2c 0107 0a0a 0a02
0x0020:  0009 0009 002c  be9b e955  00c7
0x0030:  4421 0f0f 0001 f03d  0310  
0x0040:       

for the example label stack. So it looks correct to me, though I'm slightly
worried by the [|MPLS] I counted up the bytes manually and unless I've
made a mistake somewhere it appears ok.
 
  But I'll guess the mpls result code is not what you expected...
 
  echo mpls 0001000a,0002000a,000a/proc/net/pktgen/eth1
  cat /proc/net/pktgen/eth1 | grep Res
  Result: 000a
 
   sprintf(pg_result, OK: mpls=);
   for(n = 0; n  pkt_dev-nr_labels; n++)
sprintf(pg_result, %08x%s, ntohl(pkt_dev-labels[n]),
 n == pkt_dev-nr_labels-1 ?  : ,);
 
  Cheers.
 
   --ro

Yes, I'll send another patch with that fixed shortly :-)

Steve.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: MPLS extension for pktgen

2006-03-22 Thread Steven Whitehouse
Hi,

Here is the updated patch. If you are happy with this, then will you send
it on to Dave, or should I do that?

Steve.

---


Signed-off-by: Steven Whitehouse [EMAIL PROTECTED]

diff --git a/Documentation/networking/pktgen.txt 
b/Documentation/networking/pktgen.txt
--- a/Documentation/networking/pktgen.txt
+++ b/Documentation/networking/pktgen.txt
@@ -109,6 +109,22 @@ Examples:
  cycle through the port range.
  pgset udp_dst_max 9   set UDP destination port max.
 
+ pgset mpls 0001000a,0002000a,000a set MPLS labels (in this example
+ outer label=16,middle label=32,
+inner label=0 (IPv4 NULL)) Note that
+there must be no spaces between the
+arguments. Leading zeros are required.
+Do not set the bottom of stack bit,
+thats done automatically. If you do
+set the bottom of stack bit, that
+indicates that you want to randomly
+generate that address and the flag
+MPLS_RND will be turned on. You
+can have any mix of random and fixed
+labels in the label stack.
+
+ pgset mpls 0  turn off mpls (or any invalid argument works 
too!)
+
  pgset stop  aborts injection. Also, ^C aborts generator.
 
 
@@ -167,6 +183,8 @@ pkt_size 
 min_pkt_size
 max_pkt_size
 
+mpls
+
 udp_src_min
 udp_src_max
 
@@ -211,4 +229,4 @@ Grant Grundler for testing on IA-64 and 
 Stephen Hemminger, Andi Kleen, Dave Miller and many others.
 
 
-Good luck with the linux net-development.
\ No newline at end of file
+Good luck with the linux net-development.
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -106,6 +106,9 @@
  *
  * interruptible_sleep_on_timeout() replaced Nishanth Aravamudan [EMAIL 
PROTECTED] 
  * 050103
+ *
+ * MPLS support by Steven Whitehouse [EMAIL PROTECTED]
+ *
  */
 #include linux/sys.h
 #include linux/types.h
@@ -154,7 +157,7 @@
 #include asm/div64.h /* do_div */
 #include asm/timex.h
 
-#define VERSION  pktgen v2.66: Packet Generator for packet performance 
testing.\n
+#define VERSION  pktgen v2.67: Packet Generator for packet performance 
testing.\n
 
 /* #define PG_DEBUG(a) a */
 #define PG_DEBUG(a)
@@ -162,6 +165,8 @@
 /* The buckets are exponential in 'width' */
 #define LAT_BUCKETS_MAX 32
 #define IP_NAME_SZ 32
+#define MAX_MPLS_LABELS 16 /* This is the max label stack depth */
+#define MPLS_STACK_BOTTOM __constant_htonl(0x0100)
 
 /* Device flag bits */
 #define F_IPSRC_RND   (10)   /* IP-Src Random  */
@@ -172,6 +177,7 @@
 #define F_MACDST_RND  (15)   /* MAC-Dst Random */
 #define F_TXSIZE_RND  (16)   /* Transmit size is random */
 #define F_IPV6(17)   /* Interface in IPV6 Mode */
+#define F_MPLS_RND(18)   /* Random MPLS labels */
 
 /* Thread control flag bits */
 #define T_TERMINATE   (10)
@@ -278,6 +284,10 @@ struct pktgen_dev {
__u16 udp_dst_min;  /* inclusive, dest UDP port */
__u16 udp_dst_max;  /* exclusive, dest UDP port */
 
+   /* MPLS */
+   unsigned nr_labels; /* Depth of stack, 0 = no MPLS */
+   __be32 labels[MAX_MPLS_LABELS];
+
__u32 src_mac_count;/* How many MACs to iterate through */
__u32 dst_mac_count;/* How many MACs to iterate through */
 
@@ -623,9 +633,19 @@ static int pktgen_if_show(struct seq_fil
   pkt_dev-udp_dst_min, pkt_dev-udp_dst_max);
 
seq_printf(seq,
-   src_mac_count: %d  dst_mac_count: %d \n Flags: ,
+   src_mac_count: %d  dst_mac_count: %d\n,
   pkt_dev-src_mac_count, pkt_dev-dst_mac_count);
 
+   if (pkt_dev-nr_labels) {
+   unsigned i;
+   seq_printf(seq,  mpls: );
+   for(i = 0; i  pkt_dev-nr_labels; i++)
+   seq_printf(seq, %08x%s, ntohl(pkt_dev-labels[i]),
+  i == pkt_dev-nr_labels-1 ? \n : , );
+   }
+
+   seq_printf(seq,  Flags: );
+
if (pkt_dev-flags  F_IPV6)
seq_printf(seq, IPV6  );
 
@@ -644,6 +664,9 @@ static int pktgen_if_show(struct seq_fil
if (pkt_dev-flags  F_UDPDST_RND)
seq_printf(seq, UDPDST_RND  );
 
+   if (pkt_dev-flags  F_MPLS_RND)
+   seq_printf(seq,  MPLS_RND  );
+
if (pkt_dev-flags  F_MACSRC_RND)
seq_printf(seq, MACSRC_RND  );
 
@@ -691,6 +714,29 @@ static int pktgen_if_show(struct seq_fil
return 0;
 }
 
+
+static int 

Re: MPLS extension for pktgen

2006-03-22 Thread David S. Miller
From: Steven Whitehouse [EMAIL PROTECTED]
Date: Wed, 22 Mar 2006 11:11:10 +

 Here is the updated patch. If you are happy with this, then will you send
 it on to Dave, or should I do that?

I have eyes here :-)
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: MPLS extension for pktgen

2006-03-22 Thread Robert Olsson


Steven Whitehouse writes:
  Here is the updated patch. If you are happy with this, then will you send
  it on to Dave, or should I do that?


 Hello! 

 Yes the minor problem with the return code is fixed as:
 Result: OK: mpls=0001000a,0002000a,000a

 So I'll guess Dave will apply it. 

 Signed-off-by: Robert Olsson [EMAIL PROTECTED]
 
 Thanks.
--ro
  




  
  Signed-off-by: Steven Whitehouse [EMAIL PROTECTED]
  
  diff --git a/Documentation/networking/pktgen.txt 
  b/Documentation/networking/pktgen.txt
  --- a/Documentation/networking/pktgen.txt
  +++ b/Documentation/networking/pktgen.txt
  @@ -109,6 +109,22 @@ Examples:
cycle through the port range.
pgset udp_dst_max 9   set UDP destination port max.
   
  + pgset mpls 0001000a,0002000a,000a set MPLS labels (in this example
  + outer label=16,middle label=32,
  + inner label=0 (IPv4 NULL)) Note that
  + there must be no spaces between the
  + arguments. Leading zeros are required.
  + Do not set the bottom of stack bit,
  + thats done automatically. If you do
  + set the bottom of stack bit, that
  + indicates that you want to randomly
  + generate that address and the flag
  + MPLS_RND will be turned on. You
  + can have any mix of random and fixed
  + labels in the label stack.
  +
  + pgset mpls 0   turn off mpls (or any invalid argument works 
  too!)
  +
pgset stop   aborts injection. Also, ^C aborts generator.
   
   
  @@ -167,6 +183,8 @@ pkt_size 
   min_pkt_size
   max_pkt_size
   
  +mpls
  +
   udp_src_min
   udp_src_max
   
  @@ -211,4 +229,4 @@ Grant Grundler for testing on IA-64 and 
   Stephen Hemminger, Andi Kleen, Dave Miller and many others.
   
   
  -Good luck with the linux net-development.
  \ No newline at end of file
  +Good luck with the linux net-development.
  diff --git a/net/core/pktgen.c b/net/core/pktgen.c
  --- a/net/core/pktgen.c
  +++ b/net/core/pktgen.c
  @@ -106,6 +106,9 @@
*
* interruptible_sleep_on_timeout() replaced Nishanth Aravamudan [EMAIL 
  PROTECTED] 
* 050103
  + *
  + * MPLS support by Steven Whitehouse [EMAIL PROTECTED]
  + *
*/
   #include linux/sys.h
   #include linux/types.h
  @@ -154,7 +157,7 @@
   #include asm/div64.h  /* do_div */
   #include asm/timex.h
   
  -#define VERSION  pktgen v2.66: Packet Generator for packet performance 
  testing.\n
  +#define VERSION  pktgen v2.67: Packet Generator for packet performance 
  testing.\n
   
   /* #define PG_DEBUG(a) a */
   #define PG_DEBUG(a)
  @@ -162,6 +165,8 @@
   /* The buckets are exponential in 'width' */
   #define LAT_BUCKETS_MAX 32
   #define IP_NAME_SZ 32
  +#define MAX_MPLS_LABELS 16 /* This is the max label stack depth */
  +#define MPLS_STACK_BOTTOM __constant_htonl(0x0100)
   
   /* Device flag bits */
   #define F_IPSRC_RND   (10)/* IP-Src Random  */
  @@ -172,6 +177,7 @@
   #define F_MACDST_RND  (15)/* MAC-Dst Random */
   #define F_TXSIZE_RND  (16)/* Transmit size is random */
   #define F_IPV6(17)/* Interface in IPV6 Mode */
  +#define F_MPLS_RND(18)/* Random MPLS labels */
   
   /* Thread control flag bits */
   #define T_TERMINATE   (10)
  @@ -278,6 +284,10 @@ struct pktgen_dev {
   __u16 udp_dst_min;  /* inclusive, dest UDP port */
   __u16 udp_dst_max;  /* exclusive, dest UDP port */
   
  +/* MPLS */
  +unsigned nr_labels; /* Depth of stack, 0 = no MPLS */
  +__be32 labels[MAX_MPLS_LABELS];
  +
   __u32 src_mac_count;/* How many MACs to iterate through */
   __u32 dst_mac_count;/* How many MACs to iterate through */
   
  @@ -623,9 +633,19 @@ static int pktgen_if_show(struct seq_fil
  pkt_dev-udp_dst_min, pkt_dev-udp_dst_max);
   
   seq_printf(seq,
  -src_mac_count: %d  dst_mac_count: %d \n Flags: ,
  +src_mac_count: %d  dst_mac_count: %d\n,
  pkt_dev-src_mac_count, pkt_dev-dst_mac_count);
   
  +if (pkt_dev-nr_labels) {
  +unsigned i;
  +seq_printf(seq,  mpls: );
  +for(i = 0; i  pkt_dev-nr_labels; i++)
  +seq_printf(seq, %08x%s, ntohl(pkt_dev-labels[i]),
  +   i == pkt_dev-nr_labels-1 ? \n : , );
  +}
  +
  +seq_printf(seq,  Flags: );
  +
   if (pkt_dev-flags  F_IPV6)
   seq_printf(seq, IPV6  );
   
  @@ -644,6 +664,9 @@ static int pktgen_if_show(struct seq_fil
   if 

MPLS extension for pktgen

2006-03-21 Thread Steven Whitehouse
Hi,

I've been looking into MPLS recently and so one of the first things that
would be useful is a testbed to generate test traffic, and hence the
attached patch to pktgen.

If you have a moment to look over it, then please let me know if you
would give it your blessing. The patch is against davem's current
net-2.6.17 tree,


Steve.


--

diff --git a/Documentation/networking/pktgen.txt 
b/Documentation/networking/pktgen.txt
--- a/Documentation/networking/pktgen.txt
+++ b/Documentation/networking/pktgen.txt
@@ -109,6 +109,22 @@ Examples:
  cycle through the port range.
  pgset udp_dst_max 9   set UDP destination port max.
 
+ pgset mpls 0001000a,0002000a,000a set MPLS labels (in this example
+ outer label=16,middle label=32,
+inner label=0 (IPv4 NULL)) Note that
+there must be no spaces between the
+arguments. Leading zeros are required.
+Do not set the bottom of stack bit,
+thats done automatically. If you do
+set the bottom of stack bit, that
+indicates that you want to randomly
+generate that address and the flag
+MPLS_RND will be turned on. You
+can have any mix of random and fixed
+labels in the label stack.
+
+ pgset mpls 0  turn off mpls (or any invalid argument works 
too!)
+
  pgset stop  aborts injection. Also, ^C aborts generator.
 
 
@@ -167,6 +183,8 @@ pkt_size 
 min_pkt_size
 max_pkt_size
 
+mpls
+
 udp_src_min
 udp_src_max
 
@@ -211,4 +229,4 @@ Grant Grundler for testing on IA-64 and 
 Stephen Hemminger, Andi Kleen, Dave Miller and many others.
 
 
-Good luck with the linux net-development.
\ No newline at end of file
+Good luck with the linux net-development.
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -106,6 +106,9 @@
  *
  * interruptible_sleep_on_timeout() replaced Nishanth Aravamudan [EMAIL 
PROTECTED] 
  * 050103
+ *
+ * MPLS support by Steven Whitehouse [EMAIL PROTECTED]
+ *
  */
 #include linux/sys.h
 #include linux/types.h
@@ -154,7 +157,7 @@
 #include asm/div64.h /* do_div */
 #include asm/timex.h
 
-#define VERSION  pktgen v2.66: Packet Generator for packet performance 
testing.\n
+#define VERSION  pktgen v2.67: Packet Generator for packet performance 
testing.\n
 
 /* #define PG_DEBUG(a) a */
 #define PG_DEBUG(a)
@@ -162,6 +165,8 @@
 /* The buckets are exponential in 'width' */
 #define LAT_BUCKETS_MAX 32
 #define IP_NAME_SZ 32
+#define MAX_MPLS_LABELS 16 /* This is the max label stack depth */
+#define MPLS_STACK_BOTTOM __constant_htonl(0x0100)
 
 /* Device flag bits */
 #define F_IPSRC_RND   (10)   /* IP-Src Random  */
@@ -172,6 +177,7 @@
 #define F_MACDST_RND  (15)   /* MAC-Dst Random */
 #define F_TXSIZE_RND  (16)   /* Transmit size is random */
 #define F_IPV6(17)   /* Interface in IPV6 Mode */
+#define F_MPLS_RND(18)   /* Random MPLS labels */
 
 /* Thread control flag bits */
 #define T_TERMINATE   (10)
@@ -278,6 +284,10 @@ struct pktgen_dev {
__u16 udp_dst_min;  /* inclusive, dest UDP port */
__u16 udp_dst_max;  /* exclusive, dest UDP port */
 
+   /* MPLS */
+   unsigned nr_labels; /* Depth of stack, 0 = no MPLS */
+   __be32 labels[MAX_MPLS_LABELS];
+
__u32 src_mac_count;/* How many MACs to iterate through */
__u32 dst_mac_count;/* How many MACs to iterate through */
 
@@ -623,9 +633,19 @@ static int pktgen_if_show(struct seq_fil
   pkt_dev-udp_dst_min, pkt_dev-udp_dst_max);
 
seq_printf(seq,
-   src_mac_count: %d  dst_mac_count: %d \n Flags: ,
+   src_mac_count: %d  dst_mac_count: %d\n,
   pkt_dev-src_mac_count, pkt_dev-dst_mac_count);
 
+   if (pkt_dev-nr_labels) {
+   unsigned i;
+   seq_printf(seq,  mpls: );
+   for(i = 0; i  pkt_dev-nr_labels; i++)
+   seq_printf(seq, %08x%s, ntohl(pkt_dev-labels[i]),
+  i == pkt_dev-nr_labels-1 ? \n : , );
+   }
+
+   seq_printf(seq,  Flags: );
+
if (pkt_dev-flags  F_IPV6)
seq_printf(seq, IPV6  );
 
@@ -644,6 +664,9 @@ static int pktgen_if_show(struct seq_fil
if (pkt_dev-flags  F_UDPDST_RND)
seq_printf(seq, UDPDST_RND  );
 
+   if (pkt_dev-flags  F_MPLS_RND)
+   seq_printf(seq,  MPLS_RND  );
+
if (pkt_dev-flags  

MPLS extension for pktgen

2006-03-21 Thread Robert Olsson

Steven Whitehouse writes:

  I've been looking into MPLS recently and so one of the first things that
  would be useful is a testbed to generate test traffic, and hence the
  attached patch to pktgen.
  
  If you have a moment to look over it, then please let me know if you
  would give it your blessing. The patch is against davem's current
  net-2.6.17 tree,

 Nice. Well never thought about mpls but it seems possible too. With mpls 
 enabled it seems send something my tcpdump does not understand so I trust 
 you there. I and it does not seem to brake standard ipv4 sending. So it 
 should be OK. 

 But I'll guess the mpls result code is not what you expected...

 echo mpls 0001000a,0002000a,000a/proc/net/pktgen/eth1
 cat /proc/net/pktgen/eth1 | grep Res
 Result: 000a

  sprintf(pg_result, OK: mpls=);
  for(n = 0; n  pkt_dev-nr_labels; n++)
   sprintf(pg_result, %08x%s, ntohl(pkt_dev-labels[n]),
n == pkt_dev-nr_labels-1 ?  : ,);

 Cheers.
--ro



 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html