| 75 | } |
| 76 | |
| 77 | static int |
| 78 | mana_mp_primary_handle(const struct rte_mp_msg *mp_msg, const void *peer) |
| 79 | { |
| 80 | struct rte_eth_dev *dev; |
| 81 | const struct mana_mp_param *param = |
| 82 | (const struct mana_mp_param *)mp_msg->param; |
| 83 | struct rte_mp_msg mp_res = { 0 }; |
| 84 | struct mana_mp_param *res = (struct mana_mp_param *)mp_res.param; |
| 85 | int ret; |
| 86 | struct mana_priv *priv; |
| 87 | |
| 88 | if (!rte_eth_dev_is_valid_port(param->port_id)) { |
| 89 | DRV_LOG(ERR, "MP handle port ID %u invalid", param->port_id); |
| 90 | return -ENODEV; |
| 91 | } |
| 92 | |
| 93 | dev = &rte_eth_devices[param->port_id]; |
| 94 | priv = dev->data->dev_private; |
| 95 | |
| 96 | mp_init_msg(&mp_res, param->type, param->port_id); |
| 97 | |
| 98 | switch (param->type) { |
| 99 | case MANA_MP_REQ_CREATE_MR: |
| 100 | ret = mana_mp_mr_create(priv, param->addr, param->len); |
| 101 | res->result = ret; |
| 102 | ret = rte_mp_reply(&mp_res, peer); |
| 103 | break; |
| 104 | |
| 105 | case MANA_MP_REQ_VERBS_CMD_FD: |
| 106 | mp_res.num_fds = 1; |
| 107 | mp_res.fds[0] = priv->ib_ctx->cmd_fd; |
| 108 | res->result = 0; |
| 109 | ret = rte_mp_reply(&mp_res, peer); |
| 110 | break; |
| 111 | |
| 112 | default: |
| 113 | DRV_LOG(ERR, "Port %u unknown primary MP type %u", |
| 114 | param->port_id, param->type); |
| 115 | ret = -EINVAL; |
| 116 | } |
| 117 | |
| 118 | return ret; |
| 119 | } |
| 120 | |
| 121 | static int |
| 122 | mana_mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer) |
nothing calls this directly
no test coverage detected