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

Function local_dev_probe

dpdk/lib/eal/common/eal_common_dev.c:168–231  ·  view source on GitHub ↗

probe device at local process. */

Source from the content-addressed store, hash-verified

166
167/* probe device at local process. */
168int
169local_dev_probe(const char *devargs, struct rte_device **new_dev)
170{
171 struct rte_device *dev;
172 struct rte_devargs *da;
173 int ret;
174
175 *new_dev = NULL;
176 da = calloc(1, sizeof(*da));
177 if (da == NULL)
178 return -ENOMEM;
179
180 ret = rte_devargs_parse(da, devargs);
181 if (ret)
182 goto err_devarg;
183
184 if (da->bus->plug == NULL) {
185 RTE_LOG(ERR, EAL, "Function plug not supported by bus (%s)\n",
186 da->bus->name);
187 ret = -ENOTSUP;
188 goto err_devarg;
189 }
190
191 ret = rte_devargs_insert(&da);
192 if (ret)
193 goto err_devarg;
194
195 /* the rte_devargs will be referenced in the matching rte_device */
196 ret = da->bus->scan();
197 if (ret)
198 goto err_devarg;
199
200 dev = da->bus->find_device(NULL, cmp_dev_name, da->name);
201 if (dev == NULL) {
202 RTE_LOG(ERR, EAL, "Cannot find device (%s)\n",
203 da->name);
204 ret = -ENODEV;
205 goto err_devarg;
206 }
207 /* Since there is a matching device, it is now its responsibility
208 * to manage the devargs we've just inserted. From this point
209 * those devargs shouldn't be removed manually anymore.
210 */
211
212 ret = dev->bus->plug(dev);
213 if (ret > 0)
214 ret = -ENOTSUP;
215
216 if (ret && !rte_dev_is_probed(dev)) { /* if hasn't ever succeeded */
217 RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n",
218 dev->name);
219 return ret;
220 }
221
222 *new_dev = dev;
223 return ret;
224
225err_devarg:

Callers 3

__handle_primary_requestFunction · 0.85
rte_dev_probeFunction · 0.85

Calls 7

callocFunction · 0.85
rte_devargs_parseFunction · 0.85
rte_devargs_insertFunction · 0.85
rte_dev_is_probedFunction · 0.85
rte_devargs_removeFunction · 0.85
rte_devargs_resetFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected