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

Function __handle_primary_request

dpdk/lib/eal/common/hotplug_mp.c:225–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225static void __handle_primary_request(void *param)
226{
227 struct mp_reply_bundle *bundle = param;
228 struct rte_mp_msg *msg = &bundle->msg;
229 const struct eal_dev_mp_req *req =
230 (const struct eal_dev_mp_req *)msg->param;
231 struct rte_mp_msg mp_resp;
232 struct eal_dev_mp_req *resp =
233 (struct eal_dev_mp_req *)mp_resp.param;
234 struct rte_devargs *da;
235 struct rte_device *dev;
236 struct rte_bus *bus;
237 int ret = 0;
238
239 memset(&mp_resp, 0, sizeof(mp_resp));
240
241 switch (req->t) {
242 case EAL_DEV_REQ_TYPE_ATTACH:
243 case EAL_DEV_REQ_TYPE_DETACH_ROLLBACK:
244 ret = local_dev_probe(req->devargs, &dev);
245 break;
246 case EAL_DEV_REQ_TYPE_DETACH:
247 case EAL_DEV_REQ_TYPE_ATTACH_ROLLBACK:
248 da = calloc(1, sizeof(*da));
249 if (da == NULL) {
250 ret = -ENOMEM;
251 break;
252 }
253
254 ret = rte_devargs_parse(da, req->devargs);
255 if (ret != 0)
256 goto quit;
257
258 bus = rte_bus_find_by_name(da->bus->name);
259 if (bus == NULL) {
260 RTE_LOG(ERR, EAL, "Cannot find bus (%s)\n", da->bus->name);
261 ret = -ENOENT;
262 goto quit;
263 }
264
265 dev = bus->find_device(NULL, cmp_dev_name, da->name);
266 if (dev == NULL) {
267 RTE_LOG(ERR, EAL, "Cannot find plugged device (%s)\n", da->name);
268 ret = -ENOENT;
269 goto quit;
270 }
271
272 if (!rte_dev_is_probed(dev)) {
273 if (req->t == EAL_DEV_REQ_TYPE_ATTACH_ROLLBACK) {
274 /**
275 * Don't fail the rollback just because there's
276 * nothing to do.
277 */
278 ret = 0;
279 } else
280 ret = -ENODEV;
281
282 goto quit;

Callers

nothing calls this directly

Calls 12

memsetFunction · 0.85
local_dev_probeFunction · 0.85
callocFunction · 0.85
rte_devargs_parseFunction · 0.85
rte_bus_find_by_nameFunction · 0.85
rte_dev_is_probedFunction · 0.85
local_dev_removeFunction · 0.85
rte_devargs_resetFunction · 0.85
rte_mp_replyClass · 0.70
freeFunction · 0.50
strlcpyFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected