#include <stdint.h>
#include <unistd.h>
#include <inttypes.h>
+#include <arpa/inet.h>
#include <rte_common.h>
#include <rte_byteorder.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
#include <rte_string_fns.h>
-#ifdef RTE_LIBRTE_CMDLINE
-#include <cmdline_parse.h>
-#include <cmdline_parse_etheraddr.h>
-#endif
#ifdef RTE_LIBRTE_PMD_BOND
#include <rte_eth_bond.h>
#endif
#ifdef RTE_LIBRTE_CMDLINE
"--eth-peers-configfile= | "
"--eth-peer=X,M:M:M:M:M:M | "
+ "--tx-ip=SRC,DST | --tx-udp=PORT | "
#endif
"--pkt-filter-mode= |"
"--rss-ip | --rss-udp | "
printf(" --txonly-multi-flow: generate multiple flows in txonly mode\n");
printf(" --disable-link-check: disable check on link status when "
"starting/stopping ports.\n");
+ printf(" --disable-device-start: do not automatically start port\n");
printf(" --no-lsc-interrupt: disable link status change interrupt.\n");
printf(" --no-rmv-interrupt: disable device removal interrupt.\n");
printf(" --bitrate-stats=N: set the logical core N to perform "
if (fgets(buf, sizeof(buf), config_file) == NULL)
break;
- if (cmdline_parse_etheraddr(NULL, buf, &peer_eth_addrs[i],
- sizeof(peer_eth_addrs[i])) < 0) {
+ if (rte_ether_unformat_addr(buf, &peer_eth_addrs[i]) < 0) {
printf("Bad MAC address format on line %d\n", i+1);
fclose(config_file);
return -1;
{ "txpkts", 1, 0, 0 },
{ "txonly-multi-flow", 0, 0, 0 },
{ "disable-link-check", 0, 0, 0 },
+ { "disable-device-start", 0, 0, 0 },
{ "no-lsc-interrupt", 0, 0, 0 },
{ "no-rmv-interrupt", 0, 0, 0 },
{ "print-event", 1, 0, 0 },
{ "mlockall", 0, 0, 0 },
{ "no-mlockall", 0, 0, 0 },
{ "mp-alloc", 1, 0, 0 },
+ { "tx-ip", 1, 0, 0 },
+ { "tx-udp", 1, 0, 0 },
{ "noisy-tx-sw-buffer-size", 1, 0, 0 },
{ "noisy-tx-sw-buffer-flushtime", 1, 0, 0 },
{ "noisy-lkup-memory", 1, 0, 0 },
}
if (!strcmp(lgopts[opt_idx].name, "eth-peer")) {
char *port_end;
- uint8_t c, peer_addr[6];
errno = 0;
n = strtoul(optarg, &port_end, 10);
"eth-peer: port %d >= RTE_MAX_ETHPORTS(%d)\n",
n, RTE_MAX_ETHPORTS);
- if (cmdline_parse_etheraddr(NULL, port_end,
- &peer_addr, sizeof(peer_addr)) < 0)
+ if (rte_ether_unformat_addr(port_end,
+ &peer_eth_addrs[n]) < 0)
rte_exit(EXIT_FAILURE,
"Invalid ethernet address: %s\n",
port_end);
- for (c = 0; c < 6; c++)
- peer_eth_addrs[n].addr_bytes[c] =
- peer_addr[c];
nb_peer_eth_addrs++;
}
#endif
+ if (!strcmp(lgopts[opt_idx].name, "tx-ip")) {
+ struct in_addr in;
+ char *end;
+
+ end = strchr(optarg, ',');
+ if (end == optarg || !end)
+ rte_exit(EXIT_FAILURE,
+ "Invalid tx-ip: %s", optarg);
+
+ *end++ = 0;
+ if (inet_aton(optarg, &in) == 0)
+ rte_exit(EXIT_FAILURE,
+ "Invalid source IP address: %s\n",
+ optarg);
+ tx_ip_src_addr = rte_be_to_cpu_32(in.s_addr);
+
+ if (inet_aton(end, &in) == 0)
+ rte_exit(EXIT_FAILURE,
+ "Invalid destination IP address: %s\n",
+ optarg);
+ tx_ip_dst_addr = rte_be_to_cpu_32(in.s_addr);
+ }
+ if (!strcmp(lgopts[opt_idx].name, "tx-udp")) {
+ char *end = NULL;
+
+ errno = 0;
+ n = strtoul(optarg, &end, 10);
+ if (errno != 0 || end == optarg ||
+ n > UINT16_MAX ||
+ !(*end == '\0' || *end == ','))
+ rte_exit(EXIT_FAILURE,
+ "Invalid UDP port: %s\n",
+ optarg);
+ tx_udp_src_port = n;
+ if (*end == ',') {
+ char *dst = end + 1;
+
+ n = strtoul(dst, &end, 10);
+ if (errno != 0 || end == dst ||
+ n > UINT16_MAX || *end)
+ rte_exit(EXIT_FAILURE,
+ "Invalid destination UDP port: %s\n",
+ dst);
+ tx_udp_dst_port = n;
+ } else {
+ tx_udp_dst_port = n;
+ }
+
+ }
if (!strcmp(lgopts[opt_idx].name, "nb-ports")) {
n = atoi(optarg);
if (n > 0 && n <= nb_ports)
}
if (!strcmp(lgopts[opt_idx].name, "max-pkt-len")) {
n = atoi(optarg);
- if (n >= ETHER_MIN_LEN) {
+ if (n >= RTE_ETHER_MIN_LEN) {
rx_mode.max_rx_pkt_len = (uint32_t) n;
- if (n > ETHER_MAX_LEN)
+ if (n > RTE_ETHER_MAX_LEN)
rx_offloads |=
DEV_RX_OFFLOAD_JUMBO_FRAME;
} else
rte_exit(EXIT_FAILURE,
"Invalid max-pkt-len=%d - should be > %d\n",
- n, ETHER_MIN_LEN);
+ n, RTE_ETHER_MIN_LEN);
}
if (!strcmp(lgopts[opt_idx].name, "pkt-filter-mode")) {
if (!strcmp(optarg, "signature"))
no_flush_rx = 1;
if (!strcmp(lgopts[opt_idx].name, "disable-link-check"))
no_link_check = 1;
+ if (!strcmp(lgopts[opt_idx].name, "disable-device-start"))
+ no_device_start = 1;
if (!strcmp(lgopts[opt_idx].name, "no-lsc-interrupt"))
lsc_interrupt = 0;
if (!strcmp(lgopts[opt_idx].name, "no-rmv-interrupt"))