From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5DDA8A054F; Mon, 15 Mar 2021 20:27:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCA9F2427A1; Mon, 15 Mar 2021 20:27:34 +0100 (CET) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by mails.dpdk.org (Postfix) with ESMTP id 3B68D24279D for ; Mon, 15 Mar 2021 20:27:33 +0100 (CET) Received: by mail-pf1-f181.google.com with SMTP id r16so5909357pfh.10 for ; Mon, 15 Mar 2021 12:27:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XV5Pazj1IPVF0rwd8TK+lpTN0/1lr1X4B9yV7Kgxeak=; b=Bp+amvqn12L/GnydYPnzBpMzcabc5VTC7WsE0BdSIMpUF0jOwTfRgM51Gcc+ViU5lJ LlSRCzmAbUOy7MAzHHDjgmDw+b5S3Md96h4Y36VwxBl8D+2e4J9CCT5upjYqz4PjhIZf ov0cfozw+sVv8FjyBrSHTp6xGQVIzdpqY3oHBwv9+KjBzfZBgykAb/rVhf93S9QFnqXM YNfCbFmsjcVcgzJglUYxOXetmpWw92w+Br+gwWAQD0zsE0caF0b2HMevitkEn4K/5Oi+ +EdQKGnqC9gnVawW6/UospNlObJ04xFPXzR1fTQiCimc3VXwDf+9sqlKMeJV7g3wF/lb HH2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XV5Pazj1IPVF0rwd8TK+lpTN0/1lr1X4B9yV7Kgxeak=; b=jhvoGWzoGwqkIxqm6RxEuNO9P6n1ICI/Cucee/tsNNIEoBmjZ1jPKOlwxgUIFyeTfY Zicpne82FZfVdLx1Tp1YeWOGTqZm0VCNKaIe7/19GEdfS59dSIcA9fDk6pjz6aBU0S8A bhuXp/HT6Y7WobLIT3iM1W1fTijayCzf7sOCYsiukdWvpN+4A4W1ZbY2mHCDhROgzrI4 Mm0AGntH4HGwS+UwYnmlfDElozZ8KsGunX/B1TaRsue6wBTxj8MqEGNGiOF/I6Wq/99U 7jege40xqKysXhVCb5vWDRl+m9Zrxnca3sU7iqhywXGzHjY3UwpcVjs+Hk1EmfmkewIx HjAQ== X-Gm-Message-State: AOAM533fHlqvx3yg9cNEVuzxGzuXBbMSGT44U8U2nl/H9sujOUxrXsaS E/bIPDPIDZKBIu3NH/YYh3j2KzWeYNz+Mg== X-Google-Smtp-Source: ABdhPJzk08kqQ1lM6/8Wx6DPMyxsXa+FYm4qmFTrjMaSClfQSczVhWLEjCXN0FP2/tGZJiY3QBsOIA== X-Received: by 2002:a65:538f:: with SMTP id x15mr557465pgq.429.1615836452058; Mon, 15 Mar 2021 12:27:32 -0700 (PDT) Received: from hermes.local (76-14-218-44.or.wavecable.com. [76.14.218.44]) by smtp.gmail.com with ESMTPSA id v26sm13729202pff.195.2021.03.15.12.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 12:27:31 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , suanmingm@nvidia.com Date: Mon, 15 Mar 2021 12:27:21 -0700 Message-Id: <20210315192722.35490-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315192722.35490-1-stephen@networkplumber.org> References: <20210315192722.35490-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/2] ethdev: make flow API primary/secondary process safe X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Posix mutex are not by default safe for protecting for usage from multiple processes. The flow ops mutex could be used by both primary and secondary processes. Bugzilla ID: 662 Signed-off-by: Stephen Hemminger Fixes: 80d1a9aff7f6 ("ethdev: make flow API thread safe") Cc: suanmingm@nvidia.com --- lib/librte_ethdev/rte_ethdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 6f514c388b4e..d1024df408a5 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -470,6 +470,7 @@ rte_eth_dev_allocate(const char *name) { uint16_t port_id; struct rte_eth_dev *eth_dev = NULL; + pthread_mutexattr_t attr; size_t name_len; name_len = strnlen(name, RTE_ETH_NAME_MAX_LEN); @@ -506,7 +507,10 @@ rte_eth_dev_allocate(const char *name) strlcpy(eth_dev->data->name, name, sizeof(eth_dev->data->name)); eth_dev->data->port_id = port_id; eth_dev->data->mtu = RTE_ETHER_MTU; - pthread_mutex_init(ð_dev->data->flow_ops_mutex, NULL); + + pthread_mutexattr_init(&attr); + pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); + pthread_mutex_init(ð_dev->data->flow_ops_mutex, &attr); unlock: rte_spinlock_unlock(ð_dev_shared_data->ownership_lock); -- 2.30.2