@@ -119,6 +119,9 @@ typedef struct {
/** Global pointer to args */
static args_t *args;
+/** By default act as loopback and bridge */
+static int loopback = 1;
+
/* helper funcs */
static int drop_err_pkts(odp_packet_t pkt_tbl[], unsigned len);
static void swap_pkt_addrs(odp_packet_t pkt_tbl[], unsigned len);
@@ -187,7 +190,7 @@ static void *pktio_queue_thread(void *arg)
pktio_info = args->pktio_lt[pktio_tmp];
/* Send back packets arrived on physical interface */
- if (pktio_info->netmap_mode == ODP_NETMAP_RING_HW) {
+ if (pktio_info->netmap_mode == ODP_NETMAP_RING_HW && loopback) {
odp_packet_t pkt_copy;
pkt_copy = odph_packet_alloc(pkt_pool);
@@ -460,11 +463,12 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
static struct option longopts[] = {
{"interface", required_argument, NULL, 'i'}, /* return 'i' */
{"help", no_argument, NULL, 'h'}, /* return 'h' */
+ {"bridge", no_argument, NULL, 'b'}, /* return 'b' */
{NULL, 0, NULL, 0}
};
while (1) {
- opt = getopt_long(argc, argv, "+i:h", longopts, &long_index);
+ opt = getopt_long(argc, argv, "+i:h:b", longopts, &long_index);
if (opt == -1)
break; /* No more options */
@@ -521,6 +525,9 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
exit(EXIT_SUCCESS);
break;
+ case 'b':
+ loopback = 0;
+
default:
break;
}
@@ -582,6 +589,7 @@ static void usage(char *progname)
"\n"
"Optional OPTIONS\n"
" -h, --help Display help and exit.\n"
+ " -b, --bridge Bridge only, disable loopback.\n"
"\n", NO_PATH(progname), NO_PATH(progname)
);
}
@@ -85,18 +85,44 @@ To configure ODP for linux-generic:
3. Running the example application
==================================
-The example application for netmap-linux is odp_pktio_netmap. The main purpose
-of the example application is to show how to implement a simple packet loopback
-application using ODP. The example also implements a bridge between the Linux
-IP stack and the physical interfaces since netmap disrupts the communication
-between the two. The bridging is achieved by passing packets between the
-"software" ring attached to the host stack and the physical rings of the NIC.
+The example application for netmap-linux is odp_pktio_netmap.
+
+The main feature of this application is that it can bridge the interfaces with
+the netmap software rings attached to the host stack. There is one such software
+ring for each interface in the system that runs in netmap mode.
+
+Another feature of the example application is to run as a basic loopback app,
+similar to the packet example from linux-generic. In this mode bridging is still
+active.
+
More information on netmap architecture and software rings can be found in the
"netmap: a novel framework for fast packet I/O" paper by Luigi Rizzo on his
research page: http://info.iet.unipi.it/~luigi/research.html
- sudo ./odp_pktio_netmap -i eth0 -m 1
+3.1 Running with loopback on
+----------------------------
+This is the default mode, you can pass more than one interfaces, sepparated by
+comma.
+
+ sudo ./odp_pktio_netmap -i eth0,eth1
From another machine you can simply run ping and observe the duplicate ICMP
replies. Also the host running the example application should still have network
connectivity due to the bridging performed as explained above.
+
+3.2 Running with loopback off
+-----------------------------
+This mode of operation is very similar to the netmap bridge example, with the
+difference that the bridging will only be performed between the NICs and the
+corresponding software rings attached to the host stack.
+
+One use of this application is iperf.
+
+From the 'server':
+
+ iperf -s
+
+From the 'client':
+
+ iperf -c <server_ip>
+
Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org> --- example/packet_netmap/odp_pktio_netmap.c | 12 ++++++++-- platform/linux-netmap/README | 40 ++++++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 9 deletions(-)