From patchwork Sun Jun 4 10:30:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mintz, Yuval" X-Patchwork-Id: 770874 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wgZ4s5Bk6z9s74 for ; Sun, 4 Jun 2017 20:31:57 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=CAVIUMNETWORKS.onmicrosoft.com header.i=@CAVIUMNETWORKS.onmicrosoft.com header.b="A6mHLH9h"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751170AbdFDKbb (ORCPT ); Sun, 4 Jun 2017 06:31:31 -0400 Received: from mail-co1nam03on0070.outbound.protection.outlook.com ([104.47.40.70]:10770 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751157AbdFDKb2 (ORCPT ); Sun, 4 Jun 2017 06:31:28 -0400 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=3ReZYtojuG5n5VhBlMkQdd4zpRuk6ouGNo0pmcdFcRc=; b=A6mHLH9hVAfqXOMb45xCcdba9Hmw6bxXKYg63wzYaDUU4sr+IG1cagxeGzH/dAkFSMY1L8CZSnP+6y55mm4gZaTq+9KgmitQcLMSzFYnovgK4+SVLrcWnollQZlDhCQ4VFcFWbGNarYSuJazUzGqqhdqhi0Fu9WDMe6TGsKCFU4= Received: from MWHPR07CA0018.namprd07.prod.outlook.com (10.172.94.28) by BN1PR07MB424.namprd07.prod.outlook.com (10.141.59.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Sun, 4 Jun 2017 10:31:25 +0000 Received: from BN1AFFO11FD031.protection.gbl (2a01:111:f400:7c10::170) by MWHPR07CA0018.outlook.office365.com (2603:10b6:300:dc::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10 via Frontend Transport; Sun, 4 Jun 2017 10:31:22 +0000 Authentication-Results: spf=none (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=cavium.com; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BN1AFFO11FD031.mail.protection.outlook.com (10.58.52.185) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.1101.12 via Frontend Transport; Sun, 4 Jun 2017 10:31:21 +0000 Received: from lb-tlvb-yuvalmin.qlc.com (10.185.6.94) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Sun, 4 Jun 2017 03:31:18 -0700 From: Yuval Mintz To: , CC: Yuval Mintz Subject: [PATCH net-next 01/11] qed: Add bitmaps for VF CIDs Date: Sun, 4 Jun 2017 13:30:59 +0300 Message-ID: <20170604103109.3082-2-Yuval.Mintz@cavium.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170604103109.3082-1-Yuval.Mintz@cavium.com> References: <20170604103109.3082-1-Yuval.Mintz@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39400400002)(39850400002)(39410400002)(2980300002)(428002)(199003)(189002)(9170700003)(72206003)(189998001)(50226002)(36756003)(2906002)(101416001)(4326008)(1076002)(8936002)(81166006)(6666003)(77096006)(8676002)(478600001)(2950100002)(48376002)(76176999)(5003940100001)(356003)(107886003)(38730400002)(104016004)(50986999)(50466002)(305945005)(53416004)(105586002)(106466001)(86362001)(5660300001)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR07MB424; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD031; 1:ypqMcgYJGUxtdRu4c7KxIXTasC+X+Zk85AsETQ9u274IDpeurmF90ufTNPghuTKkMF1K9p3OXbUNUSSwSxWrpqoVZ38KkrV++uNWIjwzhCSrR+WSabYpivyuJ3hAyLEw8fVS6m+9D0ZgHkCTqcPH+rBVXI8Ueugecp+hJJz4E81Rz6Fq1F0/c0mn9UAFk5XJWW4SWOP/Rmvxt56sfMWhguFtKXrARSYpbgMmlX+Ew6dfeVzVQx2AgM7wXrEk15QRJCuIiet6N5G0iD3JZ+xpbhs6k0GowEpleI+uqJJczUoQhuo3Q4iyhrwMYbn0AKb/qfxxQo8dNbQdLUuYcqNi/3eksmYb8xt7Bh2P6K+bal74K9OI4kudcwmmvdgsM1gq7RkzpG9+1eH3KUKOmu+qQCcsptVcA/ru4HDKS7pYFkEf2dKHyV0BG3sVmUWgKoDugXnHcNJ6Fnb9mXvyjk2TBc1VvSCLX4KpdqWv0Am8nheouFyemZ1wEbhMdjX79tOcxbLtj3AI7EC08L++yjjzLg== X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PR07MB424: X-MS-Office365-Filtering-Correlation-Id: e20ff740-b97d-4680-1f9d-08d4ab34d7ec X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:BN1PR07MB424; X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB424; 3:GZtffOwayRy6Okcil5w+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yo0AXrrGUycRVTVo+9fSAdnFmGtFNoyiqH58eIZY+J/iryv6A6zqOyskQyjQlMlRIHXvKMrhEcQQe7c8+KZtXG/5Civ+jOZeleVyPHycSxH/jroUTBNRtO/qBvxIs+tB2jsk/kYYU8/HzVZAssuOdDePrBRZUO6jvAXL213R30T//n80vem3uIRrvQnBCBeMrg8D7kkqZ4NhMyLOiqsPEI+wuQUrjf6Nxlr6YdjA== X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB424; 20:Ml7f/ATYHk6AvmdreWChwWionUunUYBEfI3eyQEYCbyIW7sgRIpMfc++NsUEZZOz/j2KvW6Zb1SzjdozojANh4VaORJzWgE/pVpsinhttnYJm/7s6PQftUBeB8AvyQZIPmR6YCR68x+3CXcZhpLExmTIrcj4ywCNrNiLZLvURJWJAejWPkpuoBdvWdnCVqwUHgsNG7sCrEsu5jLJgLyN9qAwPJCKh0frW8JFlDEsTBmxghwy7PMLVgLukA1FOQNOL2/QTjXh2AHyFKaf1eOV+Hb+2vx7jdBACHdqgVchqNvSLEjIwf9oYZ0pjiPWYyLHIHTeF4tpOmqbCKovWffSL8wDxa9dxL84elMSpzJYIqQ+DXXkQM/dslN/6fyJumfUO+g4LKRIdZ7B0qJnALuyFWFcLaCnrkbBb3fGWq+gjPMHG6LAUBuXG6/TUoYLSyvptSj8F5y4V7R9lasPZvORz2rwwHVlErOdsZR+Z/8gzwUP4zBIdycz6YhcXpptmRFT X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(13016025)(13018025)(10201501046)(93006095)(93001095)(3002001)(100000703101)(100105400095)(6041248)(20161123562025)(20161123555025)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN1PR07MB424; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN1PR07MB424; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR07MB424; 4:UQYV9EtL4dsqNYT9YFu2pmUryQSCy0UGF8ULhRGgX68?= =?us-ascii?Q?LEExhVX1WSmdojo7najJdZCRbh/Ek2lIIjkPS6zubOPtUbNSy2riynqh6w8j?= =?us-ascii?Q?QNGKPOBUznmliBKLKR3icfHV3MmvLsSKeLbQP/EsR800D7eH5x5j4UdJqsLv?= =?us-ascii?Q?dqv7JHdrOFLHNX3u1q6swU/2HIzbFblPUIwr7d+3bVpvezP6UAdmbb3RGNtd?= =?us-ascii?Q?KoQw5hPB8xJdk1KmOCpWTQ2d0oFRX3TIplpgtaa8AnKfSh92GR735qUKvvOg?= =?us-ascii?Q?MES/PVZapdTcV/9q/IK1xYlALn9Lgxxhm6l1qx7nUEd/RHyAkBcF6cr8K5tp?= =?us-ascii?Q?C7/TnQp6Ir40socQiEJcAJ86vpmcUJkEIqC/wjkfVOCcsSfoRgt7mumzizJj?= =?us-ascii?Q?1b1O3bxZcn+2w0RkH0gga4SzdCFNhfVI9OUQzkvfKIf9bNkL9wufm1xdg0Sx?= =?us-ascii?Q?hlnZ4MshoYd6F0hUfKLomGFe4GTARW8shGUNYiQZsYFGEBpWWQxWpDxRPv6w?= =?us-ascii?Q?zvCZ1BsCHnRElSJa7ilP7SxibCGxrgRLhyTuCfE4Y/6xeOdJ0IAf85ToP30W?= =?us-ascii?Q?KgBHxEnpXDU7j3GmO7Y9pE1kGDr8EKAzoCZpiu9uB+rfol9yKyI3ncOy1eXf?= =?us-ascii?Q?hFYPN9Osy2cAjyI50SeJTRM1U6qc8kW1LjqhY5jJOPgVn2tO7eqHKjoNbY5t?= =?us-ascii?Q?KWB8kBNIVVvy/BD5tRiCwdsJyb7TNQAPbwjP3JvZEu4bSxhFPpCsT/8t8w9h?= =?us-ascii?Q?prX66frRFqoL6jE9Rpf8LN4UQg9XbGI1BnIKnxUIwILKk7WIOQ6cPZ/S8gkT?= =?us-ascii?Q?3oikKWIYPDStRXBZn4q4dN3C1xHsMW/0C7WcHdDDXaluGxak/cX6S78hrDfr?= =?us-ascii?Q?tOiWfaJsFw0iQADOTScolLq36MqvAiCv47evzkNwOKkJW3d/NL2HA157gqiC?= =?us-ascii?Q?OWusromN1sD/RBd9fUXjkZxgw7X+4YDM1Dm+vKvrMh9t6v59za4K5ZTqD0t6?= =?us-ascii?Q?YPvT7SLAbt+YV1QpbhUb4Djhhhy9GfNNFtgPKnRnrd1t6eHVRBXE5GchcTjk?= =?us-ascii?Q?qzlhMpVqJoEOoYgaU4RzxJhww0TLEcnRtp29HHBBsI5DwDYFr/rGVQzdXG2q?= =?us-ascii?Q?GVFFgroY8Mq4eav/xjG18aKYplTmv1bWyUVjuKam0Hv6/zRYM7WwQmUAcuC8?= =?us-ascii?Q?801YL7dazBWM=3D?= X-Forefront-PRVS: 03283976A6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR07MB424; 23:4DL8Wg4ZdvL6Dix7Z+ECWC8HsyEfNLjJEv4KFIt2Xe?= =?us-ascii?Q?QcnPPb/oWKvTAE8mjLotaFWyc38ZgsI3lT8VY6NlQZib29Tdns5F697ubMPY?= =?us-ascii?Q?Qgh8pSmSwwJAUfINaDbH3ZHa52ygPN+Ri/BcnGSOHwnSqBPKQUJuJmBIpQ/g?= =?us-ascii?Q?dvm5absGgf3qYiUIq/HA5+SPc4UPHqElNufy42nYF89SUPEEg4fTMTqaPOuX?= =?us-ascii?Q?5F/aIKlHdDtCBz5+z6OdRmDFUKJ2FbPIDeGvo+CwB6omDyeg3kjGQe2lkjSC?= =?us-ascii?Q?lAB7pW8ZSptyOfKaxtq/uR7BdNpdyjZuJxJA+X/APq9RXmNPf1k8JcjmnU0x?= =?us-ascii?Q?Tc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vNpjSCwW4Xh9tI7ole/xfK09f0PPAQesJ+J3P809V0PbLaeplqjljMhQcaLXmsl2L+rP0RqKY9GqrQipchr2zxwJC1FHkPn/9ubbEhUyqusWO15WzTZ06h/ILDc4UMb/37h8gdsDckW62Uijc8IqChWmaS9CeDYOU3kL+LNGv2RWl6xWKUA7yN1Nqa9L7u2r7oJ3oQtftMVBvAtNBoyFEJ/y3zQ40ZEiREDRsbS35RL1FHxU90VlpCG8ATfrVywEcz4mjxTt4hZTR8GrzueDf6ZfkwUwJ89tfPl5har6KSboShW74B2026opNtpabgLxclkU7JQw== X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB424; 5:TQx4SSc3oTWyCsDEXME4kYeFc89WnyOuOsLVQ4hy6d7BR53GQLiNAawWdDb0m8+oE5h8KBZGM7Ee7W3fS/Y8lFP2YFEMnPXAfcItkm/s9A9ACkLXhbkAF/tOoNB4GmouLXZdylGeKSd+HyVbljDun+5BYPU4Wg09N/B23tFkx7EGuyaFf/9RopxFjcTdwIwqFFGLc41p3BoXH5SQINR7nQuf373IEfvBu47uk+ztnImEcj23/q+BO2zz30EQaYWwGBQeZ8mJN4qwz7n8grOwayT/awfj4+ILOjvElJlVTO1GJ25RFYKNOJ3QczzH6pejktZEh1hDgvrmIhSNd48Ign4fkGIHmOQpF/YkFt55Xx72qNMcfzGUC/z1hI1VzXC8SBEb7dD/e9FjPFn7Xv5JAjFJG4jXyc87Q0Ko7iXSYWDNs+KdIABpcxygJWC8YVasXjvAIsBmBnN1yfIq0MbVUroaB4ONhkimGeJhPp/1kdqJfuWrK3YALjb7sRwLhM2Q; 24:hgKPhKrNQb8ReYGAOd00oK1TjH4o7IiwOReST29F0dk91ldUkAwlgcCwTjTsojNz3/JFxn1lsOfcYdl0cUS1gg2ulbKreS40q5t4TEqgGOU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR07MB424; 7:BHldognmZ5UwbrR+Bw7Ky3pxSd+mGmU+vAR0kHH3Aocz6Mfm9q0jWRKi9qnzMUinXf8I2unsruzHTvjjJ3u2fIRAxErrL8Af/AZrbMUbkL5Ldgc1LFeGxh3ZOAyIGY1Xlx96m8L7dy0lii8Ij+rij5An4HuKu98M44g0M8WHFscHwxDw/Zk+KcmmvjfOXx7036znTc7vNMWuxHnhb4bS1iK+c166b+gUqvHBF8Ibiiok8dsxRfm1/JqKhDgWTHfXgb3Bzh5Qcs0s1HPndxCvVVmgDFRKQz34E2sLBegecqcTVHTS2vzWZV3p/BxkHuVgRaJ56Bf8rV7+9Z7eX2eJMg== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2017 10:31:21.1875 (UTC) X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR07MB424 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Each PF has a bitmap for its own ranges of CIDs, to allow easy grabbing of an available CID when such is needed. But VFs are not using the same mechanism, instead relying on hard-coded CIDs [ queue-index == cid ]. As an infrastructure step toward increasing number of CIDs of VFs, the PF is going to maintain bitmaps for the VF CIDs as well - the bitmaps would be per-VF and the ranges would be the same [in HW all VFs of a given PF have the same mapping of CIDs, and the HW is capable of distinguishing between those according to the VF index] Signed-off-by: Yuval Mintz --- drivers/net/ethernet/qlogic/qed/qed_cxt.c | 222 ++++++++++++++++++++++-------- drivers/net/ethernet/qlogic/qed/qed_cxt.h | 54 ++++++-- 2 files changed, 202 insertions(+), 74 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c b/drivers/net/ethernet/qlogic/qed/qed_cxt.c index 6948457..25d5b91 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c +++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c @@ -135,7 +135,6 @@ struct qed_tid_seg { struct qed_conn_type_cfg { u32 cid_count; - u32 cid_start; u32 cids_per_vf; struct qed_tid_seg tid_seg[TASK_SEGMENTS]; }; @@ -222,6 +221,9 @@ struct qed_cxt_mngr { /* Acquired CIDs */ struct qed_cid_acquired_map acquired[MAX_CONN_TYPES]; + struct qed_cid_acquired_map + acquired_vf[MAX_CONN_TYPES][MAX_NUM_VFS]; + /* ILT shadow table */ struct qed_dma_mem *ilt_shadow; u32 pf_start_line; @@ -1121,45 +1123,76 @@ static int qed_ilt_shadow_alloc(struct qed_hwfn *p_hwfn) static void qed_cid_map_free(struct qed_hwfn *p_hwfn) { struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; - u32 type; + u32 type, vf; for (type = 0; type < MAX_CONN_TYPES; type++) { kfree(p_mngr->acquired[type].cid_map); p_mngr->acquired[type].max_count = 0; p_mngr->acquired[type].start_cid = 0; + + for (vf = 0; vf < MAX_NUM_VFS; vf++) { + kfree(p_mngr->acquired_vf[type][vf].cid_map); + p_mngr->acquired_vf[type][vf].max_count = 0; + p_mngr->acquired_vf[type][vf].start_cid = 0; + } } } +static int +qed_cid_map_alloc_single(struct qed_hwfn *p_hwfn, + u32 type, + u32 cid_start, + u32 cid_count, struct qed_cid_acquired_map *p_map) +{ + u32 size; + + if (!cid_count) + return 0; + + size = DIV_ROUND_UP(cid_count, + sizeof(unsigned long) * BITS_PER_BYTE) * + sizeof(unsigned long); + p_map->cid_map = kzalloc(size, GFP_KERNEL); + if (!p_map->cid_map) + return -ENOMEM; + + p_map->max_count = cid_count; + p_map->start_cid = cid_start; + + DP_VERBOSE(p_hwfn, QED_MSG_CXT, + "Type %08x start: %08x count %08x\n", + type, p_map->start_cid, p_map->max_count); + + return 0; +} + static int qed_cid_map_alloc(struct qed_hwfn *p_hwfn) { struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; - u32 start_cid = 0; - u32 type; + u32 start_cid = 0, vf_start_cid = 0; + u32 type, vf; for (type = 0; type < MAX_CONN_TYPES; type++) { - u32 cid_cnt = p_hwfn->p_cxt_mngr->conn_cfg[type].cid_count; - u32 size; + struct qed_conn_type_cfg *p_cfg = &p_mngr->conn_cfg[type]; + struct qed_cid_acquired_map *p_map; - if (cid_cnt == 0) - continue; - - size = DIV_ROUND_UP(cid_cnt, - sizeof(unsigned long) * BITS_PER_BYTE) * - sizeof(unsigned long); - p_mngr->acquired[type].cid_map = kzalloc(size, GFP_KERNEL); - if (!p_mngr->acquired[type].cid_map) + /* Handle PF maps */ + p_map = &p_mngr->acquired[type]; + if (qed_cid_map_alloc_single(p_hwfn, type, start_cid, + p_cfg->cid_count, p_map)) goto cid_map_fail; - p_mngr->acquired[type].max_count = cid_cnt; - p_mngr->acquired[type].start_cid = start_cid; - - p_hwfn->p_cxt_mngr->conn_cfg[type].cid_start = start_cid; + /* Handle VF maps */ + for (vf = 0; vf < MAX_NUM_VFS; vf++) { + p_map = &p_mngr->acquired_vf[type][vf]; + if (qed_cid_map_alloc_single(p_hwfn, type, + vf_start_cid, + p_cfg->cids_per_vf, p_map)) + goto cid_map_fail; + } - DP_VERBOSE(p_hwfn, QED_MSG_CXT, - "Type %08x start: %08x count %08x\n", - type, p_mngr->acquired[type].start_cid, - p_mngr->acquired[type].max_count); - start_cid += cid_cnt; + start_cid += p_cfg->cid_count; + vf_start_cid += p_cfg->cids_per_vf; } return 0; @@ -1265,19 +1298,36 @@ void qed_cxt_mngr_free(struct qed_hwfn *p_hwfn) void qed_cxt_mngr_setup(struct qed_hwfn *p_hwfn) { struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; + struct qed_cid_acquired_map *p_map; + struct qed_conn_type_cfg *p_cfg; int type; + u32 len; /* Reset acquired cids */ for (type = 0; type < MAX_CONN_TYPES; type++) { - u32 cid_cnt = p_hwfn->p_cxt_mngr->conn_cfg[type].cid_count; + u32 vf; + + p_cfg = &p_mngr->conn_cfg[type]; + if (p_cfg->cid_count) { + p_map = &p_mngr->acquired[type]; + len = DIV_ROUND_UP(p_map->max_count, + sizeof(unsigned long) * + BITS_PER_BYTE) * + sizeof(unsigned long); + memset(p_map->cid_map, 0, len); + } - if (cid_cnt == 0) + if (!p_cfg->cids_per_vf) continue; - memset(p_mngr->acquired[type].cid_map, 0, - DIV_ROUND_UP(cid_cnt, - sizeof(unsigned long) * BITS_PER_BYTE) * - sizeof(unsigned long)); + for (vf = 0; vf < MAX_NUM_VFS; vf++) { + p_map = &p_mngr->acquired_vf[type][vf]; + len = DIV_ROUND_UP(p_map->max_count, + sizeof(unsigned long) * + BITS_PER_BYTE) * + sizeof(unsigned long); + memset(p_map->cid_map, 0, len); + } } } @@ -1841,91 +1891,145 @@ void qed_cxt_hw_init_pf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) qed_prs_init_pf(p_hwfn); } -int qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn, - enum protocol_type type, u32 *p_cid) +int _qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn, + enum protocol_type type, u32 *p_cid, u8 vfid) { struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; + struct qed_cid_acquired_map *p_map; u32 rel_cid; - if (type >= MAX_CONN_TYPES || !p_mngr->acquired[type].cid_map) { + if (type >= MAX_CONN_TYPES) { + DP_NOTICE(p_hwfn, "Invalid protocol type %d", type); + return -EINVAL; + } + + if (vfid >= MAX_NUM_VFS && vfid != QED_CXT_PF_CID) { + DP_NOTICE(p_hwfn, "VF [%02x] is out of range\n", vfid); + return -EINVAL; + } + + /* Determine the right map to take this CID from */ + if (vfid == QED_CXT_PF_CID) + p_map = &p_mngr->acquired[type]; + else + p_map = &p_mngr->acquired_vf[type][vfid]; + + if (!p_map->cid_map) { DP_NOTICE(p_hwfn, "Invalid protocol type %d", type); return -EINVAL; } - rel_cid = find_first_zero_bit(p_mngr->acquired[type].cid_map, - p_mngr->acquired[type].max_count); + rel_cid = find_first_zero_bit(p_map->cid_map, p_map->max_count); - if (rel_cid >= p_mngr->acquired[type].max_count) { + if (rel_cid >= p_map->max_count) { DP_NOTICE(p_hwfn, "no CID available for protocol %d\n", type); return -EINVAL; } - __set_bit(rel_cid, p_mngr->acquired[type].cid_map); + __set_bit(rel_cid, p_map->cid_map); + + *p_cid = rel_cid + p_map->start_cid; - *p_cid = rel_cid + p_mngr->acquired[type].start_cid; + DP_VERBOSE(p_hwfn, QED_MSG_CXT, + "Acquired cid 0x%08x [rel. %08x] vfid %02x type %d\n", + *p_cid, rel_cid, vfid, type); return 0; } +int qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn, + enum protocol_type type, u32 *p_cid) +{ + return _qed_cxt_acquire_cid(p_hwfn, type, p_cid, QED_CXT_PF_CID); +} + static bool qed_cxt_test_cid_acquired(struct qed_hwfn *p_hwfn, - u32 cid, enum protocol_type *p_type) + u32 cid, + u8 vfid, + enum protocol_type *p_type, + struct qed_cid_acquired_map **pp_map) { struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; - struct qed_cid_acquired_map *p_map; - enum protocol_type p; u32 rel_cid; /* Iterate over protocols and find matching cid range */ - for (p = 0; p < MAX_CONN_TYPES; p++) { - p_map = &p_mngr->acquired[p]; + for (*p_type = 0; *p_type < MAX_CONN_TYPES; (*p_type)++) { + if (vfid == QED_CXT_PF_CID) + *pp_map = &p_mngr->acquired[*p_type]; + else + *pp_map = &p_mngr->acquired_vf[*p_type][vfid]; - if (!p_map->cid_map) + if (!((*pp_map)->cid_map)) continue; - if (cid >= p_map->start_cid && - cid < p_map->start_cid + p_map->max_count) + if (cid >= (*pp_map)->start_cid && + cid < (*pp_map)->start_cid + (*pp_map)->max_count) break; } - *p_type = p; - if (p == MAX_CONN_TYPES) { - DP_NOTICE(p_hwfn, "Invalid CID %d", cid); - return false; + if (*p_type == MAX_CONN_TYPES) { + DP_NOTICE(p_hwfn, "Invalid CID %d vfid %02x", cid, vfid); + goto fail; } - rel_cid = cid - p_map->start_cid; - if (!test_bit(rel_cid, p_map->cid_map)) { - DP_NOTICE(p_hwfn, "CID %d not acquired", cid); - return false; + rel_cid = cid - (*pp_map)->start_cid; + if (!test_bit(rel_cid, (*pp_map)->cid_map)) { + DP_NOTICE(p_hwfn, "CID %d [vifd %02x] not acquired", + cid, vfid); + goto fail; } + return true; +fail: + *p_type = MAX_CONN_TYPES; + *pp_map = NULL; + return false; } -void qed_cxt_release_cid(struct qed_hwfn *p_hwfn, u32 cid) +void _qed_cxt_release_cid(struct qed_hwfn *p_hwfn, u32 cid, u8 vfid) { - struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; + struct qed_cid_acquired_map *p_map = NULL; enum protocol_type type; bool b_acquired; u32 rel_cid; + if (vfid != QED_CXT_PF_CID && vfid > MAX_NUM_VFS) { + DP_NOTICE(p_hwfn, + "Trying to return incorrect CID belonging to VF %02x\n", + vfid); + return; + } + /* Test acquired and find matching per-protocol map */ - b_acquired = qed_cxt_test_cid_acquired(p_hwfn, cid, &type); + b_acquired = qed_cxt_test_cid_acquired(p_hwfn, cid, vfid, + &type, &p_map); if (!b_acquired) return; - rel_cid = cid - p_mngr->acquired[type].start_cid; - __clear_bit(rel_cid, p_mngr->acquired[type].cid_map); + rel_cid = cid - p_map->start_cid; + clear_bit(rel_cid, p_map->cid_map); + + DP_VERBOSE(p_hwfn, QED_MSG_CXT, + "Released CID 0x%08x [rel. %08x] vfid %02x type %d\n", + cid, rel_cid, vfid, type); +} + +void qed_cxt_release_cid(struct qed_hwfn *p_hwfn, u32 cid) +{ + _qed_cxt_release_cid(p_hwfn, cid, QED_CXT_PF_CID); } int qed_cxt_get_cid_info(struct qed_hwfn *p_hwfn, struct qed_cxt_info *p_info) { struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; + struct qed_cid_acquired_map *p_map = NULL; u32 conn_cxt_size, hw_p_size, cxts_per_p, line; enum protocol_type type; bool b_acquired; /* Test acquired and find matching per-protocol map */ - b_acquired = qed_cxt_test_cid_acquired(p_hwfn, p_info->iid, &type); + b_acquired = qed_cxt_test_cid_acquired(p_hwfn, p_info->iid, + QED_CXT_PF_CID, &type, &p_map); if (!b_acquired) return -EINVAL; diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.h b/drivers/net/ethernet/qlogic/qed/qed_cxt.h index 53ad532..1783634 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_cxt.h +++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.h @@ -54,19 +54,6 @@ struct qed_tid_mem { }; /** - * @brief qed_cxt_acquire - Acquire a new cid of a specific protocol type - * - * @param p_hwfn - * @param type - * @param p_cid - * - * @return int - */ -int qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn, - enum protocol_type type, - u32 *p_cid); - -/** * @brief qedo_cid_get_cxt_info - Returns the context info for a specific cid * * @@ -195,14 +182,51 @@ void qed_qm_init_pf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); */ int qed_qm_reconf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt); +#define QED_CXT_PF_CID (0xff) + /** * @brief qed_cxt_release - Release a cid * * @param p_hwfn * @param cid */ -void qed_cxt_release_cid(struct qed_hwfn *p_hwfn, - u32 cid); +void qed_cxt_release_cid(struct qed_hwfn *p_hwfn, u32 cid); + +/** + * @brief qed_cxt_release - Release a cid belonging to a vf-queue + * + * @param p_hwfn + * @param cid + * @param vfid - engine relative index. QED_CXT_PF_CID if belongs to PF + */ +void _qed_cxt_release_cid(struct qed_hwfn *p_hwfn, u32 cid, u8 vfid); + +/** + * @brief qed_cxt_acquire - Acquire a new cid of a specific protocol type + * + * @param p_hwfn + * @param type + * @param p_cid + * + * @return int + */ +int qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn, + enum protocol_type type, u32 *p_cid); + +/** + * @brief _qed_cxt_acquire - Acquire a new cid of a specific protocol type + * for a vf-queue + * + * @param p_hwfn + * @param type + * @param p_cid + * @param vfid - engine relative index. QED_CXT_PF_CID if belongs to PF + * + * @return int + */ +int _qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn, + enum protocol_type type, u32 *p_cid, u8 vfid); + int qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn, enum qed_cxt_elem_type elem_type, u32 iid); u32 qed_cxt_get_proto_tid_count(struct qed_hwfn *p_hwfn,