[PATCH 01/10] ethdev: support telemetry query MAC addresses

Ferruh Yigit ferruh.yigit at amd.com
Thu Jun 1 16:39:23 CEST 2023


On 5/30/2023 10:05 AM, Jie Hai wrote:
> +static int
> +eth_dev_handle_port_macs(const char *cmd __rte_unused,
> +		const char *params,
> +		struct rte_tel_data *d)
> +{
> +	char mac_addr[RTE_ETHER_ADDR_FMT_SIZE];
> +	struct rte_eth_dev_info dev_info;
> +	struct rte_eth_dev *eth_dev;
> +	unsigned long port_id;
> +	char *end_param;
> +	uint32_t i;
> +	int ret;
> +
> +	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
> +		return -EINVAL;
> +
> +	port_id = strtoul(params, &end_param, 0);
> +	if (*end_param != '\0')
> +		RTE_ETHDEV_LOG(NOTICE,
> +			"Extra parameters passed to ethdev telemetry command, ignoring");
> +
> +	if (port_id >= UINT16_MAX)
> +		return -EINVAL;
> +

Above part is common in many telemetry handle functions, what about
extracting it as a function?



More information about the dev mailing list