From patchwork Tue Sep 19 01:51:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mody, Rasesh" X-Patchwork-Id: 28905 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DB8C5397D; Tue, 19 Sep 2017 03:52:02 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0082.outbound.protection.outlook.com [104.47.36.82]) by dpdk.org (Postfix) with ESMTP id 76AEC968 for ; Tue, 19 Sep 2017 03:52:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=3jbQFOo2i8MDWdRINI+F1Zc2DIpcE1xSq9hRcVIxnT0=; b=Tca99eV/gtbU0dUkftdpqKMAZolHNz7sBy4SANfnFMo65lPkjdKvAILNwxvGH+k76Y5ZOWsISPisQmMqKleex3WmlfSLcRD5VmQKWgMgPxndS7BAqgvwSThCX4wuqroVgYN9RDOBEsZ2PmfAp+m4JQukXI7of2xNtJhIxEr9FOU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rasesh.Mody@cavium.com; Received: from cavium.com (198.186.0.2) by DM5PR0701MB3832.namprd07.prod.outlook.com (2603:10b6:4:7f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.11; Tue, 19 Sep 2017 01:51:59 +0000 From: Rasesh Mody To: dev@dpdk.org, ferruh.yigit@intel.com Cc: Rasesh Mody , Dept-EngDPDKDev@cavium.com Date: Mon, 18 Sep 2017 18:51:20 -0700 Message-Id: <1505785903-1741-1-git-send-email-rasesh.mody@cavium.com> X-Mailer: git-send-email 1.7.10.3 MIME-Version: 1.0 X-Originating-IP: [198.186.0.2] X-ClientProxiedBy: MWHPR14CA0048.namprd14.prod.outlook.com (2603:10b6:300:12b::34) To DM5PR0701MB3832.namprd07.prod.outlook.com (2603:10b6:4:7f::30) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cfa6b290-6a9b-4e97-27f4-08d4ff010461 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR0701MB3832; X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3832; 3:8cGm8e4Fr1pwx/aW8CNK63xgNaEpibfZX01aO8ut4fXIFX44DaZMSfZPx7KNi39S3Ib4czYjxJ0iB6aNF5Tbsw4NZOynkLpWk9I0Jmv3FsvopGB5luonpYi0e/qLRnFfZgdAkU5NZYsaQ/9EFQ0kJhVsCcn62JIWmqLPtP+36hR4Ed80wpWhqXRjvdyfGD2NgzVc80v6ulsxj/6LcMaAqlSdTOr7WOBG/W7Yh3y8PfqB88x8R4M/fsfDGPF2704P; 25:5E+/nHRxBqTymNsNq6JnMxWKgq1zxCxAaCCw5zmk0RtGIOMWNmpQgo3zamEx18PkYmm5gYCHqbiHyxvNcZlsHriaMZ4BsAsLbE7nNdNr00cVkv94aPF45E0QSx4575v+91lMP7ZFEGk/EfuQQcit64CaUfRe/HXkV2Kh5gE0W5YzCUt00xMYqDa1bIkuItzDDevHLYEht0bjJ26ELPN+erU5IiBnn4PnvmrEjzhI7NgMdbha0b/0cwIsJnffByAA7D2zbrEiKjriEL6D+QaQSxwbG50pYdS+iiuJ3xacWbs8/FzFqjhWhQFUcwDetaBFe0BWM2JH8bp+4WV9QVTyLQ==; 31:qW9PAWU9p2YA7hktaLNarzKpGvYY0+2mymbCxLVcnYJFJKoWCpWrRg4OBhr9BOgI4WvUcTJdYW5fxNLU247S59ePqwYhW4C5uR4XyK6YqVLFhExA66dUf0vRi45Pd7w/dtARmmS9wffZ685kS1/wWUwNdpYNh4nXQBTN0o8H0n82SI4nW/4ceTctgPr5Dt3Lmg4CkyC9HCj2CmFcOgeKDGWZ6MwjwZIfqp4kn84byF4= X-MS-TrafficTypeDiagnostic: DM5PR0701MB3832: X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3832; 20:PT5r+0oj+mh+WMiMA5/S04RKgNw6olsyalxYG6jqSf9da6MmURri1YNgRKhZq4vy3JCNcydAtllNIrDzBO6P0f6IWm3B6/bdAudLsZQBboTiFmjTqGQBM4j8PxVaPsNvheIxoNSKVDOq7/qUabVUiyV/N0yZEn0lADrEXc2IMvhmdwKC9XyDPUQS5XdDwMbuMG1sABJPq/RzhYdctqTnIb0C5sU79FLmIJMQfx+0i61ivtNxerKLjZemIQL9kBrXLcRx9jLX7kmWZygBnxIkpSe+usadFm/AqVAx4b6fDPwRZ7GU8I4uSl5kKaomvYGEmHmhih1I/G14ReCnTASgcCVOLXuCFBl+SLLyZjm8h8dBLLe/P+La6ImzBV43uvre6hXIiC5JUVBamz4f7gHn19ar3mI9rzzBU6q814UKS/xMRoRj544GSc+v8/g2BLKFhOtgMqOC7b/RmOPzPwOX16S9s6SUlQmyDmxOlBG7k8/yllzINF4ZwZpwwgIskjLm; 4:FX6dGKx+ebxUGan+ZYJHqSZ0GLVOJKErR34Kn+mcMUgvdQaay2fs09fxUO5ARhVL+Ud2fOd7sz4vEC6H9lbe9lNcB1ODc0O9hGSCBRs3OfSnhEaG2ILmEp2szv1VePIOkhpplgRCobyizcSk7SC2oWLgEm+pcBgGO4kzxyb8zz2lsHTtQM7gDK0cE/2GpwmzDm8DWp1C/6hkzMdqwH/4kWBKxxhYfAltJvUKFn+hSYjqZhtEmPF593WV0/Sv5zwC X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR0701MB3832; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR0701MB3832; X-Forefront-PRVS: 04359FAD81 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(199003)(189002)(72206003)(106356001)(305945005)(105586002)(7736002)(36756003)(50226002)(478600001)(25786009)(6666003)(3846002)(4720700003)(55016002)(8676002)(189998001)(66066001)(5003940100001)(81166006)(81156014)(50986999)(107886003)(316002)(5660300001)(16526017)(16586007)(47776003)(4326008)(6116002)(33646002)(21086003)(86362001)(8936002)(97736004)(575784001)(68736007)(69596002)(53936002)(50466002)(2906002)(48376002)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR0701MB3832; H:cavium.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR0701MB3832; 23:icuDsM2EloXPunTMZqZPLYlEUhiyhaeCNq1b27a?= zKA09PTi5cEkx1weY2z4qKNPcIXsLKZ4KsjcNcluKc6XTsWuhDRN0oi6Z03HDSgg4e63f6yFwUYd8I2XJ0lRJec1lZsjbCE9iVW0sCRULZPKS1WHgHx+DXNPr4UmhqdMio0kQI/L3BoYsLcZI7ZWHCuxsXkRvNEfbJMN/WC53fB6G/Dp2g3mHIAV+XL5uZpSDUQ1Dl2dkkkP1PLgRkv4ByJVcyre9roD3l247X4iU4OorXt4/I7GjGSlHHYJwJV6H2Sme47UhByfjVwqGJkCaL11ZZKBvMXGnB/VmsnFrp3Nb419/f1WPE6hUFQa1qqLk3qRoe5ev07lJuuiotjBYo2lseyy4oXLT/NSmdX1Bzd2Fz287C0SB6v71iI2F2pMtKjEKBLBBLcCmTGM9sBiHOpGEPIDeNGWf+fbjckqUwF/YvuCL3aeHm3aYhJ0PdzEMRyowk44ImvU7GdoHeCo9sOQzfi/Z2BuC68nu8Eetx+ZMdANnrvYdL+7Mk4RXZx2WKhE1OmcHfS2f1mDPDALEkKjYNrg7TXY6CYXixhQwOZsy6pIrSYKqwF7PCN5A7NxBkxsLKCncRJOXkfunvFqRP8IITlksGZizcUgjg/Nr2Yyq0M9WKJnov4kF+m2m2LpHn2iTIoZa8w6+jSBhxX4R3g4WfZB2vKEhXFlkDQWIPi7MvvKfUBAyN9STEBOaLATRGDWuuEN4ngQEKIDZmgogTVyjP5T9frERiLS0PyJeJBQ93beH1EtXe6RQ5b8AMjv7dUZbBfOirZj92hhIT74zFI5JedYrOHTQI25UajnZKlyM93rn7sDfGkanKfFJmIOt6X9IbC56OyCogcp0JpwfkymnIyI20X5awRdls9cl3grMbNID5uLM3Yhu2KPuK6bv+p4GGs79iyWesSi6XYGBO+LG1xMlOdZ3+G27hh6dk2zgeTvJcVYPSLclSfKbUlGgiv5dTfWvnZHsoRBg7qMYSGdK2k28MUlc04M/RhQAWzErwAFsPEHNi++OmWEpQAp6w5VdcxwFc6J3Jvairv+h//tMMfR6MnULY/yF3HgHqTOs4A== X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3832; 6:O2V4OschbQurARGR9BjI7SmyLkziGQOAUnG6m2y0uA4wYnhGBTmIivWQdHllBMJ/u/wl76CAvDgvc+Lt2sXHoIbCvRPzK7u9Iqj1xcjhnr8UISovYKLdo+OAMZSjuzEbZuuAjOZR7Ea/gqwZfd9SJyy49A54UkYl5srIjOimIQSq9BV4fMc6uM7UZeSIjsMshmhMI3xlVAJ7EG8oeDyMueSanICq40C1SYK4baBpQ73EdzunYI4sYwPFtLqLXnYyyAdsdgAv2ZGDew/o10YGR8gGPxGA0nJwq5AxXPJAQcPEjHgBhUZpJH4tBaYuKtvnpLfaNV2i+OVK0ZT0SqdWiw==; 5:QCE5YR9A1ELa91GP+FI35/TuSD0DSkmyD0zUBRgDJAWySAk4EO2wl0CubN4In+nJWsYTRCwPaK8v75zcnRfNvgiorsnXYiADkoJag2mHrlXB8H+frtR/K+JFe/WwRanOu5rGu3fqjWHfXVJCbyqu9Q==; 24:FDH7JyNPU3SfzkK4yBVgKPBY4JRmhJL0ninNVHJzUze69+Ex1fdz+mvg9TYxl7o1oIJREcQ3FijK0aDm46UZupZhbslPcZOVI432IKqEulI=; 7:iks40fm3LzRDxXxz74jxE599Eu51TfDJ1rLkTwNPyulUW3BMtUQRS51SVGBvqe0AqZOdTHrztEBPeYvfHkvGJPgdNqepbH5yofhFqMl3mONMUW97ikuHUdwNNM9akLk1ISnZAoselni12RJ0adkH5t1GW5KK+Dq0N2UdxmTwviVxT8+at0b5htlkEsr1wDDyq5lx4qzV0oHmtODclnEuuccKTdr66YJDPtZyMEh3g+U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2017 01:51:59.4764 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0701MB3832 Subject: [dpdk-dev] [PATCH 30/53] net/qede/base: read per queue coalescing from HW X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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 base driver API to read per queue coalescing from hardware. Move ecore_set_rxq|txq_coalesce() declarations to ecore_l2.h. Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore_dev_api.h | 14 ++++ drivers/net/qede/base/ecore_l2.c | 118 +++++++++++++++++++++++++++++++-- drivers/net/qede/base/ecore_l2.h | 24 +++++++ drivers/net/qede/base/ecore_sriov.c | 82 +++++++++++++++++++++-- drivers/net/qede/base/ecore_vf.c | 33 +++++++++ drivers/net/qede/base/ecore_vf.h | 30 +++++---- drivers/net/qede/base/ecore_vfpf_if.h | 16 +++++ 7 files changed, 295 insertions(+), 22 deletions(-) diff --git a/drivers/net/qede/base/ecore_dev_api.h b/drivers/net/qede/base/ecore_dev_api.h index 8b28af9..fd453f5 100644 --- a/drivers/net/qede/base/ecore_dev_api.h +++ b/drivers/net/qede/base/ecore_dev_api.h @@ -635,6 +635,20 @@ enum _ecore_status_t ecore_final_cleanup(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, u16 id, bool is_vf); + +/** + * @brief ecore_get_queue_coalesce - Retrieve coalesce value for a given queue. + * + * @param p_hwfn + * @param p_coal - store coalesce value read from the hardware. + * @param p_handle + * + * @return enum _ecore_status_t + **/ +enum _ecore_status_t +ecore_get_queue_coalesce(struct ecore_hwfn *p_hwfn, u16 *coal, + void *handle); + /** * @brief ecore_set_queue_coalesce - Configure coalesce parameters for Rx and * Tx queue. The fact that we can configure coalescing to up to 511, but on diff --git a/drivers/net/qede/base/ecore_l2.c b/drivers/net/qede/base/ecore_l2.c index 3071b46..7c2299a 100644 --- a/drivers/net/qede/base/ecore_l2.c +++ b/drivers/net/qede/base/ecore_l2.c @@ -196,6 +196,7 @@ void ecore_eth_queue_cid_release(struct ecore_hwfn *p_hwfn, _ecore_eth_queue_to_cid(struct ecore_hwfn *p_hwfn, u16 opaque_fid, u32 cid, struct ecore_queue_start_common_params *p_params, + bool b_is_rx, struct ecore_queue_cid_vf_params *p_vf_params) { struct ecore_queue_cid *p_cid; @@ -214,6 +215,7 @@ void ecore_eth_queue_cid_release(struct ecore_hwfn *p_hwfn, p_cid->rel.queue_id = p_params->queue_id; p_cid->rel.stats_id = p_params->stats_id; p_cid->sb_igu_id = p_params->p_sb->igu_sb_id; + p_cid->b_is_rx = b_is_rx; p_cid->sb_idx = p_params->sb_idx; /* Fill-in bits related to VFs' queues if information was provided */ @@ -287,6 +289,7 @@ void ecore_eth_queue_cid_release(struct ecore_hwfn *p_hwfn, struct ecore_queue_cid * ecore_eth_queue_to_cid(struct ecore_hwfn *p_hwfn, u16 opaque_fid, struct ecore_queue_start_common_params *p_params, + bool b_is_rx, struct ecore_queue_cid_vf_params *p_vf_params) { struct ecore_queue_cid *p_cid; @@ -321,7 +324,7 @@ struct ecore_queue_cid * } p_cid = _ecore_eth_queue_to_cid(p_hwfn, opaque_fid, cid, - p_params, p_vf_params); + p_params, b_is_rx, p_vf_params); if ((p_cid == OSAL_NULL) && IS_PF(p_hwfn->p_dev) && !b_legacy_vf) _ecore_cxt_release_cid(p_hwfn, cid, vfid); @@ -330,9 +333,11 @@ struct ecore_queue_cid * static struct ecore_queue_cid * ecore_eth_queue_to_cid_pf(struct ecore_hwfn *p_hwfn, u16 opaque_fid, + bool b_is_rx, struct ecore_queue_start_common_params *p_params) { - return ecore_eth_queue_to_cid(p_hwfn, opaque_fid, p_params, OSAL_NULL); + return ecore_eth_queue_to_cid(p_hwfn, opaque_fid, p_params, b_is_rx, + OSAL_NULL); } enum _ecore_status_t @@ -984,7 +989,7 @@ enum _ecore_status_t enum _ecore_status_t rc; /* Allocate a CID for the queue */ - p_cid = ecore_eth_queue_to_cid_pf(p_hwfn, opaque_fid, p_params); + p_cid = ecore_eth_queue_to_cid_pf(p_hwfn, opaque_fid, true, p_params); if (p_cid == OSAL_NULL) return ECORE_NOMEM; @@ -1200,7 +1205,7 @@ enum _ecore_status_t struct ecore_queue_cid *p_cid; enum _ecore_status_t rc; - p_cid = ecore_eth_queue_to_cid_pf(p_hwfn, opaque_fid, p_params); + p_cid = ecore_eth_queue_to_cid_pf(p_hwfn, opaque_fid, false, p_params); if (p_cid == OSAL_NULL) return ECORE_INVAL; @@ -2137,3 +2142,108 @@ enum _ecore_status_t return ecore_spq_post(p_hwfn, p_ent, OSAL_NULL); } + +int ecore_get_rxq_coalesce(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, + struct ecore_queue_cid *p_cid, + u16 *p_rx_coal) +{ + u32 coalesce, address, is_valid; + struct cau_sb_entry sb_entry; + u8 timer_res; + enum _ecore_status_t rc; + + rc = ecore_dmae_grc2host(p_hwfn, p_ptt, CAU_REG_SB_VAR_MEMORY + + p_cid->sb_igu_id * sizeof(u64), + (u64)(osal_uintptr_t)&sb_entry, 2, 0); + if (rc != ECORE_SUCCESS) { + DP_ERR(p_hwfn, "dmae_grc2host failed %d\n", rc); + return rc; + } + + timer_res = GET_FIELD(sb_entry.params, CAU_SB_ENTRY_TIMER_RES0); + + address = BAR0_MAP_REG_USDM_RAM + + USTORM_ETH_QUEUE_ZONE_OFFSET(p_cid->abs.queue_id); + coalesce = ecore_rd(p_hwfn, p_ptt, address); + + is_valid = GET_FIELD(coalesce, COALESCING_TIMESET_VALID); + if (!is_valid) + return ECORE_INVAL; + + coalesce = GET_FIELD(coalesce, COALESCING_TIMESET_TIMESET); + *p_rx_coal = (u16)(coalesce << timer_res); + + return ECORE_SUCCESS; +} + +int ecore_get_txq_coalesce(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, + struct ecore_queue_cid *p_cid, + u16 *p_tx_coal) +{ + u32 coalesce, address, is_valid; + struct cau_sb_entry sb_entry; + u8 timer_res; + enum _ecore_status_t rc; + + rc = ecore_dmae_grc2host(p_hwfn, p_ptt, CAU_REG_SB_VAR_MEMORY + + p_cid->sb_igu_id * sizeof(u64), + (u64)(osal_uintptr_t)&sb_entry, 2, 0); + if (rc != ECORE_SUCCESS) { + DP_ERR(p_hwfn, "dmae_grc2host failed %d\n", rc); + return rc; + } + + timer_res = GET_FIELD(sb_entry.params, CAU_SB_ENTRY_TIMER_RES1); + + address = BAR0_MAP_REG_XSDM_RAM + + XSTORM_ETH_QUEUE_ZONE_OFFSET(p_cid->abs.queue_id); + coalesce = ecore_rd(p_hwfn, p_ptt, address); + + is_valid = GET_FIELD(coalesce, COALESCING_TIMESET_VALID); + if (!is_valid) + return ECORE_INVAL; + + coalesce = GET_FIELD(coalesce, COALESCING_TIMESET_TIMESET); + *p_tx_coal = (u16)(coalesce << timer_res); + + return ECORE_SUCCESS; +} + +enum _ecore_status_t +ecore_get_queue_coalesce(struct ecore_hwfn *p_hwfn, u16 *p_coal, + void *handle) +{ + struct ecore_queue_cid *p_cid = (struct ecore_queue_cid *)handle; + enum _ecore_status_t rc = ECORE_SUCCESS; + struct ecore_ptt *p_ptt; + + if (IS_VF(p_hwfn->p_dev)) { + rc = ecore_vf_pf_get_coalesce(p_hwfn, p_coal, p_cid); + if (rc != ECORE_SUCCESS) + DP_NOTICE(p_hwfn, false, + "Unable to read queue calescing\n"); + + return rc; + } + + p_ptt = ecore_ptt_acquire(p_hwfn); + if (!p_ptt) + return ECORE_AGAIN; + + if (p_cid->b_is_rx) { + rc = ecore_get_rxq_coalesce(p_hwfn, p_ptt, p_cid, p_coal); + if (rc != ECORE_SUCCESS) + goto out; + } else { + rc = ecore_get_txq_coalesce(p_hwfn, p_ptt, p_cid, p_coal); + if (rc != ECORE_SUCCESS) + goto out; + } + +out: + ecore_ptt_release(p_hwfn, p_ptt); + + return rc; +} diff --git a/drivers/net/qede/base/ecore_l2.h b/drivers/net/qede/base/ecore_l2.h index 3618ae6..f4212cf 100644 --- a/drivers/net/qede/base/ecore_l2.h +++ b/drivers/net/qede/base/ecore_l2.h @@ -64,6 +64,8 @@ struct ecore_queue_cid { u32 cid; u16 opaque_fid; + bool b_is_rx; + /* VFs queues are mapped differently, so we need to know the * relative queue associated with them [0-based]. * Notice this is relevant on the *PF* queue-cid of its VF's queues, @@ -96,6 +98,7 @@ void ecore_eth_queue_cid_release(struct ecore_hwfn *p_hwfn, struct ecore_queue_cid * ecore_eth_queue_to_cid(struct ecore_hwfn *p_hwfn, u16 opaque_fid, struct ecore_queue_start_common_params *p_params, + bool b_is_rx, struct ecore_queue_cid_vf_params *p_vf_params); enum _ecore_status_t @@ -140,4 +143,25 @@ enum _ecore_status_t u16 pq_id); u8 ecore_mcast_bin_from_mac(u8 *mac); + +enum _ecore_status_t ecore_set_rxq_coalesce(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, + u16 coalesce, + struct ecore_queue_cid *p_cid); + +enum _ecore_status_t ecore_set_txq_coalesce(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, + u16 coalesce, + struct ecore_queue_cid *p_cid); + +enum _ecore_status_t ecore_get_rxq_coalesce(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, + struct ecore_queue_cid *p_cid, + u16 *p_hw_coal); + +enum _ecore_status_t ecore_get_txq_coalesce(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, + struct ecore_queue_cid *p_cid, + u16 *p_hw_coal); + #endif diff --git a/drivers/net/qede/base/ecore_sriov.c b/drivers/net/qede/base/ecore_sriov.c index 82ba198..53d6b36 100644 --- a/drivers/net/qede/base/ecore_sriov.c +++ b/drivers/net/qede/base/ecore_sriov.c @@ -54,6 +54,7 @@ "CHANNEL_TLV_UPDATE_TUNN_PARAM", "CHANNEL_TLV_COALESCE_UPDATE", "CHANNEL_TLV_QID", + "CHANNEL_TLV_COALESCE_READ", "CHANNEL_TLV_MAX" }; @@ -1392,6 +1393,8 @@ static void ecore_iov_send_response(struct ecore_hwfn *p_hwfn, REG_WR(p_hwfn, GTT_BAR0_MAP_REG_USDM_RAM + USTORM_VF_PF_CHANNEL_READY_OFFSET(eng_vf_id), 1); + + OSAL_IOV_PF_RESP_TYPE(p_hwfn, p_vf->relative_vf_id, status); } static u16 ecore_iov_vport_to_tlv(enum ecore_iov_vport_update_flag flag) @@ -1476,8 +1479,6 @@ static void ecore_iov_prepare_resp(struct ecore_hwfn *p_hwfn, sizeof(struct channel_list_end_tlv)); ecore_iov_send_response(p_hwfn, p_ptt, vf_info, length, status); - - OSAL_IOV_PF_RESP_TYPE(p_hwfn, vf_info->relative_vf_id, status); } struct ecore_public_vf_info @@ -2258,7 +2259,7 @@ static void ecore_iov_vf_mbx_start_rxq(struct ecore_hwfn *p_hwfn, vf_params.qid_usage_idx = qid_usage_idx; p_cid = ecore_eth_queue_to_cid(p_hwfn, vf->opaque_fid, - ¶ms, &vf_params); + ¶ms, true, &vf_params); if (p_cid == OSAL_NULL) goto out; @@ -2532,7 +2533,7 @@ static void ecore_iov_vf_mbx_start_txq(struct ecore_hwfn *p_hwfn, vf_params.qid_usage_idx = qid_usage_idx; p_cid = ecore_eth_queue_to_cid(p_hwfn, vf->opaque_fid, - ¶ms, &vf_params); + ¶ms, false, &vf_params); if (p_cid == OSAL_NULL) goto out; @@ -3452,6 +3453,76 @@ static void ecore_iov_vf_mbx_release(struct ecore_hwfn *p_hwfn, length, status); } +static void ecore_iov_vf_pf_get_coalesce(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, + struct ecore_vf_info *p_vf) +{ + struct ecore_iov_vf_mbx *mbx = &p_vf->vf_mbx; + struct pfvf_read_coal_resp_tlv *p_resp; + struct vfpf_read_coal_req_tlv *req; + u8 status = PFVF_STATUS_FAILURE; + struct ecore_vf_queue *p_queue; + struct ecore_queue_cid *p_cid; + enum _ecore_status_t rc = ECORE_SUCCESS; + u16 coal = 0, qid, i; + bool b_is_rx; + + mbx->offset = (u8 *)mbx->reply_virt; + req = &mbx->req_virt->read_coal_req; + + qid = req->qid; + b_is_rx = req->is_rx ? true : false; + + if (b_is_rx) { + if (!ecore_iov_validate_rxq(p_hwfn, p_vf, qid, + ECORE_IOV_VALIDATE_Q_ENABLE)) { + DP_VERBOSE(p_hwfn, ECORE_MSG_IOV, + "VF[%d]: Invalid Rx queue_id = %d\n", + p_vf->abs_vf_id, qid); + goto send_resp; + } + + p_cid = ecore_iov_get_vf_rx_queue_cid(&p_vf->vf_queues[qid]); + rc = ecore_get_rxq_coalesce(p_hwfn, p_ptt, p_cid, &coal); + if (rc != ECORE_SUCCESS) + goto send_resp; + } else { + if (!ecore_iov_validate_txq(p_hwfn, p_vf, qid, + ECORE_IOV_VALIDATE_Q_ENABLE)) { + DP_VERBOSE(p_hwfn, ECORE_MSG_IOV, + "VF[%d]: Invalid Tx queue_id = %d\n", + p_vf->abs_vf_id, qid); + goto send_resp; + } + for (i = 0; i < MAX_QUEUES_PER_QZONE; i++) { + p_queue = &p_vf->vf_queues[qid]; + if ((p_queue->cids[i].p_cid == OSAL_NULL) || + (!p_queue->cids[i].b_is_tx)) + continue; + + p_cid = p_queue->cids[i].p_cid; + + rc = ecore_get_txq_coalesce(p_hwfn, p_ptt, + p_cid, &coal); + if (rc != ECORE_SUCCESS) + goto send_resp; + break; + } + } + + status = PFVF_STATUS_SUCCESS; + +send_resp: + p_resp = ecore_add_tlv(&mbx->offset, CHANNEL_TLV_COALESCE_READ, + sizeof(*p_resp)); + p_resp->coal = coal; + + ecore_add_tlv(&mbx->offset, CHANNEL_TLV_LIST_END, + sizeof(struct channel_list_end_tlv)); + + ecore_iov_send_response(p_hwfn, p_ptt, p_vf, sizeof(*p_resp), status); +} + static void ecore_iov_vf_pf_set_coalesce(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, struct ecore_vf_info *vf) @@ -3986,6 +4057,9 @@ void ecore_iov_process_mbx_req(struct ecore_hwfn *p_hwfn, case CHANNEL_TLV_COALESCE_UPDATE: ecore_iov_vf_pf_set_coalesce(p_hwfn, p_ptt, p_vf); break; + case CHANNEL_TLV_COALESCE_READ: + ecore_iov_vf_pf_get_coalesce(p_hwfn, p_ptt, p_vf); + break; } } else if (ecore_iov_tlv_supported(mbx->first_tlv.tl.type)) { /* If we've received a message from a VF we consider malicious diff --git a/drivers/net/qede/base/ecore_vf.c b/drivers/net/qede/base/ecore_vf.c index fb5d0a7..97ed0b7 100644 --- a/drivers/net/qede/base/ecore_vf.c +++ b/drivers/net/qede/base/ecore_vf.c @@ -1454,6 +1454,39 @@ enum _ecore_status_t ecore_vf_pf_int_cleanup(struct ecore_hwfn *p_hwfn) return rc; } +enum _ecore_status_t ecore_vf_pf_get_coalesce(struct ecore_hwfn *p_hwfn, + u16 *p_coal, + struct ecore_queue_cid *p_cid) +{ + struct ecore_vf_iov *p_iov = p_hwfn->vf_iov_info; + struct pfvf_read_coal_resp_tlv *resp; + struct vfpf_read_coal_req_tlv *req; + enum _ecore_status_t rc; + + /* clear mailbox and prep header tlv */ + req = ecore_vf_pf_prep(p_hwfn, CHANNEL_TLV_COALESCE_READ, + sizeof(*req)); + req->qid = p_cid->rel.queue_id; + req->is_rx = p_cid->b_is_rx ? 1 : 0; + + ecore_add_tlv(&p_iov->offset, CHANNEL_TLV_LIST_END, + sizeof(struct channel_list_end_tlv)); + resp = &p_iov->pf2vf_reply->read_coal_resp; + + rc = ecore_send_msg2pf(p_hwfn, &resp->hdr.status, sizeof(*resp)); + if (rc != ECORE_SUCCESS) + goto exit; + + if (resp->hdr.status != PFVF_STATUS_SUCCESS) + goto exit; + + *p_coal = resp->coal; +exit: + ecore_vf_pf_req_end(p_hwfn, rc); + + return rc; +} + enum _ecore_status_t ecore_vf_pf_set_coalesce(struct ecore_hwfn *p_hwfn, u16 rx_coal, u16 tx_coal, struct ecore_queue_cid *p_cid) diff --git a/drivers/net/qede/base/ecore_vf.h b/drivers/net/qede/base/ecore_vf.h index 0945522..8c44d37 100644 --- a/drivers/net/qede/base/ecore_vf.h +++ b/drivers/net/qede/base/ecore_vf.h @@ -51,23 +51,25 @@ struct ecore_vf_iov { struct ecore_sb_info *sbs_info[PFVF_MAX_SBS_PER_VF]; }; - -enum _ecore_status_t ecore_set_rxq_coalesce(struct ecore_hwfn *p_hwfn, - struct ecore_ptt *p_ptt, - u16 coalesce, - struct ecore_queue_cid *p_cid); -enum _ecore_status_t ecore_set_txq_coalesce(struct ecore_hwfn *p_hwfn, - struct ecore_ptt *p_ptt, - u16 coalesce, - struct ecore_queue_cid *p_cid); +/** + * @brief VF - Get coalesce per VF's relative queue. + * + * @param p_hwfn + * @param p_coal - coalesce value in micro second for VF queues. + * @param p_cid - queue cid + * + **/ +enum _ecore_status_t ecore_vf_pf_get_coalesce(struct ecore_hwfn *p_hwfn, + u16 *p_coal, + struct ecore_queue_cid *p_cid); /** * @brief VF - Set Rx/Tx coalesce per VF's relative queue. - * Coalesce value '0' will omit the configuration. + * Coalesce value '0' will omit the configuration. * - * @param p_hwfn - * @param rx_coal - coalesce value in micro second for rx queue - * @param tx_coal - coalesce value in micro second for tx queue - * @param queue_cid + * @param p_hwfn + * @param rx_coal - coalesce value in micro second for rx queue + * @param tx_coal - coalesce value in micro second for tx queue + * @param p_cid - queue cid * **/ enum _ecore_status_t ecore_vf_pf_set_coalesce(struct ecore_hwfn *p_hwfn, diff --git a/drivers/net/qede/base/ecore_vfpf_if.h b/drivers/net/qede/base/ecore_vfpf_if.h index 4df5619..d632423 100644 --- a/drivers/net/qede/base/ecore_vfpf_if.h +++ b/drivers/net/qede/base/ecore_vfpf_if.h @@ -503,6 +503,19 @@ struct vfpf_update_coalesce { u8 padding[2]; }; +struct vfpf_read_coal_req_tlv { + struct vfpf_first_tlv first_tlv; + u16 qid; + u8 is_rx; + u8 padding[5]; +}; + +struct pfvf_read_coal_resp_tlv { + struct pfvf_tlv hdr; + u16 coal; + u8 padding[6]; +}; + union vfpf_tlvs { struct vfpf_first_tlv first_tlv; struct vfpf_acquire_tlv acquire; @@ -516,6 +529,7 @@ struct vfpf_update_coalesce { struct vfpf_ucast_filter_tlv ucast_filter; struct vfpf_update_tunn_param_tlv tunn_param_update; struct vfpf_update_coalesce update_coalesce; + struct vfpf_read_coal_req_tlv read_coal_req; struct tlv_buffer_size tlv_buf_size; }; @@ -525,6 +539,7 @@ struct vfpf_update_coalesce { struct tlv_buffer_size tlv_buf_size; struct pfvf_start_queue_resp_tlv queue_start; struct pfvf_update_tunn_param_tlv tunn_param_resp; + struct pfvf_read_coal_resp_tlv read_coal_resp; }; /* This is a structure which is allocated in the VF, which the PF may update @@ -644,6 +659,7 @@ enum { CHANNEL_TLV_UPDATE_TUNN_PARAM, CHANNEL_TLV_COALESCE_UPDATE, CHANNEL_TLV_QID, + CHANNEL_TLV_COALESCE_READ, CHANNEL_TLV_MAX, /* Required for iterating over vport-update tlvs.