From patchwork Tue Nov 25 16:24:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 41485 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 01BE6246DF for ; Tue, 25 Nov 2014 16:24:59 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf805150eek.4 for ; Tue, 25 Nov 2014 08:24:58 -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=MQNFqQ6IfRNPlxdttK08CaBZPMqW0NbtiGWJ+lS2lgo=; b=fXyDH6ynN9zvvqBeaKhxqjirnFVy6bcGx4HP/pc/JoH598uskSIfJCfpov5ATVHNjq AgxzhNc9E0Ye8Ql56KiluqnohvNcERw4BOB661PAI3gFGrgzO+HPW23zsESaClOfHmXT ZclJsJ3PSEzElw9i01LC8/XrSz0dFZ0KYSpkbtdu3xl3QN3ePmfCRxHb6Nf87J95JZAM iOJLL+MUK7QRADedFjb6Sr2EUcIswb2rUreP+GeXurK+eAhhN3mq7pzHjEmUlO5KraZP a5XPRCnzv6sZbyTDsUu3ovwj9tOrvF+t5SgGukiXpqtFry+BP8oB3ScMtRhsibbYwkgY vH3A== X-Gm-Message-State: ALoCoQl3RDIWZMQ3u1DrrI01NxfnwnUffjxMuqOAWpRrpxISY+0HH9VQWL5wz09YvFD9z9HglJ3w X-Received: by 10.112.138.234 with SMTP id qt10mr7948996lbb.4.1416932698145; Tue, 25 Nov 2014 08:24:58 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.7 with SMTP id o7ls554921lao.55.gmail; Tue, 25 Nov 2014 08:24:57 -0800 (PST) X-Received: by 10.112.141.66 with SMTP id rm2mr4216950lbb.0.1416932697894; Tue, 25 Nov 2014 08:24:57 -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 o10si1800814laj.108.2014.11.25.08.24.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Nov 2014 08:24:57 -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 gm9so878077lab.12 for ; Tue, 25 Nov 2014 08:24:57 -0800 (PST) X-Received: by 10.152.87.100 with SMTP id w4mr27853526laz.27.1416932697495; Tue, 25 Nov 2014 08:24:57 -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 ew9csp464868lbc; Tue, 25 Nov 2014 08:24:56 -0800 (PST) X-Received: by 10.220.127.5 with SMTP id e5mr15733293vcs.40.1416932696282; Tue, 25 Nov 2014 08:24:56 -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 oa7si544368vcb.89.2014.11.25.08.24.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 25 Nov 2014 08:24:56 -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 1XtIv8-0003wA-C3; Tue, 25 Nov 2014 16:24:54 +0000 Received: from mail-lb0-f180.google.com ([209.85.217.180]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XtIuy-0003vm-CP for lng-odp@lists.linaro.org; Tue, 25 Nov 2014 16:24:44 +0000 Received: by mail-lb0-f180.google.com with SMTP id l4so827319lbv.39 for ; Tue, 25 Nov 2014 08:24:38 -0800 (PST) X-Received: by 10.112.189.104 with SMTP id gh8mr12376692lbc.91.1416932678015; Tue, 25 Nov 2014 08:24:38 -0800 (PST) Received: from localhost.localdomain ([188.92.105.210]) by mx.google.com with ESMTPSA id b9sm460748laf.15.2014.11.25.08.24.36 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Nov 2014 08:24:37 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Tue, 25 Nov 2014 19:24:29 +0300 Message-Id: <1416932669-2053-2-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 In-Reply-To: <1416932669-2053-1-git-send-email-maxim.uvarov@linaro.org> References: <1416932669-2053-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 2/2] linux-generic: odp_pktio_open loop0 support 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: maxim.uvarov@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: Maxim Uvarov --- platform/linux-generic/odp_packet_io.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index c523350..501b2e9 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -156,6 +156,33 @@ odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool) pktio_entry_t *pktio_entry; int res; int fanout = 1; + char loop0[IFNAMSIZ] = "eth0"; /* linux-generic loop0 device*/ + char *loop_hint; + + if (strlen(dev) > IFNAMSIZ) { + /* ioctl names limitation */ + ODP_ERR("pktio name %s is too big, limit is %d bytes\n", + dev, IFNAMSIZ); + return ODP_PKTIO_INVALID; + } + + loop_hint = getenv("ODP_PKTIO_LOOPDEV"); + if (!strncmp(dev, "loop0", 5)) { + if (loop_hint && (strlen(loop_hint) > 0)) { + if (strlen(loop_hint) > IFNAMSIZ) { + ODP_ERR("pktio name %s is too big, limit is %d bytes\n", + loop_hint, IFNAMSIZ); + return ODP_PKTIO_INVALID; + } + + memset(loop0, 0, IFNAMSIZ); + memcpy(loop0, loop_hint, strlen(loop_hint)); + ODP_DBG("pktio rename loop0 to %s\n", loop_hint); + } else { + ODP_DBG("pktio rename loop0 to eth0\n"); + dev = loop0; + } + } id = alloc_lock_pktio_entry(); if (id == ODP_PKTIO_INVALID) {