From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 23B84A0562;
	Thu,  2 Apr 2020 19:20:43 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id C7DEE1BF26;
	Thu,  2 Apr 2020 19:20:10 +0200 (CEST)
Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com
 [209.85.216.66]) by dpdk.org (Postfix) with ESMTP id 7878D1BED0
 for <dev@dpdk.org>; Thu,  2 Apr 2020 19:20:08 +0200 (CEST)
Received: by mail-pj1-f66.google.com with SMTP id ng8so1798606pjb.2
 for <dev@dpdk.org>; Thu, 02 Apr 2020 10:20:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=YugD632XLy8IW/yOBAT1NsvfKKAvA7yxzcqVl83JtW8=;
 b=CRroZWLxjY4z8NH7+AtnCDn8CEkYa/T6+Pra0HT158eXZJCqlcJGBEQWqraxYNZNML
 eANHk485409wple6RSmKfpqUGAjpWcE2Rn6iI2X6ShShz5M4yPR6NegmHxKpz0+YSq2m
 EmlG72ePIIiSgvvRMQbJdPiH5RI623Li5WxouWuK5t0SZiPZ61KSlqR8UIIlFapttHSA
 aTv1y8AWMTZ40h3W9OgVR7790Nljk15vGbux7ZvcgbTu0fmnaObkCwPvtzDN8RhdsuLL
 jiBENZkX0jozWhgeILRKAD/880XcR7GQ8dh83Qdx6tPlCTC28i0Rn7Nn+bTc2EqgtwTa
 QmEA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=YugD632XLy8IW/yOBAT1NsvfKKAvA7yxzcqVl83JtW8=;
 b=AMpR1VxH56Plzlm7BgFxI96MMOt8thXk4fJ1DO0y7XebIy7xbbbBEiQJ4I+/pgWTdq
 qSHH7gbKxJSL9pPkh2fHOz6rhNK5ALynG5PF75ML7YWiafyznVg4ZxD/yhk5yUcfcd0R
 gEJ80TgjCMzDNIYgrttbuKPaWTY1CEcQbm5exaYUUio3WjwzGXddg3gz4xgB/MOmc6M2
 FFST9gUWnCpvHEpdFpiCSpxB/8G9M86Sd6K6nE4fg6smUmhBso1xpNeO8UY0Xtsw2MfW
 L0r336nbA21BD2ha+akf7ZDRi6ZANcdKbSK/hn296E1h/+xD1vEZ8mzWwz4G7lXn/D5F
 PHQA==
X-Gm-Message-State: AGi0PubRP0Pz0eQnLsdeQOrOd2lm2qLc3d/s1qq5x4Dwz1xjPp0dksjr
 xe0cquEBOy0gLBb138xgMQ5KmzcRhpfcPQ==
X-Google-Smtp-Source: APiQypJlbgv3JvnRbW/TMkhTwHBoj81Zw6sSS46AWXrHgCQjFjdSIOVzC3uq3S//tiVLFo4qJ5Ng/g==
X-Received: by 2002:a17:90b:292:: with SMTP id
 az18mr4861197pjb.126.1585848007133; 
 Thu, 02 Apr 2020 10:20:07 -0700 (PDT)
Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])
 by smtp.gmail.com with ESMTPSA id y28sm4152347pfp.128.2020.04.02.10.20.05
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Apr 2020 10:20:06 -0700 (PDT)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>, matan@mellanox.com,
 stable@dpdk.org
Date: Thu,  2 Apr 2020 10:19:51 -0700
Message-Id: <20200402171953.13356-5-stephen@networkplumber.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200402171953.13356-1-stephen@networkplumber.org>
References: <20200312172047.19973-1-stephen@networkplumber.org>
 <20200402171953.13356-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v3 4/6] examples/l3fwd-acl: make applicaton aware
	of port ownership
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

If a ethdev port is in use for a sub device, then it should not
be allowed in the portmask of application.

Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
Cc: matan@mellanox.com
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/l3fwd-acl/Makefile    | 3 +++
 examples/l3fwd-acl/main.c      | 4 ++++
 examples/l3fwd-acl/meson.build | 1 +
 3 files changed, 8 insertions(+)

diff --git a/examples/l3fwd-acl/Makefile b/examples/l3fwd-acl/Makefile
index d9909584b1c6..ff14b4fdd593 100644
--- a/examples/l3fwd-acl/Makefile
+++ b/examples/l3fwd-acl/Makefile
@@ -20,7 +20,9 @@ static: build/$(APP)-static
 PKGCONF ?= pkg-config
 
 PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+
 LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
 LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
 
@@ -51,6 +53,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 CFLAGS += -O3
 CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 
 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index fa92a2829740..dbdea8db241a 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -1470,6 +1470,10 @@ check_port_config(void)
 			printf("port %u is not present on the board\n", portid);
 			return -1;
 		}
+		if (rte_eth_dev_owner_get(portid, NULL) == 0) {
+			printf("port %u is already in use\n", portid);
+			return -1;
+		}
 	}
 	return 0;
 }
diff --git a/examples/l3fwd-acl/meson.build b/examples/l3fwd-acl/meson.build
index 7096e00c1073..6fa468b3aa9c 100644
--- a/examples/l3fwd-acl/meson.build
+++ b/examples/l3fwd-acl/meson.build
@@ -6,6 +6,7 @@
 # To build this example as a standalone application with an already-installed
 # DPDK instance, use 'make'
 
+allow_experimental_apis = true
 deps += ['acl', 'lpm', 'hash']
 sources = files(
 	'main.c'
-- 
2.20.1