From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0065.outbound.protection.outlook.com [104.47.33.65]) by dpdk.org (Postfix) with ESMTP id 34AE71B024; Tue, 23 Jan 2018 14:03:20 +0100 (CET) Received: from BN6PR03CA0079.namprd03.prod.outlook.com (2603:10b6:405:6f::17) by DM2PR03MB478.namprd03.prod.outlook.com (2a01:111:e400:2420::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 13:03:19 +0000 Received: from BN1AFFO11FD042.protection.gbl (2a01:111:f400:7c10::116) by BN6PR03CA0079.outlook.office365.com (2603:10b6:405:6f::17) 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 13:03:19 +0000 Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD042.mail.protection.outlook.com (10.58.52.253) 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 13:03:19 +0000 Received: from b27504-OptiPlex-790.ap.freescale.net (b27504-OptiPlex-790.ap.freescale.net [10.232.132.60]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id w0NCR9X1020973; Tue, 23 Jan 2018 05:27:18 -0700 From: Nipun Gupta To: CC: , , , Nipun Gupta , Date: Tue, 23 Jan 2018 17:57:02 +0530 Message-ID: <1516710427-22843-3-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1516710427-22843-1-git-send-email-nipun.gupta@nxp.com> References: <1516710671-13897-1-git-send-email-nipun.gupta@nxp.com> <1516710427-22843-1-git-send-email-nipun.gupta@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131611861994276305; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39380400002)(396003)(376002)(346002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(47776003)(2950100002)(6666003)(6346003)(77096007)(2351001)(2906002)(68736007)(106466001)(8936002)(97736004)(356003)(305945005)(26005)(81156014)(81166006)(8676002)(105606002)(50466002)(50226002)(48376002)(575784001)(86362001)(53936002)(76176011)(450100002)(104016004)(498600001)(51416003)(5660300001)(54906003)(6862004)(4326008)(69596002)(36756003)(336011)(16586007)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR03MB478; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD042; 1:59zDKJ+xdteLEpH6dv8/1SFnzso2QyT94xmRhWoSgWL9zUlM3iWT9RpudDojMkYAPIidzV4u0ZtJchU2EdSbsAE8jx8FvtX0uJW//6TZ/RePPdqp/f0oo6RwBIeSGaVa MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 27d29425-e994-4c84-2470-08d56261acda X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:DM2PR03MB478; X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB478; 3:W56ExZJgp6TH9rHB5ZWOtDok2CM99PhVQqG98/8cdNKBHOY0qRCt1wH+xae7GpJVxS887PNDWgUJwsqJhxr0ndOwvc5QoMyCffgGHu1hye+1sWq/xOQ8Dz9EFK7JsEfYoKFPIIaCHhtyJCKPJPax9cEzyGofn1W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8WUqmkONYrupzvgwFDraQr3mXKfo/1hr/BBDZY/WyqmROm7XC0m6/yGsBkM1mgAw+v6YupCkelKtEAJLNmIhHwjBMlFJjb9HiKuZ185gY6dmv6/wWfLJSje+DgepTKkB/pi1I7Yx+cUhDvr0hv1N2ag/qq9D5ZzOUE0jwwCG 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)(93006095)(93001095)(3231023)(2400081)(944501161)(10201501046)(3002001)(6055026)(6096035)(20161123556025)(20161123561025)(20161123563025)(201703131430075)(201703131433075)(201703131448075)(201703151042153)(20161123559100)(20161123565025)(201708071742011); SRVR:DM2PR03MB478; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:DM2PR03MB478; X-Forefront-PRVS: 05610E64EE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR03MB478; 23:vJ2Hmdh+CTawZcwA4SjzMnOus+rx5hLpNZFX5MkhJa?= =?us-ascii?Q?izBoN/EEldmVq8uqI2RFa7vNOp9ctHsmDfrdqC619/orde1V7LILyxUP8pgM?= =?us-ascii?Q?yPLKQvVv9kdzUHkSBWh5I1coTeWkslkMmoTXCeChlcucoqW7Q3w5Zz4TqrlJ?= =?us-ascii?Q?Y6CJZRoROYtxaAhyzcgKbITj5AwgU4J/TVvKFmU9QCRRC3WrNkUTj12gbPli?= =?us-ascii?Q?78iiVBmsTR53+2gwpPs+4LSNBqiiEMv/rTQRxhElaMVGGWWRDrVop/bBa2m1?= =?us-ascii?Q?RW0qp1pct0rvEGrzpDdcxBvImwE4KdfqCUPZPBoR8BLY3HWxphyFkBddJ0cx?= =?us-ascii?Q?ZqtLzqPiuXa5jbLeBZcHjxN+dXV5UV75+F7qxNtfvhz7NExq3xspRoto2PIu?= =?us-ascii?Q?DUwaKj4B0rpAvQq97xkBl3LFOt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+NDfBrrJEpMa8jV2QW6M3hl/vhtZn9RLs4a5VHSSZVdEZI1G3ykp3022XvqIrQIQTr15gAUn/qMsYwCaYuDXz3aZ32itXo/8Dmjhkx/+MgeUc8cnJQ7TQDU2Oajns8fH27yRXa3MjRVlnsyfzdOkelkGPdfKR2dXUUwtC185C1fptVQWUi4+N53n7h49qkSs6O/p1tOW6Dco20fzs6DLdGtbzbtqXfyI=; 5:rhGQ03P4i42iEClMWMeogFn2wOwzYNWh3XbnajteBs7IbOjyTiZLOD8bUHz4AXNhZJMjx4EDX7/U7SDGRsJc3eCUSXT2yb6xH1Al0VnsG5l19FTEusOdaVPP5SmiF98cfRkL4HvFNt0O8Fu4pdp66mvX5NgJfiqxKID41xqmXNY=; 24:02ay/s5SEW9M320Yk7LAkn9IF6np3AjnQUxsebDfmY0UYrYoMyV2aUgKiAD+yMoDLZprT6G6ozKkkv6KLzL5FCIVqUvNzVGiIeiPPqDs0nU=; 7:IPRJabbV2rPAuC0nacQSODc6p7L7cL6KGXHv3Z5W42xv3nL/koR/NjeUutehG1d0557gmaKMe0ccFvoLhXLdFJOEbwjvfjSuTintlLXggcoD3XEHvdn+tHv6OsfWzzyFqhewPPLAmV4mNsWNPQv8Sa/FATfsJfeJmEEz5XqyUfIGE+hHdBaHoZEVOI0j2IFU0LxQHiUPnOjK+GEcoGeO6JCkg8zgsJUPKSaRXwiSvFJmw6gWJfFO3qPuR3DUrhFR SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2018 13:03:19.1936 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 27d29425-e994-4c84-2470-08d56261acda X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR03MB478 Subject: [dpdk-stable] [PATCH 2/7 v2] 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 13:03:21 -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