[dpdk-dev] [PATCH v3 1/5] net/af_xdp: introduce AF XDP PMD driver

Stephen Hemminger stephen at networkplumber.org
Thu Mar 21 16:32:58 CET 2019


On Thu, 21 Mar 2019 17:18:41 +0800
Xiaolong Ye <xiaolong.ye at intel.com> wrote:

> +
> +	strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
> +	if (ioctl(sock, SIOCGIFINDEX, &ifr))
> +		goto error;
> +
> +	if (ioctl(sock, SIOCGIFHWADDR, &ifr))
> +		goto error;
> +
> +	rte_memcpy(eth_addr, ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
> +
> +	close(sock);
> +	*if_index = if_nametoindex(if_name);

This seems confused:
	- first you get ifindex with SIOCGIFINDEX, then you ignore the result
	- then get MAC address.
	- then use if_nametoindex() which does SIOCGIFINDEX internally


More information about the dev mailing list