Re: [PATCH 2/2] pktgen: receive packets and process incoming rate

Previous thread: [PATCH 1/2] pktgen: increasing transmission granularity by Daniel Turull on Wednesday, June 2, 2010 - 4:49 am. (8 messages)

Next thread: [PATCH] netfilter: Xtables: idletimer target implementation by Luciano Coelho on Wednesday, June 2, 2010 - 4:58 am. (3 messages)
From: Daniel Turull
Date: Wednesday, June 2, 2010 - 4:49 am

This patch adds receiver part to pktgen taking advantages of SMP systems
with multiple rx queues:
- Creation of new proc file  /proc/net/pktgen/pgrx to control and display the receiver.
- It uses PER-CPU variable to store the results per each CPU.
- Results displayed per CPU and aggregated.
- The packet handler is add in the protocols handlers (dev_Add_pack())
- Available statistics: packets and bytes received, work time and rate
- Only process pktgen packets
- It is possible to select the incoming interface 
- Documentation updated with the new commands to control the receiver part.

Signed-off-by: Daniel Turull <daniel.turull@gmail.com>

---
diff --git a/Documentation/networking/pktgen.txt b/Documentation/networking/pktgen.txt
index ac0e4ff..20a8810 100644
--- a/Documentation/networking/pktgen.txt
+++ b/Documentation/networking/pktgen.txt
@@ -22,7 +22,7 @@ For monitoring and control pktgen creates:
 	/proc/net/pktgen/pgctrl
 	/proc/net/pktgen/kpktgend_X
         /proc/net/pktgen/ethX
-
+	/proc/net/pktgen/pgrx
 
 Viewing threads
 ===============
@@ -155,6 +155,43 @@ Examples:
  pgset stop    	          aborts injection. Also, ^C aborts generator.
 
 
+=======
+Viewing receiver
+================
+
+/proc/net/pktgen/pgrx
+
+		RECEPTION STATISTICS
+	PER-CPU Stats.
+CPU 0: 	Rx packets: 0	 Rx bytes: 0
+CPU 1: 	Rx packets: 2502400	 Rx bytes: 150144000
+	Rate:  22218pps 10 Mb/sec (10665033bps)
+	Worktime 112625248 us
+CPU 2: 	Rx packets: 1251200	 Rx bytes: 75072000
+	Rate:  11109pps 5 Mb/sec (5332412bps)
+	Worktime 112627453 us
+CPU 3: 	Rx packets: 1251100	 Rx bytes: 75066000
+	Rate:  11108pps 5 Mb/sec (5332035bps)
+	Worktime 112626413 us
+CPU 4: 	Rx packets: 1251400	 Rx bytes: 75084000
+	Rate:  11111pps 5 Mb/sec (5333458bps)
+	Worktime 112623364 us
+CPU 5: 	Rx packets: 1251200	 Rx bytes: 75072000
+	Rate:  11110pps 5 Mb/sec (5332844bps)
+	Worktime 112618314 us
+CPU 6: 	Rx packets: 1241500	 Rx bytes: 74490000
+	Rate:  11023pps 5 Mb/sec (5291273bps)
+	Worktime ...
From: Daniel Turull
Date: Wednesday, June 2, 2010 - 6:28 am

Yes, I used the same type as the number of packets send of the transmission size
struct pktgen_dev




--

From: Daniel Turull
Date: Thursday, June 10, 2010 - 7:04 am

Hi,

I've made some modification to the patch. I'll send another email with the patch,
but I want to comment some things


In order to make it to ipv6 compatible it will be better to create a new packet 

Pktgen is used in experimental environments. In order to start the receiver is necessary 




--

From: Daniel Turull
Date: Thursday, June 10, 2010 - 7:05 am

This patch adds receiver part to pktgen taking advantages of SMP systems
with multiple rx queues:
- Creation of new proc file  /proc/net/pktgen/pgrx to control and display the receiver.
- It uses PER-CPU variable to store the results per each CPU.
- Results displayed per CPU and aggregated.
- The packet handler is add in the protocols handlers (dev_add_pack())
- Available statistics: packets and bytes received, work time and rate
- Only process pktgen packets
- It is possible to select the incoming interface 
- Documentation updated with the new commands to control the receiver part.

Signed-off-by: Daniel Turull <daniel.turull@gmail.com>

---
diff --git a/Documentation/networking/pktgen.txt b/Documentation/networking/pktgen.txt
index ac0e4ff..ed3016a 100644
--- a/Documentation/networking/pktgen.txt
+++ b/Documentation/networking/pktgen.txt
@@ -22,7 +22,7 @@ For monitoring and control pktgen creates:
 	/proc/net/pktgen/pgctrl
 	/proc/net/pktgen/kpktgend_X
         /proc/net/pktgen/ethX
-
+	/proc/net/pktgen/pgrx
 
 Viewing threads
 ===============
@@ -155,6 +155,42 @@ Examples:
  pgset stop    	          aborts injection. Also, ^C aborts generator.
 
 
+Viewing receiver
+================
+
+/proc/net/pktgen/pgrx
+
+		RECEPTION STATISTICS
+	PER-CPU Stats.
+CPU 0: 	Rx packets: 0	 Rx bytes: 0
+CPU 1: 	Rx packets: 2502400	 Rx bytes: 150144000
+	Rate:  22218pps 10 Mb/sec (10665033bps)
+	Worktime 112625248 us
+CPU 2: 	Rx packets: 1251200	 Rx bytes: 75072000
+	Rate:  11109pps 5 Mb/sec (5332412bps)
+	Worktime 112627453 us
+CPU 3: 	Rx packets: 1251100	 Rx bytes: 75066000
+	Rate:  11108pps 5 Mb/sec (5332035bps)
+	Worktime 112626413 us
+CPU 4: 	Rx packets: 1251400	 Rx bytes: 75084000
+	Rate:  11111pps 5 Mb/sec (5333458bps)
+	Worktime 112623364 us
+CPU 5: 	Rx packets: 1251200	 Rx bytes: 75072000
+	Rate:  11110pps 5 Mb/sec (5332844bps)
+	Worktime 112618314 us
+CPU 6: 	Rx packets: 1241500	 Rx bytes: 74490000
+	Rate:  11023pps 5 Mb/sec (5291273bps)
+	Worktime 112623172 ...
From: David Miller
Date: Tuesday, June 15, 2010 - 2:59 pm

From: Daniel Turull <daniel.turull@gmail.com>

I completely disagree with this patch on two levels:

1) pktgen is for "generating" packets, not receiving them.
   Trying to put lipstick on a pig is never a good idea.

2) The information it gathers and shows is completely useless.
   What's interesting as "RX work cost" is what happens deep
   down in the netif_receive_skb() code paths, IP input, routing,
   netfilter, whatever... but that is not what this thing is
   measuring at all.

Sorry, I'm not applying this.  You can probably do something more
clever with tracepoints.

--

From: Eric Dumazet
Date: Wednesday, June 2, 2010 - 6:00 am

Interesting, but does it belongs to pktgen ?



Following code is ... well ... interesting... But ...

1) Is it IPV6 compatable ? pktgen can be ipv6 or ipv4
2) Is it resistant to malicious packets ? (very small ones)
3) No checksum ?

I think you should use standard mechanisms... (pskb_may_pull(), ...)

Its a bit suboptimal to use __get_cpu_var several time. Take a look at
disassembly code :)


This +14 seems suspect (what about vlan tags ?)

Should not recognised packets be allowed to flight in other parts of
kernel stack ? This way, we could use ssh to remotely control this

--

Previous thread: [PATCH 1/2] pktgen: increasing transmission granularity by Daniel Turull on Wednesday, June 2, 2010 - 4:49 am. (8 messages)

Next thread: [PATCH] netfilter: Xtables: idletimer target implementation by Luciano Coelho on Wednesday, June 2, 2010 - 4:58 am. (3 messages)