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

Function __handle_secondary_request

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

Source from the content-addressed store, hash-verified

83}
84
85static void
86__handle_secondary_request(void *param)
87{
88 struct mp_reply_bundle *bundle = param;
89 const struct rte_mp_msg *msg = &bundle->msg;
90 const struct eal_dev_mp_req *req =
91 (const struct eal_dev_mp_req *)msg->param;
92 struct eal_dev_mp_req tmp_req;
93 struct rte_devargs da;
94 struct rte_device *dev;
95 struct rte_bus *bus;
96 int ret = 0;
97
98 tmp_req = *req;
99
100 memset(&da, 0, sizeof(da));
101 if (req->t == EAL_DEV_REQ_TYPE_ATTACH) {
102 ret = local_dev_probe(req->devargs, &dev);
103 if (ret != 0 && ret != -EEXIST) {
104 RTE_LOG(ERR, EAL, "Failed to hotplug add device on primary\n");
105 goto finish;
106 }
107 ret = eal_dev_hotplug_request_to_secondary(&tmp_req);
108 if (ret != 0) {
109 RTE_LOG(ERR, EAL, "Failed to send hotplug request to secondary\n");
110 ret = -ENOMSG;
111 goto rollback;
112 }
113 if (tmp_req.result != 0) {
114 ret = tmp_req.result;
115 RTE_LOG(ERR, EAL, "Failed to hotplug add device on secondary\n");
116 if (ret != -EEXIST)
117 goto rollback;
118 }
119 } else if (req->t == EAL_DEV_REQ_TYPE_DETACH) {
120 ret = rte_devargs_parse(&da, req->devargs);
121 if (ret != 0)
122 goto finish;
123
124 ret = eal_dev_hotplug_request_to_secondary(&tmp_req);
125 if (ret != 0) {
126 RTE_LOG(ERR, EAL, "Failed to send hotplug request to secondary\n");
127 ret = -ENOMSG;
128 goto rollback;
129 }
130
131 bus = rte_bus_find_by_name(da.bus->name);
132 if (bus == NULL) {
133 RTE_LOG(ERR, EAL, "Cannot find bus (%s)\n", da.bus->name);
134 ret = -ENOENT;
135 goto finish;
136 }
137
138 dev = bus->find_device(NULL, cmp_dev_name, da.name);
139 if (dev == NULL) {
140 RTE_LOG(ERR, EAL, "Cannot find plugged device (%s)\n", da.name);
141 ret = -ENOENT;
142 goto finish;

Callers

nothing calls this directly

Calls 9

memsetFunction · 0.85
local_dev_probeFunction · 0.85
rte_devargs_parseFunction · 0.85
rte_bus_find_by_nameFunction · 0.85
local_dev_removeFunction · 0.85
rte_devargs_resetFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected