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 680ECA0562;
	Thu,  2 Apr 2020 19:20:21 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 136051BED5;
	Thu,  2 Apr 2020 19:20:08 +0200 (CEST)
Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com
 [209.85.210.193]) by dpdk.org (Postfix) with ESMTP id 7B0771BE95
 for <dev@dpdk.org>; Thu,  2 Apr 2020 19:20:05 +0200 (CEST)
Received: by mail-pf1-f193.google.com with SMTP id n10so2064513pff.3
 for <dev@dpdk.org>; Thu, 02 Apr 2020 10:20:05 -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=htzPMTkkQt3wtNYQl5Pc2vBv0EMDeHc+HNJPHQ4h7nQ=;
 b=ELX+J+lCarPfI0P3qDxrg9s5Or/B3eFiKdVnyK8Jv643cmYRmdnW5WFZ7PZPnZgHou
 qAru4PuFdBFAb+m9AM0ujoMV7rM9/AHWJ4w0NeDp+kjNevm5IAKuOWGbqwYR9z83ljK+
 Zpi4P2PHzPGU7uyFCr8WS/Ivy4vm4naJ3R5/dk8dJ8zminP0thdcwNqnXy9YLAxwkAqH
 Ydp6XNOi6uFCJI+Zb5FIQ8ZuLHITu7dkh2WNzP7R/Ir4aZdr4MckAKxe1xRqzIo8hI6C
 PivhD4gYfh12y6yzURoDhestlJ1v07N+mFD1AffGx1x6IAHBStUaeM60pQJfFsmHj1u4
 pehg==
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=htzPMTkkQt3wtNYQl5Pc2vBv0EMDeHc+HNJPHQ4h7nQ=;
 b=b3EslGgJQC/0X5iJd85zVKKph8gU31sllLB7cPLhKZf75+LEODnox61LHPhVfsqVQR
 JXZK1XlxX302UKzrwYsnXRHB6AlcpA6nerDRcC8pTgN6UnXaNaRTl2gTlrbquGWYAfm5
 ViqFYrW3v7oP5/59Qxw/L+15gXRBCH5IaX5VyKRGWZ57id3C06E6A+Lvel5LXnwSaKbq
 6/rPbFWCcElsYh5vvYxeAIlbvVTJCnroavjlDXiYP6NcTJeFLG0H9b/MnXIIiRSZzXgz
 7KWcecJS6DCM8PZF3yS0qp+KZpQC+So1znug2m24bOOCTEeBwhblDSVo+zTBWnonH7Yb
 /Mjw==
X-Gm-Message-State: AGi0PubqMeSWzIMzZmIlSp0WuRXxfYF+eRJ1RyEVFuu9MTuHBkULoIE9
 bEXYOLXjoFCCK+hdefdG0t3mWKmUozClOA==
X-Google-Smtp-Source: APiQypKoPkgdI6HM5ZY9jGpKNZqz2PnwkZj+pWHE60HFzx3yAF/3w9bbtrh40EG6eInfFUwEPX2Tzg==
X-Received: by 2002:aa7:9a8e:: with SMTP id w14mr4113941pfi.113.1585848003935; 
 Thu, 02 Apr 2020 10:20:03 -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.02
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 02 Apr 2020 10:20:02 -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:49 -0700
Message-Id: <20200402171953.13356-3-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 2/6] examples/l2fwd-cat: 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/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..e370efeaf1f8 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_owner_get(port, NULL) == 0)
+		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