[dpdk-dev] [PATCH] app/testpmd: add support for forced ethernet speed

Andrew Boyer aboyer at pensando.io
Thu Feb 25 19:33:10 CET 2021



> On Feb 22, 2021, at 2:18 PM, Ajit Khaparde <ajit.khaparde at broadcom.com> wrote:
> 
> Add support for forced ethernet speed setting.
> Currently testpmd tries to configure the Ethernet port in autoneg mode.
> It is not possible to set the Ethernet port to a specific speed while
> starting testpmd. In some cases capability to configure a forced speed
> for the Ethernet port during initialization may be necessary. This patch
> tries to add this support.
> 
> The patch assumes full duplex setting and does not attempt to change that.
> So speeds like 10M, 100M are not configurable using this method.
> 
> The command line to configure a forced speed of 10G:
> dpdk-testpmd -c 0xff  -- -i  --eth-link-speed  10000
> 
> The command line to configure a forced speed of 50G:
> dpdk-testpmd -c 0xff  -- -i  --eth-link-speed  50000
> 
> Signed-off-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
> ---
...
> @@ -485,6 +486,41 @@ parse_event_printing_config(const char *optarg, int enable)
> 	return 0;
> }
> 
> +static int
> +parse_link_speed(int n)
> +{
> +	uint32_t speed;
> +
> +	switch (n) {
> +	case 1000:
> +		speed = ETH_LINK_SPEED_1G;
> +		break;
> +	case 10000:
> +		speed = ETH_LINK_SPEED_10G;
> +		break;
> +	case 25000:
> +		speed = ETH_LINK_SPEED_25G;
> +		break;
> +	case 40000:
> +		speed = ETH_LINK_SPEED_40G;
> +		break;
> +	case 50000:
> +		speed = ETH_LINK_SPEED_50G;
> +		break;
> +	case 100000:
> +		speed = ETH_LINK_SPEED_100G;
> +		break;
> +	case 200000:
> +		speed = ETH_LINK_SPEED_200G;
> +		break;

Shouldn’t all of these fixed values be OR’d with ETH_LINK_SPEED_FIXED?

The testpmd command to change speed is also missing it.

-Andrew

...


More information about the dev mailing list