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 0922BA0A0C; Fri, 2 Jul 2021 18:12:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 85D9941363; Fri, 2 Jul 2021 18:12:29 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id EEA3841353 for ; Fri, 2 Jul 2021 18:12:27 +0200 (CEST) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 930AE7F502; Fri, 2 Jul 2021 19:12:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 930AE7F502 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1625242347; bh=4R2JS7/NabY8Z8chUC0fcbeGQvjf4Mjvr9RxPaM1B9M=; h=Subject:To:References:From:Date:In-Reply-To; b=Ma6qH4m5g7kebDbk1fl4AKf/8L/vWhWCrea/MI9SUgSVOQVGX2oxyevHLL3eZ2OzD hsuYvR4AAghbJTTr8yWLQCmz/39oiff9Na/x9/c7l3Z9HdPSV0TOLyyjvkIi3Pw4Hk JusRoGZvYXAo6VvH5ysK4lTt4ILetGlP8rN/lqLg= To: Jiawen Wu , dev@dpdk.org References: <20210617110005.4132926-1-jiawenwu@trustnetic.com> <20210617110005.4132926-10-jiawenwu@trustnetic.com> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: <4ad7ea3c-ce98-9ba4-db0a-b35a8a4c2730@oktetlabs.ru> Date: Fri, 2 Jul 2021 19:12:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210617110005.4132926-10-jiawenwu@trustnetic.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 09/19] net/ngbe: store MAC address 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 Sender: "dev" On 6/17/21 1:59 PM, Jiawen Wu wrote: > Store MAC addresses and init receive address filters. > > Signed-off-by: Jiawen Wu [snip] > diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c > index 31d4dda976..deca64137d 100644 > --- a/drivers/net/ngbe/ngbe_ethdev.c > +++ b/drivers/net/ngbe/ngbe_ethdev.c > @@ -116,6 +116,31 @@ eth_ngbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) > return -EIO; > } > > + /* Allocate memory for storing MAC addresses */ > + eth_dev->data->mac_addrs = rte_zmalloc("ngbe", RTE_ETHER_ADDR_LEN * > + hw->mac.num_rar_entries, 0); > + if (eth_dev->data->mac_addrs == NULL) { > + PMD_INIT_LOG(ERR, > + "Failed to allocate %u bytes needed to store " > + "MAC addresses", Do not split format strings. It makes it hard to find line in code using grep by the message found in log. [snip] > + RTE_ETHER_ADDR_LEN * hw->mac.num_rar_entries); > + return -ENOMEM; > + } > + > + /* Copy the permanent MAC address */ > + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, > + ð_dev->data->mac_addrs[0]); > + > + /* Allocate memory for storing hash filter MAC addresses */ > + eth_dev->data->hash_mac_addrs = rte_zmalloc("ngbe", > + RTE_ETHER_ADDR_LEN * NGBE_VMDQ_NUM_UC_MAC, 0); > + if (eth_dev->data->hash_mac_addrs == NULL) { > + PMD_INIT_LOG(ERR, > + "Failed to allocate %d bytes needed to store MAC addresses", > + RTE_ETHER_ADDR_LEN * NGBE_VMDQ_NUM_UC_MAC); Shouldn't we free eth_dev->data->mac_addrs here? > + return -ENOMEM; > + } > + > return 0; > } >