From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0071.outbound.protection.outlook.com [104.47.40.71]) by dpdk.org (Postfix) with ESMTP id 44095F958 for ; Thu, 2 Mar 2017 12:38:27 +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=fU9jqy0wprZBx3rfrzYuBR61/zl+AkHFA95Qs/WQrAbDXfMULN9zdnSAd9dlnSMxMeCo0szyzVE+NmypwIpCQk1ios5z+AVwCBDYTB6zwW2IaQm8iotviVAd6hcHbb6vZpI4mHT1QqswLpEemhwuDVGu/XyD75Sqgb/Y1Idwm8M= 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 CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Thu, 2 Mar 2017 11:38:23 +0000 From: Shijith Thotton To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Thu, 2 Mar 2017 17:02:15 +0530 Message-Id: <1488454371-3342-11-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> <1488454371-3342-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: BM1PR01CA0021.INDPRD01.PROD.OUTLOOK.COM (10.163.198.156) To CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) X-MS-Office365-Filtering-Correlation-Id: 0fb5f2aa-4df9-46ff-902e-08d46160a3c9 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:ILDtsXEBdFZbRHqVYI+nYw41/ioJj4zhF/UlFOJIxhbX89XYDsRsGW3xOYpUl3BpGRcCHuAj7LEGSEVoFlPVjlolZu3iICZn5xycT+ODBVBd5Uwq1L7AeqJZvhtB18B7yDQB02wnTgncDQqsv45/ryp2F/egfiGijppSci8HmAs2czjQ4ICAQbxSNjAdTQjAZ3MwEKHPNJINRvXaBchlaNNZlohgIOkJ59f7XCGJVJ4NAs0JhCK8ljP/gFnMKIvBOdAFUrE9v1Wd+m0dde5yxA==; 25:01C3LP3dBEDzeA7HZWLDBzxpdX6iUZIR1GpHJZyDV25jBlye7FIPAdoT5iE+/3TxwhTiKPJM+wTS76m9B8FgPKSSOQHjzBv40LPMf9fD6Ti8oqQwgxKm8frqDWs/e4LpQ/ypLoj3uozTcblwPchlAaXpY8wx9a2n+dbkn3eCKklarXfUsQzy9+4olmnXp+aQvkoM2AIGAjMCJQJvtZsnMwpuAcA0ONX+WALBTW+Ip+rupTljdVlEHkmgMsKbIIBF8O62Cqe966AMonymUubjwaP98yX3/o4Eq+9pUTAqtuc3QE6oa3FGAP71d7Zmd1yoqV1Hi/E5dmP7OsnRMwnQJjnB7/lykow5A5pSGyaOL/nDS1Xz85sxh6f0/jewSQxMmhULcGgSVwsgwcIf00T9pYo4XgLY2vJAwRi8S36VE6etPk5YsyV4cHA6bK7XQhArIFiEHDVuXiUADJKm2mZNVg== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:aG+egVSlAH8ntIr2Y3mBdp+IEIv0igxNp14CvoR8UwRvQIfBkEZBqcQqF7MjixvOxTXYH++QtxqhmfO3LM+KNEiiMUNiEQnLO0nMQngJFwS1RSnAJetuGMBpAWpOhWrUYZzkEbHJYhhMUtapGrzOewHXcgKTDbKXx36vIvIf1HPY8ny1i69c4G/3zmrPZNMBc7lsjlVEBqunOrkXTC+7SiM48arvRzfYzPsFHxcy0gg/fI1BOAO1eGcu/5RycIso; 20:YceZ0qamzNEl/XVNo/CMUIzTnk4xV78NKT3vWaUOb49HaNQZ5goppjRHxm/3TOGk4ooHUGuj7SJ3PqD2k8Bk1OBg4hW9SZIeWSqjuKschPY/RkU7Q65NUw/TvdE0wr0c1kSq9aM2mNzJt1Z4nBHRz0Hy1yltU2NjA3uKDleSzzV1dB3mz+EhW0ehx1IJUR7EeAS00AhiOH/dsbj63Mf3to9zvlAAK2jwYyag9jUPaKtqTfKfoCL8O+mm3MPsjoSrmowipGuDe47Jj82AxR3gmHeL94d+MdNiPhgKjvJBRgKp0eGwjOvMBUB8CUwmaod8Atvjaa1YWrUyJlqF1kodEsKmLA3DvgdPlEuhFvO3bxtbvLGj05jOhR6Q9kRexwMFepjIcxyFZwLfl5q5wtVcnhazQHTFGSwYYL4oyvootD9s1qvp+ZILeueXGWg4UJfmpbwbczYV6yZ2DYHCRUAU7mLEK+Wnu4xhYly+X93lG0OVlh/5MREh5QKRgxdx05P+86I+QLmm3ihX+HasxGmNGkVyS915m7ARtQD4Z58IioAOy1n9QFsudByLa2pjoU7FloclUtxeFBiXH+44TEiqhRg3rmHpOXG4EgixKFk4X3w= 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)(10201501046)(3002001)(6041248)(20161123558025)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148); SRVR:CY1PR07MB2277; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 4:82n1n7/gGVA8CZJTZLn+znodriTYX3Tyn54ntF+31O7Dg9mLLg5Id3GjNl3uKAkb1Bno7tsgy+aVEVktQ2q54B3hO2kuskDAwyRvvxZVjJhuWI123zvmhIvJ18SSmF1AdvGN4FkhJbGkb1KUgVdpo1WH7IhtxmAn6AA8r7Q+YaYLGgeCBcvZO1klH0nOge3yjXj3f2qBt8p+1VcosuTVH/2rusVkg0J2RFHOXjpTnC7Tezp4mQA6/jIg9sPyAB7bBH8WaID/MFl+V2SJ+boU8EdtvRCCsfTH3hhifKonxqWde4Su3xoQZSJvT3pJbSSsSDPh1LlyTiNZDNCLhZXxacXMQjWLdF2rmXc2DxYK5AQwd/0eUqC+68/+lq5GFVyvl+o8w0B56yQcsuYjm40PLI/yCP/EIk8iky0nBrhBj6kHDJuLoatyoTeLxjtPCavk2kZOZHkv9vVPzUuH2VlvRsk2LQQnv4vL1yKJ3Syi9Mm9QCz3YVKqNickZmAiXyIRYryPzzqO/A/wG2WVZ8W5W8A3VBkVFVJVrT7SI29WjCCaU1E7GkculJycT5gqYN0bCKF2bukJg1bSlPDbgnjPsf+Lsx5ywmK87OOOqMU9WHE= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(2950100002)(6916009)(42882006)(5660300001)(92566002)(4720700003)(33646002)(48376002)(50226002)(6666003)(2906002)(5003940100001)(36756003)(8676002)(50466002)(81166006)(110136004)(38730400002)(4326008)(305945005)(2361001)(53936002)(2351001)(25786008)(6512007)(189998001)(54906002)(47776003)(6506006)(6486002)(66066001)(6116002)(3846002)(50986999)(76176999)(5009440100003)(42186005)(7736002)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2277; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2277; 23:x4FosT1yR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Q?C/XrCDEORIpqXKygZAiJSM+xG+BFv43uHP/BU1X09dlxGVRFmwJ4OY748zJ3?= =?us-ascii?Q?uVv/kKkG/YKrXclBSgozOqBR5jqv/yjEkIuKBXlnVoBfdbfPAilj2FolRAg0?= =?us-ascii?Q?G+LeGjuzlAFKEzs1N4UTaVISWjj7Mru5L/qP0NqNAMsE3VrB5lP40wzuePFw?= =?us-ascii?Q?4aYrwqx84Lw5sIq+AwmQeo/jTxlhRs/fjWSsSw/uicYdYshgw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:jWzPnW1nqHAPqdSDsQ8jnXT9ezpJoxRgSCt1392t5hZIaQgjn9p7hLv96ddz8bd689A0+X6K7vBWdVpuMzxXV4c63AmPOA8Ut2zuPhdIt4noXnGsWhuboN5vQRqb1PY2qtTZiOLbbFXAoNQqlSAIXh/9iRhdCnK8JNiGnCCUCKwyOC/ylC96UjxrlfWnQXbQ1SleYLhUVHqqfVp3P/ESZyfEkA5CHPyi5QHDUZ1KOMO0NuzavHigCe3iJ/dytvOCcfLn3ZGwcx2TEuc+wUhmA3+gaZxsg2hczWujVx691eINFvra9jWKDvR0DcF6DmywoO2j/T0Ap0wNHoruXYP5HCG2wSLUjzmBh1OCsIT675mimbH/xV8eYst0llQ0uwxpgRxJ1InqlVjAzhzE0gRuDA==; 5:QMLqfYuuuXsKIkzgQk6GceoyommK5v3K6DQ8nYHZmIP+yVZ3U6ALEHTRkV8C+JvOjybN1Vo82CEb3IFsS8vxxzvql7+v3j22vQXF6tMg6vrC+EwHyy4o4iKSHsU47G/jrIGXRlP91PnMfxl33loz2g==; 24:/Qd1BTpyGxmCQYuVI2ZbKc/HHOuppZseZBGRB2+JV2+1D+s4XGoMIeMomNEzxqiCi7bB7kmXAHnwERyh4SY+fLL3iwDZi5mt79uV5Ctip0A= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:+Fky8Y45AukZ+HhIUUl0Jfb6C1Oq7hhQvPqeIBB/l3kSt0qfsU5MmIMVzyo/ipXvILgRwQCuv4kz5M4pFxslDaeT/gZdjOgeFeyITxkTIGAokUMpzMlz2U+IYADYuGqgrVu5GEVXbXGBC/Ee/e/MRESh2YINA98kSGCRwA5xnkXpbW9NXTACW3zDFFSM09ML6eiNuo0YDqZHnXKDoKxjEfm1nfnLoem8rCe/CNw/TOsNR+cmeQK49HpsrjGctfi/vnou3Qm+Ta/ZZ7tl9RTFTqL8mgIPxNRJkc/FUOjS606s7pXqTq1OEiN6USvsK95q5TSna/k1MnrplX9sTH8JpA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:38:23.4826 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 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: Thu, 02 Mar 2017 11:38:28 -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