From: Yongseok Koh <yskoh@mellanox.com>
To: Ido Goshen <ido@cgstowernetworks.com>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>, dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'net/pcap: fix multiple queues' has been queued to LTS release 17.11.4
Date: Thu, 26 Jul 2018 19:09:20 -0700 [thread overview]
Message-ID: <20180727021019.37388-24-yskoh@mellanox.com> (raw)
In-Reply-To: <20180727021019.37388-1-yskoh@mellanox.com>
Hi,
FYI, your patch has been queued to LTS release 17.11.4
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/28/18. So please
shout if anyone has objections.
Thanks.
Yongseok
---
>From abfc2bace9e58f72dd7ca63a7a3133876b0307f4 Mon Sep 17 00:00:00 2001
From: Ido Goshen <ido@cgstowernetworks.com>
Date: Tue, 19 Jun 2018 17:37:25 +0300
Subject: [PATCH] net/pcap: fix multiple queues
[ upstream commit 8ffda7673fa71e6a666963fc0ea4969d65dd09da ]
Change open_rx/tx_pcap/iface functions to open only a single pcap/dumper
and not loop num_of_queue times
The num_of_queue loop is already achieved by the
caller rte_kvargs_process
Fixing:
1. Opens N requested pcaps/dumpers instead of N^2
2. Leak of pcap/dumper's which are being overwritten by
the sequential calls to open_rx/tx_pcap/iface functions
3. Use the filename/iface args per queue and not just the last one
that overwrites the previous names
Fixes: 4c173302c307 ("pcap: add new driver")
Signed-off-by: Ido Goshen <ido@cgstowernetworks.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/pcap/rte_eth_pcap.c | 86 +++++++++++++++++------------------------
1 file changed, 36 insertions(+), 50 deletions(-)
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 39947105b..f71ba001e 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -687,19 +687,19 @@ static const struct eth_dev_ops ops = {
static int
open_rx_pcap(const char *key, const char *value, void *extra_args)
{
- unsigned int i;
const char *pcap_filename = value;
struct pmd_devargs *rx = extra_args;
pcap_t *pcap = NULL;
- for (i = 0; i < rx->num_of_queue; i++) {
- if (open_single_rx_pcap(pcap_filename, &pcap) < 0)
- return -1;
+ if (rx->num_of_queue >= RTE_PMD_PCAP_MAX_QUEUES)
+ return -1;
+ if (open_single_rx_pcap(pcap_filename, &pcap) < 0)
+ return -1;
- rx->queue[i].pcap = pcap;
- rx->queue[i].name = pcap_filename;
- rx->queue[i].type = key;
- }
+ rx->queue[rx->num_of_queue].pcap = pcap;
+ rx->queue[rx->num_of_queue].name = pcap_filename;
+ rx->queue[rx->num_of_queue].type = key;
+ rx->num_of_queue++;
return 0;
}
@@ -711,19 +711,19 @@ open_rx_pcap(const char *key, const char *value, void *extra_args)
static int
open_tx_pcap(const char *key, const char *value, void *extra_args)
{
- unsigned int i;
const char *pcap_filename = value;
struct pmd_devargs *dumpers = extra_args;
pcap_dumper_t *dumper;
- for (i = 0; i < dumpers->num_of_queue; i++) {
- if (open_single_tx_pcap(pcap_filename, &dumper) < 0)
- return -1;
+ if (dumpers->num_of_queue >= RTE_PMD_PCAP_MAX_QUEUES)
+ return -1;
+ if (open_single_tx_pcap(pcap_filename, &dumper) < 0)
+ return -1;
- dumpers->queue[i].dumper = dumper;
- dumpers->queue[i].name = pcap_filename;
- dumpers->queue[i].type = key;
- }
+ dumpers->queue[dumpers->num_of_queue].dumper = dumper;
+ dumpers->queue[dumpers->num_of_queue].name = pcap_filename;
+ dumpers->queue[dumpers->num_of_queue].type = key;
+ dumpers->num_of_queue++;
return 0;
}
@@ -754,18 +754,18 @@ open_rx_tx_iface(const char *key, const char *value, void *extra_args)
static inline int
open_rx_iface(const char *key, const char *value, void *extra_args)
{
- unsigned int i;
const char *iface = value;
struct pmd_devargs *rx = extra_args;
pcap_t *pcap = NULL;
- for (i = 0; i < rx->num_of_queue; i++) {
- if (open_single_iface(iface, &pcap) < 0)
- return -1;
- rx->queue[i].pcap = pcap;
- rx->queue[i].name = iface;
- rx->queue[i].type = key;
- }
+ if (rx->num_of_queue >= RTE_PMD_PCAP_MAX_QUEUES)
+ return -1;
+ if (open_single_iface(iface, &pcap) < 0)
+ return -1;
+ rx->queue[rx->num_of_queue].pcap = pcap;
+ rx->queue[rx->num_of_queue].name = iface;
+ rx->queue[rx->num_of_queue].type = key;
+ rx->num_of_queue++;
return 0;
}
@@ -776,18 +776,18 @@ open_rx_iface(const char *key, const char *value, void *extra_args)
static int
open_tx_iface(const char *key, const char *value, void *extra_args)
{
- unsigned int i;
const char *iface = value;
struct pmd_devargs *tx = extra_args;
pcap_t *pcap;
- for (i = 0; i < tx->num_of_queue; i++) {
- if (open_single_iface(iface, &pcap) < 0)
- return -1;
- tx->queue[i].pcap = pcap;
- tx->queue[i].name = iface;
- tx->queue[i].type = key;
- }
+ if (tx->num_of_queue >= RTE_PMD_PCAP_MAX_QUEUES)
+ return -1;
+ if (open_single_iface(iface, &pcap) < 0)
+ return -1;
+ tx->queue[tx->num_of_queue].pcap = pcap;
+ tx->queue[tx->num_of_queue].name = iface;
+ tx->queue[tx->num_of_queue].type = key;
+ tx->num_of_queue++;
return 0;
}
@@ -977,15 +977,8 @@ pmd_pcap_probe(struct rte_vdev_device *dev)
* We check whether we want to open a RX stream from a real NIC or a
* pcap file
*/
- pcaps.num_of_queue = rte_kvargs_count(kvlist, ETH_PCAP_RX_PCAP_ARG);
- if (pcaps.num_of_queue)
- is_rx_pcap = 1;
- else
- pcaps.num_of_queue = rte_kvargs_count(kvlist,
- ETH_PCAP_RX_IFACE_ARG);
-
- if (pcaps.num_of_queue > RTE_PMD_PCAP_MAX_QUEUES)
- pcaps.num_of_queue = RTE_PMD_PCAP_MAX_QUEUES;
+ is_rx_pcap = rte_kvargs_count(kvlist, ETH_PCAP_RX_PCAP_ARG) ? 1 : 0;
+ pcaps.num_of_queue = 0;
if (is_rx_pcap)
ret = rte_kvargs_process(kvlist, ETH_PCAP_RX_PCAP_ARG,
@@ -1001,15 +994,8 @@ pmd_pcap_probe(struct rte_vdev_device *dev)
* We check whether we want to open a TX stream to a real NIC or a
* pcap file
*/
- dumpers.num_of_queue = rte_kvargs_count(kvlist, ETH_PCAP_TX_PCAP_ARG);
- if (dumpers.num_of_queue)
- is_tx_pcap = 1;
- else
- dumpers.num_of_queue = rte_kvargs_count(kvlist,
- ETH_PCAP_TX_IFACE_ARG);
-
- if (dumpers.num_of_queue > RTE_PMD_PCAP_MAX_QUEUES)
- dumpers.num_of_queue = RTE_PMD_PCAP_MAX_QUEUES;
+ is_tx_pcap = rte_kvargs_count(kvlist, ETH_PCAP_TX_PCAP_ARG) ? 1 : 0;
+ dumpers.num_of_queue = 0;
if (is_tx_pcap)
ret = rte_kvargs_process(kvlist, ETH_PCAP_TX_PCAP_ARG,
--
2.11.0
next prev parent reply other threads:[~2018-07-27 2:11 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-27 2:08 [dpdk-stable] patch 'net/qede: fix VF MTU update' " Yongseok Koh
2018-07-27 2:08 ` [dpdk-stable] patch 'net/mvpp2: check pointer before using it' " Yongseok Koh
2018-07-27 2:08 ` [dpdk-stable] patch 'net/qede: fix link change event notification' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/bnxt: add missing ids in xstats' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/ena: fix GENMASK_ULL macro' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/nfp: fix field initialization in Tx descriptor' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/bonding: always update bonding link status' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/bonding: fix MAC address reset' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/mlx5: fix crash in device probe' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'eventdev: fix port in Rx adapter internal function' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'eventdev: fix missing update to Rx adaper WRR position' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'eventdev: add event buffer flush in Rx adapter' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'eventdev: fix internal port logic " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'eventdev: fix Rx SW adapter stop' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'bus/dpaa: fix build' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'kni: fix build with gcc 8.1' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/ixgbe: add support for VLAN in IP mode FDIR' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/ixgbe: fix tunnel id format error for " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/ixgbe: fix tunnel type set " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/ixgbe: fix mask bits register " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/i40e: fix shifts of 32-bit value' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'app/testpmd: fix VLAN TCI mask set error for FDIR' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/i40e: workaround performance degradation' " Yongseok Koh
2018-07-27 2:09 ` Yongseok Koh [this message]
2018-07-27 2:09 ` [dpdk-stable] patch 'net/thunderx: fix build with gcc optimization on' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/qede: fix legacy interrupt mode' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/qede: remove primary MAC removal' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/ena: fix SIGFPE with 0 Rx queue' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/mlx5: fix Rx buffer replenishment threshold' " Yongseok Koh
2018-07-27 2:09 ` [dpdk-stable] patch 'net/bnxt: fix HW Tx checksum offload check' " Yongseok Koh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180727021019.37388-24-yskoh@mellanox.com \
--to=yskoh@mellanox.com \
--cc=ferruh.yigit@intel.com \
--cc=ido@cgstowernetworks.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).