From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0041.outbound.protection.outlook.com [104.47.40.41]) by dpdk.org (Postfix) with ESMTP id 9FD5A37AA for ; Wed, 15 Feb 2017 20:06:23 +0100 (CET) Received: from DM5PR03CA0001.namprd03.prod.outlook.com (10.175.104.11) by BY2PR0301MB0728.namprd03.prod.outlook.com (10.160.63.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Wed, 15 Feb 2017 19:06:22 +0000 Received: from BN1BFFO11FD003.protection.gbl (2a01:111:f400:7c10::1:185) by DM5PR03CA0001.outlook.office365.com (2603:10b6:3:118::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13 via Frontend Transport; Wed, 15 Feb 2017 19:06:21 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; caviumnetworks.com; dkim=none (message not signed) header.d=none;caviumnetworks.com; dmarc=fail action=none header.from=nxp.com;caviumnetworks.com; dkim=none (message not signed) header.d=none; 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 BN1BFFO11FD003.mail.protection.outlook.com (10.58.144.66) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.904.16 via Frontend Transport; Wed, 15 Feb 2017 19:06:21 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v1FJ5fLg020023; Wed, 15 Feb 2017 12:06:18 -0700 From: Hemant Agrawal To: CC: , , , , , Date: Thu, 16 Feb 2017 06:09:11 +0530 Message-ID: <1487205586-6785-13-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> References: <1485172803-17288-1-git-send-email-hemant.agrawal@nxp.com> <1487205586-6785-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131316591815288402; (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)(7916002)(39450400003)(39380400002)(39850400002)(39860400002)(39410400002)(39400400002)(39840400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(189998001)(54906002)(97736004)(86362001)(2906002)(575784001)(68736007)(33646002)(5003940100001)(104016004)(81156014)(8676002)(81166006)(356003)(4326007)(8936002)(305945005)(50226002)(2351001)(36756003)(106466001)(8656002)(5660300001)(77096006)(48376002)(50466002)(6916009)(53936002)(626004)(2950100002)(6666003)(92566002)(76176999)(110136004)(50986999)(38730400002)(105606002)(47776003)(389900002)(85426001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB0728; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD003; 1:IkdLKR+mGz/wAwBAZ1KARxSTiKTb88AvxV5I0+tuZHS8joQ0F6wFgDd1YiRNsCcIj//1m3SFxvy3ItgPM2X+GlJjXCTX0rVGHhzSpuhl1dJyhmlTLBUg0pjVPPHljyxfhFnRRvbq9TDyocFrol+zFzABPU4vqWPrwU0E74MPi5ov3M8ZUcbEQDn/3WqmV0J++neQBxGj+ComUIzCIR87f+sLy1QaeeCPdmokcsh38EikqARSqiBhvygl8OJ0shcH2SObe87ODARR+NffXYGqPFz191zDDXf7btrzdlUCCHBpOSKcg//rM0p/X9agc8TTnxD3Zt5Ht3kz6oNXhKNIUA3l13CN6D2u8k3c/HrTT0PkWBHV26KZE1ZN2sewWAGJS1+UtlisGz+nooN7Pl+vsugEpNqItp5pWPccc8rqlxWdYOXl8OFNE27R6vmDFVWP4xyI998jvfmtaDEQ1Z+0aUPiUz7jJ6dBnup5VyPwv8KL2yX9zd39ch75Jc+CJhH6p5F0VCExjYWd7sj+kR2D2+z0jAPjZz11xOSw09pbg89XJq7uA8ujSX+7EZM+jEcgtU5dUT/h2FJ+79g0G+cU1pkdj/dLak9BDjMZ7o4N/Q7vxOtXcykyWrjk7R1CQdUv1/cMdxIy0FXczUVEzB9/eA== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: c2480a89-ee2e-40ce-84f3-08d455d5bab8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY2PR0301MB0728; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0728; 3:4vocxPRpR9h8cZJkw0/YIj9uz+allkgAh/bqc8lab8qffjkgMxr+Awd/i4jjG2czaLZqj8Fx+hccN+dLJk7Ew2A74vOSvU5ELyXjt9tmO3uJyHZNivZXp25XXfE48My1Gy4FokTH6owx91Cxb97Jj+T2b2FlmqEeSitS7I9JNwGMHoliPvP5GkM6T4ZDp3W2lNA19ort87RTHwGOyYTOlWfj2QBORIg8nclBLOrkloKf6CEGCDQJbMGEGrOW+FMJun0otc5ogVM/Xt4Wk7OKLNO9KjX+8D0TkO+BqniaQPHaaLSx9FS5heZFmiBSAaneuNW5vKV2NDhsL4UsO/jOU0nQBbcPjPr5b5R0Hr5w3eIaqB4hr736SNxsrYr8VRd8; 25:vXI6EYPOY93WDi6Go8GeAZ7yhdKym2GDHTx6oY+oe3/4AHFhThDPAH477daIY5Khv/HhMiHfu9Eq1yxN+jjTgjOzjXvid7gdh/kMhm31XyGZjIEQx/q+9XqU9/IseHRhMxptUiQCgKwMKse+c7+pnA5HZlZzPUSYhC5HB9Dgy+oe61EhmnnjHE3nQFFXOIEykSE0VPdI+zMBtgrlYJQZcB5c9kLxr3V60EjSQ4XQNDUBRbcTNjfy43khQ35DV9vC0b5+LiQnYJ2ws3m1kF9yB5RWT8cQ2SsQwN7lvZ+g3DXIR6ejXl1fJ0kM/FCp1G/buoTBY784GQ1CQBiHkq+HPU+NSGKPo3s/+B96tQEUdFuKf3AeUi/fM2XEUATdBd4QIDcDhu1QjENhCMmBFZnOXx5pWHw4UjgMBzk8aEYVDUWVtpmnOH7M6FT1T8u5yat2KPhxJxn1aZ6usJ194JkmAA== X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0728; 31:vv/RXxzxcpuGZuwFlY8UOr4sZaw8BKdgbJiqgTeh48gYfKzEzJzfbGH6Zg34u7GVizKe+VuXzVpBj2rxkFWPRSzh09qz5DVhw1eBO1AJ4fL5BdVbmxy1wuKvUE9uMbixynXyM50N2Z7AO1WxsijBBhF3oo06lGhK1U5z2XpCba6Y7BmTtrhn4UUuJqc3jAdrMfE4YcIOjtKFlAZbQ+/KeLuDLw7ouMdXtvCrdNsK9XC/dA7iANtYUnhFvzuWVpvFPKrJo0uuhXlJHWDEZVVeJw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13018025)(13024025)(13023025)(13015025)(13017025)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(20161123556025)(20161123559025)(20161123563025)(20161123561025); SRVR:BY2PR0301MB0728; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB0728; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0728; 4:l3FYe7Vka8s2mhnPoiP/y6EfjOOn6fUsb88ceUD3SI4ihKgzuc+WZ41vj2tOiU9JktvwHJNv/G+1HvMOKddz3n71mfHlEl9XJEJhziGcWgtk1RF11oWUh8JjuE+WG+cNwZnE1cTBZ00ttVtHZYXYsY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oB8B/KcISMCVDsG/5MnsrL95WEeCtddpdyMlQ?= =?us-ascii?Q?e2OZw9mtea8fjSNtXICnQQ4mwxm9kBOV28jTXQYFWBM/3TlTP2pV8XaL0eC4?= =?us-ascii?Q?t3q/LHy1kXSEzJHsSMGEd/zV/O7YrzaoSSJDesNWmmDPdI58dTOYT9qMt+DE?= =?us-ascii?Q?1H8AbjA=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0728; 6:DR96skarvL9H6TF2WjkmPuHNQbkDBoeNYrLZ5S5+Lp4RxpQ6302KMh776jwfY+lj8o5yGaifboP45+fyDDZHtLZWVPDeeH1gdkYJVLdxjlkZfYDDWK29x5sHagB/SbQyHNwAqe00TGjlc5wyFzoDRCsa0nvxupM9denr1hFjjNMvHCs2acD7xPxiCM8MCX984IdSmSdj0tfdc5Arer2zXOg6bfclcecRaS8boJZ4Dkyy14SZy/K+ZW8p0in3zEuNWoCl+DYyb3kvxBgrjEYbm2ZlNJ70k6p9RtoE20E5JRYfbEaCe3CrapOb+RYMDkizjvs0lPakgPyBrW94c9+kVfJa7SUZcClwBFRZ6t6lSATu9j6lw+36Bq/AXlKQRo1Vb0ONmWvLo2Ocf76eIjPMGco/5UMY9935GabCW8yyeeU=; 5:2y9HauiXBvADrEZIM53fj8yal2mKeP6f9r0uF40L84waJxtUy3aG0d3yuNIRuCKYCuS1jVP4M4TdhUpziKekk/HKCeavj1tPA5paXmO9fkfKhtXcX2o6W+NLcbKtkTHxD8Qo9vra7Us+Mon75ugIGu5SRJrvXNBCUi89EjNYXxqU408dY/X9fuOBKQxIuejq; 24:a1kfSgEjxddMn0jN6sfhEi+yzm+vXkxA1WDs6sXFYdilKDpysPJe6NX6ipuhy+aN6NlHPpQkbmRal2+pJtgxBMVeCLqMX6urWtRIAAAqAqg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0728; 7:H7UINsWApEPcq/QIFES6U3h7ASSDycE6Huadnfiq9YqLWOkNzMN90JlvnL7/YR5ikXgpoceYMFhQS7JG1bLHXoJ4V7H82RnHN3utQfqY6vyu/Z9BRMErSjIuQb73p7VqzCFEBwL/bjRmX/qw6zS5NEPGWA3EoI/DeRz2F8gPsKl0EhztJMu39i6WITg/SirhAQgIFisbL1J6JmfF0mJF6wQk4BNbIaU+bor4mBE2IfDDbU43CUJtm3zGg1KKdyoiHmYRvMEwkRvRYRgH/bchqirlFebTFnv8L9HdalrsRyEa2GZwErmUhrOqpa133TPLen5EMBrTK0YauyPsjCtSvg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2017 19:06:21.3260 (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: BY2PR0301MB0728 Subject: [dpdk-dev] [PATCHv7 12/47] bus/fslmc: scan for net and sec devices 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: Wed, 15 Feb 2017 19:06:24 -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 73db595..0d4c0a2 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; @@ -348,6 +390,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); -- 1.9.1