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

Function mp_req_on_rxtx

dpdk/drivers/net/mlx4/mlx4_mp.c:182–231  ·  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

180 * Request type.
181 */
182static void
183mp_req_on_rxtx(struct rte_eth_dev *dev, enum mlx4_mp_req_type type)
184{
185 struct rte_mp_msg mp_req;
186 struct rte_mp_msg *mp_res;
187 struct rte_mp_reply mp_rep;
188 struct mlx4_mp_param *res __rte_unused;
189 struct timespec ts = {.tv_sec = MLX4_MP_REQ_TIMEOUT_SEC, .tv_nsec = 0};
190 struct mlx4_priv *priv;
191 int ret;
192 int i;
193
194 MLX4_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);
195 if (!mlx4_shared_data->secondary_cnt)
196 return;
197 if (type != MLX4_MP_REQ_START_RXTX && type != MLX4_MP_REQ_STOP_RXTX) {
198 ERROR("port %u unknown request (req_type %d)",
199 dev->data->port_id, type);
200 return;
201 }
202 mp_init_msg(dev, &mp_req, type);
203 if (type == MLX4_MP_REQ_START_RXTX) {
204 priv = dev->data->dev_private;
205 mp_req.num_fds = 1;
206 mp_req.fds[0] = priv->ctx->cmd_fd;
207 }
208 ret = rte_mp_request_sync(&mp_req, &mp_rep, &ts);
209 if (ret) {
210 if (rte_errno != ENOTSUP)
211 ERROR("port %u failed to request stop/start Rx/Tx (%d)",
212 dev->data->port_id, type);
213 goto exit;
214 }
215 if (mp_rep.nb_sent != mp_rep.nb_received) {
216 ERROR("port %u not all secondaries responded (req_type %d)",
217 dev->data->port_id, type);
218 goto exit;
219 }
220 for (i = 0; i < mp_rep.nb_received; i++) {
221 mp_res = &mp_rep.msgs[i];
222 res = (struct mlx4_mp_param *)mp_res->param;
223 if (res->result) {
224 ERROR("port %u request failed on secondary #%d",
225 dev->data->port_id, i);
226 goto exit;
227 }
228 }
229exit:
230 free(mp_rep.msgs);
231}
232
233/**
234 * Broadcast request of starting data-path to secondary processes. The request

Callers 2

mlx4_mp_req_start_rxtxFunction · 0.70
mlx4_mp_req_stop_rxtxFunction · 0.70

Calls 4

rte_eal_process_typeFunction · 0.85
mp_init_msgFunction · 0.70
rte_mp_request_syncFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected