#include <rte_ethdev.h>
#include <rte_byteorder.h>
#include <cmdline_parse.h>
-#include <cmdline_parse_etheraddr.h>
#include <rte_flow.h>
#include "testpmd.h"
/* Only network endian is supported. */
if (!arg->hton)
goto error;
- ret = cmdline_parse_etheraddr(NULL, str, &tmp, size);
- if (ret < 0 || (unsigned int)ret != len)
+ ret = rte_ether_unformat_addr(str, &tmp);
+ if (ret < 0)
goto error;
if (!ctx->object)
return len;
#include <rte_pmd_bnxt.h>
#endif
#include <rte_gro.h>
-#include <cmdline_parse_etheraddr.h>
#include <rte_config.h>
#include "testpmd.h"
void
set_fwd_eth_peer(portid_t port_id, char *peer_addr)
{
- uint8_t c, new_peer_addr[6];
+ struct rte_ether_addr new_peer_addr;
if (!rte_eth_dev_is_valid_port(port_id)) {
printf("Error: Invalid port number %i\n", port_id);
return;
}
- if (cmdline_parse_etheraddr(NULL, peer_addr, &new_peer_addr,
- sizeof(new_peer_addr)) < 0) {
+ if (rte_ether_unformat_addr(peer_addr, &new_peer_addr) < 0) {
printf("Error: Invalid ethernet address: %s\n", peer_addr);
return;
}
- for (c = 0; c < 6; c++)
- peer_eth_addrs[port_id].addr_bytes[c] =
- new_peer_addr[c];
+ peer_eth_addrs[port_id] = new_peer_addr;
}
int
#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
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;
}
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