src/dpdk/drivers/net/mlx4/mlx4_ethdev.c
static int
mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
{
	struct mlx4_priv *priv = dev->data->dev_private;
	const char *mode;
	struct rte_flow_error error;
	int ret;

	switch (toggle) {
	case RXMODE_TOGGLE_PROMISC_OFF:
	case RXMODE_TOGGLE_PROMISC_ON:
		mode = "promiscuous";
		dev->data->promiscuous = toggle & 1;
		break;
	case RXMODE_TOGGLE_ALLMULTI_OFF:
	case RXMODE_TOGGLE_ALLMULTI_ON:
		mode = "all multicast";
		dev->data->all_multicast = toggle & 1;
		break;
	default:
		mode = "undefined";
	}

	ret = mlx4_flow_sync(priv, &error);
	if (!ret)
		return 0;

	ERROR("cannot toggle %s mode (code %d, \"%s\"),"
	      " flow error type %d, cause %p, message: %s",
	      mode, rte_errno, strerror(rte_errno), error.type, error.cause,
	      error.message ? error.message : "(unspecified)");
	return ret;
}
/**
 * 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.
 */
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.
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 .
static int
mlx4_rxmode_toggle(struct rte_eth_dev *dev, enum rxmode_toggle toggle)
{
	struct mlx4_priv *priv = dev->data->dev_private;
	const char *mode;
	struct rte_flow_error error;
	int ret;
	switch (toggle) {
	case RXMODE_TOGGLE_PROMISC_OFF:
	case RXMODE_TOGGLE_PROMISC_ON:
		mode = "promiscuous";
		dev->data->promiscuous = toggle & 1;
		break;
	case RXMODE_TOGGLE_ALLMULTI_OFF:
	case RXMODE_TOGGLE_ALLMULTI_ON:
		mode = "all multicast";
		dev->data->all_multicast = toggle & 1;
		break;
	default:
		mode = "undefined";
	}
	ret = mlx4_flow_sync(priv, &error);
	if (!ret)
		return 0;
	ERROR("cannot toggle %s mode (code %d, \"%s\"),"
	      " flow error type %d, cause %p, message: %s",
	      mode, rte_errno, strerror(rte_errno), error.type, error.cause,
	      error.message ? error.message : "(unspecified)");
	return ret;
}
static int mlx4_rxmode_toggle ( struct rte_eth_dev * dev , enum rxmode_toggle toggle ) { struct mlx4_priv * priv = dev -> data -> dev_private ; const char * mode ; struct rte_flow_error error ; int ret ; switch ( toggle ) { case RXMODE_TOGGLE_PROMISC_OFF : case RXMODE_TOGGLE_PROMISC_ON : mode = " " ; dev -> data -> promiscuous = toggle & 1 ; break ; case RXMODE_TOGGLE_ALLMULTI_OFF : case RXMODE_TOGGLE_ALLMULTI_ON : mode = " " ; dev -> data -> all_multicast = toggle & 1 ; break ; default : mode = " " ; } ret = mlx4_flow_sync ( priv , & error ) ; if ( ! ret ) return 0 ; ERROR ( " \" \" " " " , mode , rte_errno , strerror ( rte_errno ) , error . type , error . cause , error . message ? error . message : " " ) ; return ret ; }
Helper function to toggle promiscuous and all multicast modes.
Helper function to toggle promiscuous and all multicast modes .