MCPcopy Create free account
hub / github.com/F-Stack/f-stack / parse_eth_dest

Function parse_eth_dest

dpdk/examples/l3fwd/main.c:547–573  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

545}
546
547static void
548parse_eth_dest(const char *optarg)
549{
550 uint16_t portid;
551 char *port_end;
552 uint8_t c, *dest, peer_addr[6];
553
554 errno = 0;
555 portid = strtoul(optarg, &port_end, 10);
556 if (errno != 0 || port_end == optarg || *port_end++ != ',')
557 rte_exit(EXIT_FAILURE,
558 "Invalid eth-dest: %s", optarg);
559 if (portid >= RTE_MAX_ETHPORTS)
560 rte_exit(EXIT_FAILURE,
561 "eth-dest: port %d >= RTE_MAX_ETHPORTS(%d)\n",
562 portid, RTE_MAX_ETHPORTS);
563
564 if (cmdline_parse_etheraddr(NULL, port_end,
565 &peer_addr, sizeof(peer_addr)) < 0)
566 rte_exit(EXIT_FAILURE,
567 "Invalid ethernet address: %s\n",
568 port_end);
569 dest = (uint8_t *)&dest_eth_addr[portid];
570 for (c = 0; c < 6; c++)
571 dest[c] = peer_addr[c];
572 *(uint64_t *)(val_eth + portid) = dest_eth_addr[portid];
573}
574
575static void
576parse_mode(const char *optarg __rte_unused)

Callers 1

parse_argsFunction · 0.70

Calls 3

strtoulFunction · 0.85
rte_exitFunction · 0.85
cmdline_parse_etheraddrFunction · 0.85

Tested by

no test coverage detected