From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hemant Agrawal Subject: Re: [PATCH 22/32] net/dpaa2: configure mac address at init Date: Mon, 19 Dec 2016 21:01:21 +0530 Message-ID: <3af745d0-0fb7-8508-af7a-a95897e19888@nxp.com> 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"; format=flowed Content-Transfer-Encoding: 7bit Cc: , , To: Ferruh Yigit , Return-path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0087.outbound.protection.outlook.com [104.47.40.87]) by dpdk.org (Postfix) with ESMTP id 3CBBAF921 for ; Mon, 19 Dec 2016 16:31:31 +0100 (CET) In-Reply-To: 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/7/2016 1:20 AM, Ferruh Yigit wrote: > 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() > I have fixed it. >> } >> >> 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. I have tried to take care of it in v2. Please check now. >> >> 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; >> } >> > >