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

Function parse_port_id

dpdk/drivers/net/bonding/rte_eth_bond_args.c:79–109  ·  view source on GitHub ↗

* Parses a port identifier string to a port id by pci address, then by name, * and finally port id. */

Source from the content-addressed store, hash-verified

77 * and finally port id.
78 */
79static inline int
80parse_port_id(const char *port_str)
81{
82 struct rte_pci_addr dev_addr;
83 int port_id;
84
85 /* try parsing as pci address, physical devices */
86 if (rte_pci_addr_parse(port_str, &dev_addr) == 0) {
87 port_id = find_port_id_by_pci_addr(&dev_addr);
88 if (port_id < 0)
89 return -1;
90 } else {
91 /* try parsing as device name, virtual devices */
92 port_id = find_port_id_by_dev_name(port_str);
93 if (port_id < 0) {
94 char *end;
95 errno = 0;
96
97 /* try parsing as port id */
98 port_id = strtol(port_str, &end, 10);
99 if (*end != 0 || errno != 0)
100 return -1;
101 }
102 }
103
104 if (!rte_eth_dev_is_valid_port(port_id)) {
105 RTE_BOND_LOG(ERR, "Specified port (%s) is invalid", port_str);
106 return -1;
107 }
108 return port_id;
109}
110
111int
112bond_ethdev_parse_member_port_kvarg(const char *key,

Calls 5

rte_pci_addr_parseFunction · 0.85
find_port_id_by_pci_addrFunction · 0.85
find_port_id_by_dev_nameFunction · 0.85
strtolFunction · 0.85

Tested by

no test coverage detected