[PATCH v2] examples/ethtool: adds promiscuous mode functionality

Stephen Hemminger stephen at networkplumber.org
Tue Jul 4 00:08:00 CEST 2023


On Thu, 11 Aug 2022 14:45:08 +0500
Muhammad Jawad Hussain <jawad.hussain at emumba.com> wrote:

>  
>  
> +int
> +eth_set_promisc_mode(uint16_t port, int enable)
> +{
> +	int ret;
> +
> +
> +	if (enable)
> +		ret = rte_eth_promiscuous_enable(port);
> +	else
> +		ret = rte_eth_promiscuous_disable(port);
> +
> +	if (ret != 0) {
> +		fprintf(stderr,
> +			"Error during %s promiscuous mode for port %u: %s\n",
> +			enable ? "enabling" : "disabling",
> +			port, rte_strerror(-ret));
> +			return 0;
> +	} else
> +		return 1;
> +}
> +
> +
> +
> +


Some minor comments:
  1. The naming convention in ethtool should be followed.
     This should be named: rte_ethtool_set_promisc_mode

  2. Indentation is wrong for the "return 0" part

  3. Lots of useless extra blank lines, one will do fine.

Overall, the idea is fine, but almost no one cares about the ethtool example.
That is why no one reviewed or acked it.


More information about the dev mailing list