From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0058.outbound.protection.outlook.com [104.47.38.58]) by dpdk.org (Postfix) with ESMTP id F12642C2E; Tue, 23 Jan 2018 08:24:54 +0100 (CET) Received: from CY4PR03CA0101.namprd03.prod.outlook.com (2603:10b6:910:4d::42) by BY1PR03MB1420.namprd03.prod.outlook.com (2a01:111:e400:5255::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Tue, 23 Jan 2018 07:24:53 +0000 Received: from BN1AFFO11FD044.protection.gbl (2a01:111:f400:7c10::154) by CY4PR03CA0101.outlook.office365.com (2603:10b6:910:4d::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.428.17 via Frontend Transport; Tue, 23 Jan 2018 07:24:52 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 BN1AFFO11FD044.mail.protection.outlook.com (10.58.52.191) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.428.12 via Frontend Transport; Tue, 23 Jan 2018 07:24:50 +0000 Received: from b27504-OptiPlex-790.ap.freescale.net (b27504-OptiPlex-790.ap.freescale.net [10.232.132.60]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w0N6G0du023569; Mon, 22 Jan 2018 23:16:08 -0700 From: Nipun Gupta To: CC: , , , Nipun Gupta , Date: Tue, 23 Jan 2018 18:01:06 +0530 Message-ID: <1516710671-13897-3-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1516710671-13897-1-git-send-email-nipun.gupta@nxp.com> References: <1516710671-13897-1-git-send-email-nipun.gupta@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131611658922592465; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(376002)(39380400002)(39860400002)(396003)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(50226002)(8936002)(2906002)(76176011)(81156014)(47776003)(36756003)(575784001)(81166006)(68736007)(16586007)(316002)(8676002)(356003)(86362001)(54906003)(305945005)(51416003)(498600001)(105606002)(106466001)(2351001)(2950100002)(104016004)(5660300001)(6862004)(53936002)(4326008)(48376002)(50466002)(450100002)(77096007)(336011)(85426001)(97736004)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR03MB1420; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD044; 1:FJ22vf4h1RSpObjJMvAIMBxHIoX914c+8HLK6bAl45Hx/Zq8sHKw33/nCrYJ8ImGH7m/F+MCh2Dl+iUYE6cLwPYXdk0PMAjthYAv5EiXizmF5m3bSVZXVGgKBr3lCff4 MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab098a13-b625-44d7-276f-08d5623264d6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:BY1PR03MB1420; X-Microsoft-Exchange-Diagnostics: 1; BY1PR03MB1420; 3:d/8eX/yJKONT6q5j/GMooq4riDmrSjMLb1V78Vkk+BG2vQ8uVufgn8kqOUU58zs1iUBdK6g1IEjjS7RL0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BtiBupAi25EZ0Kw7M7TzoS6ctC75pTo9CS4N3jk6ztEPpObkS8lCybpjsjpsAhXtYfCHUBPa2/lNFb9jZ2TPtMV0i9j0vWy8Op4IPSXZq/kFmfxdJPNXW7l605aORpRMXdve4R4Q6AUJlEjyQzlAaxRNBA9P16rsTiP2RSCPhuHjBHpMdRrkjWZIgXOaEQMqzgVj/P5SyQDgFNUgHPMrg1JivglpgOOs9zEHEgx9wwDquaBDm X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(227817650892897)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(3231023)(2400081)(944501161)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703151042153)(20161123556025)(20161123561025)(20161123559100)(20161123565025)(20161123563025)(201708071742011); SRVR:BY1PR03MB1420; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BY1PR03MB1420; X-Forefront-PRVS: 05610E64EE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR03MB1420; 23:K4RaLIxzbpKAUe51yz+pCCfPAoaVreh+F0F9ely5J?= =?us-ascii?Q?QTGXTuFiOOULn+75XzvaQqczFzh4iOZWioijJpmNb7IKNT/C50Ag4CQVpc4f?= =?us-ascii?Q?RGQz0FxBxpFpx3JMK4TpgjtmxjX8ORTeOInpI54759YhzGzHTL65gTLTOW4h?= =?us-ascii?Q?Y3hDT7myzRusu101/LrD9GCkA7JnkQYZEGdDdgzKufAB2F1HDv79rGBjh95A?= =?us-ascii?Q?jQINuAiavY+O4ra/QAx+T/lEb62ULAoEd6cHBfxXnloNVWbuGQVGIjhoTcol?= =?us-ascii?Q?79xr34MwRJC23JJb2mj2z4P93ZumTzu1qnNqadss06420LPMNPvDRypSXBnq?= =?us-ascii?Q?HAPJ9zZYsEQLShNdkt1wq/dEQWMnoiyZUWve296AM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Memrk2SGlLPrTkPdB9AadV1wh3bJJdEwzX7mPuicaZBGSSVrJfLnPfYyN56yo8ZXCPx7XZ9Stsm9TUcEH170Y/vuSKC0gpr6BbimwkRCyt1ox8CSbRBeFnQjlEoMOSx9JqC1igUaT2iCOtBUR3xUVAxfmVNXXOVevqVLXqFrD+iaO+Y/iaO8/Q1uYCzZ5gJua+ljIMfxmTXjtUjjcgnYiTGsIAUvmaWa8vjXu4=; 5:f9ySwc7ntGbBYZph7wPkp1HAb/ipeEg9qrEho5VRx2ohQqdOQ2cOmtWZQbKb5GNH1vkCjWqnrpsGMRdp4KDvCikm6cClYMmS3yR+2B4CFak9rWXMISlxgMW+144qnMaT4GtY97tBXNDg1ebwMniQOk0GoIy7Nz3j0rPDdjfEZ5c=; 24:mbLegNwgFYxe2YB0atQRkxEiWWjalntyDWHDGtwy3WmbIoZn+Xhg+oJo3hqy+qZmgRj0UbNdqMuPMXv605H8UGrxYZ1J+sn8sKzcHqyGshE=; 7:ov5JCLpW5Agb77rW0wqicT+76QnYuiA1sNQgoqdWwAI9kT2VtOwsHTjuWsOcplb7bS67IlTMh1kwkf04RHcoJNP9mu3Pjh5PWLkn2FJvoFZozS+wNdrq5R7Ut7E/GD3J345VOLUPn7tXOEn2D0sxNe76mdrd60cTZptatAmfX92b0Yl8vA8XIvj37zThqhwJ+cMvyq4Ey6xMp7u5oTE0nHr/b+JM/p7Z4cqRs/z7ZI0XyBfi92xRvzeFGXIClZ5s SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2018 07:24:50.2000 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ab098a13-b625-44d7-276f-08d5623264d6 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: BY1PR03MB1420 Subject: [dpdk-stable] [PATCH 2/7] bus/dpaa: allocate qman portals in thread safe manner X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jan 2018 07:24:55 -0000 Fixes: 9d32ef0f5d61 ("bus/dpaa: support creating dynamic HW portal") Cc: stable@dpdk.org Signed-off-by: Nipun Gupta --- drivers/bus/dpaa/base/qbman/qman.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c index e7fdf03..4d8bdae 100644 --- a/drivers/bus/dpaa/base/qbman/qman.c +++ b/drivers/bus/dpaa/base/qbman/qman.c @@ -625,7 +625,7 @@ struct qman_portal *qman_create_portal( #define MAX_GLOBAL_PORTALS 8 static struct qman_portal global_portals[MAX_GLOBAL_PORTALS]; -static int global_portals_used[MAX_GLOBAL_PORTALS]; +rte_atomic16_t global_portals_used[MAX_GLOBAL_PORTALS]; static struct qman_portal * qman_alloc_global_portal(void) @@ -633,10 +633,8 @@ struct qman_portal *qman_create_portal( unsigned int i; for (i = 0; i < MAX_GLOBAL_PORTALS; i++) { - if (global_portals_used[i] == 0) { - global_portals_used[i] = 1; + if (rte_atomic16_test_and_set(&global_portals_used[i])) return &global_portals[i]; - } } pr_err("No portal available (%x)\n", MAX_GLOBAL_PORTALS); @@ -650,7 +648,7 @@ struct qman_portal *qman_create_portal( for (i = 0; i < MAX_GLOBAL_PORTALS; i++) { if (&global_portals[i] == portal) { - global_portals_used[i] = 0; + rte_atomic16_clear(&global_portals_used[i]); return 0; } } -- 1.9.1