[v5,0/2] ethdev: make rte_flow API thread safe
Message ID | 1602724067-390536-1-git-send-email-suanmingm@nvidia.com (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5E4F7A04DB; Thu, 15 Oct 2020 03:07:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A7D211DB4F; Thu, 15 Oct 2020 03:07:57 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 6242D1DB4D for <dev@dpdk.org>; Thu, 15 Oct 2020 03:07:55 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from suanmingm@nvidia.com) with SMTP; 15 Oct 2020 04:07:53 +0300 Received: from nvidia.com (mtbc-r640-04.mtbc.labs.mlnx [10.75.70.9]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 09F17qNr027350; Thu, 15 Oct 2020 04:07:52 +0300 From: Suanming Mou <suanmingm@nvidia.com> To: Cc: dev@dpdk.org, thomas@monjalon.net Date: Thu, 15 Oct 2020 09:07:45 +0800 Message-Id: <1602724067-390536-1-git-send-email-suanmingm@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601194817-208834-1-git-send-email-suanmingm@nvidia.com> References: <1601194817-208834-1-git-send-email-suanmingm@nvidia.com> Subject: [dpdk-dev] [PATCH v5 0/2] ethdev: make rte_flow API thread safe X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Message
Suanming Mou
Oct. 15, 2020, 1:07 a.m. UTC
Currently, the rte_flow functions are not defined as thread safe. DPDK applications either call the functions in single thread or add locks around the functions for the critical section. For PMDs support the flow operations thread safe natively, the redundant protection in application hurts the performance of the rte_flow operation functions. And the restriction of thread safe not guaranteed for the rte_flow functions also limits the applications' expectation. This feature is going to change the rte_flow functions to be thread safe. As different PMDs have different flow operations, some may support thread safe already and others may not. For PMDs don't support flow thread safe operation, a new lock is defined in ethdev in order to protects thread unsafe PMDs from rte_flow level. A new RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE device flag is added to determine whether the PMD supports thread safe flow operation or not. For PMDs support thread safe flow operations, set the RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE flag, rte_flow level functions will skip the thread safe helper lock for these PMDs. Again the rte_flow level thread safe lock only works when PMD operation functions are not thread safe. For the PMDs which don't want the default mutex lock, just set the flag in the PMD, and add the prefer type of lock in the PMD. Then the default mutex lock is easily replaced by the PMD level lock. The change has no effect on the current DPDK applications. No change is required for the current DPDK applications. For the standard posix pthread_mutex, if no lock contention with the added rte_flow level mutex, the mutex only does the atomic increasing in pthread_mutex_lock() and decreasing in pthread_mutex_unlock(). No futex() syscall will be involved. Suanming Mou (2): eal/windows: add pthread mutex lock ethdev: make rte_flow API thread safe --- v5: - Update ethdev patch commnets, doc and release notes. - Update fts_mutex -> flow_ops_mutex. - Remove PTHREAD_MUTEX_INITIALIZER for windows added in v4. v4: - Add PTHREAD_MUTEX_INITIALIZER for windows pthread mutex. - Change RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE to 0x0001, since RTE_ETH_DEV_CLOSE_REMOVE has been removed. - Update small comments. - Update release notes. v3: - Update flow_lock/unlock -> fts_enter/exit. v2: - Using critical section for windows pthread mutex. - Update ethdev commnets. --- doc/guides/prog_guide/rte_flow.rst | 12 +++-- doc/guides/rel_notes/release_20_11.rst | 6 +++ lib/librte_eal/windows/include/pthread.h | 33 +++++++++++++ lib/librte_ethdev/rte_ethdev.c | 2 + lib/librte_ethdev/rte_ethdev.h | 2 + lib/librte_ethdev/rte_ethdev_core.h | 4 ++ lib/librte_ethdev/rte_flow.c | 84 ++++++++++++++++++++++++-------- 7 files changed, 120 insertions(+), 23 deletions(-)