From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0082.outbound.protection.outlook.com [104.47.38.82]) by dpdk.org (Postfix) with ESMTP id 2EEB12B98 for ; Fri, 31 Mar 2017 21:35:55 +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=s9Pve3wR0lXuOUyiE9Tj6+26A/gSUzpzg1vUdN7VenE=; b=ZnezWEc3uO73tFOiDFnXrPCzdaevuuzTfO4C/whWohg202FgxycbYwOq4AKHyFOpSMBcHRRo6WIfivlU1TjhA+zE0TaqdVGcwidXb6MQwfNMnUW0IipCp8Hwc+JCU1bOOx3f/AG6MDbzr9lmqV9yE3qZ7DDdqUdIVLAibknhhuc= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain (14.140.2.178) by BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14; Fri, 31 Mar 2017 19:35:50 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, bruce.richardson@intel.com, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, gage.eads@intel.com, nipun.gupta@nxp.com, santosh.shukla@caviumnetworks.com, Jerin Jacob Date: Sat, 1 Apr 2017 01:04:31 +0530 Message-Id: <1490988905-12584-5-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1490988905-12584-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1488562101-6658-1-git-send-email-jerin.jacob@caviumnetworks.com> <1490988905-12584-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MAXPR01CA0058.INDPRD01.PROD.OUTLOOK.COM (10.164.146.158) To BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) X-MS-Office365-Filtering-Correlation-Id: a1f25103-0250-41d8-4793-08d4786d2509 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 3:SeDJ7cEFLhj8V7W1N40edhTalPp6xO36ml6zqQf0Uwph075YycYVGKkCeoZ5JN3YAmr7iQ4i5hq7RwMW0bAoc1zUI3sxswkZpqaRkNhBA/7yA1JkET6gV5IJAlqmEzXlTQQFqxPMLqlvf+uyArsM5yXKDKWbOAJQYaFS78BfigNSU5MVy07LR8msuTTyRibuqOMC+Co860QQ/xYrO5oY0BYXmblrYtz6QgAgBjP0qHisIr+/OGp3+sGDhfAcRMKTJtwsu87H7JqCZEVmqSsPyrD+RRuSlKQi/e+iceCZCYsMuQl0+dghO2C7zyS0SZrUPyvQgZCE8HThFXheeorkYQ==; 25:gfEyTy4nWO9lvZ2re6uK2Azdv5UoaVCeF45Yl/S686QBaUBYOW9nfqBorqtcf1YMNEtSDcw/NCdBv4CKIclje6C+qqiqNktPWN0Tt08gm83gl9BI3ecb4sIz+ff+RrrgoSTaV0Aia89SkgfnUcvZlk51i4XvMXwCwZMzY6d861+mubs0Jz7a6Ued54nsKomXHKjrWjgstUdU+oNFQ7YXhtbDmzf/P+O4NNm2xPVfwJe2vDtIl9nCgKrNx872clwhD+IzsyIruE8uSVs5ru7JWZUS0MU3exN10krOPRVhPlMoAM+Ta1hVtxAUvnaQTcPm1RdTm1hfdGwiP09oyYaBXnjRylHUeVfh2FWQcq0IbSWF1XfKQLl8Nb5f2RGPmPsClfSXVlwabr7ZyW39E7IYm38nQsThBgFYRxofQwIZ6TKixxK29hFBK9z/AtTeaXKBUjjAApe0t3sJ9KBPCQo/xg== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 31:BoZP/EW6C+ddmqvGuqnXRRpDmoJ5KahWK+/+Vvhnd+UBSUulgoyEIw1HPZDtLxfBblqr6Z6pMme+Q48EiZruDkPEw1XeuyjSCBGHBuvf6B439B/M1zwPKIhLiaYGueSmVgLgF0t3CyLRhelrs1jG+VF9fxSKLg2ncNyv6hiS9Qa2YEbFnYyn4dYM4T62rXELz9aJyUfwGNJVUvLVGjqxPWdwqD6ZsbSjfpRZMLVQh2Y=; 20:oA3nVT0Y+b6LPptLxPpQFLRXDCULiATWFmRXdtgpNyY4xKlNdw+iZqjauIJ4nY4Ek2XwqK6HKlLEZNd8mEg9bUDiDFT3TxP5nUF1orfHNZ2TqqSe3xLsO7XdqG1D0wqBGdIs3IRuXNDcDOcG+VfHyF8fPRQOInfP+HE7SA3Yq5pb0CvFaDVQ8gY1KyqtamP9UPAMrCrsLDmM0ChNy9TwqnaRdW20DSdLw2BFCd1MNu+mcK1Xs7KswPflBFQTkGk/9c1oI2jlln65h9spP1HBNLLBkjvnerCutgNog2zpfreFifvpkxKTlHvca7sfu8Wo/dDe7aucasvOk5XZE3ZId3PUIVUN4alcvia/u/72ImxNXJsmt4ExGQB8PzmV51ZCjS+9AwnURxT0xUxyQGTgo238RyIoY6HLEcHx16QE37Qg155k08fNQYPmvkQngb+4m4H/mCYZ1UuREIaY53IK9ajHRWOCxjtp5c+DODwWtubflq7GPNPaLdkXpAg9XsfJnI20Sk7YB4Gy0/GzgCaHiLNdePH3Sfq6MRfE50YKSXRnCwjftAI7YqTvPSWJvpL+JjuMvSDtOGNdXAcPUih+oKhhA1JqK4UIjPNJD9rDnos= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(93006095)(3002001)(6041248)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123564025)(6072148); SRVR:BY1PR0701MB1723; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 4:Wt9paHM/z06lnAs5HX/v85ZDOx2VZANmqB81CRlfacXHsCczJEtIUmVF8dt93u2Q8kLpl45GrNHR1FSu+xSL8s8OQczzhRxW9vDd88HDPedKv8PB4516ccwGzEIvZNErP71JtB1d1JYMEIG5+oCrMUEPTL97/gfCvA76wqyw8aTak2sPvQjvdDuCVL63uoIRLVw1kSQoKklhBsKRyQIODfRe9Qu19moi5IInK7+WSzFGVoxa+Tf39+vnnhUcrDI4I1KvRQ0Q1ohq0vnULNYE5t5slddBofzHipVR4vbeu9qqDuMzMr9E8hkirFoJ/YDQfk+N/KU8EJbKTYFXGz2TvaMuLuTnv9NKaI+tAKOM8HOnSmI2CcNb48kpmhff30d4h7DE0AxJUKdZeoJuStW0PToxAF2nolXPWXCXeDjGQaAkNqZgcH1gofirSXAYEq3AymIDipBiqS/r+Jp2vrGB0kY+pX6Ks3aiV2FGdsLcuVV8E+y4MTS1sQKwHZo5AwCXuf3OIVbtCyZQd4rj2TcK7ulMNO9NZpOiqV5Ift1XHOiqlg+SblgvArwANpmHhjAgOfS1kWIcLdbh8ewTCLI9gzpkLnUxAf8kRGczFvkGUPoLsIXYfCRZdtVrTVhkaNCqi2IGuuWov5aQioiVoY0BecfTUWtY+91vZCtK1Y7O7YEEg8Ax/lD3oZiWbiIGHhPwb9wTvm2YeCkysBQ2K7WHNv1/S4m9v75LGuQmrv+fztOy75btpwVj2qcKNOygbtfo X-Forefront-PRVS: 02638D901B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(979002)(6069001)(6009001)(39450400003)(39410400002)(39400400002)(39850400002)(39840400002)(38730400002)(8676002)(107886003)(110136004)(50466002)(189998001)(305945005)(6506006)(36756003)(50226002)(25786009)(48376002)(6666003)(8656002)(6486002)(7736002)(2950100002)(5660300001)(53936002)(81156014)(81166006)(3846002)(42882006)(6916009)(6116002)(6512007)(42186005)(33646002)(2361001)(2351001)(76176999)(50986999)(5003940100001)(47776003)(2906002)(5009440100003)(4326008)(66066001)(110426004)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1723; H:localhost.localdomain; FPR:; SPF:None; MLV:ovr; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1723; 23:96c1lJMkoBMnF3rhmfR2OX4xTRrXgPq0MTA5diT?= =?us-ascii?Q?QMzUQIoAnOOtLV4JRYXIY/eyMRgQYOc1bxdNvUuBVyoy16SJFCTfX0OmOCnp?= =?us-ascii?Q?HIJIjTX+MVFEJhWc8ldqIdpu88syaDOU2seUDZniq1I/t2RQvl4f7GVHcBf3?= =?us-ascii?Q?iY4XSYmlGhPZr1K50/dbjPMl3BCVK0pQsIOrjk8mAFmUjgIP6v3o2lor9Snx?= =?us-ascii?Q?wfGuGLyH6REhNuR1vD73qD8NHqlmscxm1Dfofpag4Cp5ZKJBR+LyYL/CG1wk?= =?us-ascii?Q?BEw7YBssWwF9wisetjYGD41k2Fb59Fe1gOTrW+vhkHJLK6hZRoW+XUrbBHAI?= =?us-ascii?Q?f03eT3dZr5JLL4YgdOJhVsXGCBJ5g08tABTlxZV1zztO40kHaG4KqDrY/0vm?= =?us-ascii?Q?f4lWGfUknFmQeUhWUdZsAVc3FpdrDRhyx9xpVCMtImVBScSBMTCCcb7e7KaO?= =?us-ascii?Q?yBIm9LK/+9wBqVH1reTHuhte8otlGy/FiACGof7sAbIfK+W3gx5zn19ey2lg?= =?us-ascii?Q?YRqTEj0wA72+dyx1I+iZTAIeGZ7buSJNEycr9QqlRoh4/inoofi8bJ5JNJjJ?= =?us-ascii?Q?BmCd+X2ALlTEzzwoPXlgIT9P62Ec2HEM5yAKCRHUClq4cic0iZcYOHge4CYf?= =?us-ascii?Q?qrmRoVicCARa3HWVtS0cuXysvJ2PQy/POrhSNPFP/a5YSunev9Ca4pwe2qAS?= =?us-ascii?Q?8t8G0AnNluAPoE1kw5V3nWTdugZqsN7s41LCusP1fH7Wd2IztRSCxbdXf8iO?= =?us-ascii?Q?JTE8C28WHjwb3g6r+USVZBtEiwfj52HtbAKGfsZQeVtajCzCkGcvOJUHMT4c?= =?us-ascii?Q?m1y57RYjV+Fk3r5Lvm43PT8IIqHZH3RRTCU4ZXDu81qeQ3epQnM2VCyVLrvE?= =?us-ascii?Q?X4obd+w5VciTyTZ1gBH2hthbeII/3vWkCL4GdCGQ5IkAXi4ttLXSaSBTSdoj?= =?us-ascii?Q?ioKfsM9TcdwtyAD3MbcSNjVyRAY2pqOYnsCtQaErR635ta11IaAZbKIH2Bs1?= =?us-ascii?Q?WueyICfpXFrfeWywZXcDBlRI4bSI1OPLijR2TUDOC8/lWX8mOQvvxwNVA3bb?= =?us-ascii?Q?bT0DRKZkLnc9/ghVVm8TjbhpknLqwQsCT2UtGBsZdQynzI7+Kvyut5TIssEV?= =?us-ascii?Q?7nONGFwj0LGpp1hACBm+Vu5n7t4WZg9YoWkF/jYbRYhPXG2+vG/Cd5/AAtvJ?= =?us-ascii?Q?7P1NelQxkrLzyXK5ydAEIotpcDLZM/mBHA3nyR2unG/Lt38JcTeuQQE0GLeS?= =?us-ascii?Q?7LWyOz5ELGHCbqQMWyYcYzTaRQU77nMAQniCyZ7sq?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 6:miIY4Rbbs75BIiAAxF4mz9YBeyVq0YBZmjtnBtqmm4dCisnuZRje1JLH4AWQEucOzsfNGdmNrEuYs4g2pp5xQJ5OL0ia2TAGGQqtdJrKQQ7C7x0dG/17Du4lY5aFbY8qUdXkEulIVFsgpwRayiMXrZLiww/DAPc95zi3XE2OqzeW4F6i9nhluYdEP6jAOBlAJBcCLEGVgsCW1HLC/Zo0jTjMEFZcQ5CN52HuC+oVs0YgggMSQpLKSjBuSpxT3dBX3K/Tm8vaS6cN26VMjacuIMKlj2/XMlWIiaOaX7oOFHyxdrvSoVEkzP2yQnV/TvBmImnZznnr8B9cO4o4dsg6+3KZke2tvSKfViw5WyOmjD38RAShnKgArdwTOVucSEqHCNr2jql0qr+7yGO6h+s9fQ==; 5:/APFRjkHOBCB0q1V2DmzWEBjuswjkW2jPM0X5wWTaYebn7pMYOfWAmSAEGtvcTTU0XWBK5zcn60cWoVoMDNjcDqdNaSfFvgVLzZaGZ9hVG7+VRC/15Ye9evoIfByWstw2MtTFj7nONjsbcnPOvH2KOUiOox8wUxf7cFY3fydPwM=; 24:NLNKC5k4fGNqh2UwTlYQ31h8SduHoXwt6mEnYUCnGfEA1ofWleN2u0CrzStJ+E/KpnRsidqk0G/1VsAyaZyL7hDSlyLX3wDpnjxFWT2H0QY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 7:W/aHeFmD0EPdq0dkMY35M5lH42zS9xUj+U43cqDRCg0749FoGrK28LRvGMJjUWrpy0qsPetasW5DtGMbzSUYf3+UgxwUQp7cuSJhFuKRwqROqfdMyZp+QKP0UfRveKiHXY8UUVvtlPLbOKNsVq02y7mnC7af9CLyzHrHtaUksZFzHDlS3TxiW1JFTFZu452kN5UuBvtSdKaanYJOr+1phPl5qMBtzmj7o7jK+teA0yRcfQ6oSIzo+0oGm/4K/FEUnUXmjYA8Owl+vQ8YHl2x2u6DRveGSf3kNCL+Bpg4PBkDY0zh+7R+Y8hRNhAwh17/N/Lf6RQSXeeXlpQIjxChQA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2017 19:35:50.1486 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1723 Subject: [dpdk-dev] [PATCH v2 04/38] event/octeontx: add vdev interface functions 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: Fri, 31 Mar 2017 19:35:55 -0000 ssovf and ssowvf PCIe VF devices are shared between eventdev PMD and ethdev PMD. This patch expose a set of interface API to get info about probed ssovf and ssowvf VF resources to use with eventdev and ethdev vdev devices latter. Signed-off-by: Jerin Jacob Signed-off-by: Santosh Shukla Acked-by: Gage Eads --- v2: added -ENODEV return to octeontx_ssovf_info() --- drivers/event/octeontx/Makefile | 3 + drivers/event/octeontx/rte_pmd_octeontx_ssovf.h | 53 ++++++++++++++ .../octeontx/rte_pmd_octeontx_ssovf_version.map | 4 ++ drivers/event/octeontx/ssovf_evdev.h | 2 + drivers/event/octeontx/ssovf_probe.c | 84 ++++++++++++++++++++++ 5 files changed, 146 insertions(+) create mode 100644 drivers/event/octeontx/rte_pmd_octeontx_ssovf.h diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile index d72ad46..896e556 100644 --- a/drivers/event/octeontx/Makefile +++ b/drivers/event/octeontx/Makefile @@ -48,6 +48,9 @@ LIBABIVER := 1 # SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_probe.c +# install this header file +SYMLINK-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF)-include := rte_pmd_octeontx_ssovf.h + # this lib depends upon: DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += lib/librte_eal DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += lib/librte_eventdev diff --git a/drivers/event/octeontx/rte_pmd_octeontx_ssovf.h b/drivers/event/octeontx/rte_pmd_octeontx_ssovf.h new file mode 100644 index 0000000..e92a61f --- /dev/null +++ b/drivers/event/octeontx/rte_pmd_octeontx_ssovf.h @@ -0,0 +1,53 @@ +/* + * BSD LICENSE + * + * Copyright (C) Cavium networks Ltd. 2017. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Cavium networks nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __RTE_PMD_OCTEONTX_SSOVF_H__ +#define __RTE_PMD_OCTEONTX_SSOVF_H__ + +#include + +struct octeontx_ssovf_info { + uint16_t domain; /* Domain id */ + uint8_t total_ssovfs; /* Total sso groups available in domain */ + uint8_t total_ssowvfs;/* Total sso hws available in domain */ +}; + +enum octeontx_ssovf_type { + OCTEONTX_SSO_GROUP, /* SSO group vf */ + OCTEONTX_SSO_HWS, /* SSO hardware workslot vf */ +}; + + +int octeontx_ssovf_info(struct octeontx_ssovf_info *info); +void *octeontx_ssovf_bar(enum octeontx_ssovf_type, uint8_t id, uint8_t bar); + +#endif /* __RTE_PMD_OCTEONTX_SSOVF_H__ */ diff --git a/drivers/event/octeontx/rte_pmd_octeontx_ssovf_version.map b/drivers/event/octeontx/rte_pmd_octeontx_ssovf_version.map index 8591cc0..c71d4c7 100644 --- a/drivers/event/octeontx/rte_pmd_octeontx_ssovf_version.map +++ b/drivers/event/octeontx/rte_pmd_octeontx_ssovf_version.map @@ -1,4 +1,8 @@ DPDK_17.05 { + global: + + octeontx_ssovf_info; + octeontx_ssovf_bar; local: *; }; diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index 0a3c76e..c2b8187 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -36,6 +36,8 @@ #include #include +#include "rte_pmd_octeontx_ssovf.h" + #define EVENTDEV_NAME_OCTEONTX_PMD event_octeontx #ifdef RTE_LIBRTE_PMD_OCTEONTX_SSOVF_DEBUG diff --git a/drivers/event/octeontx/ssovf_probe.c b/drivers/event/octeontx/ssovf_probe.c index 7033ff5..b644ebd 100644 --- a/drivers/event/octeontx/ssovf_probe.c +++ b/drivers/event/octeontx/ssovf_probe.c @@ -67,6 +67,90 @@ struct ssodev { static struct ssodev sdev; +/* Interface functions */ +int +octeontx_ssovf_info(struct octeontx_ssovf_info *info) +{ + uint8_t i; + uint16_t domain; + + if (rte_eal_process_type() != RTE_PROC_PRIMARY || info == NULL) + return -EINVAL; + + if (sdev.total_ssovfs == 0 || sdev.total_ssowvfs == 0) + return -ENODEV; + + domain = sdev.grp[0].domain; + for (i = 0; i < sdev.total_ssovfs; i++) { + /* Check vfid's are contiguous and belong to same domain */ + if (sdev.grp[i].vfid != i || + sdev.grp[i].bar0 == NULL || + sdev.grp[i].domain != domain) { + ssovf_log_err("GRP error, vfid=%d/%d domain=%d/%d %p", + i, sdev.grp[i].vfid, + domain, sdev.grp[i].domain, + sdev.grp[i].bar0); + return -EINVAL; + } + } + + for (i = 0; i < sdev.total_ssowvfs; i++) { + /* Check vfid's are contiguous and belong to same domain */ + if (sdev.hws[i].vfid != i || + sdev.hws[i].bar0 == NULL || + sdev.hws[i].domain != domain) { + ssovf_log_err("HWS error, vfid=%d/%d domain=%d/%d %p", + i, sdev.hws[i].vfid, + domain, sdev.hws[i].domain, + sdev.hws[i].bar0); + return -EINVAL; + } + } + + info->domain = domain; + info->total_ssovfs = sdev.total_ssovfs; + info->total_ssowvfs = sdev.total_ssowvfs; + return 0; +} + +void* +octeontx_ssovf_bar(enum octeontx_ssovf_type type, uint8_t id, uint8_t bar) +{ + if (rte_eal_process_type() != RTE_PROC_PRIMARY || + type > OCTEONTX_SSO_HWS) + return NULL; + + if (type == OCTEONTX_SSO_GROUP) { + if (id >= sdev.total_ssovfs) + return NULL; + } else { + if (id >= sdev.total_ssowvfs) + return NULL; + } + + if (type == OCTEONTX_SSO_GROUP) { + switch (bar) { + case 0: + return sdev.grp[id].bar0; + case 2: + return sdev.grp[id].bar2; + default: + return NULL; + } + } else { + switch (bar) { + case 0: + return sdev.hws[id].bar0; + case 2: + return sdev.hws[id].bar2; + case 4: + return sdev.hws[id].bar4; + default: + return NULL; + } + } +} + /* SSOWVF pcie device aka event port probe */ static int -- 2.5.5