[dpdk-dev] Error in adding vdev for packet capture from secondary process
Sunil Kumar Kori
sunilkumarkori1985 at gmail.com
Tue Oct 30 14:06:58 CET 2018
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 ?
More information about the dev
mailing list