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

Function mp_req_on_rxtx

dpdk/drivers/net/mlx5/linux/mlx5_mp_os.c:223–273  ·  view source on GitHub ↗

* Broadcast request of stopping/starting data-path to secondary processes. * * @param[in] dev * Pointer to Ethernet structure. * @param[in] type * Request type. */

Source from the content-addressed store, hash-verified

221 * Request type.
222 */
223static void
224mp_req_on_rxtx(struct rte_eth_dev *dev, enum mlx5_mp_req_type type)
225{
226 struct rte_mp_msg mp_req;
227 struct rte_mp_msg *mp_res;
228 struct rte_mp_reply mp_rep;
229 struct mlx5_mp_param *res;
230 struct timespec ts = {.tv_sec = MLX5_MP_REQ_TIMEOUT_SEC, .tv_nsec = 0};
231 struct mlx5_priv *priv = dev->data->dev_private;
232 int ret;
233 int i;
234
235 MLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);
236 if (!mlx5_shared_data->secondary_cnt)
237 return;
238 if (type != MLX5_MP_REQ_START_RXTX && type != MLX5_MP_REQ_STOP_RXTX) {
239 DRV_LOG(ERR, "port %u unknown request (req_type %d)",
240 dev->data->port_id, type);
241 return;
242 }
243 mp_init_msg(&priv->mp_id, &mp_req, type);
244 if (type == MLX5_MP_REQ_START_RXTX) {
245 mp_req.num_fds = 1;
246 mp_req.fds[0] =
247 ((struct ibv_context *)priv->sh->cdev->ctx)->cmd_fd;
248 }
249 ret = rte_mp_request_sync(&mp_req, &mp_rep, &ts);
250 if (ret) {
251 if (rte_errno != ENOTSUP)
252 DRV_LOG(ERR, "port %u failed to request stop/start Rx/Tx (%d)",
253 dev->data->port_id, type);
254 goto exit;
255 }
256 if (mp_rep.nb_sent != mp_rep.nb_received) {
257 DRV_LOG(ERR,
258 "port %u not all secondaries responded (req_type %d)",
259 dev->data->port_id, type);
260 goto exit;
261 }
262 for (i = 0; i < mp_rep.nb_received; i++) {
263 mp_res = &mp_rep.msgs[i];
264 res = (struct mlx5_mp_param *)mp_res->param;
265 if (res->result) {
266 DRV_LOG(ERR, "port %u request failed on secondary #%d",
267 dev->data->port_id, i);
268 goto exit;
269 }
270 }
271exit:
272 mlx5_free(mp_rep.msgs);
273}
274
275/**
276 * Broadcast request of starting data-path to secondary processes. The request

Callers 2

mlx5_mp_os_req_stop_rxtxFunction · 0.70

Calls 4

rte_eal_process_typeFunction · 0.85
mlx5_freeFunction · 0.85
mp_init_msgFunction · 0.50
rte_mp_request_syncFunction · 0.50

Tested by

no test coverage detected