From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0085.outbound.protection.outlook.com [104.47.32.85]) by dpdk.org (Postfix) with ESMTP id 2E3F0F959 for ; Tue, 21 Feb 2017 10:28:46 +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=f3kh6WsiVVAXDv32FjadTwbMovA5J3xX9VGXNDPHFdU=; b=hOlcCWQG++yc8tuedzfA6AtjvHf7vBzVkjg1ZVHMnTPD02T/HVrNsKoXrZIQBC8JPmXaIqyTvm4YsWBL9/rzjtTHe3s2ncXWnsKDMVhsHACkJTvGTq4miulx3SJNt9TUDUhAHRNgYZ8zNkadocBD71N5jr6RKM2TUDHMEicP1CU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shijith.Thotton@cavium.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Tue, 21 Feb 2017 09:28:42 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:28 +0530 Message-Id: <1487669225-30091-14-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-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: MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.56.29) To SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) X-MS-Office365-Filtering-Correlation-Id: 240b59f1-b912-48c8-a432-08d45a3c07f5 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:9R3/z2Nb7WmeGE5x4+Eecpi/NoFhr6BIfPJQSwEFTqFxJRk7A0Q8spcXtcjr8ioFhaOsliJAr2OMR2PQ6NJ/kAQcbWtCa46gkmpSUprT+NqxZCnAzlTFv83AkIg8dKL1DharIaUFosP1GKkMEyDXMNG49LWqTHuBSlP1N0ZKJTsA5onfwe6fLznDEclLIfwVq3A4ht9SCIQF+Hqmp/RIf8wCGif3vBlROY6qeRoJhRIbVTA7oLuK7GPmPcSJ0eS5wcwyrYlkZu8CxSAq+yW6Qw==; 25:nKUMqo+hY3MekYU2Rgh9+W6A/dDo9WAMtHkxoLz0nou8CaO6GJhEvL2xI+yu8BqSIwiem/lUIXKdfEIbU6eMy20jCMEFkqnxRkpDxAgSq46iJNUtYFzcM6TF4jBQy1ghHszm1PKv7huARMxQN2ROMyx050NhjpE7va589yfZZ+KtkV1MAYx9bGeukycZchsxu8syKORLewxQ81d8KFONMweZjpvdi/w6DPqBGwqHzwWgAMd2QvUOUYaM30U11Oq5Hc2yC8D7QKMYm7+n6Xx0bFeDANtl4iEBa8SvK40zW3oGNWG6Kt8PmsoczlmGGukPZZosOSwSHOYye/1l/Iruw5Jhni9nd9QuUN/RhyihpqGao3M2lfjPgkCF7KLRaVlqS4Gphd1GkIuvGMeY7hzVvVfSznRdt9RjT5Fkvi00hKTqVhcPwXDms9ROujAOPFkt2u5Swh5qpp8xzUvB/te3tA== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:3eugnfKrM84GCrtETHw2psirGddyUtGPCfDMGwXNBj7jnNAuHlfIgn2/UVmQeCMRhnkAnvAWqGeyb7OXTegbzSuXY9z0nL9EMSpx7bmw2lB7vlqCgOfCu4Xqo1diryOkYXTdkWD11nr3SamlPn0RfarGQcBqL6Wl2QuY5gA6JAwe4pT3QTle2LYTr1Ri2caGFJxjE0ZymvYuig1baXBElGclE1BRo5gPmrsnxsUC9tBefGtHxLS+9GOLwEWtWcy0; 20:C+jrtGpLFLFA7IHca/8f6YemchT7WRUOCFCCYghsQO9n3orw56Zb+HafOw+Lqu05FiRGtOLs+hW94paK+yIzBevLkYZ06xctQYRt9xGCFH4FXcPPZWH8dQ2cxvrOPH4VhorGIDZ9EQoC/wfe/B5yqUTBN5Hv0RHw8PRVTeh026t2SXDUVDmQNaW1E25mcEUPGzKUNJ+yaL1gqOF7Jbl1UZ04UoDCjULXSVTt/qOUvZ8HnoCI+F89O14jYo9Hpp+BZZ8dArbJOYAdK36xzUM0g2oXYkUy8Xz/hQAps9b9V6T+mz+f0NLYFGqLasMq5fUZAolvGvzKgRUzmrAlz283+OrXVu8QxbcCNVoB7EDQHosY2ActddbkKCy+hvW4f+OvdiD4Ja9/eAVDROfliBx7ioCzDCcxTRyM+Co/xIsc1cL+ULS7uLXWeKUfD1/oAVYDY3AGKq3NkmvWpOlsxaHjU1ZoutaVmtco+rJvDD6Euj9Wat2k+cqVMdHIrz8J4+sNJg66DIw8o9Ohg+8PBAhecxIMDXIk3mDMGdhMSCcdzHjnZnp0vJt6masgYs7L9yuZx4l6QVmuvOYkiYZ8OmXzte+dETZ4D/XHZ6OSmqM0C8g= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(6072148); SRVR:SN1PR07MB2285; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 4:zUlFOvyRZyYTyZAppcSiUk597UrQYPXPz9YJQcFsku8HRY6avDaRimZZK8d+L7r5ToTKkcFA7ezC3sssFwi9N8PRTIF14B2ZAYw9XQYXPLXevS86O9Rmww7XnnctA4DD98WqS3DNxFUITUbeJpyy3ZyFonOM5hkF8z0lL7aaBtQHWDgICtDAtlomKXJm6VP2OdKK3a8DJJCyCR/khiWxhtu7jJf9LBcwNZShsNs784wNZp+8mhuAASPNeOiYbCOgLZRaUrinIz426rObmg2alWXvZXdO5zdQs6zUsCqeCCY0ysG8yraE854MdhQpBHb7gaCiykPQa9cb2Ii2rOSH0iCQhItOUH52E5Uie8j3rvNF34is+hbOcqvGi+gbx/56XLbYF5vBE+Lzvkq1IxvELMEECmuSmodVLg85PU5HSvEcIsyfe8YA29N9j1qn42xwTic2thFkQMW9FCFoAbEdflHR1bulUKeL2Ipmy69sAo67u88KZrIHC6JNh3YUT87a3TRXCJbROd6uTTVbvY6yhqWyc5LdqMpeo9Xba4otUFzBvRQabnVubVi7e2UC0f3mx1LD0gHjOYBS7yG1qlLfxrDLz5yNMLzkVo/Rdq6mYs4= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39410400002)(39830400002)(189002)(199003)(50226002)(81166006)(42186005)(2361001)(101416001)(81156014)(305945005)(3846002)(6116002)(5009440100003)(8676002)(105586002)(7736002)(53936002)(36756003)(110136004)(106356001)(6506006)(25786008)(38730400002)(2351001)(92566002)(48376002)(6486002)(97736004)(50466002)(5003940100001)(189998001)(68736007)(2906002)(4326007)(33646002)(76176999)(54906002)(5660300001)(6666003)(6916009)(50986999)(2950100002)(6512007)(4720700003)(42882006)(66066001)(47776003)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2285; H:lio357.in.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; SN1PR07MB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aFLpyC+EnkurLQ5dRbva7nfb3MBzjrA27phT31bH0NIzxeq+W72jUdpZFTUxbPWd2vD9CJM/V6m1/w==; 24:kCkDnA0EKf8KISaYqYrLp5NvldFj/TldxMEycheuOHnKZbppRlw4N7aMObKpzLp8cbYw6bg5cd/iSV8d95MWZ7CdkPWHdc3EsYkmG7Xlcc4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:1fkuF3g32J/SvP715m4MbMu6zhUBfxLKJ10usW4uwGRGOCcZeDl5rUxOWLi/jSf1XaB0ABrkh4DRDJ0ez/aqQX/dYasB8cTYAt5npFIiYt0mfzjkHzBxTiyQx2Wh+AY27j8lG21+ZHtteV3fw4TlH17xT+klO99T0sHxIqrhM5iwMTZvbTga0KgWReHFu/AotFbWtEcOl7aLtg+wQlq+A52EmJg43EB/nkvtdHJ8Is8PR8ztneN8xEthYIoqqFw5xb9H5WoxFrMlAJzkMPiGnGzDQOBWgJclo1LIV1biiB6hwkogw4zwlpas24Iu8CTEly58NMsspJ/z0sNiazChoA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:28:42.2595 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 13/50] 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: Tue, 21 Feb 2017 09:28:46 -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: 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 daf7fce..dd5e3b7 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