From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0067.outbound.protection.outlook.com [104.47.42.67]) by dpdk.org (Postfix) with ESMTP id 8870AF961 for ; Tue, 17 Jan 2017 14:19:56 +0100 (CET) Received: from BY2PR03CA053.namprd03.prod.outlook.com (10.141.249.26) by BN6PR03MB2468.namprd03.prod.outlook.com (10.168.223.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Tue, 17 Jan 2017 13:19:55 +0000 Received: from BY2FFO11FD008.protection.gbl (2a01:111:f400:7c0c::161) by BY2PR03CA053.outlook.office365.com (2a01:111:e400:2c5d::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12 via Frontend Transport; Tue, 17 Jan 2017 13:19:54 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.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 BY2FFO11FD008.mail.protection.outlook.com (10.1.14.159) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8 via Frontend Transport; Tue, 17 Jan 2017 13:19:54 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v0HDJ8mJ021741; Tue, 17 Jan 2017 06:19:51 -0700 From: Hemant Agrawal To: CC: , , , , , , Hemant Agrawal Date: Wed, 18 Jan 2017 00:22:33 +0530 Message-ID: <1484679174-4174-13-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484679174-4174-1-git-send-email-hemant.agrawal@nxp.com> References: <1482988612-6638-1-git-send-email-shreyansh.jain@nxp.com> <1484679174-4174-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131291327944700794; (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)(39400400002)(39850400002)(39840400002)(39380400002)(39410400002)(39860400002)(39450400003)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(6916009)(104016004)(5003940100001)(48376002)(356003)(2351001)(8656002)(38730400001)(2950100002)(305945005)(92566002)(6666003)(85426001)(54906002)(36756003)(110136003)(77096006)(8676002)(47776003)(5660300001)(86362001)(50466002)(81156014)(97736004)(81166006)(50986999)(76176999)(105606002)(50226002)(626004)(106466001)(189998001)(33646002)(4326007)(2906002)(30001)(68736007)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2468; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD008; 1:yP3VnED7rpzNm5YDimp7pfTaXQZVbeliSjZLKItq/sUWP749rVCvH4w0Gs5ssXEO4pFS+zsfrMTjExQ7QiXlwSVA0pWFMosO0hoNSmxHSFzwr30RwlTKHoUax6cEtq+cZvOp0lDoExsDljBdKtqMhtPs377F0ETzts3MyeURw9mHqP6L3/5aaepaQLzpKCxgI7LZ1v/6vLp/XLoOPNXteXdMaIuTbQ4lPdltofP/qheSW6VZ8S+Psk4bpmZnAMHGUHd/macchhBe9ysqiOiB1W1xqiN7tZQ7r18BMxfHKOVUGpMNT7XSdk7PMOhyxAaPH/i9Mg6cKGU68FXtOkXzmahzOk826RyDifPM6NgAh6pqECDQcTAtVwO76fGcgzdV8lRSybzL+66LA1o0tNETKhsS/JYuMZUKs9BFuawwJ3KCTM+F5zKLXc/wlimilfYFFEImB1uyjUQkPFJcNQagcm1X2Xdf7IVy1wONKgSg0QV9ot9jEsOGOv/fa3adEMJAEF4FxCiA+8NfI8NaTiYIHLqcW1uFENRRrkyrZNuLkMqrnoPExuXTRPutI5bF2p4TCOUiu5t4qqIZlBML8lqeFbrJq29m2bMuzMmwKJEGkACvjo/TrxVbO2AO9iF0AUR4hzs+z7JN506aFkMLLdkDOqseY1WxgkAE+ylMgu8fkx3tkeSFG4mOzCrYT8DIjJLAdom0Mh11aGkPPfPEKMobV28DHpf0XKjRVp5xKuhFaS6WSsjKzkdVdBQDib3G2qCz MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 9b528aa1-fa04-4033-b37a-08d43edb86b2 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN6PR03MB2468; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2468; 3:ZhRhv3DrzlCxSYUSAaeISbb3+Ues2aPdJrQg+XmaUEMmpGivrB8N3B5pn3cwPz1wprJ4O8nEvM6VgJffdZtVKX/bG/JuPcVoIOqgTfPSJl+A2bZVHuW/0kkGuhop8qyRjmbn/xv7s800so0JhrYxeKWmeNEiOwRu4RZc2DEcxugrbF0xv7ZsbjHcZeuceQ0PdW18wELYY0Qu2YI2WO+FZoUJVIjqxvj4TmoMuiq/lgnjwMeWR1VhR4Cg9ko1k0SWuZdljWsId2XysjlmAVTgrAbfJqLn8Kj/DOz+WvY8j2NzsuexOdo6aRr7kF42GIjCe9j6PvL8ulON3cZFrtNayoCVFnLq7aZWcgXA3NbmiI5PbAu30dkHTvYOcr3sV934; 25:wntNKe9Xh3LAg6ySmjAPpB91K400EDw00A46uMZ/uGVGpKzs36AfuSx5Y8hQX3wOlnhUF+ofHwmw0yES1/DXZYCZ8xv6M7w3xQLUTO3Sf+jHar3HWVGIdtIXR7P02igEpKEY/9FsFdYiW693xSbiMVAfYQ9APkt6J8bSLwlvFiH2n04V/Uzo3FxVNi18NXToTOgibmvEEQnGaPYm/lFBhb/TTQWgAlH++lMlzQeYjoHWrojscRGE+jkevqBL+NU2qxGUaowbhAkBVUWkS7gzdL7EmWHiDu3lEuiHCIk7sG23biR/WOb06jNC3T4OGVNMh29Ntk6JlO2yJNYXanynpe/v92PI+bjzTqWSbgqELHG5AH0vVZArTgt9ppHvgRau5nbRx4fUb7ACDBL+XliJnOnaOa54xfRxVWzVkra2e3mR6H5UtQV88t8Ehic7P5N+ X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2468; 31:qzqlp9w9nwQt+7s8nNELu+oC2Slwlgkfq40esUKlJiZ9AZEOVOTeMsVJcBWD1IMrXSf3PleQQLu/YuMn33Yc+KGTdjWzIRu+ml2P/hKPlGsLqLz1QvG3BXGOmPtIFFxNqiz0kOP9ljozpRlIbODRp0gYCX2MCc0tCRgYdil03bu82CaF9OierMJNg0Ti25eXww9RKSYfID3K2ehlghVaZpLB2HwQBywml2Xo2EAL8zGIjmOrCV7v/ArLGlhgKpli602r474KKeJ9HvMlJr9Ryg== 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)(5005006)(8121501046)(13018025)(13015025)(13017025)(13023025)(13024025)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(20161123563025)(20161123556025)(20161123559025)(20161123561025); SRVR:BN6PR03MB2468; BCL:0; PCL:0; RULEID:(400006); SRVR:BN6PR03MB2468; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2468; 4:cw3fXCPsT+VUFYjOnQZvPohZaDwxvYmG/Qclr6rBSVLB+H93n+sd7RqCYP1V+Wo2LFVFAmNHTFAbztsleYuv0HGAS4NT7DoPhFZIMVCSSZD41e2km67yYWSr+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=?us-ascii?Q?WshbuFwTv4YZ39ybLF8BsflRMYz3GZtj55ggK0CvSDhozIKmpHIg24GAz5LN?= =?us-ascii?Q?VoUxDZyKE1lcG3DjYkazKfIpk4nmnUISSwZbQvtiH7h0uQ2d4oF1GIbOne1i?= =?us-ascii?B?dz09?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2468; 6:dHZvob4L/UT4hU0bp+w4JDJi4g6DeIMQV9Faanj9lFxxxXR7PwDnHYwx84m1CDuxGhJ78OxLLlMuBsq5IN8AXiJlRFYfXbNAuWZv6/WA8EEY5CETTzYdpjy3JmGodlnFHfXXQYlUqSRWsEEm1Bjj10M9r/i2XCLRTR5vidLT70s0J7S4VYtlRhBxwf/DTo3Nw1JxeHSmw3t3InNrR86caVIlXl0JrJdyDasDJM9mWmLIUSfE5E/muvKAKZIREw23Q23mlCd0hTqxgRneLXh2KTqhNz9JeN6QaD4+9kHfFeQr3Yd9lL4Y5Sj2GvDY4l0tFrQMmEPACRMRrSdCofqllRqiKl3jy5pDcImh4Rbjq+VK1WprHXninVukUb/liLbOyLt311O2ZZd5bSyb6W0aElZ3CaP6m3drjZtW5PVZlDBN2PRJ7NJR4LP1upAVTocU; 5:8CO4GDxwBfGE6wxMmrvNx8ua/LOA23y8eYQ0OWFjcbFpeyIKIgBVzOSG3BFJrJzpXnv5Mq66HASD9+pEU6ljVkld2F25lhBSemzEr8tKNzy9M0az6FPFGkaMNKqpDbqz+VUxIWXiWGxStJdY4AE90zsUEgi31XmZ4ts3a9U9gZo7bcvMhagktqe+oZIYF9hJ; 24:tgj2TDV/HBQQtMMOg4uekDGQzwic99rsyR8lcpsrtuPGyJLB7t0OiVgsXY0HY5e25aJi3QMGxUpDAb7dhOf7+WyKQWNlXVZNEVg8+K7gnJ4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2468; 7:6uDEx2+4TOR1zE+QxQ3TSDuLDqoEDuN9WW0prJJvNaMIRITCt/SUCk5CkTD4Lp1BMFUSWkc+VR8en3CkVMdKlyQOvdixN4DnO9azM/1zYodkGfCy8vVve3owA/sNSiBmb/FqqOCQlM4iHyzWHXQgxLvXInMpwnvsLAoeSzvlibr0xA4GgPp+v43zz7UHD/UxYd4g9FOzmac52xICU5gVd8haOl8v/AOhVk5iOK3Os1an3NVKkfc1b2/uBWfKVK8MLWUpGqRblrEIaXSC8k536k7Yysba6QKYeNYI33btU4wSC/6GPSaF3uSxQpsmeHfGTwgGzgdYTNpZnlANuGFGv9U+zlDMqztLxl/pK8Rrq9gmhIldsfzRQgkVoWsHAq3FtJ4I02HntQYNqBx6HgQk0wQCeiGvB0WqgiRQdoawP4tIYTSVbpnPajbZJoISACFcgL9QzuEI+7PHTv/e0OnMpQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2017 13:19:54.2828 (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: BN6PR03MB2468 Subject: [dpdk-dev] [PATCHv4 12/33] 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: Tue, 17 Jan 2017 13:19:57 -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 d51e33a..fd844e2 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