From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Mody, Rasesh" Subject: [PATCH 10/18] net/qede/base: add support for SRIOV VF min rate Date: Sat, 29 Sep 2018 08:14:33 +0000 Message-ID: <1538208822-9726-11-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 904022C37 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 support for SRIOV vf min rate configuration. Fix return code for ecore_iov_get_vf_min_rate(). Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore_iov_api.h | 10 ++++++++++ drivers/net/qede/base/ecore_sriov.c | 28 +++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/net/qede/base/ecore_iov_api.h b/drivers/net/qede/base/= ecore_iov_api.h index d398478..55de708 100644 --- a/drivers/net/qede/base/ecore_iov_api.h +++ b/drivers/net/qede/base/ecore_iov_api.h @@ -702,6 +702,16 @@ bool ecore_iov_is_vf_started(struct ecore_hwfn *p_hwfn= , */ int ecore_iov_get_vf_min_rate(struct ecore_hwfn *p_hwfn, int vfid); =20 +/** + * @brief - Configure min rate for VF's vport. + * @param p_dev + * @param vfid + * @param - rate in Mbps + * + * @return + */ +enum _ecore_status_t ecore_iov_configure_min_tx_rate(struct ecore_dev *p_d= ev, + int vfid, u32 rate); #endif =20 /** diff --git a/drivers/net/qede/base/ecore_sriov.c b/drivers/net/qede/base/ec= ore_sriov.c index 9e4a57b..9da4e41 100644 --- a/drivers/net/qede/base/ecore_sriov.c +++ b/drivers/net/qede/base/ecore_sriov.c @@ -4798,6 +4798,32 @@ enum _ecore_status_t ecore_iov_configure_tx_rate(str= uct ecore_hwfn *p_hwfn, p_link->speed); } =20 +enum _ecore_status_t ecore_iov_configure_min_tx_rate(struct ecore_dev *p_d= ev, + int vfid, u32 rate) +{ + struct ecore_vf_info *vf; + int i; + + for_each_hwfn(p_dev, i) { + struct ecore_hwfn *p_hwfn =3D &p_dev->hwfns[i]; + + if (!ecore_iov_pf_sanity_check(p_hwfn, vfid)) { + DP_NOTICE(p_hwfn, true, + "SR-IOV sanity check failed, can't set min rate\n"); + return ECORE_INVAL; + } + } + + vf =3D ecore_iov_get_vf_info(ECORE_LEADING_HWFN(p_dev), (u16)vfid, true); + if (!vf) { + DP_NOTICE(p_dev, true, + "Getting vf info failed, can't set min rate\n"); + return ECORE_INVAL; + } + + return ecore_configure_vport_wfq(p_dev, vf->vport_id, rate); +} + enum _ecore_status_t ecore_iov_get_vf_stats(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, int vfid, @@ -4908,7 +4934,7 @@ bool ecore_iov_is_vf_started(struct ecore_hwfn *p_hwf= n, return (p_vf->state !=3D VF_FREE && p_vf->state !=3D VF_STOPPED); } =20 -enum _ecore_status_t +int ecore_iov_get_vf_min_rate(struct ecore_hwfn *p_hwfn, int vfid) { struct ecore_wfq_data *vf_vp_wfq; --=20 1.7.10.3