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

Function mp_primary_handle

dpdk/drivers/net/mlx4/mlx4_mp.c:53–95  ·  view source on GitHub ↗

* IPC message handler of primary process. * * @param[in] dev * Pointer to Ethernet structure. * @param[in] peer * Pointer to the peer socket path. * * @return * 0 on success, negative errno value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

51 * 0 on success, negative errno value otherwise and rte_errno is set.
52 */
53static int
54mp_primary_handle(const struct rte_mp_msg *mp_msg, const void *peer)
55{
56 struct rte_mp_msg mp_res;
57 struct mlx4_mp_param *res = (struct mlx4_mp_param *)mp_res.param;
58 const struct mlx4_mp_param *param =
59 (const struct mlx4_mp_param *)mp_msg->param;
60 struct rte_eth_dev *dev;
61 struct mlx4_priv *priv;
62 struct mlx4_mr_cache entry;
63 uint32_t lkey;
64 int ret;
65
66 MLX4_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);
67 if (!rte_eth_dev_is_valid_port(param->port_id)) {
68 rte_errno = ENODEV;
69 ERROR("port %u invalid port ID", param->port_id);
70 return -rte_errno;
71 }
72 dev = &rte_eth_devices[param->port_id];
73 priv = dev->data->dev_private;
74 switch (param->type) {
75 case MLX4_MP_REQ_CREATE_MR:
76 mp_init_msg(dev, &mp_res, param->type);
77 lkey = mlx4_mr_create_primary(dev, &entry, param->args.addr);
78 if (lkey == UINT32_MAX)
79 res->result = -rte_errno;
80 ret = rte_mp_reply(&mp_res, peer);
81 break;
82 case MLX4_MP_REQ_VERBS_CMD_FD:
83 mp_init_msg(dev, &mp_res, param->type);
84 mp_res.num_fds = 1;
85 mp_res.fds[0] = priv->ctx->cmd_fd;
86 res->result = 0;
87 ret = rte_mp_reply(&mp_res, peer);
88 break;
89 default:
90 rte_errno = EINVAL;
91 ERROR("port %u invalid mp request type", dev->data->port_id);
92 return -rte_errno;
93 }
94 return ret;
95}
96
97/**
98 * IPC message handler of a secondary process.

Callers

nothing calls this directly

Calls 5

rte_eal_process_typeFunction · 0.85
mlx4_mr_create_primaryFunction · 0.85
mp_init_msgFunction · 0.70
rte_mp_replyClass · 0.70

Tested by

no test coverage detected