From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 48ED0A00C3; Wed, 8 Jun 2022 13:14:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B14E04281B; Wed, 8 Jun 2022 13:14:09 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 332504021D; Wed, 8 Jun 2022 13:14:08 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 115) id D2CFE30F; Wed, 8 Jun 2022 14:14:06 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mail1.oktetlabs.ru X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD autolearn=no autolearn_force=no version=3.4.6 Received: from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17]) by shelob.oktetlabs.ru (Postfix) with ESMTP id 573F1308; Wed, 8 Jun 2022 14:14:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 573F1308 Authentication-Results: shelob.oktetlabs.ru/573F1308; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: Ferruh Yigit , Stephen Hemminger Cc: dev@dpdk.org, Min Hu , Ke Zhang , stable@dpdk.org Subject: [PATCH v4 1/2] kni: use dedicated function to set random MAC address Date: Wed, 8 Jun 2022 14:13:58 +0300 Message-Id: <20220608111359.1234110-2-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220608111359.1234110-1-andrew.rybchenko@oktetlabs.ru> References: <20220531091330.230715-1-ke1x.zhang@intel.com> <20220608111359.1234110-1-andrew.rybchenko@oktetlabs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Ke Zhang eth_hw_addr_random() sets address type correctly. eth_hw_addr_random() is available since Linux v3.4, so no compat is required. Also fix the warning: warning: passing argument 1 of ‘memcpy’ discards ‘const’ qualifier from pointer target type Variable dev_addr is done const intentionally in Linux v5.17 to prevent using it directly. Fixes: ea6b39b5b847 ("kni: remove ethtool support") Cc: stable@dpdk.org Signed-off-by: Ke Zhang Signed-off-by: Andrew Rybchenko --- kernel/linux/kni/kni_misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/linux/kni/kni_misc.c b/kernel/linux/kni/kni_misc.c index 780187d8bf..4f6dd373a3 100644 --- a/kernel/linux/kni/kni_misc.c +++ b/kernel/linux/kni/kni_misc.c @@ -405,8 +405,8 @@ kni_ioctl_create(struct net *net, uint32_t ioctl_num, if (is_valid_ether_addr(dev_info.mac_addr)) memcpy(net_dev->dev_addr, dev_info.mac_addr, ETH_ALEN); else - /* Generate random MAC address. */ - eth_random_addr(net_dev->dev_addr); + /* Assign random MAC address. */ + eth_hw_addr_random(net_dev); if (dev_info.mtu) net_dev->mtu = dev_info.mtu; -- 2.30.2