app/testpmd: add engine that replies to ARP and ICMP echo requests
authorIvan Boule <ivan.boule@6wind.com>
Wed, 30 Apr 2014 13:30:11 +0000 (15:30 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 16 May 2014 11:25:16 +0000 (13:25 +0200)
commit168dfa61667e0a46bdbbed2b30a3117f91b62537
treeecec877cdef1768acd1917437fc32fecb8f4af86
parenta7e7bb4e44010f69a73400302a8b1cb77549f0e1
app/testpmd: add engine that replies to ARP and ICMP echo requests

Add a new specific packet processing engine in the "testpmd" application that
only replies to ARP requests and to ICMP echo requests.
For this purpose, a new "icmpecho" forwarding mode is provided that can be
dynamically selected with the following testpmd command:

    set fwd icmpecho

before starting the receipt of packets on the selected ports.

Then, the "icmpecho" engine performs the following actions on all received
packets:

- replies to a received ARP request by sending back on the RX port a ARP
  reply with a "sender hardware address" field containing the MAC address
  of the RX port,

- replies to a ICMP echo request by sending back on the RX port a ICMP echo
  reply, swapping the IP source and the IP destination address in the IP
  header,

- otherwise, simply drops the received packet.

When replying to a received packet that was encapsulated into a VLAN tunnel,
the reply is sent back with the same VLAN identifier.
By default, the testpmd configures VLAN header stripping RX option on each
port.
This option is not managed by the icmpecho engine which won't detect
packets that were encapsulated into a VLAN.
To address this issue, the VLAN header stripping option must be previously
switched off with the following testpmd command:

    vlan set strip off

When the "verbose" mode has been set with the testpmd command
"set verbose 1", the "icmpecho" engine displays informations about each
received packet.

The "icmpecho" forwarding engine can also be used to simply check port
connectivity at the hardware level (check that cables are well-plugged)
and at the software level (receipt of VLAN packets, for instance).

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
app/test-pmd/Makefile
app/test-pmd/config.c
app/test-pmd/icmpecho.c [new file with mode: 0644]
app/test-pmd/testpmd.c
app/test-pmd/testpmd.h
lib/librte_net/Makefile
lib/librte_net/rte_arp.h [new file with mode: 0644]
lib/librte_net/rte_icmp.h [new file with mode: 0644]