Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
pktgen.c File Reference
#include <linux/sys.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/mutex.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/unistd.h>
#include <linux/string.h>
#include <linux/ptrace.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/capability.h>
#include <linux/hrtimer.h>
#include <linux/freezer.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/list.h>
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/inet.h>
#include <linux/inetdevice.h>
#include <linux/rtnetlink.h>
#include <linux/if_arp.h>
#include <linux/if_vlan.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/udp.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/wait.h>
#include <linux/etherdevice.h>
#include <linux/kthread.h>
#include <linux/prefetch.h>
#include <net/net_namespace.h>
#include <net/checksum.h>
#include <net/ipv6.h>
#include <net/addrconf.h>
#include <asm/byteorder.h>
#include <linux/rcupdate.h>
#include <linux/bitops.h>
#include <linux/io.h>
#include <linux/timex.h>
#include <linux/uaccess.h>
#include <asm/dma.h>
#include <asm/div64.h>

Go to the source code of this file.

Data Structures

struct  flow_state
 
struct  pktgen_dev
 
struct  pktgen_hdr
 
struct  pktgen_thread
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define VERSION   "2.74"
 
#define IP_NAME_SZ   32
 
#define MAX_MPLS_LABELS   16 /* This is the max label stack depth */
 
#define MPLS_STACK_BOTTOM   htonl(0x00000100)
 
#define func_enter()   pr_debug("entering %s\n", __func__);
 
#define F_IPSRC_RND   (1<<0) /* IP-Src Random */
 
#define F_IPDST_RND   (1<<1) /* IP-Dst Random */
 
#define F_UDPSRC_RND   (1<<2) /* UDP-Src Random */
 
#define F_UDPDST_RND   (1<<3) /* UDP-Dst Random */
 
#define F_MACSRC_RND   (1<<4) /* MAC-Src Random */
 
#define F_MACDST_RND   (1<<5) /* MAC-Dst Random */
 
#define F_TXSIZE_RND   (1<<6) /* Transmit size is random */
 
#define F_IPV6   (1<<7) /* Interface in IPV6 Mode */
 
#define F_MPLS_RND   (1<<8) /* Random MPLS labels */
 
#define F_VID_RND   (1<<9) /* Random VLAN ID */
 
#define F_SVID_RND   (1<<10) /* Random SVLAN ID */
 
#define F_FLOW_SEQ   (1<<11) /* Sequential flows */
 
#define F_IPSEC_ON   (1<<12) /* ipsec on for flows */
 
#define F_QUEUE_MAP_RND   (1<<13) /* queue map Random */
 
#define F_QUEUE_MAP_CPU   (1<<14) /* queue map mirrors smp_processor_id() */
 
#define F_NODE   (1<<15) /* Node memory alloc*/
 
#define T_STOP   (1<<0) /* Stop run */
 
#define T_RUN   (1<<1) /* Start run */
 
#define T_REMDEVALL   (1<<2) /* Remove all devs */
 
#define T_REMDEV   (1<<3) /* Remove one dev */
 
#define if_lock(t)   spin_lock(&(t->if_lock));
 
#define if_unlock(t)   spin_unlock(&(t->if_lock));
 
#define PKTGEN_MAGIC   0xbe9be955
 
#define PG_PROC_DIR   "pktgen"
 
#define PGCTRL   "pgctrl"
 
#define MAX_CFLOWS   65536
 
#define VLAN_TAG_SIZE(x)   ((x)->vlan_id == 0xffff ? 0 : 4)
 
#define SVLAN_TAG_SIZE(x)   ((x)->svlan_id == 0xffff ? 0 : 4)
 
#define F_INIT   (1<<0) /* flow has been initialized */
 
#define REMOVE   1
 
#define FIND   0
 

Functions

 module_init (pg_init)
 
 module_exit (pg_cleanup)
 
 MODULE_AUTHOR ("Robert Olsson <[email protected]>")
 
 MODULE_DESCRIPTION ("Packet Generator tool")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_VERSION (VERSION)
 
 module_param (pg_count_d, int, 0)
 
 MODULE_PARM_DESC (pg_count_d,"Default number of packets to inject")
 
 module_param (pg_delay_d, int, 0)
 
 MODULE_PARM_DESC (pg_delay_d,"Default delay between packets (nanoseconds)")
 
 module_param (pg_clone_skb_d, int, 0)
 
 MODULE_PARM_DESC (pg_clone_skb_d,"Default number of copies of the same packet")
 
 module_param (debug, int, 0)
 
 MODULE_PARM_DESC (debug,"Enable debugging of pktgen module")
 

Macro Definition Documentation

#define F_FLOW_SEQ   (1<<11) /* Sequential flows */

Definition at line 195 of file pktgen.c.

#define F_INIT   (1<<0) /* flow has been initialized */

Definition at line 232 of file pktgen.c.

#define F_IPDST_RND   (1<<1) /* IP-Dst Random */

Definition at line 185 of file pktgen.c.

#define F_IPSEC_ON   (1<<12) /* ipsec on for flows */

Definition at line 196 of file pktgen.c.

#define F_IPSRC_RND   (1<<0) /* IP-Src Random */

Definition at line 184 of file pktgen.c.

#define F_IPV6   (1<<7) /* Interface in IPV6 Mode */

Definition at line 191 of file pktgen.c.

#define F_MACDST_RND   (1<<5) /* MAC-Dst Random */

Definition at line 189 of file pktgen.c.

#define F_MACSRC_RND   (1<<4) /* MAC-Src Random */

Definition at line 188 of file pktgen.c.

#define F_MPLS_RND   (1<<8) /* Random MPLS labels */

Definition at line 192 of file pktgen.c.

#define F_NODE   (1<<15) /* Node memory alloc*/

Definition at line 199 of file pktgen.c.

#define F_QUEUE_MAP_CPU   (1<<14) /* queue map mirrors smp_processor_id() */

Definition at line 198 of file pktgen.c.

#define F_QUEUE_MAP_RND   (1<<13) /* queue map Random */

Definition at line 197 of file pktgen.c.

#define F_SVID_RND   (1<<10) /* Random SVLAN ID */

Definition at line 194 of file pktgen.c.

#define F_TXSIZE_RND   (1<<6) /* Transmit size is random */

Definition at line 190 of file pktgen.c.

#define F_UDPDST_RND   (1<<3) /* UDP-Dst Random */

Definition at line 187 of file pktgen.c.

#define F_UDPSRC_RND   (1<<2) /* UDP-Src Random */

Definition at line 186 of file pktgen.c.

#define F_VID_RND   (1<<9) /* Random VLAN ID */

Definition at line 193 of file pktgen.c.

#define FIND   0

Definition at line 420 of file pktgen.c.

#define func_enter ( )    pr_debug("entering %s\n", __func__);

Definition at line 181 of file pktgen.c.

#define if_lock (   t)    spin_lock(&(t->if_lock));

Definition at line 208 of file pktgen.c.

#define if_unlock (   t)    spin_unlock(&(t->if_lock));

Definition at line 209 of file pktgen.c.

#define IP_NAME_SZ   32

Definition at line 177 of file pktgen.c.

#define MAX_CFLOWS   65536

Definition at line 217 of file pktgen.c.

#define MAX_MPLS_LABELS   16 /* This is the max label stack depth */

Definition at line 178 of file pktgen.c.

#define MPLS_STACK_BOTTOM   htonl(0x00000100)

Definition at line 179 of file pktgen.c.

#define PG_PROC_DIR   "pktgen"

Definition at line 213 of file pktgen.c.

#define PGCTRL   "pgctrl"

Definition at line 214 of file pktgen.c.

#define PKTGEN_MAGIC   0xbe9be955

Definition at line 212 of file pktgen.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 119 of file pktgen.c.

#define REMOVE   1

Definition at line 419 of file pktgen.c.

#define SVLAN_TAG_SIZE (   x)    ((x)->svlan_id == 0xffff ? 0 : 4)

Definition at line 220 of file pktgen.c.

#define T_REMDEV   (1<<3) /* Remove one dev */

Definition at line 205 of file pktgen.c.

#define T_REMDEVALL   (1<<2) /* Remove all devs */

Definition at line 204 of file pktgen.c.

#define T_RUN   (1<<1) /* Start run */

Definition at line 203 of file pktgen.c.

#define T_STOP   (1<<0) /* Stop run */

Definition at line 202 of file pktgen.c.

#define VERSION   "2.74"

Definition at line 176 of file pktgen.c.

#define VLAN_TAG_SIZE (   x)    ((x)->vlan_id == 0xffff ? 0 : 4)

Definition at line 219 of file pktgen.c.

Function Documentation

MODULE_AUTHOR ( "Robert Olsson <[email protected]>"  )
MODULE_DESCRIPTION ( "Packet Generator tool"  )
module_exit ( pg_cleanup  )
module_init ( pg_init  )
MODULE_LICENSE ( "GPL"  )
module_param ( pg_count_d  ,
int  ,
 
)
module_param ( pg_delay_d  ,
int  ,
 
)
module_param ( pg_clone_skb_d  ,
int  ,
 
)
module_param ( debug  ,
int  ,
 
)
MODULE_PARM_DESC ( pg_count_d  ,
"Default number of packets to inject"   
)
MODULE_PARM_DESC ( pg_delay_d  ,
"Default delay between packets (nanoseconds)"   
)
MODULE_PARM_DESC ( pg_clone_skb_d  ,
"Default number of copies of the same packet  
)
MODULE_PARM_DESC ( debug  ,
"Enable debugging of pktgen module  
)
MODULE_VERSION ( VERSION  )