From patchwork Tue Nov 18 13:56:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 41030 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 407D824035 for ; Tue, 18 Nov 2014 13:56:46 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id ex7sf4601060wid.11 for ; Tue, 18 Nov 2014 05:56:45 -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: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=WZ7fFZ20jH8rJ7A6szPavlWlV8WjiKD0ZdCKM0+CtGw=; b=NtJ+npViWK3LmcUDncza8hJAG8OfxFa+ohpja6R34VCNnhqsh9YE6zOshqEMb6blVP ZNI7UczBFJ2u9qU9tXj14G1J8sqYLeaFi9hn3bw9GnDI0Tl/cWYbAclxWC2iEeiCtmD+ w6UBe0h8rWZU1eZZEHEdeTE0T6OytvatnchnXHH7PMbBj2SrC5hphAii0QB1pgfs98PZ 4MtjcmnBa/vJtU5QonJxwn11cq24Rfc+nEVrWz9Wg6YBPdqYnZhrDpnwLOldOJrFz7Bq YaPoalMZD1MWUEke1CaelZKpQ9UGP9oesx6wdqM+TJUdSt/vBxo7NQ3AV22FdUaswdpc jl6A== X-Gm-Message-State: ALoCoQlWVtGeItC6zHtxHVhSDdF+q1JH6RF7lx9x9qovilhIbTIbJO6cXNPX4qzJV7YsmoFFw3SR X-Received: by 10.152.30.66 with SMTP id q2mr15247959lah.2.1416319005457; Tue, 18 Nov 2014 05:56:45 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.227 with SMTP id u3ls1089039laa.8.gmail; Tue, 18 Nov 2014 05:56:45 -0800 (PST) X-Received: by 10.152.20.130 with SMTP id n2mr36415177lae.39.1416319005243; Tue, 18 Nov 2014 05:56:45 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id li6si55775225lbc.87.2014.11.18.05.56.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 05:56:45 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id pn19so3183420lab.26 for ; Tue, 18 Nov 2014 05:56:45 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr36139837lbc.23.1416319005089; Tue, 18 Nov 2014 05:56:45 -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.184.201 with SMTP id ew9csp1331958lbc; Tue, 18 Nov 2014 05:56:44 -0800 (PST) X-Received: by 10.236.14.97 with SMTP id c61mr3094659yhc.132.1416319003416; Tue, 18 Nov 2014 05:56:43 -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 u13si5724558qge.62.2014.11.18.05.56.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 18 Nov 2014 05:56:43 -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 1XqjGr-0000bX-BW; Tue, 18 Nov 2014 13:56:41 +0000 Received: from mail-lb0-f181.google.com ([209.85.217.181]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XqjGm-0000bR-2x for lng-odp@lists.linaro.org; Tue, 18 Nov 2014 13:56:36 +0000 Received: by mail-lb0-f181.google.com with SMTP id l4so18022984lbv.12 for ; Tue, 18 Nov 2014 05:56:30 -0800 (PST) X-Received: by 10.152.179.1 with SMTP id dc1mr9395730lac.88.1416318989872; Tue, 18 Nov 2014 05:56:29 -0800 (PST) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id k7sm11025799lak.22.2014.11.18.05.56.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Nov 2014 05:56:29 -0800 (PST) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Tue, 18 Nov 2014 15:56:21 +0200 Message-Id: <1416318981-27188-1-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Topics: patch Subject: [lng-odp] [PATCHv3 NETMAP 1/4] Update to netmap_v11.1 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.215.53 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 --- v3: changes after chat with Anders: - removed mistakenly added section title from README - added section about inserting kernel modules - reformated some paragraphs platform/linux-netmap/Makefile.am | 2 + platform/linux-netmap/README | 76 ++++++++++++++++------- platform/linux-netmap/include/odp_packet_netmap.h | 2 +- 3 files changed, 57 insertions(+), 23 deletions(-) diff --git a/platform/linux-netmap/Makefile.am b/platform/linux-netmap/Makefile.am index eae382a..0b08cad 100644 --- a/platform/linux-netmap/Makefile.am +++ b/platform/linux-netmap/Makefile.am @@ -12,6 +12,8 @@ AM_CFLAGS += -I$(srcdir)/include/api AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include/api AM_CFLAGS += -I$(top_srcdir)/helper/include +# Disable cast errors until the problem in netmap_user.h is fixed upstream +AM_CFLAGS += -Wno-cast-qual include_HEADERS = \ $(top_srcdir)/platform/linux-generic/include/api/odp.h \ diff --git a/platform/linux-netmap/README b/platform/linux-netmap/README index abcb187..a45fbfa 100644 --- a/platform/linux-netmap/README +++ b/platform/linux-netmap/README @@ -7,43 +7,49 @@ SPDX-License-Identifier: BSD-3-Clause ================================== OpenDataPlane implementation using netmap accelerated packet I/O. -The current implementation does not yet take advantage of the full -performance of netmap I/O, the data is copied between netmap slots and -ODP buffers. +The current implementation does not yet take advantage of the full performance +of netmap I/O, the data is copied between netmap slots and ODP buffers. The implementation is based almost entirely on the linux-generic platform implementation, only the packet I/O differs to work with netmap enabled interfaces. -Also the linux-netmap implementation allows hybrid pktio instances, which -means that the applications can decide to use either sockets or netmap I/O -at runtime. +Also the linux-netmap implementation allows hybrid pktio instances, which means +that applications can choose between sockets and netmap I/O at runtime. The +netmap I/O has priority by default, if socket I/O is desired instead it can be +activated by setting the environment variable ODP_PKTIO_DISABLE_NETMAP. 2. Build ================================== -2.1 Building netmap --------------------- +ODP works with the latest release version of netmap, which is currently at API +version 11.1. -Netmap is currently hosted on https://code.google.com/p/netmap/ but -ODP only works at this point with netmap API version 10 so you will need -a specific revision of netmap. +2.1 Building netmap kernel modules +---------------------------------- + +Netmap is currently hosted on https://code.google.com/p/netmap/ git clone https://code.google.com/p/netmap/ cd netmap - git reset --hard 1f462ef + git co v11.1 + +This is enough to build ODP, if you don't want to build netmap kernel modules +you can jump to section 2.2. -Netmap consists of a core kernel module (netmap_lin.ko) and optional modified -device drivers. +Netmap consists of a core kernel module (netmap.ko), optional modified device +drivers and user space API headers to access the netmap functionality. It is +recommended to build both the core module and modified device drivers. Netmap builds as an out-of-tree kernel module, you need matching kernel sources to compile it. General build instructions can be found in the packet README: -http://code.google.com/p/netmap/source/browse/README +https://code.google.com/p/netmap/source/browse/LINUX/README -2.1.1 Building netmap on Ubuntu with stock kernel + +2.1.1 Building netmap kernel modules on Ubuntu with stock kernel If you are running Ubuntu/Debian with the stock kernel and you want to compile -both netmap_lin.ko and modified drivers, these steps will guide you through it. +both netmap.ko and modified drivers, these steps will guide you through it. You will need the linux-headers and linux-source packages for this. @@ -53,21 +59,27 @@ You will need the linux-headers and linux-source packages for this. The source archive will be placed in /usr/src/linux-source- You will need to locate it and extract it to a convenient place. -Now compile netmap: +To compile: cd LINUX - make SRC= + ./configure --kernel-sources= + make -2.1.2 Building netmap for kernel built from sources + +2.1.2 Building netmap kernel modules for kernel built from sources cd LINUX - make KSRC= + ./configure --kernel-dir= + make + + 2.2 Building ODP ---------------- The default platform is linux-netmap, if you want linux-generic you need to -specify it to configure --with-platform. +specify it using configure --with-platform. + The --with-sdk-install-path can be used to point to the netmap sources. @@ -82,3 +94,23 @@ To configure ODP for linux-generic: make + +2.3 Inserting netmap kernel modules +----------------------------------- + +In order to run linux-netmap ODP you need to insert at least the core netmap +kernel module. + + cd /LINUX + insmod netmap.ko + +To insert the optional modified drivers you first need to remove the original +drivers, if loaded (and if not linked into the kernel). For example, if using +igb: + + cd /LINUX + sudo rmmod igb + sudo insmod igb/igb.ko + +To restore the original drivers you should be able to use modprobe. + diff --git a/platform/linux-netmap/include/odp_packet_netmap.h b/platform/linux-netmap/include/odp_packet_netmap.h index b4c523f..576385d 100644 --- a/platform/linux-netmap/include/odp_packet_netmap.h +++ b/platform/linux-netmap/include/odp_packet_netmap.h @@ -29,7 +29,7 @@ typedef struct { size_t max_frame_len; /**< max frame len = buf_size - sizeof(pkt_hdr) */ size_t frame_offset; /**< frame start offset from start of pkt buf */ size_t buf_size; /**< size of buffer payload in 'pool' */ - struct nm_desc_t *nm_desc; + struct nm_desc *nm_desc; uint32_t begin; uint32_t end; struct netmap_ring *rxring;