From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 766821B3BA for ; Mon, 1 Oct 2018 17:59:00 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Oct 2018 08:58:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,328,1534834800"; d="scan'208";a="95482441" Received: from fyigit-mobl.ger.corp.intel.com (HELO [10.237.221.49]) ([10.237.221.49]) by orsmga001.jf.intel.com with ESMTP; 01 Oct 2018 08:58:39 -0700 To: Gagandeep Singh , dev@dpdk.org Cc: pankaj.chauhan@nxp.com References: <20180928051647.32341-1-g.singh@nxp.com> <20180928074601.4287-1-g.singh@nxp.com> <20180928074601.4287-2-g.singh@nxp.com> From: Ferruh Yigit Openpgp: preference=signencrypt Message-ID: Date: Mon, 1 Oct 2018 16:58:38 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180928074601.4287-2-g.singh@nxp.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v4 1/4] net/enetc: add ENETC PMD with basic operations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Oct 2018 15:59:01 -0000 On 9/28/2018 8:45 AM, Gagandeep Singh wrote: > This patch introduces the enetc PMD with basic > initialisation functions includes probe, teardown, > hardware initialisation > > Signed-off-by: Gagandeep Singh <...> > +struct enetc_eth_mac_info { > + uint8_t addr[ETH_ADDR_LEN]; > + uint8_t perm_addr[ETH_ADDR_LEN]; Can reuse DPDK ETHER_ADDR_LEN for this instead of re-defining? (You can skip if this is coming from a common code and you need to maintain the difference yourself for this change.) <...> > +static int > +enetc_dev_init(struct rte_eth_dev *eth_dev) > +{ > + int error = 0; > + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); > + struct enetc_eth_hw *hw = > + ENETC_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); > + > + PMD_INIT_FUNC_TRACE(); > + eth_dev->dev_ops = &enetc_ops; > + eth_dev->rx_pkt_burst = NULL; > + eth_dev->tx_pkt_burst = NULL; > + > + /* Retrieving and storing the HW base address of device */ > + hw->hw.reg = (void *)pci_dev->mem_resource[0].addr; > + hw->device_id = pci_dev->id.device_id; > + > + error = enetc_hardware_init(hw); > + if (error != 0) { > + ENETC_PMD_ERR("Hardware initialization failed"); > + return -1; > + } > + > + /* Allocate memory for storing MAC addresses */ > + eth_dev->data->mac_addrs = rte_zmalloc("enetc_eth", ETHER_ADDR_LEN, 0); > + if (!eth_dev->data->mac_addrs) { > + ENETC_PMD_ERR("Failed to allocate %d bytes needed to " > + "store MAC addresses", > + ETHER_ADDR_LEN * 1); > + error = -ENOMEM; > + return -1; > + } Need to free eth_dev->data->mac_addrs on uninit() <...> > +static int > +enetc_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) > +{ > + struct enetc_eth_hw *hw = > + ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + struct rte_eth_link link; > + > + PMD_INIT_FUNC_TRACE(); > + hw->mac.get_link_status = 1; > + > + memset(&link, 0, sizeof(link)); > + rte_eth_linkstatus_get(dev, &link); > + > + link.link_duplex = ETH_LINK_FULL_DUPLEX; > + link.link_status = ETH_LINK_UP; > + rte_eth_linkstatus_set(dev, &link); rte_eth_linkstatus_get() / rte_eth_linkstatus_set() updates variables that holds the status of the link, but this PMD function should update the HW link status not just the state. <...> > +/* DP Logs, toggled out at compile time if level lower than current level */ > +#define ENETC_PMD_DP_LOG(level, fmt, args...) \ > + RTE_LOG_DP(level, PMD, fmt, ## args) > + > +#define ENETC_PMD_DP_DEBUG(fmt, args...) \ > + ENETC_PMD_DP_LOG(DEBUG, fmt, ## args) > +#define ENETC_PMD_DP_INFO(fmt, args...) \ > + ENETC_PMD_DP_LOG(INFO, fmt, ## args) > +#define ENETC_PMD_DP_WARN(fmt, args...) \ > + ENETC_PMD_DP_LOG(WARNING, fmt, ## args) What about adding DP logs when you need them?