| 110 | } |
| 111 | |
| 112 | static int |
| 113 | eth_dev_match(const struct rte_eth_dev *edev, |
| 114 | const void *_arg) |
| 115 | { |
| 116 | int ret; |
| 117 | const struct eth_dev_match_arg *arg = _arg; |
| 118 | const struct rte_kvargs *kvlist = arg->kvlist; |
| 119 | unsigned int pair; |
| 120 | |
| 121 | if (edev->state == RTE_ETH_DEV_UNUSED) |
| 122 | return -1; |
| 123 | if (arg->device != NULL && arg->device != edev->device) |
| 124 | return -1; |
| 125 | |
| 126 | ret = rte_kvargs_process(kvlist, |
| 127 | eth_params_keys[RTE_ETH_PARAM_MAC], |
| 128 | eth_mac_cmp, edev->data); |
| 129 | if (ret != 0) |
| 130 | return -1; |
| 131 | |
| 132 | ret = rte_kvargs_process(kvlist, |
| 133 | eth_params_keys[RTE_ETH_PARAM_REPRESENTOR], |
| 134 | eth_representor_cmp, (void *)(uintptr_t)edev); |
| 135 | if (ret != 0) |
| 136 | return -1; |
| 137 | /* search for representor key */ |
| 138 | for (pair = 0; pair < kvlist->count; pair++) { |
| 139 | ret = strcmp(kvlist->pairs[pair].key, |
| 140 | eth_params_keys[RTE_ETH_PARAM_REPRESENTOR]); |
| 141 | if (ret == 0) |
| 142 | break; /* there is a representor key */ |
| 143 | } |
| 144 | /* if no representor key, default is to not match representor ports */ |
| 145 | if (ret != 0) |
| 146 | if ((edev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0) |
| 147 | return -1; /* do not match any representor */ |
| 148 | |
| 149 | return 0; |
| 150 | } |
| 151 | |
| 152 | static void * |
| 153 | eth_dev_iterate(const void *start, |
nothing calls this directly
no test coverage detected