8
8
* the Free Software Foundation; either version 2 of the License, or
9
9
* (at your option) any later version.
10
10
*
11
- *
11
+ *
12
12
*
13
13
*/
14
14
15
15
/*
16
16
17
- A tool for loading a network with a preconfigurated packets. The tool is
18
- implemented as a linux module. Parameters as output device IPG interpacket
19
- packet, number of packets can be configured. pg uses already intalled
17
+ A tool for loading a network with a preconfigurated packets. The tool is
18
+ implemented as a linux module. Parameters as output device IPG interpacket
19
+ packet, number of packets can be configured. pg uses already intalled
20
20
device driver output routine.
21
21
22
22
@@ -45,12 +45,12 @@ MAC address typo fixed. 010417 --ro
45
45
pgset "frags 5" packet will consist of 5 fragments
46
46
pgset "count 200000" sets number of packets to send
47
47
pgset "ipg 5000" sets artificial gap inserted between packets
48
- to 5000 nanoseconds
48
+ to 5000 nanoseconds
49
49
pgset "dst 10.0.0.1" sets IP destination address
50
- (BEWARE! This generator is very aggressive!)
50
+ (BEWARE! This generator is very aggressive!)
51
51
pgset "dstmac 00:00:00:00:00:00" sets MAC destination address
52
52
pgset stop aborts injection
53
-
53
+
54
54
Also, ^C aborts generator.
55
55
56
56
---- cut here
@@ -66,7 +66,7 @@ function pgset() {
66
66
67
67
result=`cat /proc/net/pg | fgrep "Result: OK:"`
68
68
if [ "$result" = "" ]; then
69
- cat /proc/net/pg | fgrep Result:
69
+ cat /proc/net/pg | fgrep Result:
70
70
fi
71
71
}
72
72
@@ -111,7 +111,7 @@ pgset "dst 0.0.0.0"
111
111
#include <linux/if_arp.h>
112
112
#include <net/checksum.h>
113
113
114
- static char version [] __initdata =
114
+ static char version [] __initdata =
115
115
"pg3.c: v1.0 010812: Packet Generator for packet performance testing.\n" ;
116
116
117
117
@@ -131,8 +131,8 @@ int forced_stop;
131
131
int pg_cpu_speed ;
132
132
int pg_busy ;
133
133
134
- static __u8 hh [14 ] = {
135
- 0x00 , 0x80 , 0xC8 , 0x79 , 0xB3 , 0xCB ,
134
+ static __u8 hh [14 ] = {
135
+ 0x00 , 0x80 , 0xC8 , 0x79 , 0xB3 , 0xCB ,
136
136
137
137
/* We fill in SRC address later */
138
138
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
@@ -430,9 +430,9 @@ static void pg_inject(void)
430
430
431
431
idle = (((idle_acc_hi <<20 )/pg_cpu_speed )<<12 )+ idle_acc_lo /pg_cpu_speed ;
432
432
433
- if (1 ) {
433
+ if (1 ) {
434
434
char * p = pg_result ;
435
-
435
+
436
436
p += sprintf (p , "OK: %u(c%u+d%u) usec, %u (%dbyte,%dfrags) %upps %uMB/sec" ,
437
437
total , total - idle , idle ,
438
438
pc , skb -> len , skb_shinfo (skb )-> nr_frags ,
@@ -444,7 +444,7 @@ static void pg_inject(void)
444
444
out_relskb :
445
445
kfree_skb (skb );
446
446
out_reldev :
447
- dev_put (odev );
447
+ dev_put (odev );
448
448
return ;
449
449
450
450
out_intr :
@@ -461,11 +461,11 @@ int proc_pg_busy_read(char *buf , char **start, off_t offset,
461
461
int len , int * eof , void * data )
462
462
{
463
463
char * p ;
464
-
464
+
465
465
p = buf ;
466
466
p += sprintf (p , "%d\n" , pg_busy );
467
467
* eof = 1 ;
468
-
468
+
469
469
return p - buf ;
470
470
}
471
471
@@ -474,7 +474,7 @@ int proc_pg_read(char *buf , char **start, off_t offset,
474
474
{
475
475
char * p ;
476
476
int i ;
477
-
477
+
478
478
p = buf ;
479
479
p += sprintf (p , "Params: count=%u pkt_size=%u frags %d ipg %u odev \"%s\" dst %s dstmac " ,
480
480
pg_count , pkt_size , nfrags , pg_ipg ,
@@ -511,12 +511,12 @@ int count_trail_chars(const char *buffer, unsigned int maxlen)
511
511
return i ;
512
512
}
513
513
514
- unsigned long num_arg (const char * buffer , unsigned long maxlen ,
514
+ unsigned long num_arg (const char * buffer , unsigned long maxlen ,
515
515
unsigned long * num )
516
516
{
517
517
int i = 0 ;
518
518
* num = 0 ;
519
-
519
+
520
520
for (; i < maxlen ;i ++ ) {
521
521
if ( (buffer [i ] >= '0' ) && (buffer [i ] <= '9' )) {
522
522
* num *= 10 ;
@@ -552,22 +552,22 @@ int proc_pg_write(struct file *file, const char *buffer,
552
552
int i = 0 , max , len ;
553
553
char name [16 ], valstr [32 ];
554
554
unsigned long value = 0 ;
555
-
555
+
556
556
if (count < 1 ) {
557
557
sprintf (pg_result , "Wrong command format" );
558
558
return - EINVAL ;
559
559
}
560
-
560
+
561
561
max = count - i ;
562
562
i += count_trail_chars (& buffer [i ], max );
563
-
563
+
564
564
/* Read variable name */
565
565
566
566
len = strn_len (& buffer [i ], sizeof (name )- 1 );
567
567
memset (name , 0 , sizeof (name ));
568
568
strncpy (name , & buffer [i ], len );
569
569
i += len ;
570
-
570
+
571
571
max = count - i ;
572
572
len = count_trail_chars (& buffer [i ], max );
573
573
i += len ;
@@ -576,7 +576,7 @@ int proc_pg_write(struct file *file, const char *buffer,
576
576
printk ("pg: %s,%lu\n" , name , count );
577
577
578
578
/* Only stop is allowed when we are running */
579
-
579
+
580
580
if (!strcmp (name , "stop" )) {
581
581
forced_stop = 1 ;
582
582
if (pg_busy )
@@ -663,7 +663,7 @@ int proc_pg_write(struct file *file, const char *buffer,
663
663
m ++ ;
664
664
* m = 0 ;
665
665
}
666
- }
666
+ }
667
667
sprintf (pg_result , "OK: dstmac" );
668
668
return count ;
669
669
}
@@ -684,11 +684,11 @@ int proc_pg_write(struct file *file, const char *buffer,
684
684
685
685
static int pg_init (void )
686
686
{
687
- printk (version );
688
- cycles_calibrate ();
689
- if (pg_cpu_speed == 0 ) {
687
+ printk (version );
688
+ cycles_calibrate ();
689
+ if (pg_cpu_speed == 0 ) {
690
690
printk ("pg3: Error: your machine does not have working cycle counter.\n" );
691
- return - EINVAL ;
691
+ return - EINVAL ;
692
692
}
693
693
if (!pg_proc_ent ) {
694
694
pg_proc_ent = create_proc_entry ("net/pg" , 0600 , 0 );
0 commit comments