From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0053.outbound.protection.outlook.com [104.47.2.53]) by dpdk.org (Postfix) with ESMTP id 063AC5F17 for ; Wed, 25 Apr 2018 14:59:09 +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=UuqzmY5b29VbcdONSWWeZwBbQIEIdGDqbs2355LCeK0=; b=v/+0m+TJTCglKfzRgK/lafEybkQnhZyIbRQptgKiezo4kgH5UMkHREWBI0RrOvahoxK56N8Inyd87N9YAyF5piE8HRaq4p1TtfANO0SjDBfCeBBN52ZY6uBQEVNcomM9IGpA1Ymh4nEK77VdVQZxtxWKppiaeWzKnlF1taQWkkE= 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:05 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, shreyansh.jain@nxp.com Date: Wed, 25 Apr 2018 18:26:58 +0530 Message-Id: <1524661022-21484-1-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain 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:mlkRG6dFMPZxgipJsOgo7YVCBiroGWem3noI+WWIDrLDvpkbljMeq4lAEiED+K82kRfP6I+ERpwJxY1tPaXmdV1tON4DyqLJtChFl0MLKKH5z6VxrwtFctvNw6tGq0zDceUcWutQPevfbGB29WJod1ueC/8vVMcUaQddtaSZuSmG47RUfKUZAWkXbDlamqjzGQBjbJO0aqloFEKy4iztXKGdIypctXe79hAKnmem5+yHKfLYNMCQOp1nFcV6weYI; 25:Xd6+rMXEP6wBtUxag6Bl/k7gqybtOncS9lScCjF41CT+f6spqYB5QQgyVsegzOsF73IcTPJTQSmpVo0ZNNU8ey10yq+286M/YLibpCR4z4ZkyKjUvn/H1gg+ZnuZQ9VhFDVsI610WXNeGxNmV6loPh/Lodkx4cJptDW73gvNj1baCgN9HQ5n80trhhRx5ndeGwlCinhlq5bMsk1rRpFXSTPZer98N4s+mkZ6qhOdbXrbY9HfzGGOUS+eaJhvuPPlXFFNgnkPx6P84XmDBwKksfLvbDN8tgV0HxRJ/RjEIbeKMMCo3AbBPlOvc91izbQqcgec76KCUzGgwITDH67PrxcrMBWgSGt+gPioBDJuSX4=; 31:z6TQpYPDww5ms390fy7OWbsZS4xinGnhGqm1CXzUY26sa3o8A2uGIee5qQfoJFmtmsnl7sD2kLxDdG+bRXWey0sRbH+NlFuih1m5np1sgBeLleLHhekT9GqTGM9jYcNtcD9SHk0zOXdikeAKMz5+vxBh1uFRxWWbc1QJ2V4qUjzg/cwFPhi0+N4OopKzGy9ACao1BsM2b3vTVdW3h10BMtwqpqUH6P3Cg7QvWpsBtKo= X-MS-TrafficTypeDiagnostic: DB4PR04MB0765: X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0765; 20:SAQm8fq5MSEhkXls9P7KVvMI0sxjixZBino4MMDmYxKAM5jSPS1P+wrNkfpStiKUi0Drds0uYTQs3mtWk6SX5HIxc1v8X+UYzbg4YWUgv6xIV3Mt/CsOPkp8CcnGSKWB5ihY7izQC3GpEBB6zEvBL9hCOp+6ne3ZA7sjsh5lc1Ph6H+eIVfNLc3Y936G4nGG94v4caHymzP0xH3/yPCHIpQSDuSvVsnlQdLfr++zszrOelKIaPpt7AR1NMv6ckfhUUBQfVbZM+N3XBKnqX82GYTr05n/L5clOuBron21OoFQa059ck7suP3GrFVIMRa61xsnNRHEZJ2DWccbQvSnYni7XfdKnDI4UnyAQWbtXJ2XVaZFDNoZqE0prZUMkaPkzuM9FFTaECVCKuifc7I6wnIfxnojUNwcwpclj6c4rmzjugRLrywqv27it7pfeT50jl08JX+JhISXM7Y1DQkhUoRqjwdrJ21bq2SLjYybQWX0fwGB5xe8cpcCn61JT0Zg; 4:Zir/9gkpBlDJQkl10f3yLeC1GismKyv+gnm3BdyjB1rsBE0nKK1fy70HeruAsCeB76Rb0W4LG6qlRrAgBa7WVINzL5BJW/Ix8GjCjoiGoAs0ZNgaE4DzutVvZFqzRPJ4F8FD3WzOZNDbJH3iUFSGZrTRSA0zwHjbSbVyDUpzy1o3FNXRcJarK4sTNM3MUrx5A2i5v8Z+ZgeBkKLIQrpDoFUkx/0E0npGAjp41CLf1S4jluRTwiQjDSeCoufTaIkUQg5HKBvjKZuxMpY1gsZAlywAefdPMDmma5gQo/WbiDJ1O+QjZhJr6dmkGteRZXFj 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)(97736004)(2616005)(105586002)(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)(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:8IT4vz+T20+4SeuCvNPC8gJviAbIeTsW2sOEdip0E?= =?us-ascii?Q?NuqcRa+zVrOT3WHY+yNj+qpY9GlbNmYvKMjdQbtZ+lO+kyIXfFn5m/hBEIIg?= =?us-ascii?Q?MyB1bpK4CSgr5e8LxGbTCBqNotXPvWE2ekpendz2BuVOWJnd8g2RAN3mxHAI?= =?us-ascii?Q?yWQwncjScKCgBuGiLidjBC8VR9RAIsgi01FiBaL3aJGTVOP2VYUV+8DKKgRF?= =?us-ascii?Q?7M/TwJjMi3ci0U/kF+2gao9IRQvjvP/Hdkl3jNRif6YuYgXtX9D1OD93ruom?= =?us-ascii?Q?E2hkKmikViLlDSGpIK/LUWC2I/th5H6vo/FeUDL3H5KZ8FV04IaTS7D8UEnB?= =?us-ascii?Q?9U5hbidBEOtwnWRrSHHAIUbLfT+uUeJN05d46FQ/tDql0RyrCHUzoVQU5slR?= =?us-ascii?Q?PnvKs3CS+OgIzV8KtoPaEUQXoZWZ34b4Tw+B7fDBqzpiCNW29U33Wj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15ILmF7mYIF7V02BpcwcaiFut49jwXfOG30eaLcTCabV8ooFU/8g136MZhKr+VpO8LlveQI8tZTDMSLI6FYHr78+3TNgbIbPoTLO4QiBRGx7dIi2n2tsHEy5PRPuAbOKhXfVV7+Xsh5pjsRgnhub5F5x X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0765; 6:YGO6TwpO7j7LEgktS5h9VAna1l/rx6cz1eEnifRslrTTUrCRtd4wEWVh6TtAoxNYq7ExLI8iNbokYYRqy73j9C8XYO+ZqJLaSPIhGAaimn7NRwlSGkog9FWp7nl8JDIshUz69ClvSLJeAVt1ze7FUp2Oj6rk1hxFASdRTS9yaZjF/KJORM1Eo7q4r8Dn/Sdp813tzmTC1UJxzUm/MStD8HUreeT9U6CMOGVzJ/haKyo5C4bpJxMUslvM/UPQCUm1/rcXdETU03tyR0wvgrlJvxNEnM7/7DJOlWu1Aq2BkNqXL2PB6v+ZDDXOSac63Z57W0pYT6jOSTO/AwKoHeoP6gqNHsGefDuFxF54weBnMAk3I9kcw6Nt3LZYm7fRk+WN4VNJmSu1SGcM/cMdCjazt9oCktoZZxmyIyjJRROvDZbwI7NTCpTeW4/lcIOdmsGADoXzWmyEFNupyhpoZDa+iw==; 5:FRQpTjN73VQ89cMAxwSOihSmDX5d2JQpOsqeSmwbb0w5YvJqVv9MUdc7CNSsnjGedW9O4pRI/yPU9QJmSBmZsAs86YoDFoDrEyZJz6aRPaXL1lDyBm+YJL0o0KwdjnMCupYaP2h88PVYKfSCMPLv7MrCSU3MQ8AWj2cO5DDrHX0=; 24:0OdxFloOHzwR6byH3yVgc7o1ZQ4o5bbZ6xewLpucMkvlkrze7naoA6AgCT0FrXGSNh9g9Hm52KXf2KYbhvybEx6xe1mEicRL0yB/vz069P0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB4PR04MB0765; 7:LHqPJYzEM1U9t3MwSeGXwal4oApWbgfXhMlXq9R9u9BZexitoQzghh4RY2EVVmTQcLpSN3fIgKBG+9IC4jt5gDdw1n/anXRCc/KhTAuRnqQdIGhkGMAuk4JOBVFufPrDa151+CxxdtGzrdRPtnXa5dYD8FIvshgC04W66vXw9ijL7VIB+piT6QfEUUulM9036kh4i7/IsA55syq02iuV4dQeO5bNXetGlRBzh//VccMnoGsf0XsYKtWUo6+vYNvp X-MS-Office365-Filtering-Correlation-Id: 3785324f-e85b-40af-aa59-08d5aaac5461 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2018 12:59:05.8170 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3785324f-e85b-40af-aa59-08d5aaac5461 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 1/5] bus/dpaa: 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: , X-List-Received-Date: Wed, 25 Apr 2018 12:59:10 -0000 Signed-off-by: Hemant Agrawal --- doc/guides/cryptodevs/dpaa_sec.rst | 13 +++++ doc/guides/nics/dpaa.rst | 10 ++++ drivers/bus/dpaa/dpaa_bus.c | 101 ++++++++++++++++++++++++++++++------- drivers/bus/dpaa/rte_dpaa_bus.h | 2 - 4 files changed, 106 insertions(+), 20 deletions(-) diff --git a/doc/guides/cryptodevs/dpaa_sec.rst b/doc/guides/cryptodevs/dpaa_sec.rst index 2964e83..9988ee1 100644 --- a/doc/guides/cryptodevs/dpaa_sec.rst +++ b/doc/guides/cryptodevs/dpaa_sec.rst @@ -78,6 +78,19 @@ Supported DPAA SoCs * LS1046A/LS1026A * LS1043A/LS1023A +Whitelisting & Blacklisting +--------------------------- + +For blacklisting a DPAA device, following commands can be used. + + .. code-block:: console + + -b "dpaa_bus:dpaa-secX" -- ... + e.g. "dpaa_bus:dpaa-sec0" + + or to disable all 4 SEC devices + -b "dpaa_sec:dpaa-sec0" -b "dpaa_sec:dpaa-sec1" -b "dpaa_sec:dpaa-sec2" -b "dpaa_sec:dpaa-sec3" + Limitations ----------- diff --git a/doc/guides/nics/dpaa.rst b/doc/guides/nics/dpaa.rst index 0a13996..620c045 100644 --- a/doc/guides/nics/dpaa.rst +++ b/doc/guides/nics/dpaa.rst @@ -162,6 +162,16 @@ Manager. this pool. +Whitelisting & Blacklisting +--------------------------- + +For blacklisting a DPAA device, following commands can be used. + + .. code-block:: console + + -b "dpaa_bus:fmX-macY" -- ... + e.g. "dpaa_bus:fm1-mac4" + Supported DPAA SoCs ------------------- diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index ffc90a7..2b85c9e 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -54,6 +54,8 @@ pthread_key_t dpaa_portal_key; unsigned int dpaa_svr_family; +#define FSL_DPAA_BUS_NAME dpaa_bus + RTE_DEFINE_PER_LCORE(bool, dpaa_io); RTE_DEFINE_PER_LCORE(struct dpaa_portal_dqrr, held_bufs); @@ -129,6 +131,22 @@ dpaa_sec_available(void) static void dpaa_clean_device_list(void); +static struct rte_devargs * +dpaa_devargs_lookup(struct rte_dpaa_device *dev) +{ + struct rte_devargs *devargs; + char dev_name[32]; + + RTE_EAL_DEVARGS_FOREACH("dpaa_bus", devargs) { + devargs->bus->parse(devargs->name, &dev_name); + if (strcmp(dev_name, dev->device.name) == 0) { + DPAA_BUS_INFO("**Devargs matched %s", dev_name); + return devargs; + } + } + return NULL; +} + static int dpaa_create_device_list(void) { @@ -162,6 +180,7 @@ dpaa_create_device_list(void) fman_intf->mac_idx); DPAA_BUS_LOG(DEBUG, "Device added: %s", dev->name); dev->device.name = dev->name; + dev->device.devargs = dpaa_devargs_lookup(dev); dpaa_add_to_device_list(dev); } @@ -198,6 +217,8 @@ dpaa_create_device_list(void) memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN); sprintf(dev->name, "dpaa-sec%d", i); DPAA_BUS_LOG(DEBUG, "Device added: %s", dev->name); + dev->device.name = dev->name; + dev->device.devargs = dpaa_devargs_lookup(dev); dpaa_add_to_device_list(dev); } @@ -357,6 +378,51 @@ dpaa_portal_finish(void *arg) RTE_PER_LCORE(dpaa_io) = false; } +static int +rte_dpaa_bus_parse(const char *name, void *out_name) +{ + int i, j; + int max_fman = 2, max_macs = 16; + char *sep = strchr(name, ':'); + + if (strncmp(name, RTE_STR(FSL_DPAA_BUS_NAME), + strlen(RTE_STR(FSL_DPAA_BUS_NAME)))) { + return -EINVAL; + } + + if (!sep) { + DPAA_BUS_ERR("Incorrect device name observed"); + return -EINVAL; + } + + sep = (char *) (sep + 1); + + for (i = 0; i < max_fman; i++) { + for (j = 0; j < max_macs; j++) { + char fm_name[16]; + snprintf(fm_name, 16, "fm%d-mac%d", i, j); + if (strcmp(fm_name, sep) == 0) { + if (out_name) + strcpy(out_name, sep); + return 0; + } + } + } + + for (i = 0; i < RTE_LIBRTE_DPAA_MAX_CRYPTODEV; i++) { + char sec_name[16]; + + snprintf(sec_name, 16, "dpaa-sec%d", i); + if (strcmp(sec_name, sep) == 0) { + if (out_name) + strcpy(out_name, sep); + return 0; + } + } + + return -EINVAL; +} + #define DPAA_DEV_PATH1 "/sys/devices/platform/soc/soc:fsl,dpaa" #define DPAA_DEV_PATH2 "/sys/devices/platform/fsl,dpaa" @@ -458,22 +524,15 @@ static int rte_dpaa_device_match(struct rte_dpaa_driver *drv, struct rte_dpaa_device *dev) { - int ret = -1; - - BUS_INIT_FUNC_TRACE(); - if (!drv || !dev) { DPAA_BUS_DEBUG("Invalid drv or dev received."); - return ret; + return -1; } - if (drv->drv_type == dev->device_type) { - DPAA_BUS_INFO("Device: %s matches for driver: %s", - dev->name, drv->driver.name); - ret = 0; /* Found a match */ - } + if (drv->drv_type == dev->device_type) + return 0; - return ret; + return -1; } static int @@ -484,8 +543,7 @@ rte_dpaa_bus_probe(void) struct rte_dpaa_driver *drv; FILE *svr_file = NULL; unsigned int svr_ver; - - BUS_INIT_FUNC_TRACE(); + int probe_all = rte_dpaa_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST; /* For each registered driver, and device, call the driver->probe */ TAILQ_FOREACH(dev, &rte_dpaa_bus.device_list, next) { @@ -494,13 +552,19 @@ rte_dpaa_bus_probe(void) if (ret) continue; - if (!drv->probe) + if (!drv->probe || + (dev->device.devargs && + dev->device.devargs->policy == RTE_DEV_BLACKLISTED)) continue; - ret = drv->probe(drv, dev); - if (ret) - DPAA_BUS_ERR("Unable to probe.\n"); - + if (probe_all || + (dev->device.devargs && + dev->device.devargs->policy == + RTE_DEV_WHITELISTED)) { + ret = drv->probe(drv, dev); + if (ret) + DPAA_BUS_ERR("Unable to probe.\n"); + } break; } } @@ -557,6 +621,7 @@ struct rte_dpaa_bus rte_dpaa_bus = { .bus = { .scan = rte_dpaa_bus_scan, .probe = rte_dpaa_bus_probe, + .parse = rte_dpaa_bus_parse, .find_device = rte_dpaa_find_device, .get_iommu_class = rte_dpaa_get_iommu_class, }, diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h index 89aeac2..8f7e18c 100644 --- a/drivers/bus/dpaa/rte_dpaa_bus.h +++ b/drivers/bus/dpaa/rte_dpaa_bus.h @@ -15,8 +15,6 @@ #include #include -#define FSL_DPAA_BUS_NAME "FSL_DPAA_BUS" - #define DPAA_MEMPOOL_OPS_NAME "dpaa" #define DEV_TO_DPAA_DEVICE(ptr) \ -- 2.7.4