-static int
-name_to_dp_idx(const char *name)
-{
- if (!strncmp(name, "dp", 2) && isdigit((unsigned char)name[2])) {
- int dp_idx = atoi(name + 2);
- if (dp_idx >= 0 && dp_idx < N_DP_NETDEVS) {
- return dp_idx;
- }
- }
- return -1;
-}
-
-static struct dp_netdev *
-find_dp_netdev(const char *name)
-{
- int dp_idx;
- size_t i;
-
- dp_idx = name_to_dp_idx(name);
- if (dp_idx >= 0) {
- return dp_netdevs[dp_idx];
- }
-
- for (i = 0; i < N_DP_NETDEVS; i++) {
- struct dp_netdev *dp = dp_netdevs[i];
- if (dp) {
- struct dp_netdev_port *port;
- if (!get_port_by_name(dp, name, &port)) {
- return dp;
- }
- }
- }
- return NULL;
-}
-