From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Mody, Rasesh" Subject: [PATCH 09/18] net/qede/base: add pretend function for port/PF Date: Sat, 29 Sep 2018 08:14:32 +0000 Message-ID: <1538208822-9726-10-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 NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0063.outbound.protection.outlook.com [104.47.37.63]) by dpdk.org (Postfix) with ESMTP id 037862C37 for ; Sat, 29 Sep 2018 10:14:35 +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" Add a pretend function for port/PF, pretend to another port and another function when accessing the ptt window Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore_hw.c | 24 ++++++++++++++++++++++++ drivers/net/qede/base/ecore_hw.h | 12 ++++++++++++ 2 files changed, 36 insertions(+) diff --git a/drivers/net/qede/base/ecore_hw.c b/drivers/net/qede/base/ecore= _hw.c index 51bba27..6cfbbab 100644 --- a/drivers/net/qede/base/ecore_hw.c +++ b/drivers/net/qede/base/ecore_hw.c @@ -407,6 +407,30 @@ void ecore_port_unpretend(struct ecore_hwfn *p_hwfn, s= truct ecore_ptt *p_ptt) *(u32 *)&p_ptt->pxp.pretend); } =20 +void ecore_port_fid_pretend(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p= _ptt, + u8 port_id, u16 fid) +{ + u16 control =3D 0; + + SET_FIELD(control, PXP_PRETEND_CMD_PORT, port_id); + SET_FIELD(control, PXP_PRETEND_CMD_USE_PORT, 1); + SET_FIELD(control, PXP_PRETEND_CMD_PRETEND_PORT, 1); + + SET_FIELD(control, PXP_PRETEND_CMD_IS_CONCRETE, 1); + SET_FIELD(control, PXP_PRETEND_CMD_PRETEND_FUNCTION, 1); + + if (!GET_FIELD(fid, PXP_CONCRETE_FID_VFVALID)) + fid =3D GET_FIELD(fid, PXP_CONCRETE_FID_PFID); + + p_ptt->pxp.pretend.control =3D OSAL_CPU_TO_LE16(control); + p_ptt->pxp.pretend.fid.concrete_fid.fid =3D OSAL_CPU_TO_LE16(fid); + + REG_WR(p_hwfn, + ecore_ptt_config_addr(p_ptt) + + OFFSETOF(struct pxp_ptt_entry, pretend), + *(u32 *)&p_ptt->pxp.pretend); +} + u32 ecore_vfid_to_concrete(struct ecore_hwfn *p_hwfn, u8 vfid) { u32 concrete_fid =3D 0; diff --git a/drivers/net/qede/base/ecore_hw.h b/drivers/net/qede/base/ecore= _hw.h index 394207e..a62ba39 100644 --- a/drivers/net/qede/base/ecore_hw.h +++ b/drivers/net/qede/base/ecore_hw.h @@ -223,6 +223,18 @@ void ecore_port_unpretend(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt); =20 /** + * @brief ecore_port_fid_pretend - pretend to another port and another fun= ction + * when accessing the ptt window + * + * @param p_hwfn + * @param p_ptt + * @param port_id - the port to pretend to + * @param fid - fid field of pxp_pretend structure. Can contain either pf = / vf. + */ +void ecore_port_fid_pretend(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p= _ptt, + u8 port_id, u16 fid); + +/** * @brief ecore_vfid_to_concrete - build a concrete FID for a * given VF ID * --=20 1.7.10.3