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

Ye Xiaolong xiaolong.ye at intel.com
Fri Mar 22 02:54:22 CET 2019


On 03/21, Stephen Hemminger wrote:
>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

You're right, the code is chaotic here, will improve it in next version.

Thanks,
Xiaolong


More information about the dev mailing list