From patchwork Fri Mar 7 15:57:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Fomichev X-Patchwork-Id: 14006702 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90F6F21D3E8; Fri, 7 Mar 2025 15:57:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741363050; cv=none; b=Fb3zA6CGmeIS+66ou3e4TNNBC+q+r66zSSVqJT4edR62Fvr4Ct+EcTP7zqDK9UZjwqw34vBWX94jfXfNP0JqvBelyK+XzddE/IUrqiUnMJuljgV8JifxH+4O7+6j761sJMJBCdDJbAyGuvAJoubcD0BEllAiWMCyeVwvV8mRBz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741363050; c=relaxed/simple; bh=qju+Hmli1ujUwi/eHfGIMx2HJZ38f7cehV6nsoGzrPo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kNzmvLqzQMeTvA0K34J6a1ZGQ6362SzQ7nvNAe4TYULDvlN1tpXqOwmTax8lmDbKsJ2Z8OdITB83vybNYnnD9WsJf9U62fXhdhuue/ZAZOBd0YIL1wIWte6KDhsLp1V6hTHCydy4Irs8CnUeOKRTMRRKdPAB+lThwkw9Qc3IUHQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fomichev.me; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fomichev.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-22359001f1aso51236105ad.3; Fri, 07 Mar 2025 07:57:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741363047; x=1741967847; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wVxQV/o7jQOh5fqVSpMsD4HSovMAgVf5MADEYdzA/sg=; b=lggxoZPQKIf6nm2fsSVyOChnMiOXhYjKGP1BoJi3RVGFOrqqf9ev8lO7epNbgZjjv3 k8CeHId2Ve+Wo/CDcpB44AaHX3eiaKWmhgi9nuYlSsS4DLYIrsGVRAlAk2OKBkN5bFLa dO6tWg+vV3o+65DzzBhpoRDfmHm8ZQxSj09JDWWYid9KyETr/oZeq3ahb0hSIbgJgDdj IjuDDJmFt/1Pc9xcIIO93YbmZCLKvbbZa/g7zvVQvrCMqDBqG1fbWDB11CknJ9IkJ/Cy s9TgYbL/9xOTCGnBAhXMaxbpfkCnmfZ0hdbi4cTZiyC4nY1GUAw79Xx90NhLCkYz4Up5 HdBg== X-Forwarded-Encrypted: i=1; AJvYcCXEo6TJVmFEIKO+XMv7MIVxS57C51k33L1dU1CHesy2y52avdvphze8kNG7Vbj+gpW+Yoy75Mz988JL8RI=@vger.kernel.org X-Gm-Message-State: AOJu0YwQkKJBC7eOoJIJCJlk1mPE2ojGFpJ2oebzFv8OvZzp0n9FMmLT 7wIyNV+1f5WgykrPUIo+MSHjZrzzMSFH+WnKu4PZZgeyQ6sGXDGe4gCf X-Gm-Gg: ASbGncs0H0y8UIgSDIVhhlXEVLi4BsN9wmFBAbhb144PHH5JAuXDgqNbgna9ZCEnOp2 ICd0Gkbm+kwDCrd9iA2k71xcoKILqVuAwn9l5HP3aqEjgag5u0YpNY2qbZCgCc0K3FIL7UkS3bX pdc3x+Dq2rhTnsZiSFRdG1fJU9rVXIMnDY/lDWTokEsWhVFLBYDJwY3VYnb5Kpkh+lajA2X8ATI kOP2/bMxCfAkfFY0zxHM4/HVSf9DE/bFzLI1SPPvIvsFKzdVPqgwMkT0YuIlznbD/yoAKxshhc2 lgJlWTgARWUQBTiaoKppzs4xdV7aFwy+rzR6LR3geaCi X-Google-Smtp-Source: AGHT+IEuQhykDNqkZGL2g86S4EFJk8gdinVKZb1LKs3IA6FYGr29hXd6nnPoQT+BI7iTYA8Lwi9Veg== X-Received: by 2002:a05:6a00:b51:b0:736:6043:69f9 with SMTP id d2e1a72fcca58-736aaadf584mr5762887b3a.19.1741363047536; Fri, 07 Mar 2025 07:57:27 -0800 (PST) Received: from localhost ([2601:646:9e00:f56e:2844:3d8f:bf3e:12cc]) by smtp.gmail.com with UTF8SMTPSA id d2e1a72fcca58-73698538829sm3505998b3a.174.2025.03.07.07.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Mar 2025 07:57:27 -0800 (PST) From: Stanislav Fomichev To: netdev@vger.kernel.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, horms@kernel.org, donald.hunter@gmail.com, michael.chan@broadcom.com, pavan.chebbi@broadcom.com, andrew+netdev@lunn.ch, jdamato@fastly.com, sdf@fomichev.me, xuanzhuo@linux.alibaba.com, almasrymina@google.com, asml.silence@gmail.com, dw@davidwei.uk Subject: [PATCH net-next v1 1/4] net: create netdev_nl_sock to wrap bindings list Date: Fri, 7 Mar 2025 07:57:22 -0800 Message-ID: <20250307155725.219009-2-sdf@fomichev.me> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307155725.219009-1-sdf@fomichev.me> References: <20250307155725.219009-1-sdf@fomichev.me> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org No functional changes. Next patches will add more granular locking to netdev_nl_sock. Cc: Mina Almasry Signed-off-by: Stanislav Fomichev --- Documentation/netlink/specs/netdev.yaml | 4 ++-- include/net/netdev_netlink.h | 11 +++++++++++ net/core/netdev-genl-gen.c | 4 ++-- net/core/netdev-genl-gen.h | 6 +++--- net/core/netdev-genl.c | 19 +++++++++---------- 5 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 include/net/netdev_netlink.h diff --git a/Documentation/netlink/specs/netdev.yaml b/Documentation/netlink/specs/netdev.yaml index 36f1152bfac3..f5e0750ab71d 100644 --- a/Documentation/netlink/specs/netdev.yaml +++ b/Documentation/netlink/specs/netdev.yaml @@ -745,8 +745,8 @@ name: netdev - irq-suspend-timeout kernel-family: - headers: [ "linux/list.h"] - sock-priv: struct list_head + headers: [ "net/netdev_netlink.h"] + sock-priv: struct netdev_nl_sock mcast-groups: list: diff --git a/include/net/netdev_netlink.h b/include/net/netdev_netlink.h new file mode 100644 index 000000000000..1599573d35c9 --- /dev/null +++ b/include/net/netdev_netlink.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __NET_NETDEV_NETLINK_H +#define __NET_NETDEV_NETLINK_H + +#include + +struct netdev_nl_sock { + struct list_head bindings; +}; + +#endif /* __NET_NETDEV_NETLINK_H */ diff --git a/net/core/netdev-genl-gen.c b/net/core/netdev-genl-gen.c index 996ac6a449eb..739f7b6506a6 100644 --- a/net/core/netdev-genl-gen.c +++ b/net/core/netdev-genl-gen.c @@ -9,7 +9,7 @@ #include "netdev-genl-gen.h" #include -#include +#include /* Integer value ranges */ static const struct netlink_range_validation netdev_a_page_pool_id_range = { @@ -217,7 +217,7 @@ struct genl_family netdev_nl_family __ro_after_init = { .n_split_ops = ARRAY_SIZE(netdev_nl_ops), .mcgrps = netdev_nl_mcgrps, .n_mcgrps = ARRAY_SIZE(netdev_nl_mcgrps), - .sock_priv_size = sizeof(struct list_head), + .sock_priv_size = sizeof(struct netdev_nl_sock), .sock_priv_init = __netdev_nl_sock_priv_init, .sock_priv_destroy = __netdev_nl_sock_priv_destroy, }; diff --git a/net/core/netdev-genl-gen.h b/net/core/netdev-genl-gen.h index e09dd7539ff2..17d39fd64c94 100644 --- a/net/core/netdev-genl-gen.h +++ b/net/core/netdev-genl-gen.h @@ -10,7 +10,7 @@ #include #include -#include +#include /* Common nested types */ extern const struct nla_policy netdev_page_pool_info_nl_policy[NETDEV_A_PAGE_POOL_IFINDEX + 1]; @@ -42,7 +42,7 @@ enum { extern struct genl_family netdev_nl_family; -void netdev_nl_sock_priv_init(struct list_head *priv); -void netdev_nl_sock_priv_destroy(struct list_head *priv); +void netdev_nl_sock_priv_init(struct netdev_nl_sock *priv); +void netdev_nl_sock_priv_destroy(struct netdev_nl_sock *priv); #endif /* _LINUX_NETDEV_GEN_H */ diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index 2b774183d31c..a219be90c739 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -829,8 +829,8 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info) { struct nlattr *tb[ARRAY_SIZE(netdev_queue_id_nl_policy)]; struct net_devmem_dmabuf_binding *binding; - struct list_head *sock_binding_list; u32 ifindex, dmabuf_fd, rxq_idx; + struct netdev_nl_sock *priv; struct net_device *netdev; struct sk_buff *rsp; struct nlattr *attr; @@ -845,10 +845,9 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info) ifindex = nla_get_u32(info->attrs[NETDEV_A_DEV_IFINDEX]); dmabuf_fd = nla_get_u32(info->attrs[NETDEV_A_DMABUF_FD]); - sock_binding_list = genl_sk_priv_get(&netdev_nl_family, - NETLINK_CB(skb).sk); - if (IS_ERR(sock_binding_list)) - return PTR_ERR(sock_binding_list); + priv = genl_sk_priv_get(&netdev_nl_family, NETLINK_CB(skb).sk); + if (IS_ERR(priv)) + return PTR_ERR(priv); rsp = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!rsp) @@ -909,7 +908,7 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info) goto err_unbind; } - list_add(&binding->list, sock_binding_list); + list_add(&binding->list, &priv->bindings); nla_put_u32(rsp, NETDEV_A_DMABUF_ID, binding->id); genlmsg_end(rsp, hdr); @@ -931,17 +930,17 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info) return err; } -void netdev_nl_sock_priv_init(struct list_head *priv) +void netdev_nl_sock_priv_init(struct netdev_nl_sock *priv) { - INIT_LIST_HEAD(priv); + INIT_LIST_HEAD(&priv->bindings); } -void netdev_nl_sock_priv_destroy(struct list_head *priv) +void netdev_nl_sock_priv_destroy(struct netdev_nl_sock *priv) { struct net_devmem_dmabuf_binding *binding; struct net_devmem_dmabuf_binding *temp; - list_for_each_entry_safe(binding, temp, priv, list) { + list_for_each_entry_safe(binding, temp, &priv->bindings, list) { rtnl_lock(); net_devmem_unbind_dmabuf(binding); rtnl_unlock(); From patchwork Fri Mar 7 15:57:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Fomichev X-Patchwork-Id: 14006703 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E111A221547; Fri, 7 Mar 2025 15:57:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741363051; cv=none; b=AE/8DekubAr0iG943akUzWgbtEHrKaXwRw4DGF6SsOgP3v5otjJl61o2X80SAlJJwmtbexxDDq3q1Q+1IjnvQTY01OLsjXqu+PNmFcUxV4iqiJuqRUUg1m5z+3dE0lCNsDak90pdO2tJbd7DcOCBHnkn17xeWZEi613vBmdScKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741363051; c=relaxed/simple; bh=JniLJibKpEppVkt3pfDVBslPwEadXmwWbzGIt0QUQWk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UX4YIZ6R0rYpiOZn8GsGlM5nZ1wGdLYavOrfTKq6nhVMeEI7PSAzM3FRQZqjMyr1Qm8HKAHI4ezedk4X79kv8u3eKIAFPY1mNEiar3D/tz9Ens7kS+C1GRJe+vngwbCEGJPKH5CaYnl5NxFgwE4oC0iAPAT58ng3l3KJSNSdMbU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fomichev.me; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fomichev.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2241053582dso11716365ad.1; Fri, 07 Mar 2025 07:57:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741363049; x=1741967849; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fNf+k9hhNyVSY2O3O8aKeeb+5wxc5hlSdDGv1HkARCE=; b=RehljJckTmUGPW1BLm65w4RifRg6kdAVu5byLN5p8iugQPxYLO5xR+kY1ScpRjIt9T VyhJo/ly8gNBfUPBIx9z17kv55gpuCgFNxN8GwB881BHyMd6wFjwv6s0M13gK7O22Ym2 LVBbT0k3bhe3BIYRLtnDZYjqNzIO/syXxWihoYZF/wq1y6Jh7b4chd5fFw6/VZQt1/4q Twk9bXhsMCzChFDABKXJcd10PnsmTMSjD/cWPLvWT22L2R0AyxLGRzlS23aJUJB+tFlq N6DTf2Xxdf8JqNrjs2SBcP38DL8XiSxKGkuLJ/KkQCRG8NNjbt3dzBUDicmQHvhXhumq am1Q== X-Forwarded-Encrypted: i=1; AJvYcCW6dOp+PLoyYUAo5rPD+f5QHn4KYdXf0sYBdSb5NlNic5gIpItTNEseJVauUwFS3MYn30GC7RtqNYQLjbU=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6MrKppWyhHC7iGmWu0twhUSxMkbCbS8Rl1J3/xXxn2F1uM+1s s6sg/bB6Tp39X3wBssUE032KJPebD6ipBvgiV+uKSTqjKdBj5QoW9lPN X-Gm-Gg: ASbGnct4ogE0wQIpvys8xgiISZ1njH6BsF4xl3y7MfOMRWN7VCDYJlQMz9xEg+fRmOM MnTWwKxf2txByBLYOuq34wSoHPXAxrLET2gJmnCjsfFCkW1zvxwSrJixKPEAcres2deap66sr5v tC8bC0qfiw9awm9T0VhmkMaCcwqiB4Dxdo7+wgkUvwjc/BZA6jXLVPG9nmcIwa8dD4cXr5eSiBL AvUIhEWF7kShSFTJ4pO5WajGju7asTk5Oz23A9PIEuUz6GS81bz4N7iwble3Djpu3GN3MvWU2Yg SXinZUq/z0JjTLXf6bIuUo/DwshyPJp7L/yFX2u3uXbx X-Google-Smtp-Source: AGHT+IHIlEarVBMAmVMhYTsCxYZWZDmie8Syv0Q2HhlZf5ejT//6e8OjZ/bByE+MuJvWYL1wxcP4Zw== X-Received: by 2002:a17:902:f54e:b0:224:7a4:b32 with SMTP id d9443c01a7336-2242888b350mr60240155ad.20.1741363048785; Fri, 07 Mar 2025 07:57:28 -0800 (PST) Received: from localhost ([2601:646:9e00:f56e:2844:3d8f:bf3e:12cc]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-224109e99dfsm31733925ad.91.2025.03.07.07.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Mar 2025 07:57:28 -0800 (PST) From: Stanislav Fomichev To: netdev@vger.kernel.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, horms@kernel.org, donald.hunter@gmail.com, michael.chan@broadcom.com, pavan.chebbi@broadcom.com, andrew+netdev@lunn.ch, jdamato@fastly.com, sdf@fomichev.me, xuanzhuo@linux.alibaba.com, almasrymina@google.com, asml.silence@gmail.com, dw@davidwei.uk Subject: [PATCH net-next v1 2/4] net: protect net_devmem_dmabuf_bindings by new net_devmem_bindings_mutex Date: Fri, 7 Mar 2025 07:57:23 -0800 Message-ID: <20250307155725.219009-3-sdf@fomichev.me> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307155725.219009-1-sdf@fomichev.me> References: <20250307155725.219009-1-sdf@fomichev.me> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org In the process of making queue management API rtnl_lock-less, we need a separate lock to protect xa that keeps a global list of bindings. Also change the ordering of 'posting' binding to net_devmem_dmabuf_bindings: xa_alloc is done after binding is fully initialized (so xa_load lookups fully instantiated bindings) and xa_erase is done as a first step during unbind. Cc: Mina Almasry Signed-off-by: Stanislav Fomichev --- net/core/devmem.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/net/core/devmem.c b/net/core/devmem.c index 7c6e0b5b6acb..c16cdac46bed 100644 --- a/net/core/devmem.c +++ b/net/core/devmem.c @@ -25,7 +25,7 @@ /* Device memory support */ -/* Protected by rtnl_lock() */ +static DEFINE_MUTEX(net_devmem_bindings_mutex); static DEFINE_XARRAY_FLAGS(net_devmem_dmabuf_bindings, XA_FLAGS_ALLOC1); static const struct memory_provider_ops dmabuf_devmem_ops; @@ -119,6 +119,10 @@ void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding) unsigned long xa_idx; unsigned int rxq_idx; + mutex_lock(&net_devmem_bindings_mutex); + xa_erase(&net_devmem_dmabuf_bindings, binding->id); + mutex_unlock(&net_devmem_bindings_mutex); + if (binding->list.next) list_del(&binding->list); @@ -133,8 +137,6 @@ void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding) WARN_ON(netdev_rx_queue_restart(binding->dev, rxq_idx)); } - xa_erase(&net_devmem_dmabuf_bindings, binding->id); - net_devmem_dmabuf_binding_put(binding); } @@ -220,24 +222,15 @@ net_devmem_bind_dmabuf(struct net_device *dev, unsigned int dmabuf_fd, } binding->dev = dev; - - err = xa_alloc_cyclic(&net_devmem_dmabuf_bindings, &binding->id, - binding, xa_limit_32b, &id_alloc_next, - GFP_KERNEL); - if (err < 0) - goto err_free_binding; - xa_init_flags(&binding->bound_rxqs, XA_FLAGS_ALLOC); - refcount_set(&binding->ref, 1); - binding->dmabuf = dmabuf; binding->attachment = dma_buf_attach(binding->dmabuf, dev->dev.parent); if (IS_ERR(binding->attachment)) { err = PTR_ERR(binding->attachment); NL_SET_ERR_MSG(extack, "Failed to bind dmabuf to device"); - goto err_free_id; + goto err_free_binding; } binding->sgt = dma_buf_map_attachment_unlocked(binding->attachment, @@ -305,6 +298,14 @@ net_devmem_bind_dmabuf(struct net_device *dev, unsigned int dmabuf_fd, virtual += len; } + mutex_lock(&net_devmem_bindings_mutex); + err = xa_alloc_cyclic(&net_devmem_dmabuf_bindings, &binding->id, + binding, xa_limit_32b, &id_alloc_next, + GFP_KERNEL); + mutex_unlock(&net_devmem_bindings_mutex); + if (err < 0) + goto err_free_chunks; + return binding; err_free_chunks: @@ -316,8 +317,6 @@ net_devmem_bind_dmabuf(struct net_device *dev, unsigned int dmabuf_fd, DMA_FROM_DEVICE); err_detach: dma_buf_detach(dmabuf, binding->attachment); -err_free_id: - xa_erase(&net_devmem_dmabuf_bindings, binding->id); err_free_binding: kfree(binding); err_put_dmabuf: From patchwork Fri Mar 7 15:57:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Fomichev X-Patchwork-Id: 14006704 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A970221700; Fri, 7 Mar 2025 15:57:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741363052; cv=none; b=cqbuLqe0Oofl3T5Y9y8v9dGrhYWt6rSdFVGeemhSKVmgbDw0yoa+uST5A78iorpPyAVV5+Y/ElXFul4sXYwSQLvu4OQ3AtGAXYA9u0IbrMWcahl/lPuISRtAgKlapuVSepQb5oIwDSfiybv0UeGnh7oC+R1amYuArAM7Mzq1uMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741363052; c=relaxed/simple; bh=GN6Op8TH/Jsez7Jm4eQm4K7bgfkB1UTCd6/YG9PCL5E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EUbkUC41Q+Clamqj+s/5v1+GQh6lg431FJ20YUGoVLmq1KPjHS6WJ5/orxIeCl+WIVbMQOGpdEIR2Wn4rlaMI+xGwPeyV/v6ZZQwzyNQOMzcCKYVhJmq3Rg+tklijX7r2Ld/QdBUzNYZaacNSr9nHo4G8kdU0anDwp8LceKEECg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fomichev.me; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.216.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fomichev.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2ff784dc055so2271840a91.1; Fri, 07 Mar 2025 07:57:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741363050; x=1741967850; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s3Q9mEWcCQiysBRQMwjr211wmRnTzGybB6MFLrlgznk=; b=dL0q2YIPYuAdG9xzNtLMPy7oT8G1AlOwj6j/8GH4+JXFYsApHkGZ13eUhZxu1Tt2v2 1SD6+5ILJgwDZ9dYBJ1x+A5ho6GLgRAihPLe1ZWKXx4KiNrq1zsXAx1dSjDS7xVJd/Ws iLBq9TjcRyS1+Qw8K0TQauOK521FLBL7a2/FWE081nbb1xFX9M9fFXAjCf7DEb5+G0c0 hjK/NCXbuiXqm/kkjZ3qkqM5IzB0j2hJa1IgUzLFSJqeCFSYDeRhgeygCDbwREICr/av DKt4WDHYdeo0f8zQN4U8H3rQXfU+RazQoA4fr9mQvS4qCz/SDR0vJUJyEZBlcdX+WjZx LIpg== X-Forwarded-Encrypted: i=1; AJvYcCXdocQWgUhzTtmhqGJjyPSjRw0WRx24yLECCkYZEanv97C6PaUumWUdHJq7zw/o8rUv8mbKwl5V6YYoAHo=@vger.kernel.org X-Gm-Message-State: AOJu0YzQHhG3R8459qz7aExJUgrnqbtnSL9QvkjF2iBCJPElq84cYU0A NEGIIutjWLJ3NUYbnkMGJtqgEduR/3daTxXR2Qrr5LwMwOfr9Gewmyfv X-Gm-Gg: ASbGncuiTYAcq4ptwY0WQrONydnfledGDCiMC1UzuYnfWUoS4oMGU4106YoNtb5IjJp LfGqAsqbPEk1Jn9CbUCWJXyLnhuOVNpo92hy5v2FTsJZ2vBlA9maBiJW9dUgkCf+kiIVTKt9at+ DKcoyICSrMGFh5i+XMJP7usd6Kjptp+8e3Fr4s+Wpctimk7Q0e9Jn3wqeM2w0985TADYaFEvbEm 5PPcv5GJMOc8+AsTS7hKyvhsdzpwkbPw6HP1fw1DwLWXVPVTRylVn3pKmiUEGuSXkfydCnKw2nH O+TJBP64IJdcAfT5fbq56sKsofWEzjmINM0UVezGwrWY X-Google-Smtp-Source: AGHT+IF2BmNraH2QXVQIEzs4eJGtB74Dm75ZgAwr6Sdps7YblYQeVGelxck2K4x1t3uj1s7rL2zBdA== X-Received: by 2002:a17:90b:4b4f:b0:2ff:570d:88c5 with SMTP id 98e67ed59e1d1-2ff7ce831d4mr6614394a91.9.1741363050003; Fri, 07 Mar 2025 07:57:30 -0800 (PST) Received: from localhost ([2601:646:9e00:f56e:2844:3d8f:bf3e:12cc]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-224109ddfbcsm31805275ad.21.2025.03.07.07.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Mar 2025 07:57:29 -0800 (PST) From: Stanislav Fomichev To: netdev@vger.kernel.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, horms@kernel.org, donald.hunter@gmail.com, michael.chan@broadcom.com, pavan.chebbi@broadcom.com, andrew+netdev@lunn.ch, jdamato@fastly.com, sdf@fomichev.me, xuanzhuo@linux.alibaba.com, almasrymina@google.com, asml.silence@gmail.com, dw@davidwei.uk Subject: [PATCH net-next v1 3/4] net: add granular lock for the netdev netlink socket Date: Fri, 7 Mar 2025 07:57:24 -0800 Message-ID: <20250307155725.219009-4-sdf@fomichev.me> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307155725.219009-1-sdf@fomichev.me> References: <20250307155725.219009-1-sdf@fomichev.me> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org As we move away from rtnl_lock for queue ops, introduce per-netdev_nl_sock lock. Cc: Mina Almasry Signed-off-by: Stanislav Fomichev --- include/net/netdev_netlink.h | 1 + net/core/netdev-genl.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/net/netdev_netlink.h b/include/net/netdev_netlink.h index 1599573d35c9..075962dbe743 100644 --- a/include/net/netdev_netlink.h +++ b/include/net/netdev_netlink.h @@ -5,6 +5,7 @@ #include struct netdev_nl_sock { + struct mutex lock; struct list_head bindings; }; diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index a219be90c739..8acdeeae24e7 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -859,6 +859,7 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info) goto err_genlmsg_free; } + mutex_lock(&priv->lock); rtnl_lock(); netdev = __dev_get_by_index(genl_info_net(info), ifindex); @@ -925,6 +926,7 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info) net_devmem_unbind_dmabuf(binding); err_unlock: rtnl_unlock(); + mutex_unlock(&priv->lock); err_genlmsg_free: nlmsg_free(rsp); return err; @@ -933,6 +935,7 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info) void netdev_nl_sock_priv_init(struct netdev_nl_sock *priv) { INIT_LIST_HEAD(&priv->bindings); + mutex_init(&priv->lock); } void netdev_nl_sock_priv_destroy(struct netdev_nl_sock *priv) @@ -940,11 +943,13 @@ void netdev_nl_sock_priv_destroy(struct netdev_nl_sock *priv) struct net_devmem_dmabuf_binding *binding; struct net_devmem_dmabuf_binding *temp; + mutex_lock(&priv->lock); list_for_each_entry_safe(binding, temp, &priv->bindings, list) { rtnl_lock(); net_devmem_unbind_dmabuf(binding); rtnl_unlock(); } + mutex_unlock(&priv->lock); } static int netdev_genl_netdevice_event(struct notifier_block *nb, From patchwork Fri Mar 7 15:57:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Fomichev X-Patchwork-Id: 14006705 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BB8D21E0A2; Fri, 7 Mar 2025 15:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741363054; cv=none; b=q8aL8SpFVTBHSGz9czvDQn+EAOE3x8RS70hgKC4Cn9M+ELgDwOAkGHG/sqRT8gwyLDoiMMICugOmFrOM6Rul3CvwFTqUi0j5rkXEM33CCg8itYlJxG/82bau4H73TMlwknVZ4AqXel+p1THHzDauXfvLJHeoIGNBCP9zLcmEquw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741363054; c=relaxed/simple; bh=lYILpbAOKO+vkQH0pJfDI/aajZ4gWsD0lr2JKJJ5iWU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MydBupfA8JXScUYE33gE2+IGE9hJvuz+cyDpmkoAZJ7MxURPCtu3Ff8CewZfDwg1GkF6CpmZMmm9Bc0HmWSvuq8A2/ir5FAYmxcPvrBzN9iJEYY5H5m9/wJnuwXh9Ztb/yZ1Upyll/UCEBn2aRLp7g8OUPRpaEy9WirFIRa2ptM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fomichev.me; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fomichev.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-223f4c06e9fso37608555ad.1; Fri, 07 Mar 2025 07:57:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741363051; x=1741967851; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RNY7QpJz52D8G6N2MeHEgoi0caSdn8a+aQQjEhBoLzA=; b=YGbYRIW+wHoB+2lFWH16HibBbTn27LTAGa4V/ZBKe/NBOUmFlWNIp1sCwZrgTCOtJW igzcWdw9dFObMhJWejDIpyyHVx2/gDAI+1Mlu4FWZvjotlYSqlDj1YsNlEUQC5zrYWZw oaefR/Fk3MtrR+/MPrnHldtdftHg3R945pqgJmlECCzO2ah5eABp480mT1iGVk9inNX6 xhl4ftfa37ajDCOpvG4qaTLwzmTiT5ub4y+PJ0/TpUehF1cun4d9NHDS2IMDChJQovkX qivOChwIyVduXvFbNpCYV8IqugPHlLjbmNbSjQff3Kj3/GmUWvbLcNlxrEH6hnjxatOB fr4g== X-Forwarded-Encrypted: i=1; AJvYcCUrBPVhObm4x5bU2T4gfPrFZdQr7HC6zu6jUUtf/TyHm0Ylo/dw592SAlOgAd2+Kwp/t+Rx+/VIwRHKKqI=@vger.kernel.org X-Gm-Message-State: AOJu0YwGP+YQ4yWlwrGRWwZm926TFdApL1JDFBHOGkf3yOdexEnh4Vmw +enGMimI+v9hOPincYzB4vcJNyHOBnpMyt2AmCCPmdW9xAADUHMmglkm X-Gm-Gg: ASbGncv0HFR5TU9uZQlvsVgpMOk//a6lIuazI2Kozj5pu4sfWf/+/LjDkMt0XHA/5H6 ozGQZ3YG6esGcwMK/3mdVecYyfMnrARqFpYTvqGJaI+ccPARUR5Ho4CmGKp1SaxWAlSnWVj0FZI P+5SnZr1V1PE0Zs4pi3PhN/MbJ6aMTI/htmizlHIRigLYWLU5XBuLWdcnVONw9dJIspZvUns7tM nyRgRh+vAqAaRZbo5WI7aurM6xZD8JctzfuViJPVcDTte8C6ZuhzXMnO07x2FEW7oRWuFnKSMce rSRcp1FW8ThWp3+hCsy5tAaIJ640VXe5LS9zo7XEYzQY X-Google-Smtp-Source: AGHT+IGrKs8tyHlQ6sonWiilKHhayquw18UpO5yvlUWmMpGKRlmKHRoMCf/2ZVxttNss+RdVxYqDIQ== X-Received: by 2002:a17:902:e548:b0:216:271d:e06c with SMTP id d9443c01a7336-2244f057ca6mr594285ad.4.1741363051299; Fri, 07 Mar 2025 07:57:31 -0800 (PST) Received: from localhost ([2601:646:9e00:f56e:2844:3d8f:bf3e:12cc]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-224109ea87esm31641855ad.85.2025.03.07.07.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Mar 2025 07:57:30 -0800 (PST) From: Stanislav Fomichev To: netdev@vger.kernel.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org, horms@kernel.org, donald.hunter@gmail.com, michael.chan@broadcom.com, pavan.chebbi@broadcom.com, andrew+netdev@lunn.ch, jdamato@fastly.com, sdf@fomichev.me, xuanzhuo@linux.alibaba.com, almasrymina@google.com, asml.silence@gmail.com, dw@davidwei.uk Subject: [PATCH net-next v1 4/4] net: drop rtnl_lock for queue_mgmt operations Date: Fri, 7 Mar 2025 07:57:25 -0800 Message-ID: <20250307155725.219009-5-sdf@fomichev.me> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250307155725.219009-1-sdf@fomichev.me> References: <20250307155725.219009-1-sdf@fomichev.me> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org All drivers that use queue API are already converted to use netdev instance lock. Move netdev instance lock management to the netlink layer and drop rtnl_lock. Cc: Mina Almasry Signed-off-by: Stanislav Fomichev --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++-- drivers/net/netdevsim/netdev.c | 4 ++-- net/core/devmem.c | 3 ++- net/core/netdev-genl.c | 18 +++++------------- net/core/netdev_rx_queue.c | 15 +++++---------- 5 files changed, 16 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 1a1e6da77777..9b936cfc1d29 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -11380,14 +11380,14 @@ static void bnxt_irq_affinity_notify(struct irq_affinity_notify *notify, if (pcie_tph_set_st_entry(irq->bp->pdev, irq->msix_nr, tag)) return; - rtnl_lock(); + netdev_lock(irq->bp->dev); if (netif_running(irq->bp->dev)) { err = netdev_rx_queue_restart(irq->bp->dev, irq->ring_nr); if (err) netdev_err(irq->bp->dev, "RX queue restart failed: err=%d\n", err); } - rtnl_unlock(); + netdev_unlock(irq->bp->dev); } static void bnxt_irq_affinity_release(struct kref *ref) diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 54d03b0628d2..1ba2ff5e4453 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -786,7 +786,7 @@ nsim_qreset_write(struct file *file, const char __user *data, if (ret != 2) return -EINVAL; - rtnl_lock(); + netdev_lock(ns->netdev); if (queue >= ns->netdev->real_num_rx_queues) { ret = -EINVAL; goto exit_unlock; @@ -800,7 +800,7 @@ nsim_qreset_write(struct file *file, const char __user *data, ret = count; exit_unlock: - rtnl_unlock(); + netdev_unlock(ns->netdev); return ret; } diff --git a/net/core/devmem.c b/net/core/devmem.c index c16cdac46bed..e48eb42d7377 100644 --- a/net/core/devmem.c +++ b/net/core/devmem.c @@ -132,9 +132,10 @@ void net_devmem_unbind_dmabuf(struct net_devmem_dmabuf_binding *binding) rxq->mp_params.mp_priv = NULL; rxq->mp_params.mp_ops = NULL; + netdev_lock(binding->dev); rxq_idx = get_netdev_rx_queue_index(rxq); - WARN_ON(netdev_rx_queue_restart(binding->dev, rxq_idx)); + netdev_unlock(binding->dev); } net_devmem_dmabuf_binding_put(binding); diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index 8acdeeae24e7..1de28f9e0219 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -481,8 +481,6 @@ int netdev_nl_queue_get_doit(struct sk_buff *skb, struct genl_info *info) if (!rsp) return -ENOMEM; - rtnl_lock(); - netdev = netdev_get_by_index_lock(genl_info_net(info), ifindex); if (netdev) { err = netdev_nl_queue_fill(rsp, netdev, q_id, q_type, info); @@ -491,8 +489,6 @@ int netdev_nl_queue_get_doit(struct sk_buff *skb, struct genl_info *info) err = -ENODEV; } - rtnl_unlock(); - if (err) goto err_free_msg; @@ -541,7 +537,6 @@ int netdev_nl_queue_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb) if (info->attrs[NETDEV_A_QUEUE_IFINDEX]) ifindex = nla_get_u32(info->attrs[NETDEV_A_QUEUE_IFINDEX]); - rtnl_lock(); if (ifindex) { netdev = netdev_get_by_index_lock(net, ifindex); if (netdev) { @@ -559,7 +554,6 @@ int netdev_nl_queue_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb) ctx->txq_idx = 0; } } - rtnl_unlock(); return err; } @@ -860,12 +854,11 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info) } mutex_lock(&priv->lock); - rtnl_lock(); - netdev = __dev_get_by_index(genl_info_net(info), ifindex); + netdev = netdev_get_by_index_lock(genl_info_net(info), ifindex); if (!netdev || !netif_device_present(netdev)) { err = -ENODEV; - goto err_unlock; + goto err_unlock_sock; } if (dev_xdp_prog_count(netdev)) { @@ -918,14 +911,15 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info) if (err) goto err_unbind; - rtnl_unlock(); + netdev_unlock(netdev); return 0; err_unbind: net_devmem_unbind_dmabuf(binding); err_unlock: - rtnl_unlock(); + netdev_unlock(netdev); +err_unlock_sock: mutex_unlock(&priv->lock); err_genlmsg_free: nlmsg_free(rsp); @@ -945,9 +939,7 @@ void netdev_nl_sock_priv_destroy(struct netdev_nl_sock *priv) mutex_lock(&priv->lock); list_for_each_entry_safe(binding, temp, &priv->bindings, list) { - rtnl_lock(); net_devmem_unbind_dmabuf(binding); - rtnl_unlock(); } mutex_unlock(&priv->lock); } diff --git a/net/core/netdev_rx_queue.c b/net/core/netdev_rx_queue.c index 7419c41fd3cb..8fd5d784ac09 100644 --- a/net/core/netdev_rx_queue.c +++ b/net/core/netdev_rx_queue.c @@ -18,7 +18,7 @@ int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq_idx) !qops->ndo_queue_mem_alloc || !qops->ndo_queue_start) return -EOPNOTSUPP; - ASSERT_RTNL(); + netdev_assert_locked(dev); new_mem = kvzalloc(qops->ndo_queue_mem_size, GFP_KERNEL); if (!new_mem) @@ -30,8 +30,6 @@ int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq_idx) goto err_free_new_mem; } - netdev_lock(dev); - err = qops->ndo_queue_mem_alloc(dev, new_mem, rxq_idx); if (err) goto err_free_old_mem; @@ -54,8 +52,6 @@ int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq_idx) qops->ndo_queue_mem_free(dev, old_mem); - netdev_unlock(dev); - kvfree(old_mem); kvfree(new_mem); @@ -80,7 +76,6 @@ int netdev_rx_queue_restart(struct net_device *dev, unsigned int rxq_idx) qops->ndo_queue_mem_free(dev, new_mem); err_free_old_mem: - netdev_unlock(dev); kvfree(old_mem); err_free_new_mem: @@ -118,9 +113,9 @@ int net_mp_open_rxq(struct net_device *dev, unsigned ifq_idx, { int ret; - rtnl_lock(); + netdev_lock(dev); ret = __net_mp_open_rxq(dev, ifq_idx, p); - rtnl_unlock(); + netdev_unlock(dev); return ret; } @@ -153,7 +148,7 @@ static void __net_mp_close_rxq(struct net_device *dev, unsigned ifq_idx, void net_mp_close_rxq(struct net_device *dev, unsigned ifq_idx, struct pp_memory_provider_params *old_p) { - rtnl_lock(); + netdev_lock(dev); __net_mp_close_rxq(dev, ifq_idx, old_p); - rtnl_unlock(); + netdev_unlock(dev); }