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 224C345B8B; Mon, 21 Oct 2024 02:11:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A508E4021F; Mon, 21 Oct 2024 02:11:28 +0200 (CEST) Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by mails.dpdk.org (Postfix) with ESMTP id C4085400EF for ; Mon, 21 Oct 2024 02:11:27 +0200 (CEST) Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-7db238d07b3so2929876a12.2 for ; Sun, 20 Oct 2024 17:11:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1729469487; x=1730074287; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=dCMzwlJScHnkFxLrXAIKdEHkEp8v6aAADxQmPgRKDIw=; b=MAm/sYhfysGocMr/JsiClwztwgtHVkX3T6YB5uszIqbIlLQyeeXxoIXAEMdfq4sXsd l0cQeO/ceD8VxICkmop1cD7bTlMfLx6fG9+c4iDTyCM9icwd96wXWrDYM1rWghdlihTH Y0NAGZ3j9inFy1+BXiUjyevr4kv/vBLgF74kf9+Tx1yYZYvSX8ApOti62FagfIzKtQyW q4hrveW7aoi8b1Ccab76Xeh2McL9vQ9BEHJEzbKBe09pJm56rPDOMh1yhV5Q0VJbEH5D zGoN43dJ3FiioftWhGFPIln8V7xaVTH3wUqmg6tLSGjIxJb9J3HIau9SaDfR8My64Gak KURA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729469487; x=1730074287; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dCMzwlJScHnkFxLrXAIKdEHkEp8v6aAADxQmPgRKDIw=; b=D6vlz9r5WBBq6RV+bpSZ+S6gJjiGP6EoCjqcBGvlv+1HfKX5P015V3L+JEHeKJ/s/g Vx7oDnNEp+OJMr7WyswiWd96BxM7ikFhPFqtpFcUfQQ2LaEZwYFlr/Gh7B+h/I3gDQrw BllCTueKsG6BE7sCS7Gqyb6pTvaqQ9W6CAk8GG9+qWKe7AH02FNLfW3s+ezjfpWSrxo2 y1PPXIpy8DS22M7OJEG9xJdsaD2ufaBR3/Bxkwf9SyEIglC2R5mcH8gkwJHCNfyeKm/m wl/1QE6ilGssrHELShfVbHGNNhP/nq50f/3cgxpGzaUUD4y7FFd4xf76DLQPOE5hVMFZ YWfQ== X-Gm-Message-State: AOJu0YyBSSyzG8u2PZ6AvO54tRG1OXMPILcXAhO0XlG4/XGGYcrPcDyY 1icQtSKHwpbQirt1wZAMH8uVjzoZ07IllrtusdxiEBlrOzkgIkwlUUxT8mOl2Ck= X-Google-Smtp-Source: AGHT+IGE/G2r4WomYhB1VSwtCqysZ+JWHT/xOZ0HGyjbr+tVTUJlBGIzJ26rjdxa3tkKaDclPNyqbA== X-Received: by 2002:a05:6a20:e617:b0:1cf:3c60:b8d3 with SMTP id adf61e73a8af0-1d92c4dfc11mr13714855637.19.1729469486833; Sun, 20 Oct 2024 17:11:26 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7eaeabb8400sm1777517a12.63.2024.10.20.17.11.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2024 17:11:26 -0700 (PDT) Date: Sun, 20 Oct 2024 16:52:57 -0700 From: Stephen Hemminger To: vanshika.shukla@nxp.com Cc: dev@dpdk.org, Thomas Monjalon , Wathsala Vithanage , Bruce Richardson , Gagandeep Singh , Sachin Saxena , Anatoly Burakov , Apeksha Gupta Subject: Re: [v1 01/12] net/enetc: Add initial ENETC4 PMD driver support Message-ID: <20241020165257.613367c1@hermes.local> In-Reply-To: <20241018072644.2379012-2-vanshika.shukla@nxp.com> References: <20241018072644.2379012-1-vanshika.shukla@nxp.com> <20241018072644.2379012-2-vanshika.shukla@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Fri, 18 Oct 2024 12:56:33 +0530 vanshika.shukla@nxp.com wrote: > + /* Allocate memory for storing MAC addresses */ > + snprintf(eth_name, sizeof(eth_name), "enetc4_eth_%d", eth_dev->data->port_id); > + eth_dev->data->mac_addrs = rte_zmalloc(eth_name, > + RTE_ETHER_ADDR_LEN, 0); > + if (!eth_dev->data->mac_addrs) { The first argument of rte_malloc routines is hardly used. It does show up in trace but that is about all. Ok to keep it this as is, but wasted effort. > + if ((high_mac | low_mac) == 0) { > + char *first_byte; > + > + ENETC_PMD_NOTICE("MAC is not available for this SI, " > + "set random MAC"); > + mac = (uint32_t *)hw->mac.addr; > + *mac = (uint32_t)rte_rand(); > + first_byte = (char *)mac; > + *first_byte &= 0xfe; /* clear multicast bit */ > + *first_byte |= 0x02; /* set local assignment bit (IEEE802) */ > + > + enetc4_port_wr(enetc_hw, ENETC4_PMAR0, *mac); > + mac++; > + *mac = (uint16_t)rte_rand(); > + enetc4_port_wr(enetc_hw, ENETC4_PMAR1, *mac); > + print_ethaddr("New address: ", > + (const struct rte_ether_addr *)hw->mac.addr); Please use existing rte_eth_random_addr() for this.