From patchwork Mon Mar 2 18:46:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 45302 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 077E0214B5 for ; Mon, 2 Mar 2015 18:47:42 +0000 (UTC) Received: by wghl18 with SMTP id l18sf25019216wgh.3 for ; Mon, 02 Mar 2015 10:47:41 -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:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=LDoARvfFKIkpee+8fxkcj9ZdNGXF8dsayvw7QZcSTe0=; b=L1ixDfzts+UsVOz8FK3I96hv2VkP9Eqe1IYbwB4prZoz/XoB1TN3qhaloqcUyh2gOM ixhiAG5MeuZtO2zJpr3FlGe2h/TucGk08sMsdf9/1pdsKq6UKinI65Q2YpHlC6Mw6VCd QniYd/n5doSHlNFB67V7RIZA+rktYCR2uEOZE6cWyLgwzKUSBW3rrsEn6dIDP6GPm+Sc IysF+lL4MqlksDhRB7EfTZUk1JW3o3V9yX2X8c/89DVRjv+oRcuuorkQ/NnbkA0ydqVM gg3xbQXupWa1Nxznf0RRBI3x3chYl/AQ7WPyEt36cibBcVat0nitUfx7zNpaQFpHtNa1 tCOQ== X-Gm-Message-State: ALoCoQmutMORr1ds0H3bI4RZSGyW55QWTidDbQfxc7CMOJ9c/hmLBb2y+Kf6t5u8NmwChw8XitX5 X-Received: by 10.112.145.133 with SMTP id su5mr3966863lbb.17.1425322061198; Mon, 02 Mar 2015 10:47:41 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.199 with SMTP id x7ls491149lae.0.gmail; Mon, 02 Mar 2015 10:47:40 -0800 (PST) X-Received: by 10.152.184.39 with SMTP id er7mr25447280lac.116.1425322060840; Mon, 02 Mar 2015 10:47:40 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ka5si9437282lbc.119.2015.03.02.10.47.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Mar 2015 10:47:40 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labgq15 with SMTP id gq15so32495088lab.3 for ; Mon, 02 Mar 2015 10:47:40 -0800 (PST) X-Received: by 10.152.178.197 with SMTP id da5mr8500074lac.56.1425322060690; Mon, 02 Mar 2015 10:47:40 -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.35.133 with SMTP id h5csp90002lbj; Mon, 2 Mar 2015 10:47:39 -0800 (PST) X-Received: by 10.140.108.116 with SMTP id i107mr4571071qgf.73.1425322059301; Mon, 02 Mar 2015 10:47:39 -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 q65si1170781qkh.65.2015.03.02.10.47.38 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 02 Mar 2015 10:47:39 -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 1YSVNP-0008Be-TC; Mon, 02 Mar 2015 18:47:35 +0000 Received: from mail-la0-f51.google.com ([209.85.215.51]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YSVN4-00088q-FS for lng-odp@lists.linaro.org; Mon, 02 Mar 2015 18:47:14 +0000 Received: by lams18 with SMTP id s18so32352586lam.13 for ; Mon, 02 Mar 2015 10:47:08 -0800 (PST) X-Received: by 10.152.7.132 with SMTP id j4mr25936600laa.100.1425322028564; Mon, 02 Mar 2015 10:47:08 -0800 (PST) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id i13sm2696725lab.38.2015.03.02.10.47.07 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Mar 2015 10:47:07 -0800 (PST) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Mon, 2 Mar 2015 20:46:48 +0200 Message-Id: <1425322017-14636-4-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1425322017-14636-1-git-send-email-ciprian.barbu@linaro.org> References: <1425322017-14636-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH NETMAP 03/12] linux-netmap: 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.49 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 --- 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 58f7fbe..22f89f0 100644 --- a/platform/linux-netmap/include/odp_packet_netmap.h +++ b/platform/linux-netmap/include/odp_packet_netmap.h @@ -30,7 +30,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;