[dpdk-dev] [PATCH v2] net/af_packet: add string error for system errors

Stephen Hemminger stephen at networkplumber.org
Wed Jul 10 18:04:56 CEST 2019


On Wed, 10 Jul 2019 16:46:30 +0200
<kkanas at marvell.com> wrote:

>  
> +#define PMD_LOG_ERRNO(level, fmt, args...) \
> +	rte_log(RTE_LOG_ ## level, af_packet_logtype, \
> +		"%s(): " fmt ":%s\n", __func__, ##args, rte_strerror(errno))
> +
>  static uint16_t
>  eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
>  {
> @@ -603,9 +609,7 @@ rte_pmd_init_internals(struct rte_vdev_device *dev,
>  		return -1;
>  	}
>  	if (ioctl(sockfd, SIOCGIFINDEX, &ifr) == -1) {
> -		PMD_LOG(ERR,
> -			"%s: ioctl failed (SIOCGIFINDEX)",
> -		        name);
> +		PMD_LOG_ERRNO(ERR, "%s: ioctl failed (SIOCGIFINDEX)", name);
>  		return -1;

This is wrong.
The ioctl sets errno not rte_errno.

Why not?
		PMD_LOG(ERR, "%s: ioctl failed (SIOCGIFINDEX): %s",
			name, strerror(errno));


More information about the dev mailing list