DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Error in adding vdev for packet capture from secondary process
@ 2018-10-30 13:06 Sunil Kumar Kori
  0 siblings, 0 replies; only message in thread
From: Sunil Kumar Kori @ 2018-10-30 13:06 UTC (permalink / raw)
  To: dev

Hello Team,

I have an application (DPDK secondary process) which is required to capture
packet into PCAP file.

As I have gone through *dpdk-pdump* application, I came to know that pcap
driver receives packets from virtual Ethernet device and place them into a
.pcap file.

For the same purpose I did the following code changes:

static bool pdump_vdev_create(void)
{
#define SIZE 64
char vdev_name[SIZE];
char vdev_args[SIZE];
uint16_t portid;
struct ether_addr addr;
const uint16_t rxrings = 0, txrings = 1;
uint16_t q = 0;
struct rte_eth_conf port_conf_default;
int ret;

snprintf(vdev_name, strlen("pdump-vdev") + 1, "%s", "pdump-vdev");
snprintf(vdev_args, strlen("tx_pcap=report.pcap") + 1, "tx_pcap=%s",
"report.pcap");
ret = rte_eal_hotplug_add("vdev", vdev_name, vdev_args);
if (ret < 0)
error message;

if (rte_eth_dev_get_port_by_name(vdev_name, &portid) < 0) {
rte_eal_hotplug_remove("vdev", vdev_name);
error message;
}

memset(&port_conf_default, 0, sizeof(struct rte_eth_conf));
if (rte_eth_dev_configure(portid, rxrings, txrings, &port_conf_default) <
0) {
                rte_eal_hotplug_remove("vdev", vdev_name);
                error message;
    }

if (rte_eth_tx_queue_setup(portid, q, 512, rte_eth_dev_socket_id(portid),
NULL) < 0) {
                rte_eal_hotplug_remove("vdev", vdev_name);
                error message;
    }

if (rte_eth_dev_start(portid) < 0) {
                rte_eal_hotplug_remove("vdev", vdev_name);
                error message;
    }
rte_eth_promiscuous_enable(portid);
pdump_dev_id = portid;
return true;
}

But first API (rte_eal_hotplug_add) call gets failed. Return error code =
-2.

*dpdk-pdump* vs *my_application:*
*1. **dpdk-pdump *captures packets received from NIC while *my_application*
captures packets received from rte_ring.

Can someone point out that what mistake is done ?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-30 13:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30 13:06 [dpdk-dev] Error in adding vdev for packet capture from secondary process Sunil Kumar Kori

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).