From patchwork Mon Nov 3 17:05:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 40061 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6310821894 for ; Mon, 3 Nov 2014 17:06:08 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id k14sf6491859wgh.11 for ; Mon, 03 Nov 2014 09:06:07 -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=x+mGRsI93cWbMTZIrFXRD5Zrmzo8mpjQP453fOpzagg=; b=aHQnJlhmGVamN8fClLxntTkWCaW1X27kxwn5S4mUlLUfHQOGgia/dIYPVTiDrD+U5h 2XiO0GMrEzA6yNC6WNk2ci9sV8b8n6igDM53MWdPcn1a1pDGto6ISJf94vZg3E3D1ds4 LM2EXyQI7HoDY1uzqYEz9k2pQvWlaUqMJCW5G/TpIkbkPMQJBRDX4jNFXtUw4Zd0U5+8 TLDh5ePKfBdF+xm1a/5mrP9ZMFEp88W7uxi5H4IM/FJFcJhrP+ntRaItbd9ROoMIEx8u +cKiUrfgbkadyuTAzoowxjGjMhX7FNmACQ1qEPqv806Vvc9xnF6M5ob+a+emnDqol0+z j2bA== X-Gm-Message-State: ALoCoQmUH8Exu0tpSyxczBpqJNj3ScEkeaThLpCTVNxZHLP3Q5HwWDA0ioEnnW18NPdM4k+yxr+n X-Received: by 10.181.8.194 with SMTP id dm2mr3115726wid.2.1415034367587; Mon, 03 Nov 2014 09:06:07 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.11.163 with SMTP id ej3ls722184lad.95.gmail; Mon, 03 Nov 2014 09:06:07 -0800 (PST) X-Received: by 10.112.199.227 with SMTP id jn3mr27314973lbc.86.1415034367334; Mon, 03 Nov 2014 09:06:07 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id c5si33206744lah.117.2014.11.03.09.06.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Nov 2014 09:06:07 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id z12so1207742lbi.22 for ; Mon, 03 Nov 2014 09:06:07 -0800 (PST) X-Received: by 10.152.116.102 with SMTP id jv6mr52549553lab.40.1415034367204; Mon, 03 Nov 2014 09:06:07 -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 rl2csp22639lbb; Mon, 3 Nov 2014 09:06:06 -0800 (PST) X-Received: by 10.224.171.194 with SMTP id i2mr66752399qaz.59.1415034365717; Mon, 03 Nov 2014 09:06:05 -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 w9si30401522qcj.42.2014.11.03.09.06.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 03 Nov 2014 09:06:05 -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 1XlL4t-0003tq-7L; Mon, 03 Nov 2014 17:06:03 +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 1XlL4b-0003t7-Qj for lng-odp@lists.linaro.org; Mon, 03 Nov 2014 17:05:45 +0000 Received: by mail-lb0-f181.google.com with SMTP id l4so2938455lbv.26 for ; Mon, 03 Nov 2014 09:05:40 -0800 (PST) X-Received: by 10.152.27.67 with SMTP id r3mr52268764lag.19.1415034339915; Mon, 03 Nov 2014 09:05:39 -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.39 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Nov 2014 09:05:39 -0800 (PST) From: Ciprian Barbu To: lng-odp@lists.linaro.org Date: Mon, 3 Nov 2014 19:05:30 +0200 Message-Id: <1415034330-29819-3-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 2/2] 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.217.177 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/README | 22 +++++++++++++--------- platform/linux-netmap/odp_packet_netmap.c | 7 +++++-- platform/linux-netmap/odp_packet_netmap.h | 4 ++-- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/platform/linux-netmap/README b/platform/linux-netmap/README index 64ee3bd..5148091 100644 --- a/platform/linux-netmap/README +++ b/platform/linux-netmap/README @@ -25,20 +25,18 @@ at runtime. 2.1 Building netmap -------------------- -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. +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 Netmap consists of a core kernel module (netmap_lin.ko) and optional 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 @@ -56,12 +54,14 @@ You will need to locate it and extract it to a convenient place. Now compile netmap: cd LINUX - make SRC= + ./configure --kernel-sources= + make 2.1.2 Building netmap for kernel built from sources cd LINUX - make KSRC= + ./configure --kernel-dir= + make 2.2 Building ODP ---------------- @@ -69,13 +69,17 @@ Now compile netmap: The default platform is linux-netmap, if you want linux-generic you need to specify it to configure --with-platform. +ODP works with the latest release version of netmap, which is currently at API +version 11.1. There is one problem though, the default CFLAGS that ODP is built +with contains -Werror=cast-qual. A temporary fix would be to disable this flag. + The --with-sdk-install-path can be used to point to the netmap sources. ./bootstrap - ./configure + ./configure CFLAGS='-Wno-cast-qual' or - ./configure --with-sdk-install-path= + ./configure --with-sdk-install-path= CFLAGS='-Wno-cast-qual' To configure ODP for linux-generic: ./configure --with-platform=linux-generic diff --git a/platform/linux-netmap/odp_packet_netmap.c b/platform/linux-netmap/odp_packet_netmap.c index 6b9b120..2e35aec 100644 --- a/platform/linux-netmap/odp_packet_netmap.c +++ b/platform/linux-netmap/odp_packet_netmap.c @@ -142,8 +142,11 @@ int setup_pkt_netmap(pkt_netmap_t * const pkt_nm, const char *netdev, else ringid = nm_params->ringid; - strncpy(pkt_nm->ifname, netdev, sizeof(pkt_nm->ifname)); - snprintf(ifname, sizeof(ifname), "netmap:%s", netdev); + snprintf(pkt_nm->ifname, sizeof(pkt_nm->ifname), "%s", netdev); + if (nm_params->netmap_mode == ODP_NETMAP_RING_SW) + snprintf(ifname, sizeof(ifname), "netmap:%s^", netdev); + else + snprintf(ifname, sizeof(ifname), "netmap:%s", netdev); pkt_nm->nm_desc = nm_open(ifname, NULL, ringid, 0); if (pkt_nm->nm_desc == NULL) { diff --git a/platform/linux-netmap/odp_packet_netmap.h b/platform/linux-netmap/odp_packet_netmap.h index 4b66d3d..4334b9e 100644 --- a/platform/linux-netmap/odp_packet_netmap.h +++ b/platform/linux-netmap/odp_packet_netmap.h @@ -32,14 +32,14 @@ typedef struct { size_t frame_offset; /**< frame start offset from start of pkt buf */ size_t buf_size; /**< size of buffer payload in 'pool' */ int netmap_mode; - struct nm_desc_t *nm_desc; + struct nm_desc *nm_desc; uint32_t begin; uint32_t end; struct netmap_ring *rxring; struct netmap_ring *txring; odp_queue_t tx_access; /* Used for exclusive access to send packets */ uint32_t if_flags; - char ifname[32]; + char ifname[IFNAMSIZ]; } pkt_netmap_t; /**