From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0052.outbound.protection.outlook.com [104.47.36.52]) by dpdk.org (Postfix) with ESMTP id A63B9D40A for ; Sat, 25 Mar 2017 07:27:26 +0100 (CET) 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=Q7ph8Sft4dTtmMhljJRAMi4xiuLnpmp38WmYvT81zPU=; b=lqnqko6S3k2LDtouXQEcRuIRmykyEynGF6wg8/WilsGwk5RLanG8d2k9TKw1gWwK5GCjnxus5qX8LVWeiBCaRlcFa+jLQlVKGlou/6gLMbWdb+J4aqktM7DqzxnujJ2ZgFbpHQEZuUTJZtfU5h+04g+bengxb9XVg1fVkyufGxk= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Sat, 25 Mar 2017 06:27:21 +0000 From: Shijith Thotton To: Ferruh Yigit Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Sat, 25 Mar 2017 11:54:21 +0530 Message-Id: <1490423097-6797-11-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1490423097-6797-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> <1490423097-6797-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BM1PR01CA0117.INDPRD01.PROD.OUTLOOK.COM (10.174.208.33) To CY1PR07MB2280.namprd07.prod.outlook.com (10.164.112.158) X-MS-Office365-Filtering-Correlation-Id: d074cedb-ff9f-44e1-5f1a-08d473480047 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 3:y/2JMJDe7rJWIz/RtUEUxDhrE+l/kIWHHGhuajbqOsMrhCd/OUQN8SJ+49MT/dSWHsqr/Cb+bLEzjUXS6IVlz+WSF+rSNyrv/OuUAj2fpuzkDYN+rE6VfJZjvYPuysT9wS2f3Ntr/sKDCOdhvZszd33o0phbopXlCHs6Hjj/p0FzBSrnN/2VH5C07VbMFM/LA9k+iu5gDputOWZfKH1OtG6vQglKI6X+IJVkIh04YxjGOvjX4z9mjurSzRyA2Cu7mxrAOpbWRyDU8sCA4jn2Hg==; 25:LDQs1khyRZuaiNrEmSZ4l8oFVGEsA1Jc3xS4YjM80BfPBMCBxPKWAyKkXzhff1OA4bVYcQWOHL8cnaPTrNXwQPvdPaKjfvXVbsLnfJxYVfIbXY57mUa/4seOCIS0iyNf6Z/HMntJ8irtVC1567P3b+QvESCda9A9BdcEDJsU5yyTgUH1693kAbQK/2uAtsqCQg4CLVCpdIXwT3YbBS3IvD5fFjq9ngJb4tRkTeiiupHFrVjMzAZKi4sO1PVfLar91mZ9xJqod2Ks9ZWd1u0o0nTCzHMk5coUnW4TM+82wUpWpEp7QIW0F8ZOvXPdFu9GKnD9AtsCAVizRxK51NlerBsSQ6ZXF+F0IHiQMQhUNB/g4JbRRGSjS+zIz4HkpBHsUAkGnXPFCdGcq4esbKCRAXbcSNp+Itkcvl4AXnBvC2pNGVnRLBRUY1awsn7UCsEkaEeioaM5XFHjj/q4H3nFXA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 31:ZCIkGpYV649cdDfg1NrBGVu7TtKBdGf0ehr44x0prY3bD9HeUDQsrzlqk/tk9VtbhF3YlbO+TFf+JWxrhPE9Pfp9SREyRoNCfOXBJyXxzJ7h5X3cWpaQCHGniirr2rrsv8qLIU4Aha2HmyPD16OdZex/m7MdUUHgBs6pnt3IBXZJbn2wdz2KarbIr9KjB1bT8xLYQCYfTTExA9gmX+Gn7fvaLscBuWwgcmw0NUy1nsw=; 20:lYyyqw/X1yFkgeeH9Rvw/xMge71djyseBWP+b6fEYn5KdDE8oMaEFQyGQktKNIDZged6wSOWOZI6wcDbHsKHQz5i7oNRU3qR92/HVwyjzdeUghjC54DGYQGtwkENbAAX9h37rliQKlKOytwsd2KkkGQ16anbuOv5jIJhk06rbPv5wKUXXv4cRGYfIxffvsnLtDY6IVv2BHdJ3chG3oYQIbfPKcmHpCr+dLClQtBZHeIteSsTma0onuBT67ZaeZQwJkbtzdszRAbH7Ehf9Sscb6R94QX3V69cOsj3hS7y5bJUyud5zc5kCDvQwdC3vJwfOD5S2pOkTyu0FWlsn5p66cbInUDzUzMclzs8/gOt8njx+mx0KLgogZQd12vKj51h0cpEnNIK9BBC9JZl0IYifLJ7q9cO5g88fj8pHXw8tKd+mYGoBtuTpLDjln7h5qYu3UFLbsnAQA/6P/DM/cjiBMYYAMt+ovyCWSt/KF19sX84vrqTyEVa8DYlI2xQEbJFRwmenYSzBWERMSgl7rvdGS1UAiGkr+gwEcPJbCYu0NVnZn9zsVgGzXhhXe5FrxMMTvl0O6qp7ku5UIuFUmlrAjKRGl9qhFfbKa3IlIT0+Ng= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123558025)(20161123555025)(6072148); SRVR:CY1PR07MB2280; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2280; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 4:ouqijEsCC2NS+3CgamGTtQD5caWXiv7Qk7+oPsfF66dPriMrOJaKJuHsU061KeOYqiPVnuvs7gjeVQoEJyhaI/ZrJ9a788yoFZs1D/3EpBItU3uH5cQyNYYs2aa2WaSJp6CATg1N5EXX/eW2doND6NeNCvfcHB040fQ/ibZnBLMmF6XcbMmcdw51K1262RoWRPdHiQQSCKdcE3jo6Ge6zH84nHkxt4wzqucq3G9MhyE3A768g7zUGJ/tanQAK8rwUix1ZTsJKsHiSZgusgn+YTp2j449Mm3Eng22EL5c1X6QnbIf29rc+hBia2SiNv5C42cIRQ7sibmhy1XG7MJ1e+yhJMNv7pv9II3ZLoYzkL/4Hp3EPg+gW39GdVmHCUb2Uc24v+bKS5/7H/DZoxMKIFiTRF1Vg2tnL5xy9Zt/45OjrTaqzmJhw49eaKeuUZ/1U7pMPuWEgCby+7p0c010rLww3LZm74YyakREPhyFQOcrJekAL88EmcMrb8fvMl+2sR+i/oUQptmfzTNJ1Z12H4v/TmEcamBl6E2etYmb/bLXk3gEt7xHZVdU/Qc1vEy3jX4C1m4AxPmuzqRQ9DblPrT1UPbnbQ3DPEqc6mnNitM= X-Forefront-PRVS: 025796F161 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39450400003)(39410400002)(39830400002)(2906002)(2950100002)(5003940100001)(66066001)(42882006)(6916009)(50466002)(48376002)(47776003)(42186005)(53936002)(6512007)(68736007)(5009440100003)(54906002)(50226002)(38730400002)(6486002)(25786009)(305945005)(81166006)(7736002)(6116002)(3846002)(4326008)(8676002)(6506006)(189998001)(36756003)(50986999)(76176999)(33646002)(4720700003)(5660300001)(110136004)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2280; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2280; 23:xJNWYIA6EwrTYybCAdCRf0v5oQmmz3cEu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fpS1BfAr7Disf6Wq9hd1pEPo1GXzqu8cPMbb?= =?us-ascii?Q?jxJGboPQCeKkFwIOxHXpeNG2L1aadcKNItNjfTmhnpdomubj6VlB0HQ2r4pQ?= =?us-ascii?Q?tTZfy20SX7syM06leq7bhMCXszYz6P8rPCf4+6J6E0+64uDLwgzgFYaD1+8n?= =?us-ascii?Q?Tc42p0=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 6:tScOBwJnxJGHATfETFzsBSHZm0Vd8wkCGx3upW6yUqdnwvBMQTLi7Zn9ooUpLUBrTaJV1Ug3BuG9Aqtj+C4SYi0J6fgswYpWHgyIqZ+z3dq3aDmddyUmPIjHpmir3SpApfGtZ30AUbs3jEgprLbRS+EwxOG36MB2Q5Ph/SPj6hZQHy5S6yTu+I0YSW2f6APA8ImDDno+JZvUyYCYlZB3fIh6EACTiP4BXzMsWDST9Xx4wLr+8hjtcssbTFinthV3kmu35gRegU1occ/LUdfJfE7WDkKmpJ2jAWkNwvJCRAZZR3dLeOtPpXMg8UL9Bmnv0C1b4vtHHLT781TRjfWOk+75NU0gszrO4HCeT92F/NUHtp1zLYlz/72PxQcES5LCE4eFQtgJd1ZKsmWnqs83xg==; 5:zYfcXVF2WRgIm3nw1v9aL6Urr2mvtrl5++lS8JIOYaUdW+sNovpo/VuSNYAzrpWHRLeFRyDXUbMvAhiBpzI7PJvCnGj68X3LCpkB0u2QqcUABabKzfc0i7eBedieX1i59f1VWEO0NV4IFwvw9qm7Pw==; 24:WCsyf4tEdXYODvMFBnMbGkiu0teKt/N+dKzkAn4Zb6fe0eodkVRoNaUa+YMdsuhkaiu44rBt/VbXtKLSKV+EhKgRt/+EyW1VkVUqTWJ7KfY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2280; 7:neOBvLYWgzFB+KzRLe7mZNq43gKjnVqck3nrUMCe7No/PlRepbImwoCo1lCsSbRaIFKFm7gHvSzunIKy57i0Vm8toV4WGybmtgO51utmV8E+j/tRVuBlKHZ01ua0W/G0NhFres5H+NeB5V+3dj+AKSRq+T1rsQ/+lpDjEq2ZBYSAeSVFL9EHs9PilCDVmm4R5jZq/kC6Ne5ELF/OWyYpcwvxvjM1OJkEVqoRr/Ny63boCTpb2L9pu94c5IX51WPtYzYQLcLFFY3cwzO8CE3TAXPKFMVbDNY90mySgOXXrJwZF8zSgC7fy8ybKW2pPwLhFMogf2xErDmYIJikkutjzA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2017 06:27:21.9918 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2280 Subject: [dpdk-dev] [PATCH v3 10/46] net/liquidio: add API to setup mbox registers 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: , X-List-Received-Date: Sat, 25 Mar 2017 06:27:27 -0000 Map and initialize mbox registers. Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S Signed-off-by: Mallesham Jatharakonda --- drivers/net/liquidio/base/lio_23xx_vf.c | 61 +++++++++++++++++++++++++++++++++ drivers/net/liquidio/lio_ethdev.c | 15 ++++++-- drivers/net/liquidio/lio_struct.h | 3 ++ 3 files changed, 77 insertions(+), 2 deletions(-) diff --git a/drivers/net/liquidio/base/lio_23xx_vf.c b/drivers/net/liquidio/base/lio_23xx_vf.c index f61f185..70faa9b 100644 --- a/drivers/net/liquidio/base/lio_23xx_vf.c +++ b/drivers/net/liquidio/base/lio_23xx_vf.c @@ -38,6 +38,7 @@ #include "lio_logs.h" #include "lio_23xx_vf.h" #include "lio_23xx_reg.h" +#include "lio_mbox.h" static int cn23xx_vf_reset_io_queues(struct lio_device *lio_dev, uint32_t num_queues) @@ -197,6 +198,63 @@ return 0; } +static void +cn23xx_vf_free_mbox(struct lio_device *lio_dev) +{ + PMD_INIT_FUNC_TRACE(); + + rte_free(lio_dev->mbox[0]); + lio_dev->mbox[0] = NULL; + + rte_free(lio_dev->mbox); + lio_dev->mbox = NULL; +} + +static int +cn23xx_vf_setup_mbox(struct lio_device *lio_dev) +{ + struct lio_mbox *mbox; + + PMD_INIT_FUNC_TRACE(); + + if (lio_dev->mbox == NULL) { + lio_dev->mbox = rte_zmalloc(NULL, sizeof(void *), 0); + if (lio_dev->mbox == NULL) + return -ENOMEM; + } + + mbox = rte_zmalloc(NULL, sizeof(struct lio_mbox), 0); + if (mbox == NULL) { + rte_free(lio_dev->mbox); + lio_dev->mbox = NULL; + return -ENOMEM; + } + + rte_spinlock_init(&mbox->lock); + + mbox->lio_dev = lio_dev; + + mbox->q_no = 0; + + mbox->state = LIO_MBOX_STATE_IDLE; + + /* VF mbox interrupt reg */ + mbox->mbox_int_reg = (uint8_t *)lio_dev->hw_addr + + CN23XX_VF_SLI_PKT_MBOX_INT(0); + /* VF reads from SIG0 reg */ + mbox->mbox_read_reg = (uint8_t *)lio_dev->hw_addr + + CN23XX_SLI_PKT_PF_VF_MBOX_SIG(0, 0); + /* VF writes into SIG1 reg */ + mbox->mbox_write_reg = (uint8_t *)lio_dev->hw_addr + + CN23XX_SLI_PKT_PF_VF_MBOX_SIG(0, 1); + + lio_dev->mbox[0] = mbox; + + rte_write64(LIO_PFVFSIG, mbox->mbox_read_reg); + + return 0; +} + int cn23xx_vf_setup_device(struct lio_device *lio_dev) { @@ -221,6 +279,9 @@ if (lio_dev->default_config == NULL) return -1; + lio_dev->fn_list.setup_mbox = cn23xx_vf_setup_mbox; + lio_dev->fn_list.free_mbox = cn23xx_vf_free_mbox; + lio_dev->fn_list.setup_device_regs = cn23xx_vf_setup_device_regs; return 0; diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 34b7b54..5ee1bb5 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -86,14 +86,19 @@ return -1; } + if (lio_dev->fn_list.setup_mbox(lio_dev)) { + lio_dev_err(lio_dev, "Mailbox setup failed\n"); + goto error; + } + if (cn23xx_vf_set_io_queues_off(lio_dev)) { lio_dev_err(lio_dev, "Setting io queues off failed\n"); - return -1; + goto error; } if (lio_dev->fn_list.setup_device_regs(lio_dev)) { lio_dev_err(lio_dev, "Failed to configure device registers\n"); - return -1; + goto error; } dpdk_queues = (int)lio_dev->sriov_info.rings_per_vf; @@ -102,6 +107,12 @@ lio_dev->max_rx_queues = dpdk_queues; return 0; + +error: + if (lio_dev->mbox[0]) + lio_dev->fn_list.free_mbox(lio_dev); + + return -1; } static int diff --git a/drivers/net/liquidio/lio_struct.h b/drivers/net/liquidio/lio_struct.h index 0af4fe3..01b5716 100644 --- a/drivers/net/liquidio/lio_struct.h +++ b/drivers/net/liquidio/lio_struct.h @@ -45,6 +45,9 @@ struct lio_device; struct lio_fn_list { + int (*setup_mbox)(struct lio_device *); + void (*free_mbox)(struct lio_device *); + int (*setup_device_regs)(struct lio_device *); }; -- 1.8.3.1