From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6345A43699 for ; Thu, 7 Dec 2023 12:21:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5EC1B42EF4; Thu, 7 Dec 2023 12:21:40 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id CA02F4025C for ; Thu, 7 Dec 2023 12:21:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701948097; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xVbL/jrgsSrvUznDsf/pl1b99PpZOowjmg8GkXr3lkk=; b=RwZ8clbRee/wkWCUXHjxlDF6IhbR10Q+4mNimFCCWhKdjRHEEbsLEDUkrReV8efMeq42/p 7X/MGvDBVaLax3fH86wuFLH0uCloVU30aVXUX8UKTA8K/yPd/1lmb9tiM3ydwAFONUO4hR nL6CGsEzNdZzHyzX9Plrj9/NSvJ87f0= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-j0ABBviKO3GjbdbYbdQHiA-1; Thu, 07 Dec 2023 06:21:36 -0500 X-MC-Unique: j0ABBviKO3GjbdbYbdQHiA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9EF6729ABA34; Thu, 7 Dec 2023 11:21:35 +0000 (UTC) Received: from rh.Home (unknown [10.39.192.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8785C15E6C; Thu, 7 Dec 2023 11:21:34 +0000 (UTC) From: Kevin Traynor To: Stephen Hemminger Cc: Isaac Boukris , dpdk stable Subject: patch 'app/dumpcap: allow multiple invocations' has been queued to stable release 21.11.6 Date: Thu, 7 Dec 2023 11:21:01 +0000 Message-ID: <20231207112116.769502-9-ktraynor@redhat.com> In-Reply-To: <20231207112116.769502-1-ktraynor@redhat.com> References: <20231207112116.769502-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/12/23. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/952d7028792c77ad14e64bb596fb005c48f274ee Thanks. Kevin --- >From 952d7028792c77ad14e64bb596fb005c48f274ee Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 17 Nov 2023 08:35:56 -0800 Subject: [PATCH] app/dumpcap: allow multiple invocations [ upstream commit e0235c0e4d40a6d93dfef8b1316e03c32f2f8b43 ] If dumpcap is run twice with each instance pointing a different interface, it would fail because of overlap in ring a pool names. Fix by putting process id in the name. It is still not allowed to do multiple invocations on the same interface because only one callback is allowed and only one copy of mbuf is done. Dumpcap will fail with error in this case: pdump_prepare_client_request(): client request for pdump enable/disable failed EAL: Error - exiting with code: 1 Cause: Packet dump enable on 0:net_null0 failed File exists Fixes: cbb44143be74 ("app/dumpcap: add new packet capture application") Reported-by: Isaac Boukris Signed-off-by: Stephen Hemminger --- app/dumpcap/main.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c index 4a76cc3d05..74dd72b3ac 100644 --- a/app/dumpcap/main.c +++ b/app/dumpcap/main.c @@ -45,5 +45,4 @@ #include -#define RING_NAME "capture-ring" #define MONITOR_INTERVAL (500 * 1000) #define MBUF_POOL_CACHE_SIZE 32 @@ -540,4 +539,5 @@ static struct rte_ring *create_ring(void) { struct rte_ring *ring; + char ring_name[RTE_RING_NAMESIZE]; size_t size, log2; @@ -553,12 +553,14 @@ static struct rte_ring *create_ring(void) } - ring = rte_ring_lookup(RING_NAME); - if (ring == NULL) { - ring = rte_ring_create(RING_NAME, ring_size, - rte_socket_id(), 0); - if (ring == NULL) - rte_exit(EXIT_FAILURE, "Could not create ring :%s\n", - rte_strerror(rte_errno)); - } + /* Want one ring per invocation of program */ + snprintf(ring_name, sizeof(ring_name), + "dumpcap-%d", getpid()); + + ring = rte_ring_create(ring_name, ring_size, + rte_socket_id(), 0); + if (ring == NULL) + rte_exit(EXIT_FAILURE, "Could not create ring :%s\n", + rte_strerror(rte_errno)); + return ring; } @@ -566,11 +568,9 @@ static struct rte_ring *create_ring(void) static struct rte_mempool *create_mempool(void) { - static const char pool_name[] = "capture_mbufs"; + char pool_name[RTE_MEMPOOL_NAMESIZE]; size_t num_mbufs = 2 * ring_size; struct rte_mempool *mp; - mp = rte_mempool_lookup(pool_name); - if (mp) - return mp; + snprintf(pool_name, sizeof(pool_name), "capture_%d", getpid()); mp = rte_pktmbuf_pool_create_by_ops(pool_name, num_mbufs, -- 2.43.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-12-07 11:18:59.837862786 +0000 +++ 0009-app-dumpcap-allow-multiple-invocations.patch 2023-12-07 11:18:59.620873903 +0000 @@ -1 +1 @@ -From e0235c0e4d40a6d93dfef8b1316e03c32f2f8b43 Mon Sep 17 00:00:00 2001 +From 952d7028792c77ad14e64bb596fb005c48f274ee Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e0235c0e4d40a6d93dfef8b1316e03c32f2f8b43 ] + @@ -19 +20,0 @@ -Cc: stable@dpdk.org @@ -24,2 +25,2 @@ - app/dumpcap/main.c | 28 ++++++++++++++-------------- - 1 file changed, 14 insertions(+), 14 deletions(-) + app/dumpcap/main.c | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) @@ -28 +29 @@ -index 4f581bd341..d05dddac00 100644 +index 4a76cc3d05..74dd72b3ac 100644 @@ -37 +38 @@ -@@ -648,4 +647,5 @@ static struct rte_ring *create_ring(void) +@@ -540,4 +539,5 @@ static struct rte_ring *create_ring(void) @@ -43 +44 @@ -@@ -661,12 +661,14 @@ static struct rte_ring *create_ring(void) +@@ -553,12 +553,14 @@ static struct rte_ring *create_ring(void) @@ -66 +67,2 @@ -@@ -675,12 +677,10 @@ static struct rte_mempool *create_mempool(void) +@@ -566,11 +568,9 @@ static struct rte_ring *create_ring(void) + static struct rte_mempool *create_mempool(void) @@ -68 +69,0 @@ - const struct interface *intf; @@ -73 +73,0 @@ - uint32_t data_size = 128; @@ -80,8 +80 @@ - /* Common pool so size mbuf for biggest snap length */ -@@ -827,5 +827,5 @@ static void enable_pdump(struct rte_ring *r, struct rte_mempool *mp) - "Packet dump enable on %u:%s failed %s\n", - intf->port, intf->name, -- rte_strerror(-ret)); -+ rte_strerror(rte_errno)); - } - + mp = rte_pktmbuf_pool_create_by_ops(pool_name, num_mbufs,