From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Content-Transfer-Encoding: 8bit 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', -- 2.20.1