From patchwork Mon Nov 3 17:05:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 40060 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C554D24530 for ; Mon, 3 Nov 2014 17:06:01 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id b57sf3101514eek.9 for ; Mon, 03 Nov 2014 09:06:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=fWWmYntcYPoftShs+l9hu3BcBUCpu9WYq1OgF+9dg1o=; b=lLUzYhG3mZQKk59E/UyXPMhENOdtW/+K2uxluUWUxHa1CFmWff/rYXscaVLxyy/uNY E+LcHeLsowtYeUXNkpkE1ntzoLQCydcQ5tc1niBSjQCQBK7hXcdSOcZfGYYEQFqm/CqF Ycp3mgDB95EmGLPP91h6kMAAyNLe+wkCZZA4lMvu+kYYOz0JIjnWbE6R7WbC3lhHANF8 L++ms9gI6qlCZkIjO/CoOM8vBDGS/OrwOn5d4pDtT40ppWYK81sQ9eycJWlN5kd6hu+5 pCoO8JDQXgpHzfGTrjBDcWkWBcs6j5ZfSm++bDmhVlLZ80y21uBhXYN7ceAW3638Q79X ZpMw== X-Gm-Message-State: ALoCoQl5h3lfJs3eivBftltjsoSCkKpXoLZeC1XIYNs9YwFfr+3xfLd9ic6EfMc7lBo+zwgYN+I7 X-Received: by 10.180.218.100 with SMTP id pf4mr1295489wic.4.1415034361045; Mon, 03 Nov 2014 09:06:01 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.66 with SMTP id h2ls615375laa.58.gmail; Mon, 03 Nov 2014 09:06:00 -0800 (PST) X-Received: by 10.112.218.101 with SMTP id pf5mr16193999lbc.46.1415034360877; Mon, 03 Nov 2014 09:06:00 -0800 (PST) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id sd8si33291214lbb.36.2014.11.03.09.06.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Nov 2014 09:06:00 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by mail-lb0-f173.google.com with SMTP id p9so4019579lbv.32 for ; Mon, 03 Nov 2014 09:06:00 -0800 (PST) X-Received: by 10.112.218.101 with SMTP id pf5mr16193985lbc.46.1415034360779; Mon, 03 Nov 2014 09:06:00 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.141.34 with SMTP id rl2csp22623lbb; Mon, 3 Nov 2014 09:05:59 -0800 (PST) X-Received: by 10.170.81.131 with SMTP id x125mr25481313ykx.87.1415034359354; Mon, 03 Nov 2014 09:05:59 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id u67si30371239qgu.103.2014.11.03.09.05.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 03 Nov 2014 09:05:59 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XlL4n-0003tX-RG; Mon, 03 Nov 2014 17:05:57 +0000 Received: from mail-lb0-f173.google.com ([209.85.217.173]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XlL4b-0003t6-9K for lng-odp@lists.linaro.org; Mon, 03 Nov 2014 17:05:45 +0000 Received: by mail-lb0-f173.google.com with SMTP id p9so3988839lbv.4 for ; Mon, 03 Nov 2014 09:05:39 -0800 (PST) X-Received: by 10.152.30.33 with SMTP id p1mr51423393lah.78.1415034338919; Mon, 03 Nov 2014 09:05:38 -0800 (PST) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id ya10sm8158216lbb.6.2014.11.03.09.05.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Nov 2014 09:05:38 -0800 (PST) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Mon, 3 Nov 2014 19:05:29 +0200 Message-Id: <1415034330-29819-2-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1415034330-29819-1-git-send-email-ciprian.barbu@linaro.org> References: <1415034330-29819-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH NETMAP 1/2] odp_pktio_netmap: add option to disable loopback X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ciprian.barbu@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Ciprian Barbu --- example/packet_netmap/odp_pktio_netmap.c | 12 ++++++++-- platform/linux-netmap/README | 40 ++++++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/example/packet_netmap/odp_pktio_netmap.c b/example/packet_netmap/odp_pktio_netmap.c index a2756ee..b789064 100644 --- a/example/packet_netmap/odp_pktio_netmap.c +++ b/example/packet_netmap/odp_pktio_netmap.c @@ -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) ); } diff --git a/platform/linux-netmap/README b/platform/linux-netmap/README index 42b7595..64ee3bd 100644 --- a/platform/linux-netmap/README +++ b/platform/linux-netmap/README @@ -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 +