From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0055.outbound.protection.outlook.com [104.47.34.55]) by dpdk.org (Postfix) with ESMTP id 3C61268F7 for ; Sun, 9 Apr 2017 09:48:42 +0200 (CEST) Received: from DM5PR03CA0008.namprd03.prod.outlook.com (10.175.104.18) by BLUPR03MB392.namprd03.prod.outlook.com (10.141.78.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17; Sun, 9 Apr 2017 07:48:40 +0000 Received: from BN1BFFO11FD039.protection.gbl (2a01:111:f400:7c10::1:160) by DM5PR03CA0008.outlook.office365.com (2603:10b6:3:118::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1019.17 via Frontend Transport; Sun, 9 Apr 2017 07:48:40 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD039.mail.protection.outlook.com (10.58.144.102) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1019.14 via Frontend Transport; Sun, 9 Apr 2017 07:48:39 +0000 Received: from DTS-02.ap.freescale.net (DTS-02.ap.freescale.net [10.232.132.223]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v397mBLS024015; Sun, 9 Apr 2017 00:48:37 -0700 From: Hemant Agrawal To: , CC: , , Date: Sun, 9 Apr 2017 13:20:12 +0530 Message-ID: <1491724224-6319-10-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1491724224-6319-1-git-send-email-hemant.agrawal@nxp.com> References: <1489754838-1455-1-git-send-email-hemant.agrawal@nxp.com> <1491724224-6319-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131361977199587105; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39400400002)(39410400002)(39850400002)(39840400002)(39860400002)(39380400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(3190300001)(189002)(199003)(9170700003)(53936002)(85426001)(6666003)(189998001)(5003940100001)(305945005)(47776003)(8656002)(38730400002)(104016004)(54906002)(2950100002)(5660300001)(50226002)(86362001)(356003)(33646002)(36756003)(4326008)(77096006)(2906002)(8676002)(8936002)(81166006)(105606002)(50466002)(106466001)(76176999)(48376002)(50986999); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB392; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD039; 1:w0oHhI4QtwF6GYgN92kkUuf/kB4UCwOHVVa83gF9q58pLiv9MM4tqFB2DBgcbch/ezn5rBTM+p7NX0rneXson14S6VYVT6rkd8gLK60C3QF//EVfp9aGQ0SO2WZjbutTLDsIa2v6orehns4lAySlJDGAeglJ4+58GaP7B85CUPKhYskiqPmCdrjCviwTc39xVMLwJqE49MEXJapf+cennEaE8KJQhFRP7zJSdKFZj5yDg7WQxP3lfI5WOmJvExmDds067rgfSaoSWvdyNYJoAkmRhS/0lwg14HFyWEzJYuJvoOY8BS7euiKOEcRjcgluz7jZ5AGYNS+MrwzCMqkirWvRKsXtKW3lVTRroCgRgt50POBVb9sRXR8DaoIC8IRXWRHAyyGW3pptWe+9QcCVN81nNEbN8IPGYkletrFI8YpiWf9ozCpx4jACzFUuJfZ5oJH1YA/ioqWV9ab/XRwh9xpPHCCh2I2xf8zStdSBxDjVYHwB1h5+p98cl3bohYIQmQkKW3z4bpGkJoOE+ktcIkhixbTwV+sF+szRFKnzYfWZBegjkTyhmNESf68+wvCO0BodzCACqpaN9eMckMASIkubDeSteW7j5l048t7m4yVac0e2S3tnfs3r57A1HGNNPJBVLxkkh+PpOIFMWQlKUPB/o31JiSZ0yRamDMPbsDPiBgGECJKf2Ex9YUfuNYFJ MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a8984e53-e449-436b-0dc0-08d47f1cd66e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BLUPR03MB392; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB392; 3:+2T2lt/rDQ9eQUYqOIatYT9V0YvpYjzH9gTHJEGMtegaEwev7Q0UCwSes6vjZ/tGh02Jj7fXtnu1W0ibc1IcCDhwKWPlw37XkbDdJLvVvMSagT2Y7OywO7lbyVFYcjuwrzgeD24v0ZmbOpoJtdq2fhA572MhqorMIOgw+Asj1+DldYyBlPQleqHND4MrohXy4BpFnhmyw5uqWs/YzcnJ+7SBYR7a9kIxc0xWu8Nvlw/L2CL7KIWTf5J1/CGtbcb9cqlUlwqNmqD9oYTUU2a95djE46RAGz528FkqBlB9cpOVdIb/Z8Y33iiXHjLvRTKeAWBQ/e55UV24BXn/roA1ACCfl2KILAjTJN1Pm4L2kcMtpdqdANzPIPuk3W//GfSIBxz0Jlu0oLrNPcm6G9Y17MA8Lpsn00vS7no1BpHnek4Z2smQ+7/YQBZ+LKmwILY8; 25:jMTDWHLLjbKnzcA9VMqpYa2+c92BovnS/W2avIL2ANnEyd7SmDaAGJDz0H9+4K9Psxrf0Xik+3C1P5lnrmSg6Dfk7XOGhh9vnlzTvYEB19+swo6pvcYmK37pS22Bxzo1g/m80Bs/Ejhd0ILDTC+qgfZQ/yyS1nhp58gXwUBEpkiy9JM/oKFmDwSoP2h+Z8ZiIV7cSAEVkVUVhCcVL94GYKi6Cifom8RCthj6MJquYovWd6QzgOBTX6HPNe1v5g5b5YWKEO7CT0KBT8vDRVqWUqEcZ04eKF7CWrB85eiItgopGj4dWcJt9RjV9oaNxYwa0dPCrJ4DGpRU2vrbcr6QpH2VVEy2M1iyVhApKsB3vLM9uzXlizGGWM53/GN2IeaX3UHanCHHK333nlIwgtGb8NCafhVUIcOSXDoXTUZEe0ZcUe8oNKm7W0zruqa/TnBGIYFMgRRbC8HI+vBvKtWwsw== X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB392; 31:xVUfGcApRzmogXQdgu5oX98UhhmINyrqZu9PoK+jMgaWDUiaY6L0YFh8fmG+z21RJhnLvtkiffrb5XIu2UqgyWMpURe1S/kyn8mBG4TZQnXHVCKYLd4QqLrCgNI/+yOo98nJu9oxXqAAS4sYmVcis4AZPrGfgzfqevVhdQuU4bEtGv6QNO5x77aRlsCAeonFIpDS6cWlaNl9IQcYc9vF7N7EJUEBeAdOAc72YeZGSCAbUCg16W68Hwxu6G84nHJS X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13017025)(13015025)(13018025)(13024025)(13023025)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(6055026)(6096035)(201703131430075)(201703131448075)(201703131433075)(201703161259075)(20161123565025)(20161123561025)(20161123556025)(20161123563025); SRVR:BLUPR03MB392; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR03MB392; X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB392; 4:B1OpsqDir3ozt39YX2H2C15QvcADZx/XZXfP2kq28j0CvSrpNpC5myvegI4Rzrl/I9xyzx7uBed+B5/Up5My9QPteE1nDhCDT97/AyyhBxJxqZj4HFALGLE9Ij0CATeP+RJQL5xkbj56obY9bD82m3i0dUf9gGkFokXITGtNOELiatX9wIelakD3boxMdJLZ1JvPTEcCr0TMNoA+I9FAc4HNLhIiDnXCjFlLvHPcHwU/IrEsmtiO/0/P0yxhfI0dSFcCsFmbO7SdcC8SYrdYne6PxUOK6bLpQcP9wcd/rGQoHb4yaWziLa+2uIL3Of21fybPM97jNlhawO1Hrtbbg94T0PlckCKsYVP1lNa/ul6rwSMw2CgIobezZX9XMyX3cZFhAO3TVipMIH7WfO+9VrgrwXfAMKE45n2u3F3Q3+9GA4YsvdpPILhYX+0bmx43pmJmFDGjYZ5SGneCbXfcVTDmmYkmiPKDyeocftb803Ig9mnxUW+lNhCC27ki92GUxP2cvl3WJ7FFG675f6oAobKBAz5NfRXGMq4iB/xs887Kj2yZRwyagCJ8vZEbXSMBOgbkVnDikYRHkSnawrmr9K5NoU8rWmanwjLyfNEYNlGouS7LluFv3+ydoPwrarm+DYtnzJsLU8MKgxx97AddekvkAaYX7TY9dpXyuBapVdIX5vG/dJeBEpHZmFoPQYnLErbytbTA5ebw1b80gJUZWJJLpKeyirUvbbQUsnw0PLoyadwg9E/HLxRxLAUztVhdnlx12XqsJx3LFL5N5Msc8LCzCrmypj1UCeTcaNnVKQTRoQHXnDr96yJn3j7X6ac5gO59BD+6yqH1H4ciHDG+mAGAUxsizQAlrozPqjpfsWRbpABmuZhZ1+a5BudDZVls X-Forefront-PRVS: 02723F29C4 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR03MB392; 23:Mz3w69SqknLCsVDf9b00pwzokrsI/U1biRzRPwRfwN?= =?us-ascii?Q?DkZthIoEFq0+hEukez0vr/tFh5YCpPiXGvN82fF47+xXa94e5jE9jEksNTcs?= =?us-ascii?Q?Cw1R3ZKyOPGZiFWIZBUICyKSbBgVNdqS00iv3TstiHi9iGIW9w4XSbXdF6WY?= =?us-ascii?Q?FY96QSbvWmM7l9b2WppYfm+gqT2h8ed+rJBHnGI6m56dQPABY5RM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nil1ahyXNfYy6s7Lx2pLra+ZyLrPGiR1N63?= =?us-ascii?Q?2QvRtYtVwxfc2b0LVgkevGHizJq+PzEk4Nueaama8yNMohZCzn8uu49JsdCS?= =?us-ascii?Q?8Wn6nc/Y2yWX4=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB392; 6:4FIql1I2sHRMwE3UfyYTqhJPxOzuhI5l7+C0k7my8GnY/fOccX0KVxKkPRPbdUXp/DJ71NVSaXlmn++Gl04gTKFmFZr91Dfg6jqhnnA5x0QD1g5YQo32q4QLya3ra8MUEAovRVgSdqS7uHyfdcSg82xlblsNG5RzBRzTiEFwyfY2KZQP+JE3+zwRveTe5bE9SPsGY+V/O90ANqTCG5st70KrTmZwfWntHY1GXUZ/2wEK8IBYKeAieuQWVJwpTlPkAU5YaiB2jgfiX4gUFmEuCXoTsQz0Viwq6ytEE72u3C3bqocaP1Z9I+mQMyZI/L1Lks163RutlmPKBK2m1J+435n9L1uBzPXPU77qQhq4jwC/C44FRR/exPe/1ZTd1eOKI0Zp2ie7dKAPKcto4iFHw5ymUH7Nak7Xqftb6ySk2pHTorIwoqVirP4ffyN1ZulxSr94kO6KTady509yiF5JeQ==; 5:2zpKcyHm5OG21W5kvx1+7RFFNTGoHs8SqFG4+B83dVtOUQ33JC0y1+946yWF/VRSJVqKHf5t5kI59pJCsS958nW0XUVxtuXoLfllIsqdptjczH9BdJHLRf1iuUZcLCGKrmpUrQp8bwL1YTSpfHrSQxEdPPIKiPwz3QokMiN8Q9EgtmeT+OP8eBg/01INubIm; 24:pICZYU3VTWkmVBavF/pVsagAgMhVtD6zLJPi7yvcXDtxZvCHMb5PEv2XqZepQlhaYD4xhyesR/1r/sistXd1zXdfiMthT5BgC0nWiUVHOrI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR03MB392; 7:GbwPV2tGhrWa5lF+e35DJdmMQz9AINc7x3sRJYNJ18HEF4LXY6a9lKnF34Qi0FQdJrkqSLaUhYmgmLNmo8OoK53WBWzz3soROKli/xFCQ+3i246mJxlZfCljj/R7rS3KB/H9XUKGr8gLZbhZGhK45zVCXwsQpbWxXmHXPRMWobalSl4cSdC4QEpuvE7nLNTTU3JYE0aqfWTWScNjjgIOrrGnaKTQsSbpe0Pzxsaz4Wb4ndE8FsHpyFsToPAW5WO/LyvVZ5tb0nJB8QP96SqnxbfZNMKKL05TSem2k/JoVOR1SeQHVcnPyi3OGVPC/tSBpKon69PwCpToqG3rBeN39A== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Apr 2017 07:48:39.7715 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB392 Subject: [dpdk-dev] [PATCH v3 09/21] bus/fslmc: scan for net and sec device 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: Sun, 09 Apr 2017 07:48:43 -0000 This patch will add support in fslmc vfio process to scan and parse the dpni and dpseci object for net and crypto devices. It will add the scanned devices to the fslmc bus. Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/fslmc_vfio.c | 63 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 8223e48..72ea6c8 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -210,6 +210,48 @@ static int64_t vfio_map_mcp_obj(struct fslmc_vfio_group *group, char *mcp_obj) return v_addr; } +static inline int +dpaa2_compare_dpaa2_dev(const struct rte_dpaa2_device *dev, + const struct rte_dpaa2_device *dev2) +{ + /*not the same family device */ + if (dev->dev_type != DPAA2_MC_DPNI_DEVID || + dev->dev_type != DPAA2_MC_DPSECI_DEVID) + return -1; + + if (dev->object_id == dev2->object_id) + return 0; + else + return 1; +} + +static void +fslmc_bus_add_device(struct rte_dpaa2_device *dev) +{ + struct rte_fslmc_device_list *dev_l; + + dev_l = &rte_fslmc_bus.device_list; + + /* device is valid, add in list (sorted) */ + if (TAILQ_EMPTY(dev_l)) { + TAILQ_INSERT_TAIL(dev_l, dev, next); + } else { + struct rte_dpaa2_device *dev2; + int ret; + + TAILQ_FOREACH(dev2, dev_l, next) { + ret = dpaa2_compare_dpaa2_dev(dev, dev2); + if (ret <= 0) + continue; + + TAILQ_INSERT_BEFORE(dev2, dev, next); + return; + } + + TAILQ_INSERT_TAIL(dev_l, dev, next); + } +} + /* Following function shall fetch total available list of MC devices * from VFIO container & populate private list of devices and other * data structures @@ -218,7 +260,7 @@ int fslmc_vfio_process_group(void) { struct fslmc_vfio_device *vdev; struct vfio_device_info device_info = { .argsz = sizeof(device_info) }; - char *temp_obj, *object_type __rte_unused, *mcp_obj, *dev_name; + char *temp_obj, *object_type, *mcp_obj, *dev_name; int32_t object_id, i, dev_fd; DIR *d; struct dirent *dir; @@ -349,6 +391,25 @@ int fslmc_vfio_process_group(void) FSLMC_VFIO_LOG(ERR, "DPAA2 VFIO_DEVICE_GET_INFO fail"); goto FAILURE; } + if (!strcmp(object_type, "dpni") || + !strcmp(object_type, "dpseci")) { + struct rte_dpaa2_device *dev; + + dev = malloc(sizeof(struct rte_dpaa2_device)); + if (dev == NULL) + return -1; + + memset(dev, 0, sizeof(*dev)); + /* store hw_id of dpni/dpseci device */ + dev->object_id = object_id; + dev->dev_type = (strcmp(object_type, "dpseci")) ? + DPAA2_MC_DPNI_DEVID : DPAA2_MC_DPSECI_DEVID; + + FSLMC_VFIO_LOG(DEBUG, "DPAA2: Added [%s-%d]\n", + object_type, object_id); + + fslmc_bus_add_device(dev); + } } closedir(d); -- 2.1.4