From patchwork Thu Mar 12 17:20:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66605 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 09C54A056D; Thu, 12 Mar 2020 18:21:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2A27F1C00E; Thu, 12 Mar 2020 18:20:58 +0100 (CET) Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by dpdk.org (Postfix) with ESMTP id 5C5F63B5 for ; Thu, 12 Mar 2020 18:20:56 +0100 (CET) Received: by mail-pj1-f68.google.com with SMTP id f15so2818568pjq.2 for ; Thu, 12 Mar 2020 10:20:56 -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=jAMlZhKs00QGjTkXwXYH7pTdJ2cb1OdnFOJC+pOtewo=; b=T0rYkyX/apGVYlUkQEF53TtS/fxUUaStIRIznjETKz4pE0x5pj0+94oswP9WYyAUxX VnVOmXm5g8H2nhMA0OXF/5QDg5TVHDyVZjIm7zkFWqGjLppVb/r6h61tlEYnqT2OS3x4 T9HeEMslslIQ7PLNZ/R92UoFJBhreisQy3NRAmavVqOmw3Fr1XwjxvOlSt3az0ppbmAg YdMr6cjVxqW6TMUNlSYP2KK3X7ZkeziUVtHZKgRmVIajlN8H8bArjE59uwM0lYvWi8T2 i30nApoW9KC+YyQK+PMJNf56S3x0UPxeRfP9bAZl9NVZU0YkU4H9ZtzUb2DT7j3U2iRs oMBA== 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=jAMlZhKs00QGjTkXwXYH7pTdJ2cb1OdnFOJC+pOtewo=; b=k2BET3TV0/rUuYMnnhFNCFyt8UbE4o/4ooL0fnRIFozqsR4AH0TZ0sTCuocxJUNCGp O8SR0xwoTDBnuCKq82h+N1QRxcpWJ39ZKAdpcOo6mdFvVS7wJA6VFdLDQEl3GwTmzDhM afgo4WuUlCTul+wIQuntvwoB5WadcliA+5+Etfp+J3HJgglI1B94LcPFeBXnyAbWneCC BGGv8FryeBzdQRp25O7eSIHu+1t1s4LtuV8HfJ8LaGwHPuX/BVrewLSTOkrqFVsMnAu6 dVUUvtDmYbjePO6so/PLp1ZP79UppR2LhwwyX6G/ukfG09mGBKQdUQPdahOMsNEu0lOD JbLg== X-Gm-Message-State: ANhLgQ1068Q9CKU4FXloyRvWijUt7xT4ZVLjO5Z31nmcyFFB3rf7fXLb j6jj5fOKXAGWc+5g4iaWN2jeJIq9JwM= X-Google-Smtp-Source: ADFU+vucyRlnV6owRNPkWF1AJRxh4BEjo2r7Xlyyog9Xw9Z7Q85WI8CHLtO0qsaIEafIpIGK7Uzd5A== X-Received: by 2002:a17:902:db83:: with SMTP id m3mr9502100pld.166.1584033654916; Thu, 12 Mar 2020 10:20:54 -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 v1sm9447511pjy.35.2020.03.12.10.20.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 10:20:53 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com, stable@dpdk.org Date: Thu, 12 Mar 2020 10:20:41 -0700 Message-Id: <20200312172047.19973-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312172047.19973-1-stephen@networkplumber.org> References: <20200312172047.19973-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/7] ethdev: add function to test port ownership X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Applications using a port mask need a method to be able to test for (and reject) ethdev ports that are in use for other purposes. Fixes: 5b7ba31148a8 ("ethdev: add port ownership") Cc: matan@mellanox.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- lib/librte_ethdev/rte_ethdev.c | 9 +++++++++ lib/librte_ethdev/rte_ethdev.h | 15 +++++++++++++++ lib/librte_ethdev/rte_ethdev_version.map | 3 +++ 3 files changed, 27 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 774c721b3484..38f99f417dba 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -685,6 +685,15 @@ rte_eth_dev_owner_unset(const uint16_t port_id, const uint64_t owner_id) return ret; } +int +rte_eth_dev_is_owned_by(uint16_t port_id, uint64_t owner_id) +{ + if (!rte_eth_dev_is_valid_port(port_id)) + return 0; + + return rte_eth_devices[port_id].data->owner.id == owner_id; +} + int rte_eth_dev_owner_delete(const uint64_t owner_id) { diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index d1a593ad112a..91a8f9578282 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -1530,6 +1530,21 @@ uint64_t rte_eth_find_next_owned_by(uint16_t port_id, (unsigned int)p < (unsigned int)RTE_MAX_ETHPORTS; \ p = rte_eth_find_next_owned_by(p + 1, o)) +/** + * Test if a port is owned + * + * @param port_id + * The port identifier of the Ethernet device + * @param owner_id + * The owner identifier. + * RTE_ETH_DEV_NO_OWNER means test if port is not owned. + * @return + * - 0 if port is out of range or not owned by owner_id + * - 1 if device is associated with owner_id + */ +__rte_experimental +int rte_eth_dev_is_owned_by(uint16_t port_id, uint64_t owner_id); + /** * Iterates over valid ethdev ports. * diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map index 3f32fdecf722..95231fe3410c 100644 --- a/lib/librte_ethdev/rte_ethdev_version.map +++ b/lib/librte_ethdev/rte_ethdev_version.map @@ -230,4 +230,7 @@ EXPERIMENTAL { # added in 20.02 rte_flow_dev_dump; + + # added in 20.05 + rte_eth_dev_is_owned_by; }; From patchwork Thu Mar 12 17:20:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66606 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B64A1A056D; Thu, 12 Mar 2020 18:21:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E8D741C020; Thu, 12 Mar 2020 18:20:59 +0100 (CET) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id CC50A1BFC9 for ; Thu, 12 Mar 2020 18:20:57 +0100 (CET) Received: by mail-pf1-f194.google.com with SMTP id 2so3564863pfg.12 for ; Thu, 12 Mar 2020 10:20:57 -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=U7e/5Y/lTfLIR9b/60JddEwk2/u+doTPe+XZD609+BU=; b=WLDPSGs7DrqdYahb63xLoqm6msI/qo5kCqy4kFJBB130m6PhAmU8fOE9COz8AyPRdt FsddlXB7/h74QsePAjB6k7FD1Xa/Xtq/zMMUbbryhuQA1K14cTctFUztTLmZZKUSyP46 GnSAQMAOwdKrcG1Qd3A68K+DnWFuzHzRkQ8RmnPurmu0Z4o8oJiIj7ou916A00UTBnAO V1Czu1p0/sAsuZmE57DtMJtZ8of5YiET9zVNrenJLnaxjEfOi7/Jo+u64RgcWnly0rOM tJDRm3jsV3GIkprl76ha078a1xRd3ooTkmfokZbBCYGa6o0nqUvW9mIVpWIOgc/R/Plv ORcw== 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=U7e/5Y/lTfLIR9b/60JddEwk2/u+doTPe+XZD609+BU=; b=n3isiyAhx5bpJxqC7cnW8WhYL2ruHlVyRuN46ehUQPEn6z8iq9656IAKUzM1nnMQSq 4M/vG+/tRut+TjezNDQzZxKOWM25BZt0Y9iwH7vuq3wS1zN3Gw326Kfik0nhOmrr4QGG mG3iE9Ra1uhhSoOGjRByjGHO4C/F3wPYzQqwN4bVUlARaq70NBulhED6JxTE/AlZ5eMz l9C+qKykXhGkBsZJDq7ILTckaR2pg118MkZnaoEbA49m5c2kqTCufAMuXTPBv4o6r1HX 723gj5H/jGkV4sKCiPY/x/TDoLCDnx7G0zrIJSPX6lXlRORFHgKl2eUHL6NFoI+8FuWV oqzg== X-Gm-Message-State: ANhLgQ2fM9GfYbOz4PHuWQBMMMDU/2lGOwob8Yk0MxI3e7kfjV1p4DTH AadHmvJdlcVp6NMhF+NKVOEvgme27GU= X-Google-Smtp-Source: ADFU+vvhJSzV2VH+cAIF9/qyAUG8j2P8PZGZyeLTLcz++tigyzJlItCBSWkrbxWvKfllp4BAkOD4FQ== X-Received: by 2002:a62:bd14:: with SMTP id a20mr2253575pff.86.1584033656452; Thu, 12 Mar 2020 10:20:56 -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 v1sm9447511pjy.35.2020.03.12.10.20.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 10:20:55 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com, stable@dpdk.org Date: Thu, 12 Mar 2020 10:20:42 -0700 Message-Id: <20200312172047.19973-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312172047.19973-1-stephen@networkplumber.org> References: <20200312172047.19973-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/7] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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..c1c59b2d81f2 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_by(portid, RTE_ETH_DEV_NO_OWNER)) { + 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 From patchwork Thu Mar 12 17:20:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66607 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E05A7A056D; Thu, 12 Mar 2020 18:21:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1AEFE1C036; Thu, 12 Mar 2020 18:21:03 +0100 (CET) Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by dpdk.org (Postfix) with ESMTP id 3D14E1C012 for ; Thu, 12 Mar 2020 18:20:59 +0100 (CET) Received: by mail-pj1-f67.google.com with SMTP id d8so2924314pje.4 for ; Thu, 12 Mar 2020 10:20:59 -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=kcq6NWgod5osKvrxdEtMQjmmS5QiNiB/WlPhCsJbOK0=; b=tcgmpe3V2rZzOqW3kDwAtXLGeL1xsTieckxiwwqApA2/hkxjcGe0xexwIXCwBKSXCG 2J4oUWnGDpv5StGfx91brQstqhyu/6BPc0l5gVxiOhj0La/FiL2B+xFNBELl4X/73qZZ niSucwy/jD0dEVhYezA+nCa1eGv937U5gM32ddIHdjc0ZvX+ntpfPIhMxsE6eSLH6Ro6 lNCXI91CoWOS6W6cLEsFhaf6ABektlrIw5lOkKXOgBF8TIlLB1caOrOCCP/I7ifcExh0 7JtcNxqCa35krQcdQX2HYURL0hSN8uHGZ4iKXRFhvd6q8ww57eE1oqm1LmI+RC/NR870 0ngA== 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=kcq6NWgod5osKvrxdEtMQjmmS5QiNiB/WlPhCsJbOK0=; b=J8llOB6de40UNvfM80Gnqd8nWIS9iqWQU+nDr/LKYdJmlVKo8so7BLKoCaVDgWCMhN 1wkTXDKAhApo9PIjNRy+dpZtoDH3OsJGbHe1uW+NZHcgAPlTCxRZTtOY/BNAB8ZohzJD DWv41Ojp8dkn7sIkuqH1s9CE5O6hORTuPxTtN4fv2FOpHnNhTYviDjy6vFGOdZzbc1xr IS979xsabdmjevI4pyUNRB0x3ayCbmGJyZ5+hL1Vn3GLx0m8M65oE8sBKRLWEXkKTCQM D9qk+7ZtOn0k1D7DIn32UysoyPFCH65pe7Dx88ogJfaZQtqO4kd4xFZUkYVJ9NrJh5f7 N4pQ== X-Gm-Message-State: ANhLgQ3PsHRH+4145bStyVUeY2jJ1Nf8zx4HD/Jd+HUOxvApsZ+OULXI tD6mzGEE6WIRtodT/WplK1xM6taxiO0= X-Google-Smtp-Source: ADFU+vuV6aDObctJJCucSHq7T1iOUmEdSeDL7/hcXbw0Wq6q8gzYS0+OWCTV7L1r6KW0vICgY/4rjA== X-Received: by 2002:a17:902:aa49:: with SMTP id c9mr9252878plr.145.1584033657869; Thu, 12 Mar 2020 10:20:57 -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 v1sm9447511pjy.35.2020.03.12.10.20.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 10:20:56 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com, stable@dpdk.org Date: Thu, 12 Mar 2020 10:20:43 -0700 Message-Id: <20200312172047.19973-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312172047.19973-1-stephen@networkplumber.org> References: <20200312172047.19973-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 3/7] examples/l3fwd: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" If a ethdev port is in use for a sub device, then it should not be allowed in the portmask of l3fwd. Fixes: 5b7ba31148a8 ("ethdev: add port ownership") Cc: matan@mellanox.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- examples/l3fwd/Makefile | 3 +++ examples/l3fwd/main.c | 4 ++++ examples/l3fwd/meson.build | 1 + 3 files changed, 8 insertions(+) diff --git a/examples/l3fwd/Makefile b/examples/l3fwd/Makefile index 59a110d12a49..59cd00abe6e9 100644 --- a/examples/l3fwd/Makefile +++ b/examples/l3fwd/Makefile @@ -25,6 +25,8 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +CFLAGS += -DALLOW_EXPERIMENTAL_API + build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED) @@ -50,6 +52,7 @@ RTE_TARGET ?= $(notdir $(abspath $(dir $(firstword $(wildcard $(RTE_SDK)/*/.conf include $(RTE_SDK)/mk/rte.vars.mk +CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -I$(SRCDIR) CFLAGS += -O3 $(USER_FLAGS) CFLAGS += $(WERROR_FLAGS) diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index dda430d68a20..307a490fb552 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -221,6 +221,10 @@ check_port_config(void) printf("port %u is not present on the board\n", portid); return -1; } + if (!rte_eth_dev_is_owned_by(portid, RTE_ETH_DEV_NO_OWNER)) { + printf("port %u is already in use\n", portid); + return -1; + } } return 0; } diff --git a/examples/l3fwd/meson.build b/examples/l3fwd/meson.build index ebed3b518c4b..7d72b1b365ae 100644 --- a/examples/l3fwd/meson.build +++ b/examples/l3fwd/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 += ['hash', 'lpm', 'eventdev'] sources = files( 'l3fwd_em.c', 'l3fwd_lpm.c', 'l3fwd_event.c', From patchwork Thu Mar 12 17:20:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66608 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 30957A056D; Thu, 12 Mar 2020 18:21:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CCAB71C06A; Thu, 12 Mar 2020 18:21:04 +0100 (CET) Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by dpdk.org (Postfix) with ESMTP id 0532F1C029 for ; Thu, 12 Mar 2020 18:21:01 +0100 (CET) Received: by mail-pj1-f66.google.com with SMTP id mj6so2675715pjb.5 for ; Thu, 12 Mar 2020 10:21:00 -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=A0RlVzqxRogxunr7e0lWuxuL/H7L9Lu2gzHgdRoemtM=; b=zO9u+dTAFbRuG0uhtCjQa4JeYKTng0I1juKrHrRM4z9qjTaNbZ7YI+TXUvpyspdbWz O+MEm7JQgSvJfssskbD7AjmcWUzR52iWcVk33Ylf2GQuC3TDgwzo/iq7xEhJkaV1jN0P N/Y3T0Lmvfz2+inF0IqnghHFIwrmWFGloriF7YIsAVkADWRO1ICti8qZmgKqoIJtqW3F MfIpnGUxGfj1meDZ/XNotjJ5uVNkOIemRAw/LSscBubPKqK3Ms4UuQF4iRBgIJizL61i KIT6j4NlnMRPlodY1CgkQKQSHvVnzycNBd8+orhqotDVztqq1ZFJ4r+ykJICV5L0s9e8 SHtA== 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=A0RlVzqxRogxunr7e0lWuxuL/H7L9Lu2gzHgdRoemtM=; b=h3V3KkY8mxR6aolXppiFcTFzZnSCdqLNAh6MYjZzpSGO14KropZp4uZUGUU0eZaQEi Oq+z8b+5Mwb4IPMHcc39zDYRm+5zATEe/WIqAhU+jhMinv3VLe2YzUETRe84JGViVxRF yg9RGu19Q8PTLWIFuFC3F0LXQFr81FerZOn/grh3rcUR6hSFeDxzATfj0T0Z2SaiIzi4 k2srPelUeXqk+DqakUiKp24NqsfVPnv2XxMxeyE2LfR+ngOkMhCtyZ6b1Y+Z/pqBFp+/ HR0xt9pVQWR9tRCKijcDyj4QkdvpdbemFbdGc4Bn1PZrS7eNAIn+uDR6b3nl6ersXS2i rqhw== X-Gm-Message-State: ANhLgQ0QGjbmG6+0lk2cdnF2K55zxhhVEy/6C3QlFQpDqtaz55In0W9c Mkwybu0kHIT7IlrI3DGg5ip0pMAsvRg= X-Google-Smtp-Source: ADFU+vtwxuppTAhly+DzWE2xqOrTCPBqvc1u0pvzs3BsQQC/QgmRS/6IXB9q4/leQbKdqQaT+HAfZA== X-Received: by 2002:a17:90b:4c83:: with SMTP id my3mr5252342pjb.142.1584033659640; Thu, 12 Mar 2020 10:20:59 -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 v1sm9447511pjy.35.2020.03.12.10.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 10:20:58 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com, stable@dpdk.org Date: Thu, 12 Mar 2020 10:20:44 -0700 Message-Id: <20200312172047.19973-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312172047.19973-1-stephen@networkplumber.org> References: <20200312172047.19973-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 4/7] examples/l3fwd-acl: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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..695121bb7bb5 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_is_owned_by(portid, RTE_ETH_DEV_NO_OWNER)) { + 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' From patchwork Thu Mar 12 17:20:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66609 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 96E90A056D; Thu, 12 Mar 2020 18:22:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 569711C07C; Thu, 12 Mar 2020 18:21:06 +0100 (CET) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 5F1941C036 for ; Thu, 12 Mar 2020 18:21:02 +0100 (CET) Received: by mail-pf1-f196.google.com with SMTP id x2so3213666pfn.9 for ; Thu, 12 Mar 2020 10:21:02 -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=NSbxM1vchD+NHe5eMTr/oEXrivU0x2mi9+eBV5zkU+k=; b=qDJr+RwKX4J7VF53nVrmlyfBg5Z2AimwjLEkp3OWs0GiyrWZNxcxd3yjQ1kbdZEkA7 muGNxTLpBsd4o7xwSy27c+e8dZh519YLFQbU2wUXFJuLTt+lj37P7PaJJl4RQg0AXjye dtAZw/exeFTgax8cdpUDHQ2Kbd/oS1zbvgAdUlflkM7YEHldlqBpxzVGHbi4yuDAlZeG DjmlAQzfyxzkuNkE9rV4BghQMcNfY//Jk12rcdu1vn/TJUehIQbafoeNd3i+eP/cKNLy KGOGS76Y2EOdZk40QYT/5vYevDlzeKD8N3HlWY2sb0hqPL0qz/BqhlwqhJtam5ipEUI9 EfpQ== 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=NSbxM1vchD+NHe5eMTr/oEXrivU0x2mi9+eBV5zkU+k=; b=Y/FUt3XuRaDPH5SHmYyusR7xruuWhSnY8dakeLaFMP4ZQKH3hRGZpm4Z08WBU/O4ch AjRzvKon5LpzJgmlJMKQV47DA2Brrwf7hnE6faozjOo/s7sBAJ9TPyhreP9p/PzUgR2l IRXHbXfkaaSmh0n3vAlUzdKtOE/sf0HsBJzsJCyVpK2s4fvkBd3MMoULYdHf779/hKlM aKrcmgLCybCfS5R8V6M5BlrygL7Gb+ZcmFIkRXiFF2GQysqvzzbRi5h9h3lZFMLEzsf8 MQs0qS+kHte70HeglMOAJt2Ne8DwvgGsaLcJhlbO3onKdkE5dE6JNIL81N5j21pW0JX0 FIwA== X-Gm-Message-State: ANhLgQ3zMJTWxJhyQMsmXQ5D6isK3rMHfTUfmnZql8ETEvwBr6VOTBK0 ZXnX8bEHsHtGkME6tjC4q4ggIbP75Io= X-Google-Smtp-Source: ADFU+vvDNNHXI0wSNwgll97i1/R9fANFsrLZQ2kaTJcViy7qov30UV+x0VkmVoJijsswucVrM07+mg== X-Received: by 2002:a63:5847:: with SMTP id i7mr8681666pgm.127.1584033661122; Thu, 12 Mar 2020 10:21:01 -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 v1sm9447511pjy.35.2020.03.12.10.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 10:21:00 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com, stable@dpdk.org Date: Thu, 12 Mar 2020 10:20:45 -0700 Message-Id: <20200312172047.19973-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312172047.19973-1-stephen@networkplumber.org> References: <20200312172047.19973-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 5/7] examples/l3fwd-power: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" If a ethdev port is in use for a sub device, then it should not be allowed in the portmask of l3fwd. Fixes: 5b7ba31148a8 ("ethdev: add port ownership") Cc: matan@mellanox.com Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- examples/l3fwd-power/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index c7fe0ec03495..3a8a7277cb0a 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -1396,6 +1396,10 @@ check_port_config(void) portid); return -1; } + if (!rte_eth_dev_is_owned_by(portid, RTE_ETH_DEV_NO_OWNER)) { + printf("port %u is already in use\n", portid); + return -1; + } } return 0; } From patchwork Thu Mar 12 17:20:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66610 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4242BA056D; Thu, 12 Mar 2020 18:22:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 886751C0AB; Thu, 12 Mar 2020 18:21:07 +0100 (CET) Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by dpdk.org (Postfix) with ESMTP id 043881C066 for ; Thu, 12 Mar 2020 18:21:04 +0100 (CET) Received: by mail-pj1-f67.google.com with SMTP id mq3so2930576pjb.0 for ; Thu, 12 Mar 2020 10:21:03 -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=Ge4blt7351q3kY/MQA5F1nD+Om5sRlhumnyhz6o/IrQ=; b=F6SbVjofpu/QF81pwufLUJgxsghL9GdXmFmIMAmShXbbpFzDY+J9EHTfn90iaYZhuz lDHuq8VsXQKeBjT8B8n4EgRnj8iubKptcDD91xa5j/iAlHUbYLLPdnV9XCx/GAlOeFqM cITckFa3XVUwfFkjMrFlxy5d3skJSb/qGPszHlH97an352PVShKNNHwFDACnAeV5P5pl I27Rs6w7qr0uu/86ailRR7YLesEjaFtWzjwEBRBujToiCOrFinaB2DgmZShcuSI9vwNB uNmDHrsiTTFOYWmV4Qle2IBL0tRoXKbk8wm7GTOqwoYnwv9jvb01pyq+F3jFw9g0XrVf Ax/A== 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=Ge4blt7351q3kY/MQA5F1nD+Om5sRlhumnyhz6o/IrQ=; b=rWwh+l/eV4FVF0QMYW8fY4CPpP+VnC/HofDl0tLuBYMui09XSBz0xIZcQUs9dZii2Z jyszuufIuRBFMXSdBGERrVXnifqcg6tFLEC2weNnHNhApJTBhWiMmrzhsh/fNLPwiTkb s4GsE95JhcICiqeY0t2KtXkOT4zS/JK5pX2LOKQBowqPEix2RP3VNKDluxfV28is6qlw WO7nS/iThMCBPRafBtSdMOSgmRlIUe0/uLvz3cGKXt9xFbkWuo8dmdhNFLb1WHbhNi7B 19wPbKWswXYtLBBl+DxdHEuk+wJ5wURmXOZtYfOG/HirU5Bi+YvPcDEqDoaY2qdxlJ9G Q0ow== X-Gm-Message-State: ANhLgQ03Gerfirgr00mYlx84ZoXT+ueF/RbUzwToDDn5bumK08ClzbtK vaGj7T1kYxO3gpi4jQNWTqVFCrQYFLU= X-Google-Smtp-Source: ADFU+vu5RZ2mHUoapnJ4jrG81udjY1L1DAzpapeE1JgPXlM7nrc79xeKM7PeRd/nwnpP1sdnXYEpBA== X-Received: by 2002:a17:90a:c301:: with SMTP id g1mr4989829pjt.88.1584033662644; Thu, 12 Mar 2020 10:21:02 -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 v1sm9447511pjy.35.2020.03.12.10.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 10:21:01 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com, stable@dpdk.org Date: Thu, 12 Mar 2020 10:20:46 -0700 Message-Id: <20200312172047.19973-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312172047.19973-1-stephen@networkplumber.org> References: <20200312172047.19973-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 6/7] examples/tep_termination: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- examples/tep_termination/Makefile | 2 ++ examples/tep_termination/main.c | 2 +- examples/tep_termination/meson.build | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/tep_termination/Makefile b/examples/tep_termination/Makefile index 645112498d33..f55331fb24c2 100644 --- a/examples/tep_termination/Makefile +++ b/examples/tep_termination/Makefile @@ -26,6 +26,7 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk) +CFLAGS += -DALLOW_EXPERIMENTAL_API CFLAGS += -Wno-deprecated-declarations build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build @@ -61,6 +62,7 @@ endif CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) CFLAGS += -Wno-deprecated-declarations +CFLAGS += -DALLOW_EXPERIMENTAL_API include $(RTE_SDK)/mk/rte.extapp.mk endif diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c index ab956ad7ce96..928cd226d25a 100644 --- a/examples/tep_termination/main.c +++ b/examples/tep_termination/main.c @@ -507,7 +507,7 @@ check_ports_num(unsigned max_nb_ports) } for (portid = 0; portid < nb_ports; portid++) { - if (!rte_eth_dev_is_valid_port(ports[portid])) { + if (!rte_eth_dev_is_owned_by(portid, RTE_ETH_DEV_NO_OWNER)) { RTE_LOG(INFO, VHOST_PORT, "\nSpecified port ID(%u) is not valid\n", ports[portid]); diff --git a/examples/tep_termination/meson.build b/examples/tep_termination/meson.build index f65d689802a3..ddadf1c2aede 100644 --- a/examples/tep_termination/meson.build +++ b/examples/tep_termination/meson.build @@ -9,6 +9,7 @@ if not is_linux build = false endif +allow_experimental_apis = true deps += ['hash', 'vhost'] cflags += '-Wno-deprecated-declarations' sources = files( From patchwork Thu Mar 12 17:20:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66611 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BA78FA056D; Thu, 12 Mar 2020 18:22:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DB8981C00D; Thu, 12 Mar 2020 18:21:08 +0100 (CET) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 8C75F1C05C for ; Thu, 12 Mar 2020 18:21:05 +0100 (CET) Received: by mail-pf1-f196.google.com with SMTP id x2so3213759pfn.9 for ; Thu, 12 Mar 2020 10:21: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=1BC7na9ni6lsFj/t0z5LAszdbPkH3GmqR/57AiFGHOw=; b=hQ9P/YhRKfwBvJwnP3CbNYLtz3f2fqBKC4SfrIj5OoxZhPgTqRDqbyiTucbA1AGrhr 8F313h21zvneCaQBVoWZgnCOHS3J7XhUCOc0MkRRe7X3D4ifDN1EHZIP1qCeAc31F73H /SB4K1a2FbFqz0iMVVU1FAcDKYaJLOtLcsIpF5KTCoKuMms34BBzwNdwEd5h1964yoJS 3DIRA+usQeqWvv6GoHQFuybf4mNis5CZCT8suKXDc7AKRwAOLr50ODqPI8o3T5DJVP5h odYyLPPWgURwiaTYw8TeP92kJACK4gEGsDdp5LzbPlylneWYDUu9NRIR6lUzgeWUs3ww RgWQ== 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=1BC7na9ni6lsFj/t0z5LAszdbPkH3GmqR/57AiFGHOw=; b=G++6ntRNqZnNlxunw50x9b1CNoDs9XK6VFJyA5OFogvQIQAPgDBIedomJZT/Yks6f5 CvO0jaEiuFhyNONdiuSX7oiv/6v13gB0czQBR60UmSVIzDHXECt+m/Zbmqqpk22mg+ri r+iAwDBvOlIFluaUDorDOKIBflO7HNK/TrqS2VFvKKvDFmRjTwy/0FlpsHNfkxlsdv0u Aq2NzxobmTHKNCU0hI560Y4wFwPPqkxzlXupfOu4D8+ps5MGgT4vqJX6U9PLx4xiu9bl pSjMVdyP4wH9Xd0JS/A4/haw6CYi9228HOehldotVTOQ8Ot98zklCGEvp8tFD+b49n3/ qyhw== X-Gm-Message-State: ANhLgQ1onYuSMI77D3H34HN1tE2UfQtdd00Jb5VkUdkVNlEhI/gCcarZ hbUykX/RWyoDZUEi39Wg8KzEBPq/5t8= X-Google-Smtp-Source: ADFU+vsDHP1TO39dyYVk6d81yKTucaM18WlbA6MNv+pdkA2EtolcOEBNQHBOUyD53w/c7oZnAwtwag== X-Received: by 2002:a63:715b:: with SMTP id b27mr8840787pgn.275.1584033664198; Thu, 12 Mar 2020 10:21:04 -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 v1sm9447511pjy.35.2020.03.12.10.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 10:21:03 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com, stable@dpdk.org Date: Thu, 12 Mar 2020 10:20:47 -0700 Message-Id: <20200312172047.19973-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312172047.19973-1-stephen@networkplumber.org> References: <20200312172047.19973-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 7/7] examples/vhost: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- examples/vhost/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index ab649bf147e1..d759581f1904 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -669,7 +669,7 @@ static unsigned check_ports_num(unsigned nb_ports) } for (portid = 0; portid < num_ports; portid ++) { - if (!rte_eth_dev_is_valid_port(ports[portid])) { + if (!rte_eth_dev_is_owned_by(portid, RTE_ETH_DEV_NO_OWNER)) { RTE_LOG(INFO, VHOST_PORT, "\nSpecified port ID(%u) is not valid\n", ports[portid]);