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

Function mlx4_rxmode_toggle

dpdk/drivers/net/mlx4/mlx4_ethdev.c:347–379  ·  view source on GitHub ↗

* Helper function to toggle promiscuous and all multicast modes. * * @param dev * Pointer to Ethernet device structure. * @param toggle * Toggle to set. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */

Source from the content-addressed store, hash-verified

345 * 0 on success, a negative errno value otherwise and rte_errno is set.
346 */
347static int
348mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
349{
350 struct mlx4_priv *priv = dev->data->dev_private;
351 const char *mode;
352 struct rte_flow_error error;
353 int ret;
354
355 switch (toggle) {
356 case RXMODE_TOGGLE_PROMISC_OFF:
357 case RXMODE_TOGGLE_PROMISC_ON:
358 mode = "promiscuous";
359 dev->data->promiscuous = toggle & 1;
360 break;
361 case RXMODE_TOGGLE_ALLMULTI_OFF:
362 case RXMODE_TOGGLE_ALLMULTI_ON:
363 mode = "all multicast";
364 dev->data->all_multicast = toggle & 1;
365 break;
366 default:
367 mode = "undefined";
368 }
369
370 ret = mlx4_flow_sync(priv, &error);
371 if (!ret)
372 return 0;
373
374 ERROR("cannot toggle %s mode (code %d, \"%s\"),"
375 " flow error type %d, cause %p, message: %s",
376 mode, rte_errno, strerror(rte_errno), error.type, error.cause,
377 error.message ? error.message : "(unspecified)");
378 return ret;
379}
380
381/**
382 * DPDK callback to enable promiscuous mode.

Callers 4

mlx4_promiscuous_enableFunction · 0.85
mlx4_promiscuous_disableFunction · 0.85
mlx4_allmulticast_enableFunction · 0.85

Calls 1

mlx4_flow_syncFunction · 0.85

Tested by

no test coverage detected