From patchwork Wed Apr 25 12:56:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 134281 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp831541lji; Wed, 25 Apr 2018 05:59:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/nV7p4qRaZP5ric5OJ+iAYt7+bNoR50HiqT8OhQLXYH6CXUV6UTrtze7Hrdi3oRKsge6sT X-Received: by 2002:adf:bd01:: with SMTP id j1-v6mr17184024wrh.69.1524661163986; Wed, 25 Apr 2018 05:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524661163; cv=none; d=google.com; s=arc-20160816; b=WB8U3PRIR3V6HItZRWBhl+4GSbXzdyx/YfZjAHv2r9iX91VuWzL2erHY25YM5iT8w6 GRvcJLT6ksqGQQKixZd+02VBAwa/39TsCjzP3AbiN8FS18iY9GEl+nmEZ1Z1Fr7qIkhA ZWhl2EklzjU0AOZx6o8vAXZdBJn4GLfCw2FEpZZTXXEYVPQCURS3MfLg2pIel5dVX41U NkO+km9h7xBz8t63tb0newmpk/r30AHfzg5to9VVeURfHbRev8LqWU6XSI9CYG4/SmSV 2dw42BPHvX4yI4IYgvhNObmfTVXl1tefJsmt/hw/6YQpNASAszHShxoLLgxAUOfC7kZL pbKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:dkim-signature:arc-authentication-results; bh=SnTk8+iOt+2s7iv6YedZO1mU3V8lqiWEwcECy3padWE=; b=vuLuFpPH8q8s9cfWAS0GvbdhT+KZgpc4WJ+ftS0/szxIBrpOpBmUT4y0E8oZaWxQMc Q4I8Nz494SLUwWu6BRWOfu3D8ahvmsQE9zNW0NpSNuXBWucO2UXpxh3+FnD0F4uDt+7d yD9rPYO1AWdvGQB0iygtJR256wpnVBo+qvgE9RGTFpBhy04cUsYMgbiUTSrwMcs0VymS KNq/CViU45MBjRt2fmivN934RApP8MG1DZxg8VrYBkC1YC8cDhqWqzyLL3fgx+Joa9Pz aqsN198ii6ugUmRACSVpK0O91G8iLYWrCtSMt6ppcJJW3nWREnSiUsyzuu9efHjmnUiQ pi+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=aOMMLJ7C; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id e11si8788307wmi.105.2018.04.25.05.59.23; Wed, 25 Apr 2018 05:59:23 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=aOMMLJ7C; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B54077288; Wed, 25 Apr 2018 14:59:15 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0086.outbound.protection.outlook.com [104.47.2.86]) by dpdk.org (Postfix) with ESMTP id 0AE965F17 for ; Wed, 25 Apr 2018 14:59:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=SnTk8+iOt+2s7iv6YedZO1mU3V8lqiWEwcECy3padWE=; b=aOMMLJ7CoKqmJZqh5j1Z5VtkfmcAMJ5GZ6WMlN+fiVS6EWivipJ1jmDo/g9G+RXlvNRzLViTzg9hWzELTe5d4fvbAHh+LO9t0RbdP9RP4NkGK121jmpm0JEmyEI8iSRZo/3J8P7kj+erc8FD7bjoK1DC5DIGLxoLXmebALR/urA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; Received: from bf-netperf1.ap.freescale.net (14.142.187.166) by DB4PR04MB0765.eurprd04.prod.outlook.com (2a01:111:e400:984d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.15; Wed, 25 Apr 2018 12:59:07 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, shreyansh.jain@nxp.com Date: Wed, 25 Apr 2018 18:26:59 +0530 Message-Id: <1524661022-21484-2-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524661022-21484-1-git-send-email-hemant.agrawal@nxp.com> References: <1524661022-21484-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: MAXPR0101CA0035.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::21) To DB4PR04MB0765.eurprd04.prod.outlook.com (2a01:111:e400:984d::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB4PR04MB0765; X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0765; 3:2wQdJJ+oO6vKLg9mfy3G2A/v3O7245R53eH0tWkQtbUVQOa6AS2PYf7wEpAZRpEFnhS2xjZ8vlq6y7bmbW5sdO3vn9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bUU5UuA8N1m6YvGsVTLGrMVp8Zqa5ef4HAIIfxwdIigEDfMS65kIYRgxM2ZDrp7Y/cy2XLwKqNWavDMBbIma4e2sCWy+9kG1lSkYeILyiXHQ/y1RP8cfhMd+/4OVBUrLNWvjmQY9aI7ZxDI9OS2CwzDc3dinZb3hvFQsYX1e97/m4bH2FaeyhN/iQ+dZXLCRWJRR+C1lTFpUbHCw9EvlhAIDHMjUSZ+qsx/JgyMyMH6MOKQ/QuxU1uxtvX0he9NzlxAWr4M1s6mIUT9++kuC; 4:0M+v++22sgoUiCE7tsnUCwMmvsZew+DAyoJPvtr1NvWZ8EyDvLZ9PT2FNhPrpMgNz15MMoXEiiR5O4yXgaf4wI3llhK26o420JqjuWhmwPWSMTDSmGKs6EuI0kxtPx9wBtgkfew1b0AvsnldvXS1SbGRY5thcTaTkN3pF58A3ooI6bOXqOWUlZ71ItYIXF5r/8XGgQWNDCj/SmW977SOIELOybvinYVcPjnyRtHiG18Xn9RKBYoc0jUMmXZXZKe7axm/D8/VORIZVI8SuHo3rw5XRLtTvQmu2eEIZ0XzXBVHXRw6JP+EZNga1ip8Mg7R X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231232)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:DB4PR04MB0765; BCL:0; PCL:0; RULEID:; SRVR:DB4PR04MB0765; X-Forefront-PRVS: 06530126A4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(346002)(376002)(39860400002)(396003)(366004)(189003)(199004)(3846002)(186003)(26005)(6506007)(956004)(76176011)(97736004)(2616005)(11346002)(105586002)(446003)(6486002)(5009440100003)(486006)(386003)(52116002)(2351001)(2361001)(51416003)(5660300001)(25786009)(478600001)(2906002)(44832011)(316002)(16586007)(50226002)(47776003)(6666003)(6916009)(36756003)(8936002)(476003)(6512007)(106356001)(6116002)(55236004)(66066001)(53936002)(16526019)(68736007)(4326008)(86362001)(7736002)(81156014)(575784001)(8676002)(81166006)(50466002)(305945005)(48376002)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB4PR04MB0765; H:bf-netperf1.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB4PR04MB0765; 23:gzkzEgLuiOWhVkX18CNlYK9qfFNkXQGMKGKlKjBDz?= ZUmQ84rgqaWrc7/DdirMLzblzWsjvZtS1mzeZSsQOqIkxXkhu5eyK7jXu/Y1DaXCWeM/26bI0YHod/pADN4wYCC6Tkii1T9mjfZPv95myedLCbf0i+JQ6v9GTacWMTOUr8X6hb1QZ0NUandQqEyTOkICe9TM2Kl0zItrgauShgR2wizwkGzcDs92vXsVU7Gconb6to80odyIm2cuw8XLtwOrXt08v+xZ9pjqBR6tS6kaM6WMUT3N4pv/QLKlOcQcY7BqBa3zKsqyjk9begXlPZspWZBeptK2H4P77R1lrd+wj39My5aBz2ecb8OW2zFdaduCS/UIt0urNckhiudrPv4EX5TQjQhTmCciYEPy6zYJvyAERZAGZ9WFsyG98Ww/tiwfo7MN3g2Ad6fFchOV0e0zdyAZ32zOOG2A8Azw/gEmgn5Evhf32COwpYDLxdIVAmRsLz80e7fuyEm7z5n79zHBay+8enKV4gfFu1IofkpSfaqioZoIrousChtS516B63+N77jVuDhoNrTDbayyTzun3DkdBJClnT8ICC2RpfMBobKzEEzp71+smkXVtZ+jHo+XyQlXu5Dq5KtHKK6PwcIGC/8prj1nx7Cy7g7pFXA7SXpZ1+Pt2mapxxapCyjuLiXSfJyNKpTjXHGLM1nM6el9b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JOxLYSq+1badKb+nF/JYkIijLvXoRtyEi/qRM3BPfe0rlCFIwSjzRRNS9FuXd7YzoElAUQa1FEAbf/swewboo3XBJMhP8x6m+o8pR8fOnHzrL167hymstd47yqJQeepx0/s2W5sjmZGR9peru10IgHcQXPpYgN7ebtW738MiGZVZZlytqGiMVlESDznur6xix9BfKmM5oTPQyXdQnS4bLMR1pta3phtsMJr70dAj0Aw4uBwzzVcRirShJu2/M3ju+xukXLI86w==; 5:1ZNH82tJ8Uzo3IaIcu/mKcGpIrRWFXOutjl/BAIwzFkx2A64JHCDtvrfSSD8gSWmyiC4cE3dS4sGXxs0EPS/+YhUuGpVbj9o/o9GFFDXDpEnil9TBqWTLcQQX9ZH85KhYq+B69KYfF/f4G8omBgCqjVTq9sFwaAqej76xLgxFPY=; 24:PTz2t9qU0HWRnijIVzh+twixdwXq//YRxouf1e6LWhaQ59jwDlq++I61mzsnlvlMA+K2iv5xCBTAfARTsFrKokC2gb6BuE/da+kh/3M34Mo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0765; 7:seqIlQtnu3K/wVZbmncwVtdoW1rodcD+4pYKxWQZQvCmsUDRML450p0AfzeOm4G1qkgi2RBeyZ0L+dbw88sahmxWQlAIUe008a3JR4s40GT+MmpwpUn5J5+h/q8ywfQhwwED1AW5/Jx8A0TnTcfq+e43d9aMNxfDKO0JFns56iZStlATG8YEfRI2OtQwj9Kh7lLgeUIGyYt/S0b+5Sdh1hlBohG7k9Iq7LNjPVZyh9ras+C+GMdXx1S0sWdJ9Kvl X-MS-Office365-Filtering-Correlation-Id: d6b5e20e-7cd8-4a18-c604-08d5aaac5560 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2018 12:59:07.4733 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d6b5e20e-7cd8-4a18-c604-08d5aaac5560 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR04MB0765 Subject: [dpdk-dev] [PATCH 2/5] bus/fslmc: support device blacklisting 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Hemant Agrawal --- doc/guides/cryptodevs/dpaa2_sec.rst | 11 ++++ doc/guides/nics/dpaa2.rst | 11 ++++ drivers/bus/fslmc/fslmc_bus.c | 107 ++++++++++++++++++++++++++++++++---- drivers/bus/fslmc/rte_fslmc.h | 4 ++ 4 files changed, 122 insertions(+), 11 deletions(-) -- 2.7.4 diff --git a/doc/guides/cryptodevs/dpaa2_sec.rst b/doc/guides/cryptodevs/dpaa2_sec.rst index 5558ea5..0fdd673 100644 --- a/doc/guides/cryptodevs/dpaa2_sec.rst +++ b/doc/guides/cryptodevs/dpaa2_sec.rst @@ -134,6 +134,17 @@ Supported DPAA2 SoCs * LS2088A/LS2048A * LS1088A/LS1048A +Whitelisting & Blacklisting +--------------------------- + +For blacklisting a DPAA2 SEC device, following commands can be used. + + .. code-block:: console + + -b "fslmc:dpseci.x" -- ... + +Where x is the device object id as configured in resource container. + Limitations ----------- diff --git a/doc/guides/nics/dpaa2.rst b/doc/guides/nics/dpaa2.rst index 8e38eff..7d069aa 100644 --- a/doc/guides/nics/dpaa2.rst +++ b/doc/guides/nics/dpaa2.rst @@ -561,6 +561,17 @@ which are lower than logging ``level``. Using ``pmd.dpaa2`` as log matching criteria, all PMD logs can be enabled which are lower than logging ``level``. +Whitelisting & Blacklisting +--------------------------- + +For blacklisting a DPAA2 device, following commands can be used. + + .. code-block:: console + + -b "fslmc:dpni.x" -- ... + +Where x is the device object id as configured in resource container. + Limitations ----------- diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index d0b3261..e7c8cc6 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -23,6 +23,7 @@ int dpaa2_logtype_bus; #define VFIO_IOMMU_GROUP_PATH "/sys/kernel/iommu_groups" +#define FSLMC_BUS_NAME fslmc struct rte_fslmc_bus rte_fslmc_bus; uint8_t dpaa2_virt_mode; @@ -93,6 +94,22 @@ insert_in_device_list(struct rte_dpaa2_device *newdev) TAILQ_INSERT_TAIL(&rte_fslmc_bus.device_list, newdev, next); } +static struct rte_devargs * +fslmc_devargs_lookup(struct rte_dpaa2_device *dev) +{ + struct rte_devargs *devargs; + char dev_name[32]; + + RTE_EAL_DEVARGS_FOREACH("fslmc", devargs) { + devargs->bus->parse(devargs->name, &dev_name); + if (strcmp(dev_name, dev->device.name) == 0) { + DPAA2_BUS_INFO("**Devargs matched %s", dev_name); + return devargs; + } + } + return NULL; +} + static void dump_device_list(void) { @@ -182,6 +199,7 @@ scan_one_fslmc_device(char *dev_name) DPAA2_BUS_ERR("Unable to clone device name. Out of memory"); goto cleanup; } + dev->device.devargs = fslmc_devargs_lookup(dev); /* Add device in the fslmc device list */ insert_in_device_list(dev); @@ -200,6 +218,54 @@ scan_one_fslmc_device(char *dev_name) } static int +rte_fslmc_parse(const char *name, void *addr) +{ + uint16_t dev_id; + char *t_ptr; + char *sep = strchr(name, ':'); + + if (strncmp(name, RTE_STR(FSLMC_BUS_NAME), + strlen(RTE_STR(FSLMC_BUS_NAME)))) { + return -EINVAL; + } + + if (!sep) { + DPAA2_BUS_ERR("Incorrect device name observed"); + return -EINVAL; + } + + t_ptr = (char *)(sep + 1); + + if (strncmp("dpni", t_ptr, 4) && + strncmp("dpseci", t_ptr, 6) && + strncmp("dpcon", t_ptr, 5) && + strncmp("dpbp", t_ptr, 4) && + strncmp("dpio", t_ptr, 4) && + strncmp("dpci", t_ptr, 4) && + strncmp("dpmcp", t_ptr, 5) && + strncmp("dpdmai", t_ptr, 6)) { + DPAA2_BUS_ERR("Unknown or unsupported device"); + return -EINVAL; + } + + t_ptr = strchr(name, '.'); + if (!t_ptr) { + DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr); + return -EINVAL; + } + + t_ptr = (char *)(t_ptr + 1); + if (sscanf(t_ptr, "%hu", &dev_id) <= 0) { + DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr); + return -EINVAL; + } + + if (addr) + strcpy(addr, (char *)(sep + 1)); + return 0; +} + +static int rte_fslmc_scan(void) { int ret; @@ -274,6 +340,8 @@ static int rte_fslmc_probe(void) { int ret = 0; + int probe_all; + struct rte_dpaa2_device *dev; struct rte_dpaa2_driver *drv; @@ -303,6 +371,8 @@ rte_fslmc_probe(void) return 0; } + probe_all = rte_fslmc_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST; + TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) { TAILQ_FOREACH(drv, &rte_fslmc_bus.driver_list, next) { ret = rte_fslmc_match(drv, dev); @@ -312,9 +382,21 @@ rte_fslmc_probe(void) if (!drv->probe) continue; - ret = drv->probe(drv, dev); - if (ret) - DPAA2_BUS_ERR("Unable to probe"); + if (dev->device.devargs && + dev->device.devargs->policy == RTE_DEV_BLACKLISTED) { + DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping", + dev->device.name); + continue; + } + + if (probe_all || + (dev->device.devargs && + dev->device.devargs->policy == + RTE_DEV_WHITELISTED)) { + ret = drv->probe(drv, dev); + if (ret) + DPAA2_BUS_ERR("Unable to probe"); + } break; } } @@ -329,17 +411,19 @@ static struct rte_device * rte_fslmc_find_device(const struct rte_device *start, rte_dev_cmp_t cmp, const void *data) { + const struct rte_dpaa2_device *dstart; struct rte_dpaa2_device *dev; - TAILQ_FOREACH(dev, &rte_fslmc_bus.device_list, next) { - if (start != NULL) { - if (&dev->device == start) - start = NULL; /* starting point found */ - continue; - } - + if (start != NULL) { + dstart = RTE_DEV_TO_FSLMC_CONST(start); + dev = TAILQ_NEXT(dstart, next); + } else { + dev = TAILQ_FIRST(&rte_fslmc_bus.device_list); + } + while (dev != NULL) { if (cmp(&dev->device, data) == 0) return &dev->device; + dev = TAILQ_NEXT(dev, next); } return NULL; @@ -422,6 +506,7 @@ struct rte_fslmc_bus rte_fslmc_bus = { .bus = { .scan = rte_fslmc_scan, .probe = rte_fslmc_probe, + .parse = rte_fslmc_parse, .find_device = rte_fslmc_find_device, .get_iommu_class = rte_dpaa2_get_iommu_class, }, @@ -430,7 +515,7 @@ struct rte_fslmc_bus rte_fslmc_bus = { .device_count = {0}, }; -RTE_REGISTER_BUS(fslmc, rte_fslmc_bus.bus); +RTE_REGISTER_BUS(FSLMC_BUS_NAME, rte_fslmc_bus.bus); RTE_INIT(fslmc_init_log); static void diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h index 69d0fec..de40e86 100644 --- a/drivers/bus/fslmc/rte_fslmc.h +++ b/drivers/bus/fslmc/rte_fslmc.h @@ -31,6 +31,7 @@ extern "C" { #include #include #include +#include #include @@ -49,6 +50,9 @@ struct rte_dpaa2_driver; TAILQ_HEAD(rte_fslmc_device_list, rte_dpaa2_device); TAILQ_HEAD(rte_fslmc_driver_list, rte_dpaa2_driver); +#define RTE_DEV_TO_FSLMC_CONST(ptr) \ + container_of(ptr, const struct rte_dpaa2_device, device) + extern struct rte_fslmc_bus rte_fslmc_bus; enum rte_dpaa2_dev_type {