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 CEFBEA0559;
	Mon, 16 Mar 2020 17:09:54 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 9D3D21C0B9;
	Mon, 16 Mar 2020 17:09:39 +0100 (CET)
Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com
 [209.85.214.180]) by dpdk.org (Postfix) with ESMTP id D1EB91C0B0
 for <dev@dpdk.org>; Mon, 16 Mar 2020 17:09:35 +0100 (CET)
Received: by mail-pl1-f180.google.com with SMTP id a23so8223752plm.1
 for <dev@dpdk.org>; Mon, 16 Mar 2020 09:09:35 -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=f+MbdW/FtJHj8vDiIFxI4P8Rzfgur6Lyr/rXrmSd1WE=;
 b=r3cx85r74XFMOqfp30/3RNnxO2+wx545K0Ae4Zvbyj2hRujbGjOJDsmt0BfDcEXIDR
 sYXCJLgN/dhYyGLjPDEBZuLG+4S1L6fCAxxvZ6qdaQoMQj8S+esLp5C9/BBWNklcklzi
 6yk5m2V8Bkr45joqa7KGvBI3suBOCO1O9QKJRNRq7macM+9A0R1uUeq4DgMIieOeRdvy
 UupJNxT2+kbCEpkCCuWjHeAld0rqst6x+Ycpso0mUHnSMjAyiYHZy5e2zNOKYNygH7+D
 uuXoplzblkHDjtwz+pmS23U9YbRbmkPV83gqHpOwKCYg8bp5Yhj/eRVPlhNmJOpWhwxd
 DW9g==
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=f+MbdW/FtJHj8vDiIFxI4P8Rzfgur6Lyr/rXrmSd1WE=;
 b=NnM9YYUAN3Pt5BY1qouc+TcLS//jCOSiHH8SoQCkO0weSuy3lX/evQ4xfcSukHTJWm
 qQjZha2OQN7OBNMFCsW3a4yB2DI7/RVlwi/SH1/WuyAokT7sH/uFH83YL2QTh/jXbJhl
 Qof1jL02clJMTstdof9/xZRrRKS54L8EI3j6LkLiif5pTYKcaXa7yRS3ybzj1NoEGvTj
 43bnCqeMZDPbQfOLnBrM4E0Tnxy+Cy3Z2XI/siDcG6AKrVLZmqk45g3NRPCzz0My0daO
 iNCVjIZI1AYbbGFGvjhvrWh4/gqKWmz/GmRR3LWOeWBWWZDaxUrF7U5A4PajbJu/e1V/
 aMvw==
X-Gm-Message-State: ANhLgQ0/SF4B1sqotFznNHWqKJYxWxFuTFmBYJeIs4V6J5O9MqZtGpC0
 p4GVEmRxb0gOqqX4in6Y1awhPsshvf0=
X-Google-Smtp-Source: ADFU+vuy4d/Q8Eb5nIylnisotbNgL9gnVpWO9zxmqOX/uVAnD/54aZmK/ivAAg4vC2VUJbVLTF+19g==
X-Received: by 2002:a17:902:4b:: with SMTP id 69mr15199752pla.97.1584374974422; 
 Mon, 16 Mar 2020 09:09:34 -0700 (PDT)
Received: from hermes.corp.microsoft.com (204-195-22-127.wavecable.com.
 [204.195.22.127])
 by smtp.gmail.com with ESMTPSA id w17sm361952pfi.59.2020.03.16.09.09.32
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 16 Mar 2020 09:09:33 -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: Mon, 16 Mar 2020 09:09:19 -0700
Message-Id: <20200316160923.5335-3-stephen@networkplumber.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200316160923.5335-1-stephen@networkplumber.org>
References: <20200312172047.19973-1-stephen@networkplumber.org>
 <20200316160923.5335-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v2 2/6] examples/l2fwd-cat: block attempts to use
	owned ports
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/l2fwd-cat/Makefile    | 2 ++
 examples/l2fwd-cat/l2fwd-cat.c | 3 +++
 examples/l2fwd-cat/meson.build | 1 +
 3 files changed, 6 insertions(+)

diff --git a/examples/l2fwd-cat/Makefile b/examples/l2fwd-cat/Makefile
index b0e53c37e8d8..aa19347c1545 100644
--- a/examples/l2fwd-cat/Makefile
+++ b/examples/l2fwd-cat/Makefile
@@ -20,6 +20,7 @@ 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)
@@ -65,6 +66,7 @@ endif
 
 EXTRA_CFLAGS += -O3 -g -Wfatal-errors
 
+CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -I$(PQOS_INSTALL_PATH)/../include
 
 LDLIBS += -L$(PQOS_INSTALL_PATH)
diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c
index 6838f288c621..e89b3568bc86 100644
--- a/examples/l2fwd-cat/l2fwd-cat.c
+++ b/examples/l2fwd-cat/l2fwd-cat.c
@@ -42,6 +42,9 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 	if (!rte_eth_dev_is_valid_port(port))
 		return -1;
 
+	if (rte_eth_dev_is_owned(portid))
+		return -1;
+
 	/* Configure the Ethernet device. */
 	retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
 	if (retval != 0)
diff --git a/examples/l2fwd-cat/meson.build b/examples/l2fwd-cat/meson.build
index 4e2777a03358..5c062c1354e3 100644
--- a/examples/l2fwd-cat/meson.build
+++ b/examples/l2fwd-cat/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
 pqos = cc.find_library('pqos', required: false)
 build = pqos.found()
 ext_deps += pqos
-- 
2.20.1