From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 3377FA0508;
	Thu,  7 Apr 2022 02:44:29 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C125540689;
	Thu,  7 Apr 2022 02:44:28 +0200 (CEST)
Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187])
 by mails.dpdk.org (Postfix) with ESMTP id 1BDD24014F
 for <dev@dpdk.org>; Thu,  7 Apr 2022 02:44:26 +0200 (CEST)
Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.55])
 by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KYjLN66PHzdZgF;
 Thu,  7 Apr 2022 08:43:56 +0800 (CST)
Received: from [10.67.103.128] (10.67.103.128) by
 kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2375.24; Thu, 7 Apr 2022 08:44:24 +0800
Subject: Re: [PATCH] kni: fix device address set
To: Stephen Hemminger <stephen@networkplumber.org>
CC: <dev@dpdk.org>, <ferruh.yigit@intel.com>, <thomas@monjalon.net>
References: <20220406082213.45750-1-humin29@huawei.com>
 <20220406081700.4aa2d9a7@hermes.local>
From: "Min Hu (Connor)" <humin29@huawei.com>
Message-ID: <40f8ce34-982c-d96f-b1a7-d8381c36dcf1@huawei.com>
Date: Thu, 7 Apr 2022 08:44:23 +0800
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101
 Thunderbird/68.3.1
MIME-Version: 1.0
In-Reply-To: <20220406081700.4aa2d9a7@hermes.local>
Content-Type: text/plain; charset="gbk"; format=flowed
Content-Transfer-Encoding: 8bit
X-Originating-IP: [10.67.103.128]
X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To
 kwepemi500012.china.huawei.com (7.221.188.12)
X-CFilter-Loop: Reflected
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Hi, Stephen,
  I think this is a good option, but the macro definition is like:
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
+#define ether_addr_copy(dst, src) memcpy(dst, src, ETH_ALEN)
+#endif

@Ferry, why is it limited for "LINUX_VERSION_CODE < KERNEL_VERSION(3, 
14, 0)" ?


在 2022/4/6 23:17, Stephen Hemminger 写道:
> On Wed, 6 Apr 2022 16:22:13 +0800
> "Min Hu (Connor)" <humin29@huawei.com> wrote:
> 
>>   	/* if user has provided a valid mac address */
>>   	if (is_valid_ether_addr(dev_info.mac_addr))
>> -		memcpy(net_dev->dev_addr, dev_info.mac_addr, ETH_ALEN);
>> +		memcpy(mac_addr, dev_info.mac_addr, ETH_ALEN);
> 
> Minor enhancement. Could this use ether_addr_copy instead?
> 		ether_addr_copy(mac_addr, dev_info.mac_addr);
> .
>