From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH 22/32] net/dpaa2: configure mac address at init Date: Tue, 6 Dec 2016 19:50:00 +0000 Message-ID: References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> <1480875447-23680-23-git-send-email-hemant.agrawal@nxp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: thomas.monjalon@6wind.com, bruce.richardson@intel.com, shreyansh.jain@nxp.com To: Hemant Agrawal , dev@dpdk.org Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id AE2F06A94 for ; Tue, 6 Dec 2016 20:50:06 +0100 (CET) In-Reply-To: <1480875447-23680-23-git-send-email-hemant.agrawal@nxp.com> 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 12/4/2016 6:17 PM, Hemant Agrawal wrote: > Signed-off-by: Hemant Agrawal > --- > drivers/net/dpaa2/base/dpaa2_hw_dpni.h | 3 +++ > drivers/net/dpaa2/dpaa2_ethdev.c | 26 ++++++++++++++++++++++++++ > 2 files changed, 29 insertions(+) > > diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.h b/drivers/net/dpaa2/base/dpaa2_hw_dpni.h > index c109396..70d52b6 100644 > --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.h > +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.h > @@ -63,7 +63,10 @@ struct dpaa2_dev_priv { > void *rx_vq[MAX_RX_QUEUES]; > void *tx_vq[MAX_TX_QUEUES]; > > + uint32_t options; > uint16_t num_dist_per_tc[MAX_TCS]; > + uint8_t max_mac_filters; > + uint8_t max_vlan_filters; > uint8_t num_tc; > uint8_t flags; /*dpaa2 config flags */ > }; > diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c > index 094296a..65c3384 100644 > --- a/drivers/net/dpaa2/dpaa2_ethdev.c > +++ b/drivers/net/dpaa2/dpaa2_ethdev.c > @@ -64,8 +64,12 @@ > dev_info->driver_name = drivername; > dev_info->if_index = priv->hw_id; > > + dev_info->max_mac_addrs = priv->max_mac_filters; > dev_info->max_rx_queues = (uint16_t)priv->nb_rx_queues; > dev_info->max_tx_queues = (uint16_t)priv->nb_tx_queues; > + dev_info->speed_capa = ETH_LINK_SPEED_1G | > + ETH_LINK_SPEED_2_5G | > + ETH_LINK_SPEED_10G; Patch does a little more than what it says, this can be added to prev patch that introduces dpaa2_dev_info_get() > } > > static int > @@ -444,6 +448,9 @@ Overall this makes harder to review, there is no function name provided int the patch, this is same for all patchset. There was a .gitattributes patch in the mail list for this, can you please get it before sending next revision of patches. > > priv->hw = dpni_dev; > priv->hw_id = hw_id; > + priv->options = attr.options; > + priv->max_mac_filters = attr.mac_filter_entries; > + priv->max_vlan_filters = attr.vlan_filter_entries; > priv->flags = 0; > > ret = dpaa2_alloc_rx_tx_queues(eth_dev); > @@ -452,6 +459,25 @@ > return -ret; > } > > + /* Allocate memory for storing MAC addresses */ > + eth_dev->data->mac_addrs = rte_zmalloc("dpni", > + ETHER_ADDR_LEN * attr.mac_filter_entries, 0); > + if (eth_dev->data->mac_addrs == NULL) { > + PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to " > + "store MAC addresses", > + ETHER_ADDR_LEN * attr.mac_filter_entries); > + return -ENOMEM; > + } > + > + ret = dpni_get_primary_mac_addr(dpni_dev, CMD_PRI_LOW, > + priv->token, > + (uint8_t *)(eth_dev->data->mac_addrs[0].addr_bytes)); > + if (ret) { > + PMD_INIT_LOG(ERR, "DPNI get mac address failed:" > + " Error Code = %d\n", ret); > + return -ret; > + } > + > eth_dev->dev_ops = &dpaa2_ethdev_ops; > return 0; > } >