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

Function mlx4_rss_attach

dpdk/drivers/net/mlx4/mlx4_rxq.c:166–277  ·  view source on GitHub ↗

* Attach a user to a RSS context instance. * * Used when the RSS QP and indirection table objects must be instantiated, * that is, when a flow rule must be enabled. * * This function increments the usage count of the context. * * @param rss * RSS context to attach to. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

164 * 0 on success, a negative errno value otherwise and rte_errno is set.
165 */
166int
167mlx4_rss_attach(struct mlx4_rss *rss)
168{
169 MLX4_ASSERT(rss->refcnt);
170 if (rss->usecnt++) {
171 MLX4_ASSERT(rss->qp);
172 MLX4_ASSERT(rss->ind);
173 return 0;
174 }
175
176 struct ibv_wq *ind_tbl[rss->queues];
177 struct mlx4_priv *priv = rss->priv;
178 struct rte_eth_dev *dev = ETH_DEV(priv);
179 const char *msg;
180 unsigned int i = 0;
181 int ret;
182
183 if (!rte_is_power_of_2(RTE_DIM(ind_tbl))) {
184 ret = EINVAL;
185 msg = "number of RSS queues must be a power of two";
186 goto error;
187 }
188 for (i = 0; i != RTE_DIM(ind_tbl); ++i) {
189 uint16_t id = rss->queue_id[i];
190 struct rxq *rxq = NULL;
191
192 if (id < dev->data->nb_rx_queues)
193 rxq = dev->data->rx_queues[id];
194 if (!rxq) {
195 ret = EINVAL;
196 msg = "RSS target queue is not configured";
197 goto error;
198 }
199 ret = mlx4_rxq_attach(rxq);
200 if (ret) {
201 ret = -ret;
202 msg = "unable to attach RSS target queue";
203 goto error;
204 }
205 ind_tbl[i] = rxq->wq;
206 }
207 rss->ind = mlx4_glue->create_rwq_ind_table
208 (priv->ctx,
209 &(struct ibv_rwq_ind_table_init_attr){
210 .log_ind_tbl_size = rte_log2_u32(RTE_DIM(ind_tbl)),
211 .ind_tbl = ind_tbl,
212 .comp_mask = 0,
213 });
214 if (!rss->ind) {
215 ret = errno ? errno : EINVAL;
216 msg = "RSS indirection table creation failure";
217 goto error;
218 }
219 rss->qp = mlx4_glue->create_qp_ex
220 (priv->ctx,
221 &(struct ibv_qp_init_attr_ex){
222 .comp_mask = (IBV_QP_INIT_ATTR_PD |
223 IBV_QP_INIT_ATTR_RX_HASH |

Callers 1

mlx4_flow_toggleFunction · 0.85

Calls 4

mlx4_rxq_attachFunction · 0.85
mlx4_rxq_detachFunction · 0.85
rte_is_power_of_2Function · 0.50
rte_log2_u32Function · 0.50

Tested by

no test coverage detected