From: Ferruh Yigit <ferruh.yigit@intel.com>
To: qi.z.zhang@intel.com
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>,
xueqin.lin@intel.com
Subject: [dpdk-dev] [PATCH] net/pcap: fix pcap handlers for secondary
Date: Tue, 13 Nov 2018 17:11:01 +0000 [thread overview]
Message-ID: <20181113171101.40212-1-ferruh.yigit@intel.com> (raw)
In-Reply-To: <861c43b2-a082-fdf8-61b9-2df1f4ed919c@intel.com>
The intension in NOT to make a complete patch, this is to just for input
to discussion.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/net/pcap/rte_eth_pcap.c | 61 ++++++++++++++++++++++++++++-----
1 file changed, 52 insertions(+), 9 deletions(-)
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 7bbe72e25..3bc174841 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -81,6 +81,7 @@ struct pmd_internals {
int if_index;
int single_iface;
int phy_mac;
+ char devargs[ETH_PCAP_ARG_MAXLEN];
};
struct pmd_devargs {
@@ -934,6 +935,8 @@ pmd_init_internals(struct rte_vdev_device *vdev,
*/
(*eth_dev)->dev_ops = &ops;
+ strlcpy((*internals)->devargs, rte_vdev_device_args(vdev), ETH_PCAP_ARG_MAXLEN);
+
return 0;
}
@@ -1123,21 +1126,24 @@ pmd_pcap_probe(struct rte_vdev_device *dev)
hz = rte_get_timer_hz();
if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+ struct pmd_internals *internals;
+
eth_dev = rte_eth_dev_attach_secondary(name);
if (!eth_dev) {
PMD_LOG(ERR, "Failed to probe %s", name);
return -1;
}
- /* TODO: request info from primary to set up Rx and Tx */
- eth_dev->dev_ops = &ops;
- eth_dev->device = &dev->device;
- rte_eth_dev_probing_finish(eth_dev);
- return 0;
- }
- kvlist = rte_kvargs_parse(rte_vdev_device_args(dev), valid_arguments);
- if (kvlist == NULL)
- return -1;
+ internals = eth_dev->data->dev_private;
+
+ kvlist = rte_kvargs_parse(internals->devargs, valid_arguments);
+ if (kvlist == NULL)
+ return -1;
+ } else {
+ kvlist = rte_kvargs_parse(rte_vdev_device_args(dev), valid_arguments);
+ if (kvlist == NULL)
+ return -1;
+ }
/*
* If iface argument is passed we open the NICs and use them for
@@ -1202,6 +1208,43 @@ pmd_pcap_probe(struct rte_vdev_device *dev)
goto free_kvlist;
create_eth:
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+ struct pmd_internals *internals = eth_dev->data->dev_private;
+ unsigned int i;
+
+ /* TODO: request info from primary to set up Rx and Tx */
+ eth_dev->dev_ops = &ops;
+ eth_dev->device = &dev->device;
+
+ for (i = 0; i < pcaps.num_of_queue; i++) {
+ struct pcap_rx_queue *rx = &internals->rx_queue[i];
+ struct devargs_queue *queue = &pcaps.queue[i];
+
+ rx->pcap = queue->pcap;
+ snprintf(rx->name, sizeof(rx->name), "%s", queue->name);
+ snprintf(rx->type, sizeof(rx->type), "%s", queue->type);
+ }
+
+ for (i = 0; i < dumpers.num_of_queue; i++) {
+ struct pcap_tx_queue *tx = &internals->tx_queue[i];
+ struct devargs_queue *queue = &dumpers.queue[i];
+
+ tx->dumper = queue->dumper;
+ tx->pcap = queue->pcap;
+ snprintf(tx->name, sizeof(tx->name), "%s", queue->name);
+ snprintf(tx->type, sizeof(tx->type), "%s", queue->type);
+ }
+
+ eth_dev->rx_pkt_burst = eth_pcap_rx;
+ if (is_tx_pcap)
+ eth_dev->tx_pkt_burst = eth_pcap_tx_dumper;
+ else
+ eth_dev->tx_pkt_burst = eth_pcap_tx;
+
+ rte_eth_dev_probing_finish(eth_dev);
+ return 0;
+ }
+
ret = eth_from_pcaps(dev, &pcaps, pcaps.num_of_queue, &dumpers,
dumpers.num_of_queue, single_iface, is_tx_pcap);
--
2.17.2
next prev parent reply other threads:[~2018-11-13 17:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-05 21:08 [dpdk-dev] [PATCH] net/pcap: enable data path on secondary Qi Zhang
2018-11-09 21:13 ` Ferruh Yigit
2018-11-09 21:24 ` Zhang, Qi Z
2018-11-12 16:51 ` [dpdk-dev] [PATCH v2] " Qi Zhang
2018-11-13 16:56 ` Ferruh Yigit
2018-11-13 17:11 ` Ferruh Yigit [this message]
2018-11-13 17:14 ` Thomas Monjalon
2018-11-13 18:27 ` Zhang, Qi Z
2018-11-13 18:43 ` Ferruh Yigit
2018-11-13 19:18 ` Zhang, Qi Z
2018-11-14 19:56 ` [dpdk-dev] [PATCH v3 0/2] fix pcap handlers for secondary Qi Zhang
2018-11-14 19:56 ` [dpdk-dev] [PATCH v3 1/2] net/pcap: move pcap handler to process private Qi Zhang
2018-11-14 23:05 ` Ferruh Yigit
2018-11-15 0:13 ` Zhang, Qi Z
2018-11-14 19:56 ` [dpdk-dev] [PATCH v3 2/2] net/pcap: enable data path for secondary Qi Zhang
2018-11-14 23:08 ` Ferruh Yigit
2018-11-15 0:06 ` Zhang, Qi Z
2018-11-15 1:37 ` [dpdk-dev] [PATCH v4 0/2] fix pcap handlers " Qi Zhang
2018-11-15 1:37 ` [dpdk-dev] [PATCH v4 1/2] net/pcap: move pcap handler to process private Qi Zhang
2018-11-16 15:56 ` Ferruh Yigit
2018-11-15 1:37 ` [dpdk-dev] [PATCH v4 2/2] net/pcap: enable data path for secondary Qi Zhang
2018-11-16 14:54 ` [dpdk-dev] [PATCH v4 0/2] fix pcap handlers " Ferruh Yigit
2018-11-16 16:12 ` Ferruh Yigit
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=20181113171101.40212-1-ferruh.yigit@intel.com \
--to=ferruh.yigit@intel.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@intel.com \
--cc=xueqin.lin@intel.com \
/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).