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

Function mana_mp_req_verbs_cmd_fd

dpdk/drivers/net/mana/mp.c:207–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207int
208mana_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev)
209{
210 struct rte_mp_msg mp_req = { 0 };
211 struct rte_mp_msg *mp_res;
212 struct rte_mp_reply mp_rep;
213 struct mana_mp_param *res;
214 struct timespec ts = {.tv_sec = MANA_MP_REQ_TIMEOUT_SEC, .tv_nsec = 0};
215 int ret;
216
217 mp_init_msg(&mp_req, MANA_MP_REQ_VERBS_CMD_FD, dev->data->port_id);
218
219 ret = rte_mp_request_sync(&mp_req, &mp_rep, &ts);
220 if (ret) {
221 DRV_LOG(ERR, "port %u request to primary process failed",
222 dev->data->port_id);
223 return ret;
224 }
225
226 if (mp_rep.nb_received != 1) {
227 DRV_LOG(ERR, "primary replied %u messages", mp_rep.nb_received);
228 ret = -EPROTO;
229 goto exit;
230 }
231
232 mp_res = &mp_rep.msgs[0];
233 res = (struct mana_mp_param *)mp_res->param;
234 if (res->result) {
235 DRV_LOG(ERR, "failed to get CMD FD, port %u",
236 dev->data->port_id);
237 ret = res->result;
238 goto exit;
239 }
240
241 if (mp_res->num_fds != 1) {
242 DRV_LOG(ERR, "got FDs %d unexpected", mp_res->num_fds);
243 ret = -EPROTO;
244 goto exit;
245 }
246
247 ret = mp_res->fds[0];
248 DRV_LOG(ERR, "port %u command FD from primary is %d",
249 dev->data->port_id, ret);
250exit:
251 free(mp_rep.msgs);
252 return ret;
253}
254
255/*
256 * Request the primary process to register a MR.

Callers 1

mana_probe_portFunction · 0.85

Calls 3

mp_init_msgFunction · 0.70
rte_mp_request_syncFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected