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 05937A2EEB for ; Mon, 7 Oct 2019 18:53:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B37BD1D172; Mon, 7 Oct 2019 18:52:50 +0200 (CEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id C7AF61D14B for ; Mon, 7 Oct 2019 18:52:44 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id h195so9028311pfe.5 for ; Mon, 07 Oct 2019 09:52:44 -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=gK1gfSTtDiveUg2rvONozxMW7EsdJv6dQhvvDqdmx4w=; b=G32iCTaXMq3Im9mnf44IuUoaSYJKkeJhAaCUeid7oMK0ftXRoyIMkQAQTqsW5hPy5r W7k0RyqvlEjg/pbtY8sjoiorU/eZtsPASiynAYNsLeThE2leicLFU6GTOKC9oZCMOKlo mlB15jpuiC2kRrv5TvrVJ1qWrinqzuWAhQPBUUWQacJGtuz9l5mCqstQ0/vqgwTL1ozX +Qx/FT1SvP4qz3kVmZL1uQ/uhoN94qagVBhZ6CwOCzyr3d6UVpasHzqoX5KXUh9b5SVn CIXwQfLA4HCbFfOcRgvqXc4/tVdGPIRtpcndda47PxdS6C9B0D9cM/zQgmodFv4zHvVS vqqg== 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=gK1gfSTtDiveUg2rvONozxMW7EsdJv6dQhvvDqdmx4w=; b=ItKZennzK67nKUiLP+77tiKONINIiLixCsWNC87QJSyhPOc17+thcj819vIHIazXv8 fwUr0LvDx0arrW9N6E4x/d0FpsDTlbsy8kmv/MILn515OKoXkKaV19dVHNnlyy0FdOnm MEBaVjiUfVBMeTwIZqfx0rJ7giO51K7toUdUOTKC0jpozW4ugPLMU5GfotFhFL1l3Qqn XK98p7WL3fU5OjBelDcXtoln67X+lxtmANlEMFaTupzIONmYrZIg3wwA9eRDIzdyHkp/ 1LGkl1754mqKmGp8AYMdFpJtO9eOY5FiPXXVliGy1UzRec8PW/dv6KsEL/rq91hJueqp LbLQ== X-Gm-Message-State: APjAAAVfFobobtOZ72TMwYkd5H69c8k8NLJpLPCSix3iJCGWfDuFyTWI MwNpYeB+ENl/vUz2mp6MKgERM5KlOey4fw== X-Google-Smtp-Source: APXvYqwzTKDIYz7D5s0AuBdqvF+fkKcujQ3hLygKQyIIWYo2YtFbsVIHlxcbip6eATcPYc9+bVIOTw== X-Received: by 2002:a17:90a:1c7:: with SMTP id 7mr234961pjd.95.1570467163632; Mon, 07 Oct 2019 09:52:43 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id w5sm15920979pfn.96.2019.10.07.09.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2019 09:52:43 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Mon, 7 Oct 2019 09:52:27 -0700 Message-Id: <20191007165232.14535-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191007165232.14535-1-stephen@networkplumber.org> References: <20191007165232.14535-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC 3/8] pdump: tag copied mbuf with port 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" Set the port when packets go into ring, so same ring can be used for multiple ports. Signed-off-by: Stephen Hemminger --- lib/librte_pdump/rte_pdump.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c index cfb8be7ca227..830decef91e2 100644 --- a/lib/librte_pdump/rte_pdump.c +++ b/lib/librte_pdump/rte_pdump.c @@ -68,9 +68,9 @@ static struct pdump_rxtx_cbs { } rx_cbs[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT], tx_cbs[RTE_MAX_ETHPORTS][RTE_MAX_QUEUES_PER_PORT]; - -static inline void -pdump_copy(struct rte_mbuf **pkts, uint16_t nb_pkts, void *user_params) +static void +pdump_copy(uint16_t port, struct rte_mbuf **pkts, + uint16_t nb_pkts, void *user_params) { unsigned i; int ring_enq; @@ -86,8 +86,10 @@ pdump_copy(struct rte_mbuf **pkts, uint16_t nb_pkts, void *user_params) mp = cbs->mp; for (i = 0; i < nb_pkts; i++) { p = rte_pktmbuf_copy(pkts[i], mp, 0, UINT32_MAX); - if (p) + if (p) { + p->port = port; dup_bufs[d_pkts++] = p; + } } ring_enq = rte_ring_enqueue_burst(ring, (void *)dup_bufs, d_pkts, NULL); @@ -101,20 +103,20 @@ pdump_copy(struct rte_mbuf **pkts, uint16_t nb_pkts, void *user_params) } static uint16_t -pdump_rx(uint16_t port __rte_unused, uint16_t qidx __rte_unused, +pdump_rx(uint16_t port, uint16_t qidx __rte_unused, struct rte_mbuf **pkts, uint16_t nb_pkts, uint16_t max_pkts __rte_unused, void *user_params) { - pdump_copy(pkts, nb_pkts, user_params); + pdump_copy(port, pkts, nb_pkts, user_params); return nb_pkts; } static uint16_t -pdump_tx(uint16_t port __rte_unused, uint16_t qidx __rte_unused, +pdump_tx(uint16_t port, uint16_t qidx __rte_unused, struct rte_mbuf **pkts, uint16_t nb_pkts, void *user_params) { - pdump_copy(pkts, nb_pkts, user_params); + pdump_copy(port, pkts, nb_pkts, user_params); return nb_pkts; } -- 2.20.1