summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-04-12 16:32:04 +0200
committerJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-04-12 16:32:04 +0200
commit1dba5c7779bca87317c21bc33c21b7d9c733f91c (patch)
tree812e8d6782ed397b027e6b76cb54e87f2813704e
parent155c2a7183d92fc522b99d17440f1369557ea844 (diff)
parent9c078b3f3d53cc90ead63898f66b26c047f0f0ea (diff)
downloaddpdk-burst-replay-1dba5c7779bca87317c21bc33c21b7d9c733f91c.zip
dpdk-burst-replay-1dba5c7779bca87317c21bc33c21b7d9c733f91c.tar.gz
dpdk-burst-replay-1dba5c7779bca87317c21bc33c21b7d9c733f91c.tar.xz
Merge remote-tracking branch 'origin/master' into wip-big-mempool-allocation
-rw-r--r--DPDK_Makefile2
-rw-r--r--README.md2
-rw-r--r--docs/src/readme.rst2
-rw-r--r--src/dpdk.c23
-rw-r--r--src/main.c19
-rw-r--r--src/main.h5
6 files changed, 30 insertions, 23 deletions
diff --git a/DPDK_Makefile b/DPDK_Makefile
index e7d715a..b1eafc5 100644
--- a/DPDK_Makefile
+++ b/DPDK_Makefile
@@ -21,6 +21,6 @@ SRCS-y := src/main.c \
src/pcap.c \
src/utils.c
-LDFLAGS += -lpcap -lm -lnuma
+LDFLAGS += -lm -lnuma
include $(RTE_SDK)/mk/rte.extapp.mk
diff --git a/README.md b/README.md
index 15af781..b1751ac 100644
--- a/README.md
+++ b/README.md
@@ -42,6 +42,8 @@ Example:
* Be able to send dumps simultaneously on both numacores.
* Split big pkts into multiple mbufs.
* Add a Python module to facilitate scripting (something like what does scapy for tcpreplay sendpfast func).
+* Manage systems with more than 2 numa cores.
+* Use the maximum NICs capabilities (Tx queues/descriptors).
## BSD LICENCE
diff --git a/docs/src/readme.rst b/docs/src/readme.rst
index 043e80b..0f94d06 100644
--- a/docs/src/readme.rst
+++ b/docs/src/readme.rst
@@ -59,6 +59,8 @@ TODO
* Be able to send dumps simultaneously on both numacores.
* Split big pkts into multiple mbufs.
* Add a Python module to facilitate scripting (something like what does scapy for tcpreplay sendpfast func).
+* Manage systems with more than 2 numa cores.
+* Use the maximum NICs capabilities (Tx queues/descriptors).
BSD LICENCE
-----------
diff --git a/src/dpdk.c b/src/dpdk.c
index 123eb7d..955763b 100644
--- a/src/dpdk.c
+++ b/src/dpdk.c
@@ -25,23 +25,11 @@ static struct rte_eth_conf ethconf = {
.link_duplex = 0, // autonegociated link mode
#endif
.rxmode = {
- // Multi queue packet routing mode. We wont use DPDK RSS scaling for now,
- // we will use our own ashkey
.mq_mode = ETH_MQ_RX_NONE,
- // Default maximum frame length. Whenever this is > ETHER_MAX_LEN,
- // jumbo_frame has to be set to 1
- .max_rx_pkt_len = 9000,
- .split_hdr_size = 0, // Disable header split
- .header_split = 0, // Disable header split
- .hw_ip_checksum = 0, // Disable ip checksum
- .hw_vlan_filter = 0, // Disable vlan filtering
- .jumbo_frame = 1, // Enable Jumbo frame
- .hw_strip_crc = 0, // Disable hardware CRC stripping
},
.txmode = {
- .mq_mode = ETH_MQ_TX_NONE, // Multi queue packet routing mode. We wont use
- // DPDK RSS scaling for now, we will use our own ashkey
+ .mq_mode = ETH_MQ_TX_NONE, // Multi queue packet routing mode.
},
.fdir_conf = {
@@ -184,7 +172,12 @@ int init_dpdk_eal_mempool(const struct cmd_opts* opts,
if (!opts || !cpus || !dpdk)
return (EINVAL);
+ /* API BREAKAGE ON 17.05 */
+#if API_OLDEST_THAN(17, 05)
+ rte_set_log_level(RTE_LOG_ERR);
+#else /* if DPDK >= 17.05 */
rte_log_set_global_level(RTE_LOG_ERR);
+#endif
/* craft an eal arg list */
eal_args = fill_eal_args(opts, cpus, dpdk, &eal_args_ac);
@@ -214,7 +207,11 @@ int init_dpdk_eal_mempool(const struct cmd_opts* opts,
}
/* check that dpdk detects all wanted/needed NIC ports */
+#if API_OLDEST_THAN(18, 05) /* API BREAKAGE ON 18.05 */
nb_ports = rte_eth_dev_count();
+#else /* if DPDK >= 18.05 */
+ nb_ports = rte_eth_dev_count_avail();
+#endif
if (nb_ports != cpus->nb_needed_cpus) {
printf("%s error: wanted %u NIC ports, found %u\n", __FUNCTION__,
cpus->nb_needed_cpus, nb_ports);
diff --git a/src/main.c b/src/main.c
index 7d27b82..ebe7a2b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -16,14 +16,15 @@
void usage(void)
{
- puts("dpdk-replay [options] pcap_file port1[,portx...]\n"
- "pcap_file: the file to send through the DPDK ports.\n"
- "port1[,portx...] : specify the list of ports to be used (pci addresses).\n"
+ puts("dpdk-replay [OPTIONS] PCAP_FILE PORT1[,PORTX...]\n"
+ "PCAP_FILE: the file to send through the DPDK ports.\n"
+ "PORT1[,PORTX...] : specify the list of ports to be used (pci addresses).\n"
"Options:\n"
- "--numacore numacore : use cores only if it fits the wanted numa.\n"
- "--nbruns X : set the wanted number of replay (1 by default). Set to 0 to infinite mode.\n"
- "--wait-enter: will wait until you press ENTER to start the replay (asked \n"
- " once all the initialization are done)"
+ "--numacore <NUMA-CORE> : use cores from the desired NUMA. Only\n"
+ " NICs on the selected numa core will be available (default is 0).\n"
+ "--nbruns <1-N> : set the wanted number of replay (1 by default).\n"
+ "--wait-enter: will wait until you press ENTER to start the replay (asked\n"
+ " once all the initialization are done)."
/* TODO: */
/* "[--maxbitrate bitrate]|[--normalspeed] : bitrate not to be exceeded (default: no limit) in ko/s.\n" */
/* " specify --normalspeed to replay the trace with the good timings." */
@@ -107,7 +108,7 @@ int parse_options(const int ac, char** av, struct cmd_opts* opts)
return (ENOENT);
nc = atoi(av[i + 1]);
- if (nc < 0 || nc > 127)
+ if (nc < 0 || nc > 2)
return (ENOENT);
opts->numacore = (char)nc;
i++;
@@ -120,7 +121,7 @@ int parse_options(const int ac, char** av, struct cmd_opts* opts)
if (i + 1 >= ac - 2)
return (ENOENT);
opts->nbruns = atoi(av[i + 1]);
- if (opts->nbruns < 0)
+ if (opts->nbruns <= 0)
return (EPROTO);
i++;
continue;
diff --git a/src/main.h b/src/main.h
index 6c5ec28..7c3dac8 100644
--- a/src/main.h
+++ b/src/main.h
@@ -26,6 +26,11 @@
#define max(x, y) (x > y ? x : y)
#endif /* max */
+#define API_OLDEST_THAN(year, month) \
+ ((defined RTE_VER_YEAR && RTE_VER_YEAR == year \
+ && defined RTE_VER_MONTH && RTE_VER_MONTH < month) \
+ || defined RTE_VER_YEAR && RTE_VER_YEAR < year)
+
/* struct to store the command line args */
struct cmd_opts {
char** pcicards;