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 961F3A0562; Thu, 2 Apr 2020 19:20:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 88EA41BEE1; Thu, 2 Apr 2020 19:20:09 +0200 (CEST) Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by dpdk.org (Postfix) with ESMTP id DE0181BEB1 for ; Thu, 2 Apr 2020 19:20:06 +0200 (CEST) Received: by mail-pf1-f169.google.com with SMTP id c21so2058843pfo.5 for ; Thu, 02 Apr 2020 10:20:06 -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=WD7UANVVWh1Z4K+ERaNWSshHykUbX739UMEJYD62aHg=; b=bujfX7nDQ9DjEq84PPu85rzQkkiUdFOGIqpyLXG95gzNnkmml/ZNSq8KY4SgC8ZQlr DdXGA0OBB0zQZIwPGPVqNZ2Ephg0c7y3zB/Rg3RzHY+OcH/nEJnRps0GuFy0dNd4KaHI Ahj3Fruhw4A2JfM5CPofUYngBHAmUEoudamSuo9iAipcIIsvEWVX0/NVMP517IA+A0Xn GvN+2lptAq7OJzsSzM5Na70MFBt5Ni889ubna7KklJfVZ1pcK/lw9P43LJ0BVrBiMhHu 9DPAx6ES7poArawrRBBRAbWurVHWYJ54iyE0tdBxihnv8dbouzQBpJ4xghj/NOrIj1CI 4RHQ== 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=WD7UANVVWh1Z4K+ERaNWSshHykUbX739UMEJYD62aHg=; b=EuVsdx47MfdNxcr8plb0Z+kK/qYtkBEKjbog7LK4ozrGc2394ugIIQXB7sx5fhx2eM uBgPbtQ8mRMFS8TcpaNJSHGFyCs12ie7ZGce7CM7UEs3xWJpD7HPadlrNgwoTVXMxX86 6pgDLqICla06xf73HgpS/3Y+khHC8CjpoXW8wvxT63clzoQ0JXn/ifSti8uFhCoXuY8r 20Dk//D8e9AErCCdTfcn4V1gMjhNz8Rt2gfg7gC7x38zeibOB+X5HsaqsNaVJWoupkSk CjtbSLj1HuuLN5caS8XOz/uIRA2rNqRiWA10daYOePCO02zMhxpN+MY+k/jpb+wl7Fvi eUtQ== X-Gm-Message-State: AGi0PuYBg6I5YyAWt0sueFcSigyJWWOFwjh/sPmcgK39x0+3WlFlb/AP SpnJvW5V1RlG5sao9yzM8A6rVLg7eN06qg== X-Google-Smtp-Source: APiQypJCEVzWuLamNiY2pf3TSXsTd6R9CdyHa68nmf9DvOwyuAdnNIuNHsVzHeNGxN/yCVSSDDcPfQ== X-Received: by 2002:a62:e101:: with SMTP id q1mr4035335pfh.84.1585848005563; Thu, 02 Apr 2020 10:20:05 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 10:20:04 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , matan@mellanox.com, stable@dpdk.org Date: Thu, 2 Apr 2020 10:19:50 -0700 Message-Id: <20200402171953.13356-4-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 3/6] examples/l3fwd: 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 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..110d4cc109d1 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_owner_get(portid, NULL) == 0) { + 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