From patchwork Mon Mar 16 16:09:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66724 X-Patchwork-Delegate: thomas@monjalon.net 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 EA34FA0559; Mon, 16 Mar 2020 17:09:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BD4411C0AF; Mon, 16 Mar 2020 17:09:35 +0100 (CET) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id 28D9E1C068 for ; Mon, 16 Mar 2020 17:09:34 +0100 (CET) Received: by mail-pl1-f196.google.com with SMTP id f8so8205797plt.10 for ; Mon, 16 Mar 2020 09:09:34 -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=ujBoBJ6MksRkTGo8WjSaOKef1dILNKZPNJSRgokxTbQ=; b=ggsygWJYWGuZAMapdLMh7hLXhDfAIy5X/r+uYZezZMHYHbDVXA5IzRipbp9pBZQXtT 4yx/f080WrsMHSIwculC0YFIYKBxqojOAf3g5vtgl3yhynOhMwH7Oxgp5S56Zkx7yhPF VRjB0DF1MH4nFbrjZ6VE0yM+HJ+haM1VerRTkaw4zyogPMEGgNv9lGoXa/L2vEh6aRRS xkYwvoxZ+GBqqvtjaVzjYOpkv8xZOgkrlg2k0Ey1I7BgnKkugXvFqEsgOMIjSIS5LmM/ aXUjuUApVH8FyWxGNb4tFcQnkwbFtcz2cDoBcHrIztnC1urIaziYqf7w/oHysmN9zuBw s0mw== 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=ujBoBJ6MksRkTGo8WjSaOKef1dILNKZPNJSRgokxTbQ=; b=ZQzx7V3pfgiqS/sH9/tQsnS4gD3q4CyM6Zz/qWec1gu/BifAdPWv40u4iH4nSXsWEO vwFZgJfExb60vG6u8mWAwYNxv/k5qpcaif4dcTwBOnYYv7TWqxO+hB742yE7NzMyyDXB 7vFjUtKqThET/uQFYjh1gm5fMeIy/oDiIq6SOwJH002494w+709UyXl/NLAu8rmxY7Kt Md738wv8fq9vvGzitoh1pLaautbfY9cPjaaPUM0ENIUs7WPVkP4vdadbuf0Ek6b+E5RE o41tTjD9KR0CuH2xSpOuz5RBg6GPV/gDHbuV5UUvE4IDPfRL+JWWb90pVsMnm9mPH4pn O0yg== X-Gm-Message-State: ANhLgQ2DIIuVNbqpYzd7iViSA24H6dtYWj+wfuG8uaYHCbApHxMoj2R4 N/VWOnSRLIVbex0ksuYSA14/yWkK/OE= X-Google-Smtp-Source: ADFU+vu1/ewB19w7ZGlIiMaMXmTzW3q0Isyx1vzBW+z2IBBIt54laGxvRWmRU1UpbdAhk0jwWGMi2w== X-Received: by 2002:a17:902:9a42:: with SMTP id x2mr28600951plv.194.1584374972865; Mon, 16 Mar 2020 09:09:32 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 09:09:32 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Mon, 16 Mar 2020 09:09:18 -0700 Message-Id: <20200316160923.5335-2-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 Subject: [dpdk-dev] [PATCH v2 1/6] rte_ethdev: add function to check if device is owned 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" This is a simple helper function to check if device is owned (being used as a sub-device). It is more convienent than having applications call rte_eth_dev_owner_get and check the result. Signed-off-by: Stephen Hemminger --- v2 - rename the helper function and use rte_eth_dev_owner_get lib/librte_ethdev/rte_ethdev.c | 12 ++++++++++++ lib/librte_ethdev/rte_ethdev.h | 13 +++++++++++++ lib/librte_ethdev/rte_ethdev_version.map | 3 +++ 3 files changed, 28 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 774c721b3484..6e2d0110f65e 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -737,6 +737,18 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner) return ret; } +int +rte_eth_dev_is_owned(uint16_t port_id) +{ + struct rte_eth_dev_owner owner; + int ret; + + ret = rte_eth_dev_owner_get(port_id, &owner); + if (ret == 0) + ret = (owner.id != RTE_ETH_DEV_NO_OWNER); + return ret; +} + int rte_eth_dev_socket_id(uint16_t port_id) { diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index d1a593ad112a..3a8a4bcde4b7 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -1693,6 +1693,19 @@ __rte_experimental int rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner); +/** + * Check if port_id is part of a sub-device + * + * @param port_id + * The port identifier of the Ethernet device + * @return + * - 1 if device is associated with an owner + * - 0 if port is not owned + * - negative errno value on error. + */ +__rte_experimental +int rte_eth_dev_is_owned(uint16_t port_id); + /** * Get the number of ports which are usable for the application. * diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map index 3f32fdecf722..435df2dba149 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; }; From patchwork Mon Mar 16 16:09:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66725 X-Patchwork-Delegate: thomas@monjalon.net 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 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 ; Mon, 16 Mar 2020 17:09:35 +0100 (CET) Received: by mail-pl1-f180.google.com with SMTP id a23so8223752plm.1 for ; 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 To: dev@dpdk.org Cc: Stephen Hemminger , 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 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 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..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 From patchwork Mon Mar 16 16:09:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66726 X-Patchwork-Delegate: thomas@monjalon.net 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 2CFFCA0559; Mon, 16 Mar 2020 17:10:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 612341C0C4; Mon, 16 Mar 2020 17:09:41 +0100 (CET) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by dpdk.org (Postfix) with ESMTP id 77FB51C0B9 for ; Mon, 16 Mar 2020 17:09:37 +0100 (CET) Received: by mail-pj1-f48.google.com with SMTP id bo3so7533482pjb.5 for ; Mon, 16 Mar 2020 09:09:37 -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=JAMQv4YIUkehN2zt4AP+yvBCaOmB28IIJXnYvpbLWW0=; b=Y+vvIm447w7VVzokA21zLSJCJlbfst3rS1hpjinTFd79Xk1aSTX8jkk1YT7uAUIvqq U++P0/0WzZJCpJDiAzo1DW/L+JPeN9ZEjj9dQ/V8mVN/SuA0XzEOEFk4ghIh3xnVJqfd z4NvkSmd1/Dk++9skhD/nJB9aVv2iIFqAr7QtFeFwfG50LC4LXiIICJKJZ4jVytsV/wK WTTsS+iRdC8m368Gb29hnVt3Dz6kiSat8gn3hn6fgIiAoukJQkfW5JTw8qk0n+mWhtNv 8jenKoN97W8bZo5zZPD/XBvCywz0aP2uRLElKMdS+xqXJuPsCF7w/Husfdjy0Q4Lbxeb HTDg== 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=JAMQv4YIUkehN2zt4AP+yvBCaOmB28IIJXnYvpbLWW0=; b=C6bFBQ9l+GS9RxAVdsmQLJiDeCa9lpKzlg7H/xHpbEIflgU6Zbl+Rqpl7eGqwKxD/W HpbZYhxNbGtyWOsqJcinWnrvJRLrcDYArptfQY0L1/lkDCGLQnUlXvy38d1aJ2T5tXQp HQ38mxbU7NFCSo7qwZl8n3OxLgUIHJbvS7ZQZJNB7Kp1x5Dz2K5WhL6JgHroI8FMFlQ2 f9bZAz6QxyPlqrRlVT0Ms16AZYmuCjMY/F9JwmFOai1zQoeIQZQAPA8jw3IIs4HrqRTG 5v6N6jxCO3iR3yrGkNyl/Wpl3PLoFv3iEjXgSLF1tbd3bGrW7vSSCihSYKMZ6lIXkL/v yKRw== X-Gm-Message-State: ANhLgQ3uiXeD28UvJ9BJ3h+mPGlCW5kfXv3tdwmLHjJE/ktHaN/ui6/S NTORHuOPXGXHiFmE1tpbGILjQzKQtP4= X-Google-Smtp-Source: ADFU+vs+Km1gWi+6oWb9iAu/kg7GcIKJAMDndyezQ+alJbuQTBx+1AzeoXM7gLY5wH1p6c0bJlJLgA== X-Received: by 2002:a17:902:d681:: with SMTP id v1mr27350777ply.151.1584374976012; Mon, 16 Mar 2020 09:09:36 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 09:09:34 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com, stable@dpdk.org Date: Mon, 16 Mar 2020 09:09:20 -0700 Message-Id: <20200316160923.5335-4-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 Subject: [dpdk-dev] [PATCH v2 3/6] 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 | 5 +++++ examples/l3fwd/meson.build | 1 + 3 files changed, 9 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..ab717e3bfd2e 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -221,6 +221,11 @@ check_port_config(void) printf("port %u is not present on the board\n", portid); return -1; } + + if (rte_eth_dev_is_owned(portid)) { + 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 Mon Mar 16 16:09:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66727 X-Patchwork-Delegate: thomas@monjalon.net 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 E94A2A0559; Mon, 16 Mar 2020 17:10:16 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E6A9E1C0D1; Mon, 16 Mar 2020 17:09:42 +0100 (CET) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by dpdk.org (Postfix) with ESMTP id EA1E01C0B9 for ; Mon, 16 Mar 2020 17:09:38 +0100 (CET) Received: by mail-pf1-f195.google.com with SMTP id z65so10186158pfz.8 for ; Mon, 16 Mar 2020 09:09:38 -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=zYCvvLvN3i9tQ/IqBdZwCKMS+M4pJS/Ts8k1AGYthvU=; b=yoivseXGx/d7wkf4GANSAsYfWGa1n5oc+i+A+Ou6di+dB/Vu6RaF5/Lb8kSMBaC4tR Ah5Zdm32jmFqoG7YC23k9lzuycGjQh+oJ1p69F+5uGM5thZ0WUuXDzkrBZQ1pPrVPuSk 44ggV4/DWGaXnFiaFdzOs79T9WPGoXt7V7XDhfUWnOBr6zEsJJ9nF9KagO2OQ66xcITz IZhH+XRRpkzW/+9dklReRIpmGVEa0IKejXnln83Qj+CfjU05n9rYEiKayWNKiFelnGqy s0cs6IfLAiO2XRmyOXIwgEPZuavPN6qWTfsjubAECYhvylExtRj+SL8/g1moL8ZksPu1 TR+Q== 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=zYCvvLvN3i9tQ/IqBdZwCKMS+M4pJS/Ts8k1AGYthvU=; b=nDCCwwU2SNZcjvDdjGGSIhTdAYQiFhr5BbZXLSdChMpR0SjGcqMjcIWl64d/pPRbPs OAVSjfbjMDBq6uBpD2h2IAB+Q2w94Vqj4ALsYLRexGPJvu7LY+Zbv4qTqeqog97cLs6D x80xJszdpmTkWSvorlejwxGVVfmh5XUhzNY9nKCs+3yjqz6rmd2z3BO1UauYlvSLWX5L taapE4Mp4n/Dj9v4fkSidQIBhTOXjX8XNR4nTX+qKpwP0i8yPsBXhdtyDSWWInVS402v 0952d1uZ0Xz7be4Gdfd5peUlZwZTggp2a/J/KxkBuhCfdwTdpWjy6f6NA2Yk0BsDTxBR 9LcA== X-Gm-Message-State: ANhLgQ3pzSpm/D6dEqU+JyRk7MGXGD2cBE2Xy+3j/n2Lo/k6aYHFnpuO yJbUYQ9qtzuNUA7Jl3xSI8KvWEgBcGM= X-Google-Smtp-Source: ADFU+vvs7ng+cq6CarW5S1OPcWwTaCvYuAoV3b4NMI+R5eQM3aoZ3qn8f7gx19QQKc5pNkCEYxBN9w== X-Received: by 2002:aa7:9481:: with SMTP id z1mr310782pfk.185.1584374977643; Mon, 16 Mar 2020 09:09:37 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 09:09:36 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com, stable@dpdk.org Date: Mon, 16 Mar 2020 09:09:21 -0700 Message-Id: <20200316160923.5335-5-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 Subject: [dpdk-dev] [PATCH v2 4/6] 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..d9bee9ade323 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(portid)) { + 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 Mon Mar 16 16:09:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66728 X-Patchwork-Delegate: thomas@monjalon.net 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 8E522A0559; Mon, 16 Mar 2020 17:10:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EA4721C0D9; Mon, 16 Mar 2020 17:09:44 +0100 (CET) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 8081D1C0C0 for ; Mon, 16 Mar 2020 17:09:40 +0100 (CET) Received: by mail-pg1-f195.google.com with SMTP id a32so9155006pga.4 for ; Mon, 16 Mar 2020 09:09:40 -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=vsYspAECN0QqPihnoLSE2Qafwx6kgZpnLz+EbnKfpCY=; b=14dvVOZeNit7/JGmuoC2rq0yhwDzY2hCDwIXhcuxaE7TrKhxZfpalmJohXTQvWeEe1 En0hdB33VIh1iFVSrw5om8wOpvop5JwRJ9wxaiPsHw80RwsKgQljfTbQeVZO67+ilqcL TDWiqoT9L6WdyLKBJ/nB17nc2iRlSMJ9mAtN38vrlmncsDiFyrqaPQVcbUVES8uxoF8i WzOuksNxfq3i637P8d89RrHMlnhVm6O6rQ8moKZ1fT5thNa9GnfZXukAgoH+785JCzfd WX3lB4KmG5ihdLbmq9F2Wb6fyikQIDAdZjqBHbCYexZhA4su8U4KKMS/wFsxFxptE8rZ HY7A== 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=vsYspAECN0QqPihnoLSE2Qafwx6kgZpnLz+EbnKfpCY=; b=l8J8f5yE3pigVNyxJIyRDL5ezABlc9dF6V8XalwaZcMatrVG6suzGqYmhKb/WrlMa2 Fpt3A2zIrcFyvGEB+9wHPVk9bBP8Xd6ah+gkG5Oxxh3xQc4PH5v2b3LBH1l9N/0ZnMi0 lIxu1ORI2HjVWJeFfc10BKa+7uOvQtJwbH8f4yCYeTZn4BZExCoWv7t9TN/7stN60FdM xGGbDN12d9De5TA4CPSPknaOV2ubfuWmIVx9pXh0Vm+zZkgNw1eszrQGU7U9g6xUrXEq OX9KatwdC5aoYtp+TZL8TTRx/39vl0aCmL41DWtxsqG6QpL4gEKIqH8UQQYacvpkPopE 8rXg== X-Gm-Message-State: ANhLgQ0t04o2PA2ZclFG8Hh99YYRzIMNE0Dy9V5ZiQYZ/pBAnJCWtUiG TlOS4eVKcDtHokqf8EL6aISAfs0j1P0= X-Google-Smtp-Source: ADFU+vv3yd/+iY3e+BBJpnlLjKTnsnNZCsbxBBSvP/BLL5ALqAAB6rLAFxRnG/a3NZPgrujUvATL4g== X-Received: by 2002:aa7:9d0a:: with SMTP id k10mr372617pfp.266.1584374979305; Mon, 16 Mar 2020 09:09:39 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 09:09:38 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com, stable@dpdk.org Date: Mon, 16 Mar 2020 09:09:22 -0700 Message-Id: <20200316160923.5335-6-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 Subject: [dpdk-dev] [PATCH v2 5/6] 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..60f5ddd8fb9e 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(portid)) { + printf("port %u is already in use\n", portid); + return -1; + } } return 0; } From patchwork Mon Mar 16 16:09:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 66729 X-Patchwork-Delegate: thomas@monjalon.net 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 5B89DA0559; Mon, 16 Mar 2020 17:10:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CAC531C10F; Mon, 16 Mar 2020 17:09:46 +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 CF9D71C0CF for ; Mon, 16 Mar 2020 17:09:42 +0100 (CET) Received: by mail-pj1-f68.google.com with SMTP id o23so2841369pjp.0 for ; Mon, 16 Mar 2020 09:09:42 -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=XYfNI96F6gHQpFsgkLxPWY5bFlXABCzGNODbwuRb38w=; b=hU5gf3L4BIp0wz6BI2CtKd92J7gb9oiqOW/Hol43PqqHFkDUkxRAP3mFIYdIbNJbXl rraT3b7CzjEU81l6bjmHoB4Vb1Eb3tcG6rfXjCToUo62sBPaFHJFqXb/4RDFdVR6sJlK cR4A0mcfEvZZj4NO5uS8MIDwar/bqwT2BI38acGFEyqVGm2OjMCtfNKsJhHGz4KQMrLt rsNTcr+n+Fjpi7bxGHKOBwVuLuuXQhnFiJkytG2qWSRNrP6h8EuW/s212oA/CXiT5B// pBm0gaKghe+GQR2ju79bSiEprlPWVwqhEPuZKPg1eVcrDs5cFHG8LxOM4JTdEHUJFSVW wjSA== 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=XYfNI96F6gHQpFsgkLxPWY5bFlXABCzGNODbwuRb38w=; b=tDNPv1dc6oAhz4plTXS9wfDjNPloqOOV/GWa/s2qnva6lXqIpzNTzvFs5Ki7qacGed Utd1D67/xUv+dilpbAuFjmARR3+w0geHv+xl+sX4qO8BAiobeNLD+qtKTFvwRrHd6Dk4 qBr9vtVDDoZJcRN9PCFyhcILO0jFaEkf7oe5CuTFVuwKF+ypVrt+ZdjLoTZzdAuO3Hnr 1RqYEGleoCw5zo7Mtb4BoKYZ8ZelVv7m47Cimx0gFTiRkwKgkTkjqjShithkZbHaXWKS XSITPxtjRo4qFV0UpcF8arqF7hWROyHQ1m/DMuQLEwflJYB8TQDqcSKjAMd9gHj96haa F3Gw== X-Gm-Message-State: ANhLgQ1Qpu5KCF2ZpXfdaLPMrQGeCfaQezOmmN4xAG37rJU6HcIfB/9P +ulMMKD0pY0QtPk4mqYLXr3xKjQXJxE= X-Google-Smtp-Source: ADFU+vtCz05rstY91lz4960JYgQprLZpIWqXXjksLw5awHKz5WuGheAQr31L9C3eWL4A3fcOoZExpQ== X-Received: by 2002:a17:902:169:: with SMTP id 96mr15511053plb.140.1584374981098; Mon, 16 Mar 2020 09:09:41 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 09:09:40 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com, stable@dpdk.org Date: Mon, 16 Mar 2020 09:09:23 -0700 Message-Id: <20200316160923.5335-7-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 Subject: [dpdk-dev] [PATCH v2 6/6] 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..96c2d934cd09 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(portid) != 0) { 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(