aboutsummaryrefslogtreecommitdiffstats
path: root/examples/udpfwd/README
blob: 91b6e7626734558617e328887b6994e27f9a1960 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
Introduction
============

udpfwd is a sample application to demonstrate and test libtle_udp.
Depending on configuration it can do simple send/recv or both over
opened udp streams. Also it implements ability to do UDP datagram
forwarding between different streams, so it is possible to use that
application as some sort of 'UDP proxy'.
The application can reassemble input fragmented IP packets,
and fragment outgoing IP packets (if destination MTU is less then packet size).
To build and run the application DPDK and TLDK libraries are required.

Logically the application is divided into two parts:

- Back End (BE)
BE is responsible for:
	- RX over DPDK ports and feed them into UDP TLDK context(s)
	(via tle_udp_rx_bulk).
	- retrieve packets ready to be send out from UDP TLDK context(s)
	and TX them over destined DPDK port.
Multiple RX/TX queues per port are supported by RSS. Right now the number of
TX is same as the number of RX queue.
Each BE lcore can serve multiple DPDK ports, TLDK UDP contexts.

- Front End (FE)
FE responsibility is to open configured UDP streams and perform
send/recv over them. These streams can belong to different UDP contexts.

Right now each lcore can act as BE and/or FE.

Usage
=====

udpfwd <EAL parameters> -- \
	-P | --promisc          /* promiscuous mode enabled. */    \
	-R | --rbufs <num>      /* max recv buffers per stream. */ \
	-S | --sbufs <num>      /* max send buffers per stream. */ \
	-s | --streams <num>    /* streams to open per context. */ \
	-b | --becfg <filename> /* backend configuration file. */  \
	-f | --fecfg <filename> /* frontend configuration file. */ \
	<port0_params> <port1_params> ... <portN_params>

port_params: port=<uint>,lcore=<uint>[-<uint>],\
[rx_offload=<uint>,tx_offload=<uint>,mtu=<uint>,ipv4=<ipv4>,ipv6=<ipv6>]

port_params are used to configure the particular DPDK device (rte_ethdev port),
and specify BE lcore that will do RX/TX from/to the device and manage
BE part of corresponding UDP context. Multiple BE lcore can be specified.

port -		DPDK port id (multiple queues are supported when multiple lcore
		is specified for a port).
lcore -		EAL lcore id to do IO over that port (rx_burst/tx_burst).
		several ports can be managed by the same lcore, and same port can
		belong to more than one lcore.
rx_offload -	RX HW offload capabilities to enable/use on this port.
		(bitmask of DEV_RX_OFFLOAD_* values).
tx_offload -	TX HW offload capabilities to enable/use on this port.
		(bitmask of DEV_TX_OFFLOAD_* values).
mtu -		MTU to be used on that port
		( = UDP data size + L2/L3/L4 headers sizes, default=1514).
ipv4 -		ipv4 address to assign to that port.
ipv6 -		ipv6 address to assign to that port.

At least one of ipv4/ipv6 values have to be specified for each port.

As an example:
udpfwd --lcores='3,6,8' -w 01:00.0 -- \
--promisc --rbufs 0x1000 --sbufs 0x1000 --streams 0x100 \
--fecfg ./fe.cfg --becfg ./be.cfg \
port=0,lcore=6,lcore=8,rx_offload=0xf,tx_offload=0,\
ipv4=192.168.1.233,ipv6=2001:4860:b002::28

Will create TLDK UDP context on lcore=6 and lcore=8 (BE lcore) to manage
DPDK port 0. Will assign IPv4 address 192.168.1.233 and IPv6 address
2001:4860:b002::28 to that port.
The following supported by DPDK RX HW offloads:
	DEV_RX_OFFLOAD_VLAN_STRIP,
	DEV_RX_OFFLOAD_IPV4_CKSUM,
	DEV_RX_OFFLOAD_UDP_CKSUM,
	DEV_RX_OFFLOAD_TCP_CKSUM
will be enabled on that port.
No HW TX offloads will be enabled.

If multiple lcore is specified per DPDK port, the following RSS hash will
be enabled on that port:
	ETH_RSS_UDP


Fornt-End (FE) and Back-End (BE) configuration files format:
------------------------------------------------------------
        - each record on a separate line.
        - lines started with '#' are treated as comments.
        - empty lines (containing whitespace chars only) are ignored.
        - kvargs style format for each record.
        - each FE record correspond to at least one stream to be opened
          (could be multiple streams in case of op="fwd").
        - each BE record define a ipv4/ipv6 destination.

FE config record format:
------------------------

lcore=<uint>,op=<"rx|tx|echo|fwd">,\
laddr=<ip>,lport=<uint16>,raddr=<ip>,rport=<uint16>,\
[txlen=<uint>,fwladdr=<ip>,fwlport=<uint16>,fwraddr=<ip>,fwrport=<uint16>,\
belcore=<uint>]

lcore -		EAL lcore to manage that stream(s) in the FE.
op -		operation to perform on that stream:
		"rx" - do receive only on that stream.
		"tx" - do send only on that stream.
		"echo" - mimic recvfrom(..., &addr);sendto(..., &addr);
		on that stream.
		"fwd" - forward packets between streams.
laddr -		local address for the stream to open.
lport -		local port for the stream to open.
raddr -		remote address for the stream to open.
rport -		remote port for the stream to open.
txlen - 	data length to send with each packet ("tx" mode only).
fwladdr -	local address for the forwarding stream(s) to open
		("fwd mode only).
fwlport -	local port for the forwarding stream(s) to open
		("fwd mode only).
fwraddr -	remote address for the forwarding stream(s) to open
		("fwd mode only).
fwrport -	remote port for the forwarding stream(s) to open
		("fwd mode only).
belcore -		EAL lcore to manage that stream(s) in the BE.

Refer to fe.cfg for an example.

BE config record format:
------------------------

port=<uint>,addr=<ipv4/ipv6>,masklen=<uint>,mac=<ether>

port -		port number to be used to send packets to the destination.
addr -		destionation network address.
masklen -	desitantion network prefix length.
mac -		destination ethernet address.

Refer to fe.cfg for an example.