From patchwork Wed Aug 31 14:24:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Elo, Matias \(Nokia - FI/Espoo\)" X-Patchwork-Id: 75101 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp365579qga; Wed, 31 Aug 2016 07:25:54 -0700 (PDT) X-Received: by 10.107.170.90 with SMTP id t87mr5646545ioe.187.1472653554083; Wed, 31 Aug 2016 07:25:54 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a199si13122602itc.41.2016.08.31.07.25.52; Wed, 31 Aug 2016 07:25:54 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE dis=NONE) header.from=nokia.com Received: by lists.linaro.org (Postfix, from userid 109) id 1F58260D3A; Wed, 31 Aug 2016 14:25:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id C1EF960D73; Wed, 31 Aug 2016 14:25:12 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id B276F60D36; Wed, 31 Aug 2016 14:25:06 +0000 (UTC) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0090.outbound.protection.outlook.com [104.47.0.90]) by lists.linaro.org (Postfix) with ESMTPS id 287DC60D4F for ; Wed, 31 Aug 2016 14:24:28 +0000 (UTC) Received: from AM3PR07CA0032.eurprd07.prod.outlook.com (10.141.45.160) by AMSPR07MB146.eurprd07.prod.outlook.com (10.242.86.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Wed, 31 Aug 2016 14:24:25 +0000 Received: from DB3FFO11FD011.protection.gbl (2a01:111:f400:7e04::109) by AM3PR07CA0032.outlook.office365.com (2a01:111:e400:882c::32) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9 via Frontend Transport; Wed, 31 Aug 2016 14:24:25 +0000 Received-SPF: Pass (protection.outlook.com: domain of nokia.com designates 131.228.2.240 as permitted sender) receiver=protection.outlook.com; client-ip=131.228.2.240; helo=fihe3nok0734.emea.nsn-net.net; Received: from fihe3nok0734.emea.nsn-net.net (131.228.2.240) by DB3FFO11FD011.mail.protection.outlook.com (10.47.216.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.587.6 via Frontend Transport; Wed, 31 Aug 2016 14:24:26 +0000 Received: from fihe3nok0734.emea.nsn-net.net (localhost [127.0.0.1]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u7VEO9qF020843 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 31 Aug 2016 17:24:09 +0300 Received: from 10.144.19.15 ([10.144.104.92]) by fihe3nok0734.emea.nsn-net.net (8.14.9/8.14.5) with ESMTP id u7VEO935020834 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Wed, 31 Aug 2016 17:24:09 +0300 X-HPESVCS-Source-Ip: 10.144.104.92 From: Matias Elo To: Date: Wed, 31 Aug 2016 17:24:08 +0300 Message-ID: <1472653448-23947-3-git-send-email-matias.elo@nokia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472653448-23947-1-git-send-email-matias.elo@nokia.com> References: <1472653448-23947-1-git-send-email-matias.elo@nokia.com> X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:131.228.2.240; IPV:NLI; CTRY:FI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(438002)(189002)(199003)(87936001)(11100500001)(450100001)(229853001)(47776003)(5003940100001)(626004)(586003)(48376002)(92566002)(8936002)(76176999)(356003)(7846002)(50226002)(106466001)(77096005)(33646002)(97736004)(8676002)(2906002)(81166006)(305945005)(16796002)(81156014)(189998001)(107886002)(19580405001)(2950100001)(68736007)(50466002)(2351001)(50986999)(36756003)(19580395003)(5660300001)(110136002)(42882005); DIR:OUT; SFP:1102; SCL:1; SRVR:AMSPR07MB146; H:fihe3nok0734.emea.nsn-net.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD011; 1:KN3cgIQurHvGRep9fuXZ1xeEdckztJXfMJCLXy4DTvy6A01ZOSXwzxQ7Ha+urqwai5nXENF1CkKCRiEZmY39NH5NTFC41rKDoXbgf+eY6awYEc6cc1QxyqTyMiIkSPAXh9VUU7ymx9aCUhbgsjarJVNf5ZAIBW/GGek5riGxNJeLE7/IVpLyrS5mR1QE2+M/uVMEEljgrCklV48/ilKOfHHvV4wrZfvzoRd3riH7B1uAjh7agXNrfgjwPyQ990d6a3p6gGeJrUoQ4UpGAVxmalEr1Hn9QSI5B30WACKriRAIWWfDceXzuaRreOJqD8Z62dcuPo/JW0qbmXX0kFgVE8Bn4cdLlR3KZ8T4WxZaP3RXipl43gxbuAoOAUJ1hZijWc6yTYY6+5NutFTF3h4pgpvxSmW4uMkBwLh6ktWYCTU8xeHFdcXJa6m/ToSrGpGj2bRbLducIg3MvyncMrKSr4XqWGU1sItRkqhF+msYe0BcWr9mUvv+zWSSdw85Qd+3 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 36888ab1-881f-4628-d75b-08d3d1aa8303 X-Microsoft-Exchange-Diagnostics: 1; AMSPR07MB146; 2:BDIeptWVEN+jC9P/6fsOLxw3CoSgU1nJErMsSo8YS7BGB71IvtTrJ0sjzFDWkldfSvwZ5TT2x2BKnMeKovskOIqmEU/sFgXYbKfNk8Uw86w0IsOAI1SiRqbzy8Ls4ZJ7svP3nM9VLtjHhHICjPScFMMU1xYeIUGYdCKYuRQ2dn8mwkW9YLexvNm02ZDGXcWc; 3:jzGpNHpdOQ+UU6SQlqbIq2dgJ9A4JSicLQMdkxnOLXscr1DcN9dhWrcLkn769iNOLOll3RF1sZTySID6prZoAsFBpk4+eQXvBhYFv7CBTsGrZCFBfRGQVUIt0S2izTWnimUXhyNcBgx04u5K8lCWvXs9XZnu8yH2psKHxKybe4YIFwlq3t6Ssz9g59oRHkvtKqN5I0PoZAWqXq3aRZpzY7Pr9AxBWx5ijtBYBUYhg7GS+nk/wjKVbnKEuX/MpvGbxODGsv5c980yl/R62ei85Q== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:AMSPR07MB146; X-Microsoft-Exchange-Diagnostics: 1; AMSPR07MB146; 25:24OGDdJBKgDXeH05TsqiRI4m+bdsOBDjf3BQ9UUiEP5e1uX4T2HDruXwkvhZF/0vMU92WJ5GJmB3JurN7MUQUEeEUtxuhgUzlgJ5mX4vOzwKEldApnBx1XWCQNMkiGBgTGMbwGlV771pBUXsuv+gzvLm3OfhObfdTskXlJxZCuD/7pyHRp9z5qjHnF2w3npeEqNePQJdCHTGtuULIbgep9Xn/KybDlsrtBXGUZuTok4HxD2B6c3Gu4LWbowSn7+kPTRshQEhQFoWQqS/OOeEc73Yhnr23adi8pCHbQb+7XsHhqWV06rAy/c/iIL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8K5aA4pky9xG3x9r/immT+oR/OsOZ4il1LFR3O4Bm9BsSdXqSBwJ4/EAX8sDD/X99xddXiWl8Y0u58Bjwet4/vRoWFagatMovFgLTRHhCxsO823fFlozAyj252gXM/+linxkIU6SXH+BbLidw/sxbbKNqyYv4MIB87O37OsHqB0xy3gFohVRrV+/thYwd2Rl+EE+fhQ9kuKELlQiJYVEMaAfoJ+cOpYygk36hjIcT8XaWGiAgRk2TyYbOuOVYPHa1E4wWI2MPpAd1D7CP6nBuDA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(82608151540597); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13016025)(13018025)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:AMSPR07MB146; BCL:0; PCL:0; RULEID:; SRVR:AMSPR07MB146; X-Microsoft-Exchange-Diagnostics: 1; AMSPR07MB146; 4:zSFgueYSQrgF6dpRMMQybwFyeH9UhqsxGPvWDeiYYWQYEEEC/zlYcGjVvqUoHhTIsO2b7HPFeckZEIaPp+8MSXHAemRpOgAHvrH0KXnAWv20g0kJpA9R4oFCDTFuK39b92Zt6qLd2hnr4ZLxEsBXxy/yqL1vpdfgw42amQLeQe987yaWSTnUsXVZWCHUNgqLMpGKqawcG5zezqq9nwlvSZghtV8MEdfwHZ/ieTzAgLJcgExR0yvf2msvtXK94bIajn4xCDqaYGJpqXvah2pCJiHFayjVmoTVsc1hD3cc6ih7mKK3ikAGIkxmK326LRmqxwwQ+eMmsdCMw3ttpei6CFrAk1Brdf9vU5QUdI+stb6zjrV4lFmWqN1pPPmhyQesMF0VqLAvGTrNxgAIS2HHzdR6MaM/W1kVaAbIWwYC2E19sfFk0pDQlh2wMGvtcpe4wdZE9cLb1m5Po8SsT+hDozwdtDKZWSfI/s/08SrrIhQ= X-Forefront-PRVS: 00514A2FE6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AMSPR07MB146; 23:dtii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Bq3eQ/AI2WqPUPvKucWJDe3IOr0vaIkw/l1OSHHQu/JGvb11BGyIuYCH4B0tmed0YyjN2Gx9cgzK/DUYsYdA2Zzhm49hg9VZdyNfa7L1VJJn4NWyT05l7wwrrxCgK/fE0ISLHKjh7/VdwndD0nIu SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2016 14:24:26.0056 (UTC) X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5d471751-9675-428d-917b-70f44f9630b0; Ip=[131.228.2.240]; Helo=[fihe3nok0734.emea.nsn-net.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AMSPR07MB146 X-Topics: patch Subject: [lng-odp] [PATCH 3/3] linux-gen: dpdk: move rx/tx locks X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Protect only the required sections of rx/tx functions. Signed-off-by: Matias Elo --- platform/linux-generic/pktio/dpdk.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 99eb868..11f3509 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -912,6 +912,9 @@ static int dpdk_recv(pktio_entry_t *pktio_entry, int index, rx_mbufs, num); } + if (!pkt_dpdk->lockless_rx) + odp_ticketlock_unlock(&pkt_dpdk->rx_lock[index]); + if (nb_rx > 0) { if (pktio_entry->s.config.pktin.bit.ts_all || pktio_entry->s.config.pktin.bit.ts_ptp) { @@ -922,9 +925,6 @@ static int dpdk_recv(pktio_entry_t *pktio_entry, int index, ts); } - if (!pktio_entry->s.pkt_dpdk.lockless_rx) - odp_ticketlock_unlock(&pkt_dpdk->rx_lock[index]); - return nb_rx; } @@ -940,14 +940,17 @@ static int dpdk_send(pktio_entry_t *pktio_entry, int index, if (odp_unlikely(pktio_entry->s.state != PKTIO_STATE_STARTED)) return 0; - if (!pktio_entry->s.pkt_dpdk.lockless_tx) - odp_ticketlock_lock(&pkt_dpdk->tx_lock[index]); - mbufs = pkt_to_mbuf(pktio_entry, tx_mbufs, pkt_table, num); + if (!pkt_dpdk->lockless_tx) + odp_ticketlock_lock(&pkt_dpdk->tx_lock[index]); + tx_pkts = rte_eth_tx_burst(pkt_dpdk->port_id, index, tx_mbufs, mbufs); + if (!pkt_dpdk->lockless_tx) + odp_ticketlock_unlock(&pkt_dpdk->tx_lock[index]); + if (odp_unlikely(tx_pkts < num)) { for (i = tx_pkts; i < mbufs; i++) rte_pktmbuf_free(tx_mbufs[i]); @@ -955,9 +958,6 @@ static int dpdk_send(pktio_entry_t *pktio_entry, int index, odp_packet_free_multi(pkt_table, tx_pkts); - if (!pktio_entry->s.pkt_dpdk.lockless_tx) - odp_ticketlock_unlock(&pkt_dpdk->tx_lock[index]); - if (odp_unlikely(tx_pkts == 0 && __odp_errno != 0)) return -1;