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

Function mp_secondary_handle

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

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

Source from the content-addressed store, hash-verified

106 * 0 on success, a negative errno value otherwise and rte_errno is set.
107 */
108static int
109mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer)
110{
111 struct rte_mp_msg mp_res;
112 struct mlx4_mp_param *res = (struct mlx4_mp_param *)mp_res.param;
113 const struct mlx4_mp_param *param =
114 (const struct mlx4_mp_param *)mp_msg->param;
115 struct rte_eth_dev *dev;
116#ifdef HAVE_IBV_MLX4_UAR_MMAP_OFFSET
117 struct mlx4_proc_priv *ppriv;
118#endif
119 int ret;
120
121 MLX4_ASSERT(rte_eal_process_type() == RTE_PROC_SECONDARY);
122 if (!rte_eth_dev_is_valid_port(param->port_id)) {
123 rte_errno = ENODEV;
124 ERROR("port %u invalid port ID", param->port_id);
125 return -rte_errno;
126 }
127 dev = &rte_eth_devices[param->port_id];
128 switch (param->type) {
129 case MLX4_MP_REQ_START_RXTX:
130 INFO("port %u starting datapath", dev->data->port_id);
131 dev->tx_pkt_burst = mlx4_tx_burst;
132 dev->rx_pkt_burst = mlx4_rx_burst;
133#ifdef HAVE_IBV_MLX4_UAR_MMAP_OFFSET
134 ppriv = (struct mlx4_proc_priv *)dev->process_private;
135 if (ppriv->uar_table_sz != dev->data->nb_tx_queues) {
136 mlx4_tx_uar_uninit_secondary(dev);
137 mlx4_proc_priv_uninit(dev);
138 ret = mlx4_proc_priv_init(dev);
139 if (ret) {
140 close(mp_msg->fds[0]);
141 return -rte_errno;
142 }
143 ret = mlx4_tx_uar_init_secondary(dev, mp_msg->fds[0]);
144 if (ret) {
145 close(mp_msg->fds[0]);
146 mlx4_proc_priv_uninit(dev);
147 return -rte_errno;
148 }
149 }
150#endif
151 close(mp_msg->fds[0]);
152 rte_mb();
153 mp_init_msg(dev, &mp_res, param->type);
154 res->result = 0;
155 ret = rte_mp_reply(&mp_res, peer);
156 break;
157 case MLX4_MP_REQ_STOP_RXTX:
158 INFO("port %u stopping datapath", dev->data->port_id);
159 dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
160 dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
161 rte_mb();
162 mp_init_msg(dev, &mp_res, param->type);
163 res->result = 0;
164 ret = rte_mp_reply(&mp_res, peer);
165 break;

Callers

nothing calls this directly

Calls 9

rte_eal_process_typeFunction · 0.85
mlx4_proc_priv_uninitFunction · 0.85
mlx4_proc_priv_initFunction · 0.85
mp_init_msgFunction · 0.70
rte_mp_replyClass · 0.70
closeFunction · 0.50

Tested by

no test coverage detected