| 243 | } |
| 244 | |
| 245 | static int |
| 246 | ethdev_ip4_addr_add(const char *name, struct ipv4_addr_config *config) |
| 247 | { |
| 248 | struct ethdev *eth_hdl; |
| 249 | uint16_t portid = 0; |
| 250 | int rc; |
| 251 | |
| 252 | rc = rte_eth_dev_get_port_by_name(name, &portid); |
| 253 | if (rc < 0) |
| 254 | return rc; |
| 255 | |
| 256 | eth_hdl = ethdev_port_by_id(portid); |
| 257 | |
| 258 | if (eth_hdl) { |
| 259 | eth_hdl->ip4_addr.ip = config->ip; |
| 260 | eth_hdl->ip4_addr.mask = config->mask; |
| 261 | return 0; |
| 262 | } |
| 263 | |
| 264 | rc = -EINVAL; |
| 265 | return rc; |
| 266 | } |
| 267 | |
| 268 | static int |
| 269 | ethdev_ip6_addr_add(const char *name, struct ipv6_addr_config *config) |
no test coverage detected