From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0081.outbound.protection.outlook.com [104.47.0.81]) by dpdk.org (Postfix) with ESMTP id 942C22C6A for ; Sun, 6 May 2018 08:06:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=05qNINRk3A43r2oHRfR7uQMw5LfQUeXN5wv2ZAaqxno=; b=bJKVLIe7WgG55Wjzw/I7g68cGYu4TIj8GP2o4RrDKAyUejPseLFNNmXDaiUwDCln3KdwujXZ3T367T+eSP2VOW630uH/Hjl8xYMdgFwnT0ZjqPO/TvCwPUbmgUDdudL5mkgl9FfKa9k/VrxpQozbRxJ5Vze6uezSiAVSsL+t/n8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=shahafs@mellanox.com; Received: from mellanox.com (141.226.120.58) by AM6PR05MB4422.eurprd05.prod.outlook.com (2603:10a6:209:43::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.16; Sun, 6 May 2018 06:06:43 +0000 From: Shahaf Shuler To: bluca@debian.org Cc: stable@dpdk.org, nelio.laranjeiro@6wind.com, yskoh@mellanox.com, adrien.mazarguil@6wind.com Date: Sun, 6 May 2018 09:05:41 +0300 Message-Id: X-Mailer: git-send-email 2.12.0 MIME-Version: 1.0 In-Reply-To: References: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Originating-IP: [141.226.120.58] X-ClientProxiedBy: LO2P265CA0008.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:62::20) To AM6PR05MB4422.eurprd05.prod.outlook.com (2603:10a6:209:43::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM6PR05MB4422; X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4422; 3:/2iQ9uXGePvzZ3d3OXqCC0i4maL2xhoexXvAUCNDu3xG7LkDuWQnNx168alhTiDLnszNCDl61rR9/VjAiT9LN+940mh3aVdXiCFQ8FtDDHUo5lZJSJbec+RDJepNVVD80bPLDwHxjXAidVT6GCWAPBQ0GZlY07QhJkg5z5gEfj/ncdjbFxelK18goOR8b9Qa4uhhttp0dOs/3Hm4Y/hnS2gd1FGAeADojvCjIVStxc4ShBhSQdnUlAAExt5RpqqV; 25:yS7ZWLHtER/sAOanD+ucqY70uf834traiybR8PLbHcxIdrpd6SOlG+bXuDtgDXZL+h9KarM0mjBRRBB9yAXTsN8SJ0uUIloEEeFW+JixVXCeH06XlnAtxppY22F5GkFduXcted9kb5Dy9x05RJcwlib2OQdxRBxN3XBk/o2UlLxTMjMV10EAZMOabPKyL3vAJwPA+VVGLd5+6/JaZdLCa0S4BEat9xMlJ/fPLo8K6lrhpplNO6MGdSTRsi1wTflpwAL8PTf7k9jfhLD3NEFN6VaLMIp69F8hVkSAXhUTlgchDFqfv5n+so2jW2Ze3+RxwXfMHzhfw6hIgytSGRWv2w==; 31:AcOlKFiWR+j2EeSLzTc+f9ztXNQZsZ7ibKhPu198lnw6p2Pa5qOwniDW4Qbvf4/bXJT7uWH0++WeEuzeqZjOBmDewhJrIc+iQlCCNWZW4UtgZcxziQvvVwotRp/8Ew03Z3/0EITI4AP6eHCv6MNs6UbIJPF+9PA/pY2N2+SgB33G7FwN1SRtBD5E9v9x1N/e2a8QLCTLEPcJGSWYwgh0WJffwMBZFTBdiDk4+rX4VJw= X-MS-TrafficTypeDiagnostic: AM6PR05MB4422: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4422; 20:7J6KTQuWrsvOCXAr2KJA96MCeSsV7vL57NJQo+Y8rxBxfB0Oh3v0j9gzDnJnuOGxxCJVBYmvJ1nWW0UUpTkrLVzx5Ir3wv5Cc5/nbH1WTKpLdv9jiY1+JbxpxRHA140FTXZXWmxeupXC6XnT9k9QONL8zchKDNzeohwXsX1ljuFs7C2nCQL+NS0A5wSeTeT2FDgJf/PVECE34Feb8eSMDKnZ1qrhC0Y23B2ypnZzRFTzVf9kcUh0wU+vz0ap5WwmptGacV+iH0Wd6RG163PaLbCynQm7qTc4o0UzK+NUQumacOfmqeO8GHYp6Zs80CVSSJaYeQJTQISpZsOjFyr5ksFpBBsUge0hPEA6S6YnVzZYHDHAcRKWbIfAJCR4uWMzLUgYsMyvjtzq5Fii8ZYyhowkVLnz9tfa/eWz/otXbvyda2A/XvUI8zE1ZpRLC1V6VeP0rrBQSFYsopZqlOUCcD9dRc7Gmcaly0yIe72uB1ZMXrcEziydtxLPTBuU5Q1+; 4:Zt/DD8ZpUrzY9HtMCeVjLkydL1QCLDvKouI9Lh7MrhcjpqzDpKHm5j6O7PfzzKGfaMoUTdbOBdgB6sLZ82+1n1MZ4nUXqX5LDjiq19HwtydtLQ5rlww9zBJJsM5ZVjWFUwXuvAG+PZI+RtYhDImq2LxuFc2Yl33NLXy/jj3dsfLsIQZH9DDGW1gbmhGMyYvKtjFgdhUXPn8T1ejCXgbLFNURtcPMBU1jZ5c0VnRe/BvEh5A5bWKDUJEB1kC8OhQyildRTmFrfuybOLUvm+J/vw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231254)(944501410)(52105095)(93006095)(93001095)(6055026)(6041310)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:AM6PR05MB4422; BCL:0; PCL:0; RULEID:; SRVR:AM6PR05MB4422; X-Forefront-PRVS: 06640999CA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(376002)(39380400002)(396003)(346002)(39860400002)(189003)(199004)(105586002)(8676002)(8936002)(316002)(2351001)(53936002)(86362001)(575784001)(2361001)(6116002)(3846002)(106356001)(118296001)(66066001)(36756003)(47776003)(81156014)(55016002)(2906002)(2870700001)(50226002)(4326008)(68736007)(305945005)(7736002)(81166006)(50466002)(25786009)(486006)(5660300001)(476003)(2616005)(69596002)(16526019)(26005)(59450400001)(386003)(97736004)(956004)(186003)(478600001)(7696005)(52116002)(23676004)(6916009)(21086003)(446003)(11346002)(76176011)(309714004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4422; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtBTTZQUjA1TUI0NDIyOzIzOjlTWnBLY3BPbU1MUXIzdG1RY1dmbWo2VVY5?= =?utf-8?B?QmpWR2dGYWJKWTZGQlVHWm1kZTF2Zy9VdmxoVGRuOEVncmlJM2Z2UUUzQUJs?= =?utf-8?B?VWNQSnppTjFqcHNYeDlHY2xCbXJXM1NyTm9BSHdCamlUcU9ONzh0U0liSCtW?= =?utf-8?B?M2NYYjkzYTIrZWlyLzJKK0RhVUxzYXBxbGk2TTc2eFhDVHJxWTVDNEdHRlJG?= =?utf-8?B?TnBqd3Nvbk9Ga0wrNlVEQjU0akRzYWliWlVQWnFpOExXSlRkb0NoVElKb0JK?= =?utf-8?B?R0NXUGQ1b0Vvc05TcDQwWkN0ZkN6eXVzRExITm9RbVNPbzVXMGUzelVrNmZC?= =?utf-8?B?b0N3dzRZeDdrWVpLZGJUNzBNenE2ZEtXbllMN0g4bFRzZEdheEU4L2ZTZ0RL?= =?utf-8?B?ZnpXdWYwazRhWG5lQW90UFQ4VGVBaD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6cwqzOqTAQSKN257YfCGZx36Xe2gbhGo87x208TnQT3YOPmkD7pZTG6ZNqyIWRqBJdIBK3AwmlLt14lpDfqellCmFssggiC2FUSrRsF+XFb45ZS1qDkPtFBoT/yGMTmYYeXUq4Z2a6+U3hcFRlZFcx/TSoVbQWw6g==; 5:QlH4QjSuZXHiHe7vwYiwj0nrpCVwBUIoYmDwnNSKnDTGAsPVj9EE64RRoUwxyYcXVJQtFpAzw02Hblv55pPFyyfC8KA8sFfLSjbwa9VxU8B97djEFqxAgLv7BeMMYqbKmpzNzxkXcRvh1deq9ahOYLFINYlvxspZznmoBBR5JOY=; 24:lzeek+nW3E84ho52rb87OMiHE5sulgO59YbTILvJztwZ+UKELUcavIuSK2pdxIT4sjhKOiL892JrrVqsMZVS0GJd5zpAg8nfiK3AotZ/GDM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM6PR05MB4422; 7:HjsJIK4tgjWNNMb4yfc2CEJOjx32Jj8BlxkB5nWvZaQMa34Ytrl7eduRJS7D6pzaJ1iEu3469Y6mcNgykmJIuWfcFJpxvHoI6cIUubH90Lx5FXMJo6kjNZtRI0eZMAnJ3yIgDaR/YuA4CAtS8AVFO5U+uKh4GwlffB0ECiW1KZNod6kZIxFURxWgYO6n+kqUvXdBYh6ApI/8dMute7RGVLwNJaLHyX+IngTINhZXwCzMNwiVFKvV3PjTW2aNVCvP X-MS-Office365-Filtering-Correlation-Id: e3503397-737c-40d6-b79f-08d5b3178afe X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2018 06:06:43.4893 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3503397-737c-40d6-b79f-08d5b3178afe X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4422 Subject: [dpdk-stable] [PATCH 12/33] net/mlx5: remove control path locks 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: Sun, 06 May 2018 06:06:45 -0000 From: NĂ©lio Laranjeiro [ upstream commit 7b2423cd2e84c61d3052147cea7643d15d49d1e9 ] In priv struct only the memory region needs to be protected against concurrent access between the control plane and the data plane. Signed-off-by: Nelio Laranjeiro Acked-by: Adrien Mazarguil --- drivers/net/mlx5/mlx5.c | 2 -- drivers/net/mlx5/mlx5.h | 43 +------------------------- drivers/net/mlx5/mlx5_ethdev.c | 58 +++--------------------------------- drivers/net/mlx5/mlx5_flow.c | 18 +---------- drivers/net/mlx5/mlx5_mr.c | 4 +-- drivers/net/mlx5/mlx5_rss.c | 8 ----- drivers/net/mlx5/mlx5_rxq.c | 9 ------ drivers/net/mlx5/mlx5_stats.c | 15 +--------- drivers/net/mlx5/mlx5_trigger.c | 7 ----- drivers/net/mlx5/mlx5_txq.c | 5 ---- drivers/net/mlx5/mlx5_vlan.c | 6 ---- 11 files changed, 9 insertions(+), 166 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index cf0967a1d0..2fdec80efd 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -165,7 +165,6 @@ mlx5_dev_close(struct rte_eth_dev *dev) unsigned int i; int ret; - priv_lock(priv); DEBUG("%p: closing device \"%s\"", (void *)dev, ((priv->ctx != NULL) ? priv->ctx->device->name : "")); @@ -227,7 +226,6 @@ mlx5_dev_close(struct rte_eth_dev *dev) ret = priv_mr_verify(priv); if (ret) WARN("%p: some Memory Region still remain", (void *)priv); - priv_unlock(priv); memset(priv, 0, sizeof(*priv)); } diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index b65962df9e..8e021544ce 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -148,7 +148,7 @@ struct priv { LIST_HEAD(ind_tables, mlx5_ind_table_ibv) ind_tbls; uint32_t link_speed_capa; /* Link speed capabilities. */ struct mlx5_xstats_ctrl xstats_ctrl; /* Extended stats control. */ - rte_spinlock_t lock; /* Lock for control functions. */ + rte_spinlock_t mr_lock; /* MR Lock. */ int primary_socket; /* Unix socket for primary process. */ void *uar_base; /* Reserved address space for UAR mapping */ struct rte_intr_handle intr_handle_socket; /* Interrupt handler. */ @@ -157,47 +157,6 @@ struct priv { /* Context for Verbs allocator. */ }; -/** - * Lock private structure to protect it from concurrent access in the - * control path. - * - * @param priv - * Pointer to private structure. - */ -static inline void -priv_lock(struct priv *priv) -{ - rte_spinlock_lock(&priv->lock); -} - -/** - * Try to lock private structure to protect it from concurrent access in the - * control path. - * - * @param priv - * Pointer to private structure. - * - * @return - * 1 if the lock is successfully taken; 0 otherwise. - */ -static inline int -priv_trylock(struct priv *priv) -{ - return rte_spinlock_trylock(&priv->lock); -} - -/** - * Unlock private structure. - * - * @param priv - * Pointer to private structure. - */ -static inline void -priv_unlock(struct priv *priv) -{ - rte_spinlock_unlock(&priv->lock); -} - /* mlx5.c */ int mlx5_getenv_int(const char *); diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 5c43755d05..f0defc69d1 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -269,18 +269,16 @@ priv_set_flags(struct priv *priv, unsigned int keep, unsigned int flags) } /** - * Ethernet device configuration. - * - * Prepare the driver for a given number of TX and RX queues. + * DPDK callback for Ethernet device configuration. * * @param dev * Pointer to Ethernet device structure. * * @return - * 0 on success, errno value on failure. + * 0 on success, negative errno value on failure. */ -static int -dev_configure(struct rte_eth_dev *dev) +int +mlx5_dev_configure(struct rte_eth_dev *dev) { struct priv *priv = dev->data->dev_private; unsigned int rxqs_n = dev->data->nb_rx_queues; @@ -362,28 +360,7 @@ dev_configure(struct rte_eth_dev *dev) j = 0; } return 0; -} - -/** - * DPDK callback for Ethernet device configuration. - * - * @param dev - * Pointer to Ethernet device structure. - * - * @return - * 0 on success, negative errno value on failure. - */ -int -mlx5_dev_configure(struct rte_eth_dev *dev) -{ - struct priv *priv = dev->data->dev_private; - int ret; - priv_lock(priv); - ret = dev_configure(dev); - assert(ret >= 0); - priv_unlock(priv); - return -ret; } /** @@ -403,7 +380,6 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) char ifname[IF_NAMESIZE]; info->pci_dev = RTE_ETH_DEV_TO_PCI(dev); - priv_lock(priv); /* FIXME: we should ask the device for these values. */ info->min_rx_bufsize = 32; info->max_rx_pktlen = 65536; @@ -431,7 +407,6 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->hash_key_size = priv->rss_conf.rss_key_len; info->speed_capa = priv->link_speed_capa; info->flow_type_rss_offloads = ~MLX5_RSS_HF_MASK; - priv_unlock(priv); } /** @@ -490,7 +465,6 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev) struct rte_eth_link dev_link; int link_speed = 0; - /* priv_lock() is not taken to allow concurrent calls. */ if (priv_ifreq(priv, SIOCGIFFLAGS, &ifr)) { WARN("ioctl(SIOCGIFFLAGS) failed: %s", strerror(errno)); return -1; @@ -756,9 +730,7 @@ mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete __rte_unused) struct priv *priv = dev->data->dev_private; int ret; - priv_lock(priv); ret = priv_link_update(priv, wait_to_complete); - priv_unlock(priv); return ret; } @@ -780,7 +752,6 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) uint16_t kern_mtu; int ret = 0; - priv_lock(priv); ret = priv_get_mtu(priv, &kern_mtu); if (ret) goto out; @@ -795,13 +766,11 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) priv->mtu = mtu; DEBUG("adapter port %u MTU set to %u", priv->port, mtu); } - priv_unlock(priv); return 0; out: ret = errno; WARN("cannot set port %u MTU to %u: %s", priv->port, mtu, strerror(ret)); - priv_unlock(priv); assert(ret >= 0); return -ret; } @@ -828,7 +797,6 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) int ret; ifr.ifr_data = (void *)ðpause; - priv_lock(priv); if (priv_ifreq(priv, SIOCETHTOOL, &ifr)) { ret = errno; WARN("ioctl(SIOCETHTOOL, ETHTOOL_GPAUSEPARAM)" @@ -847,7 +815,6 @@ mlx5_dev_get_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) fc_conf->mode = RTE_FC_NONE; ret = 0; out: - priv_unlock(priv); assert(ret >= 0); return -ret; } @@ -886,7 +853,6 @@ mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) ethpause.tx_pause = 1; else ethpause.tx_pause = 0; - priv_lock(priv); if (priv_ifreq(priv, SIOCETHTOOL, &ifr)) { ret = errno; WARN("ioctl(SIOCETHTOOL, ETHTOOL_SPAUSEPARAM)" @@ -896,7 +862,6 @@ mlx5_dev_set_flow_ctrl(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) } ret = 0; out: - priv_unlock(priv); assert(ret >= 0); return -ret; } @@ -1039,15 +1004,8 @@ mlx5_dev_link_status_handler(void *arg) struct priv *priv = dev->data->dev_private; int ret; - while (!priv_trylock(priv)) { - /* Alarm is being canceled. */ - if (priv->pending_alarm == 0) - return; - rte_pause(); - } priv->pending_alarm = 0; ret = priv_link_status_update(priv); - priv_unlock(priv); if (!ret) _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); } @@ -1067,9 +1025,7 @@ mlx5_dev_interrupt_handler(void *cb_arg) struct priv *priv = dev->data->dev_private; uint32_t events; - priv_lock(priv); events = priv_dev_status_handler(priv); - priv_unlock(priv); if (events & (1 << RTE_ETH_EVENT_INTR_LSC)) _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); if (events & (1 << RTE_ETH_EVENT_INTR_RMV)) @@ -1088,9 +1044,7 @@ mlx5_dev_handler_socket(void *cb_arg) struct rte_eth_dev *dev = cb_arg; struct priv *priv = dev->data->dev_private; - priv_lock(priv); priv_socket_handle(priv); - priv_unlock(priv); } /** @@ -1190,9 +1144,7 @@ mlx5_set_link_down(struct rte_eth_dev *dev) struct priv *priv = dev->data->dev_private; int err; - priv_lock(priv); err = priv_dev_set_link(priv, 0); - priv_unlock(priv); return err; } @@ -1211,9 +1163,7 @@ mlx5_set_link_up(struct rte_eth_dev *dev) struct priv *priv = dev->data->dev_private; int err; - priv_lock(priv); err = priv_dev_set_link(priv, 1); - priv_unlock(priv); return err; } diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index b8d6f2f18d..2af0ea9def 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1919,9 +1919,7 @@ mlx5_flow_validate(struct rte_eth_dev *dev, int ret; struct mlx5_flow_parse parser = { .create = 0, }; - priv_lock(priv); ret = priv_flow_convert(priv, attr, items, actions, error, &parser); - priv_unlock(priv); return ret; } @@ -1941,10 +1939,8 @@ mlx5_flow_create(struct rte_eth_dev *dev, struct priv *priv = dev->data->dev_private; struct rte_flow *flow; - priv_lock(priv); flow = priv_flow_create(priv, &priv->flows, attr, items, actions, error); - priv_unlock(priv); return flow; } @@ -2431,9 +2427,7 @@ mlx5_flow_destroy(struct rte_eth_dev *dev, { struct priv *priv = dev->data->dev_private; - priv_lock(priv); priv_flow_destroy(priv, &priv->flows, flow); - priv_unlock(priv); return 0; } @@ -2449,9 +2443,7 @@ mlx5_flow_flush(struct rte_eth_dev *dev, { struct priv *priv = dev->data->dev_private; - priv_lock(priv); priv_flow_flush(priv, &priv->flows); - priv_unlock(priv); return 0; } @@ -2509,16 +2501,14 @@ priv_flow_query_count(struct ibv_counter_set *cs, * @see rte_flow_ops */ int -mlx5_flow_query(struct rte_eth_dev *dev, +mlx5_flow_query(struct rte_eth_dev *dev __rte_unused, struct rte_flow *flow, enum rte_flow_action_type action __rte_unused, void *data, struct rte_flow_error *error) { - struct priv *priv = dev->data->dev_private; int res = EINVAL; - priv_lock(priv); if (flow->cs) { res = priv_flow_query_count(flow->cs, &flow->counter_stats, @@ -2530,7 +2520,6 @@ mlx5_flow_query(struct rte_eth_dev *dev, NULL, "no counter found for flow"); } - priv_unlock(priv); return -res; } #endif @@ -2548,13 +2537,11 @@ mlx5_flow_isolate(struct rte_eth_dev *dev, { struct priv *priv = dev->data->dev_private; - priv_lock(priv); if (dev->data->dev_started) { rte_flow_error_set(error, EBUSY, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "port must be stopped first"); - priv_unlock(priv); return -rte_errno; } priv->isolated = !!enable; @@ -2562,7 +2549,6 @@ mlx5_flow_isolate(struct rte_eth_dev *dev, priv->dev->dev_ops = &mlx5_dev_ops_isolate; else priv->dev->dev_ops = &mlx5_dev_ops; - priv_unlock(priv); return 0; } @@ -3044,9 +3030,7 @@ mlx5_dev_filter_ctrl(struct rte_eth_dev *dev, *(const void **)arg = &mlx5_flow_ops; return 0; case RTE_ETH_FILTER_FDIR: - priv_lock(priv); ret = priv_fdir_ctrl_func(priv, filter_op, arg); - priv_unlock(priv); break; default: ERROR("%p: filter type (%d) not supported", diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c index 6624d0ffa6..3b7b6d1401 100644 --- a/drivers/net/mlx5/mlx5_mr.c +++ b/drivers/net/mlx5/mlx5_mr.c @@ -164,9 +164,9 @@ mlx5_txq_mp2mr_reg(struct mlx5_txq_data *txq, struct rte_mempool *mp, container_of(txq, struct mlx5_txq_ctrl, txq); struct mlx5_mr *mr; - priv_lock(txq_ctrl->priv); + rte_spinlock_lock(&txq_ctrl->priv->mr_lock); mr = priv_txq_mp2mr_reg(txq_ctrl->priv, txq, mp, idx); - priv_unlock(txq_ctrl->priv); + rte_spinlock_unlock(&txq_ctrl->priv->mr_lock); return mr; } diff --git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c index 8f5c8beff2..4b88215fba 100644 --- a/drivers/net/mlx5/mlx5_rss.c +++ b/drivers/net/mlx5/mlx5_rss.c @@ -44,7 +44,6 @@ mlx5_rss_hash_update(struct rte_eth_dev *dev, struct priv *priv = dev->data->dev_private; int ret = 0; - priv_lock(priv); if (rss_conf->rss_hf & MLX5_RSS_HF_MASK) { ret = -EINVAL; goto out; @@ -62,7 +61,6 @@ mlx5_rss_hash_update(struct rte_eth_dev *dev, } priv->rss_conf.rss_hf = rss_conf->rss_hf; out: - priv_unlock(priv); return ret; } @@ -85,7 +83,6 @@ mlx5_rss_hash_conf_get(struct rte_eth_dev *dev, if (!rss_conf) return -EINVAL; - priv_lock(priv); if (rss_conf->rss_key && (rss_conf->rss_key_len >= priv->rss_conf.rss_key_len)) { memcpy(rss_conf->rss_key, priv->rss_conf.rss_key, @@ -93,7 +90,6 @@ mlx5_rss_hash_conf_get(struct rte_eth_dev *dev, } rss_conf->rss_key_len = priv->rss_conf.rss_key_len; rss_conf->rss_hf = priv->rss_conf.rss_hf; - priv_unlock(priv); return 0; } @@ -222,9 +218,7 @@ mlx5_dev_rss_reta_query(struct rte_eth_dev *dev, int ret; struct priv *priv = dev->data->dev_private; - priv_lock(priv); ret = priv_dev_rss_reta_query(priv, reta_conf, reta_size); - priv_unlock(priv); return -ret; } @@ -249,9 +243,7 @@ mlx5_dev_rss_reta_update(struct rte_eth_dev *dev, int ret; struct priv *priv = dev->data->dev_private; - priv_lock(priv); ret = priv_dev_rss_reta_update(priv, reta_conf, reta_size); - priv_unlock(priv); if (dev->data->dev_started) { mlx5_dev_stop(dev); mlx5_dev_start(dev); diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 320a12be9f..de3335cb92 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -286,7 +286,6 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, container_of(rxq, struct mlx5_rxq_ctrl, rxq); int ret = 0; - priv_lock(priv); if (!rte_is_power_of_2(desc)) { desc = 1 << log2above(desc); WARN("%p: increased number of descriptors in RX queue %u" @@ -298,7 +297,6 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, if (idx >= priv->rxqs_n) { ERROR("%p: queue index out of range (%u >= %u)", (void *)dev, idx, priv->rxqs_n); - priv_unlock(priv); return -EOVERFLOW; } if (!priv_is_rx_queue_offloads_allowed(priv, conf->offloads)) { @@ -329,7 +327,6 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, (void *)dev, (void *)rxq_ctrl); (*priv->rxqs)[idx] = &rxq_ctrl->rxq; out: - priv_unlock(priv); return -ret; } @@ -350,12 +347,10 @@ mlx5_rx_queue_release(void *dpdk_rxq) return; rxq_ctrl = container_of(rxq, struct mlx5_rxq_ctrl, rxq); priv = rxq_ctrl->priv; - priv_lock(priv); if (!mlx5_priv_rxq_releasable(priv, rxq_ctrl->rxq.stats.idx)) rte_panic("Rx queue %p is still used by a flow and cannot be" " removed\n", (void *)rxq_ctrl); mlx5_priv_rxq_release(priv, rxq_ctrl->rxq.stats.idx); - priv_unlock(priv); } /** @@ -512,7 +507,6 @@ mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id) struct mlx5_rxq_ctrl *rxq_ctrl; int ret = 0; - priv_lock(priv); rxq_data = (*priv->rxqs)[rx_queue_id]; if (!rxq_data) { ret = EINVAL; @@ -531,7 +525,6 @@ mlx5_rx_intr_enable(struct rte_eth_dev *dev, uint16_t rx_queue_id) mlx5_priv_rxq_ibv_release(priv, rxq_ibv); } exit: - priv_unlock(priv); if (ret) WARN("unable to arm interrupt on rx queue %d", rx_queue_id); return -ret; @@ -559,7 +552,6 @@ mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id) void *ev_ctx; int ret = 0; - priv_lock(priv); rxq_data = (*priv->rxqs)[rx_queue_id]; if (!rxq_data) { ret = EINVAL; @@ -583,7 +575,6 @@ mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id) exit: if (rxq_ibv) mlx5_priv_rxq_ibv_release(priv, rxq_ibv); - priv_unlock(priv); if (ret) WARN("unable to disable interrupt on rx queue %d", rx_queue_id); diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c index 167e405480..39be1865a8 100644 --- a/drivers/net/mlx5/mlx5_stats.c +++ b/drivers/net/mlx5/mlx5_stats.c @@ -328,7 +328,6 @@ mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) unsigned int i; unsigned int idx; - priv_lock(priv); /* Add software counters. */ for (i = 0; (i != priv->rxqs_n); ++i) { struct mlx5_rxq_data *rxq = (*priv->rxqs)[i]; @@ -374,7 +373,6 @@ mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) /* FIXME: retrieve and add hardware counters. */ #endif *stats = tmp; - priv_unlock(priv); return 0; } @@ -391,7 +389,6 @@ mlx5_stats_reset(struct rte_eth_dev *dev) unsigned int i; unsigned int idx; - priv_lock(priv); for (i = 0; (i != priv->rxqs_n); ++i) { if ((*priv->rxqs)[i] == NULL) continue; @@ -409,7 +406,6 @@ mlx5_stats_reset(struct rte_eth_dev *dev) #ifndef MLX5_PMD_SOFT_COUNTERS /* FIXME: reset hardware counters. */ #endif - priv_unlock(priv); } /** @@ -436,16 +432,13 @@ mlx5_xstats_get(struct rte_eth_dev *dev, struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl; int stats_n; - priv_lock(priv); stats_n = priv_ethtool_get_stats_n(priv); if (stats_n < 0) { - priv_unlock(priv); return -1; } if (xstats_ctrl->stats_n != stats_n) priv_xstats_init(priv); ret = priv_xstats_get(priv, stats); - priv_unlock(priv); } return ret; } @@ -463,15 +456,12 @@ mlx5_xstats_reset(struct rte_eth_dev *dev) struct mlx5_xstats_ctrl *xstats_ctrl = &priv->xstats_ctrl; int stats_n; - priv_lock(priv); stats_n = priv_ethtool_get_stats_n(priv); if (stats_n < 0) - goto unlock; + return; if (xstats_ctrl->stats_n != stats_n) priv_xstats_init(priv); priv_xstats_reset(priv); -unlock: - priv_unlock(priv); } /** @@ -491,18 +481,15 @@ int mlx5_xstats_get_names(struct rte_eth_dev *dev __rte_unused, struct rte_eth_xstat_name *xstats_names, unsigned int n) { - struct priv *priv = dev->data->dev_private; unsigned int i; if (n >= xstats_n && xstats_names) { - priv_lock(priv); for (i = 0; i != xstats_n; ++i) { strncpy(xstats_names[i].name, mlx5_counters_init[i].dpdk_name, RTE_ETH_XSTATS_NAME_SIZE); xstats_names[i].name[RTE_ETH_XSTATS_NAME_SIZE - 1] = 0; } - priv_unlock(priv); } return xstats_n; } diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index b147fb4f8b..3ce93910d0 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -142,7 +142,6 @@ mlx5_dev_start(struct rte_eth_dev *dev) int err; dev->data->dev_started = 1; - priv_lock(priv); err = priv_flow_create_drop_queue(priv); if (err) { ERROR("%p: Drop queue allocation failed: %s", @@ -180,7 +179,6 @@ mlx5_dev_start(struct rte_eth_dev *dev) goto error; } priv_dev_interrupt_handler_install(priv, dev); - priv_unlock(priv); return 0; error: /* Rollback. */ @@ -192,7 +190,6 @@ mlx5_dev_start(struct rte_eth_dev *dev) priv_txq_stop(priv); priv_rxq_stop(priv); priv_flow_delete_drop_queue(priv); - priv_unlock(priv); return err; } @@ -210,7 +207,6 @@ mlx5_dev_stop(struct rte_eth_dev *dev) struct priv *priv = dev->data->dev_private; struct mlx5_mr *mr; - priv_lock(priv); dev->data->dev_started = 0; /* Prevent crashes when queues are still in use. */ dev->rx_pkt_burst = removed_rx_burst; @@ -227,7 +223,6 @@ mlx5_dev_stop(struct rte_eth_dev *dev) for (mr = LIST_FIRST(&priv->mr); mr; mr = LIST_FIRST(&priv->mr)) priv_mr_release(priv, mr); priv_flow_delete_drop_queue(priv); - priv_unlock(priv); } /** @@ -412,8 +407,6 @@ mlx5_traffic_restart(struct rte_eth_dev *dev) { struct priv *priv = dev->data->dev_private; - priv_lock(priv); priv_dev_traffic_restart(priv, dev); - priv_unlock(priv); return 0; } diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index 9be7078405..47ee959901 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -172,7 +172,6 @@ mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, container_of(txq, struct mlx5_txq_ctrl, txq); int ret = 0; - priv_lock(priv); /* * Don't verify port offloads for application which * use the old API. @@ -205,7 +204,6 @@ mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, if (idx >= priv->txqs_n) { ERROR("%p: queue index out of range (%u >= %u)", (void *)dev, idx, priv->txqs_n); - priv_unlock(priv); return -EOVERFLOW; } if (!mlx5_priv_txq_releasable(priv, idx)) { @@ -226,7 +224,6 @@ mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, (void *)dev, (void *)txq_ctrl); (*priv->txqs)[idx] = &txq_ctrl->txq; out: - priv_unlock(priv); return -ret; } @@ -248,7 +245,6 @@ mlx5_tx_queue_release(void *dpdk_txq) return; txq_ctrl = container_of(txq, struct mlx5_txq_ctrl, txq); priv = txq_ctrl->priv; - priv_lock(priv); for (i = 0; (i != priv->txqs_n); ++i) if ((*priv->txqs)[i] == txq) { DEBUG("%p: removing TX queue %p from list", @@ -256,7 +252,6 @@ mlx5_tx_queue_release(void *dpdk_txq) mlx5_priv_txq_release(priv, i); break; } - priv_unlock(priv); } diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c index 85ed546cbd..184ae2f4e6 100644 --- a/drivers/net/mlx5/mlx5_vlan.c +++ b/drivers/net/mlx5/mlx5_vlan.c @@ -46,7 +46,6 @@ mlx5_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) unsigned int i; int ret = 0; - priv_lock(priv); DEBUG("%p: %s VLAN filter ID %" PRIu16, (void *)dev, (on ? "enable" : "disable"), vlan_id); assert(priv->vlan_filter_n <= RTE_DIM(priv->vlan_filter)); @@ -82,7 +81,6 @@ mlx5_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) if (dev->data->dev_started) priv_dev_traffic_restart(priv, dev); out: - priv_unlock(priv); return ret; } @@ -155,9 +153,7 @@ mlx5_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on) ERROR("VLAN stripping, invalid queue number %d", queue); return; } - priv_lock(priv); priv_vlan_strip_queue_set(priv, queue, on); - priv_unlock(priv); } /** @@ -183,10 +179,8 @@ mlx5_vlan_offload_set(struct rte_eth_dev *dev, int mask) return 0; } /* Run on every RX queue and set/reset VLAN stripping. */ - priv_lock(priv); for (i = 0; (i != priv->rxqs_n); i++) priv_vlan_strip_queue_set(priv, i, hw_vlan_strip); - priv_unlock(priv); } return 0; } -- 2.12.0