From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Mody, Rasesh" Subject: [PATCH 05/18] net/qede/base: add API to update FW RSS indirection table Date: Sat, 29 Sep 2018 08:14:30 +0000 Message-ID: <1538208822-9726-6-git-send-email-rasesh.mody@cavium.com> References: <1538208822-9726-1-git-send-email-rasesh.mody@cavium.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: "Mody, Rasesh" , "ferruh.yigit@intel.com" , Dept-Eng DPDK Dev To: "dev@dpdk.org" Return-path: Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690074.outbound.protection.outlook.com [40.107.69.74]) by dpdk.org (Postfix) with ESMTP id 019482C37 for ; Sat, 29 Sep 2018 10:14:37 +0200 (CEST) In-Reply-To: <1538208822-9726-1-git-send-email-rasesh.mody@cavium.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Added ecore_update_eth_rss_ind_table_entry() api to update FW RSS indirection table entry according to new interface of FW 8.37.x.x. Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore_l2.c | 52 ++++++++++++++++++++++++++++++= ++++ drivers/net/qede/base/ecore_l2_api.h | 24 ++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/drivers/net/qede/base/ecore_l2.c b/drivers/net/qede/base/ecore= _l2.c index ec40aac..d87ffda 100644 --- a/drivers/net/qede/base/ecore_l2.c +++ b/drivers/net/qede/base/ecore_l2.c @@ -2323,3 +2323,55 @@ enum _ecore_status_t return ecore_init_vport_rl(p_hwfn, p_ptt, vport, rate, p_link->speed); } + +#define RSS_TSTORM_UPDATE_STATUS_MAX_POLL_COUNT 100 +#define RSS_TSTORM_UPDATE_STATUS_POLL_PERIOD_US 1 + +enum _ecore_status_t +ecore_update_eth_rss_ind_table_entry(struct ecore_hwfn *p_hwfn, + u8 vport_id, + u8 ind_table_index, + u16 ind_table_value) +{ + struct eth_tstorm_rss_update_data update_data =3D { 0 }; + void OSAL_IOMEM *addr =3D OSAL_NULL; + enum _ecore_status_t rc; + u8 abs_vport_id; + u32 cnt =3D 0; + + OSAL_BUILD_BUG_ON(sizeof(update_data) !=3D sizeof(u64)); + + rc =3D ecore_fw_vport(p_hwfn, vport_id, &abs_vport_id); + if (rc !=3D ECORE_SUCCESS) + return rc; + + addr =3D (u8 OSAL_IOMEM *)p_hwfn->regview + + GTT_BAR0_MAP_REG_TSDM_RAM + + TSTORM_ETH_RSS_UPDATE_OFFSET(p_hwfn->rel_pf_id); + + *(u64 *)(&update_data) =3D DIRECT_REG_RD64(p_hwfn, addr); + + for (cnt =3D 0; update_data.valid && + cnt < RSS_TSTORM_UPDATE_STATUS_MAX_POLL_COUNT; cnt++) { + OSAL_UDELAY(RSS_TSTORM_UPDATE_STATUS_POLL_PERIOD_US); + *(u64 *)(&update_data) =3D DIRECT_REG_RD64(p_hwfn, addr); + } + + if (update_data.valid) { + DP_NOTICE(p_hwfn, true, + "rss update valid status is not clear! valid=3D0x%x vport id=3D%d ind= _Table_idx=3D%d ind_table_value=3D%d.\n", + update_data.valid, vport_id, ind_table_index, + ind_table_value); + + return ECORE_AGAIN; + } + + update_data.valid =3D 1; + update_data.ind_table_index =3D ind_table_index; + update_data.ind_table_value =3D ind_table_value; + update_data.vport_id =3D abs_vport_id; + + DIRECT_REG_WR64(p_hwfn, addr, *(u64 *)(&update_data)); + + return ECORE_SUCCESS; +} diff --git a/drivers/net/qede/base/ecore_l2_api.h b/drivers/net/qede/base/e= core_l2_api.h index bde825c..21595f3 100644 --- a/drivers/net/qede/base/ecore_l2_api.h +++ b/drivers/net/qede/base/ecore_l2_api.h @@ -470,4 +470,28 @@ enum _ecore_status_t dma_addr_t p_addr, u16 length, u16 qid, u8 vport_id, bool b_is_add); + +/** + * @brief - ecore_update_eth_rss_ind_table_entry + * + * This function being used to update RSS indirection table entry to FW RA= M + * instead of using the SP vport update ramrod with rss params. + * + * Notice: + * This function supports only one outstanding command per engine. Ecore + * clients which use this function should call ecore_mcp_ind_table_lock() = prior + * to it and ecore_mcp_ind_table_unlock() after it. + * + * @params p_hwfn + * @params vport_id + * @params ind_table_index + * @params ind_table_value + * + * @return enum _ecore_status_t + */ +enum _ecore_status_t +ecore_update_eth_rss_ind_table_entry(struct ecore_hwfn *p_hwfn, + u8 vport_id, + u8 ind_table_index, + u16 ind_table_value); #endif --=20 1.7.10.3