Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] dpll: change dpll_netdev_pin_handle_size() to assume DPLL_A_PIN_ID will be used
@ 2026-05-21 17:14 Eric Dumazet
  2026-05-21 22:26 ` Vadim Fedorenko
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2026-05-21 17:14 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, eric.dumazet, Eric Dumazet, Vadim Fedorenko,
	Arkadiusz Kubalewski, Jiri Pirko

We plan to no longer hold RTNL in "ip link show", and use RCU instead.

Assume rtnl_fill_dpll_pin() will have to fill DPLL_A_PIN_ID.

It is fine to over-estimate skb size (by 8 bytes) in if_nlmsg_size().

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Cc: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Cc: Jiri Pirko <jiri@resnulli.us>
---
 drivers/dpll/dpll_netlink.c | 11 -----------
 include/linux/dpll.h        |  9 +++++++--
 net/core/rtnetlink.c        |  6 +++---
 3 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/drivers/dpll/dpll_netlink.c b/drivers/dpll/dpll_netlink.c
index 53ca24d0f191bc3268340543769fd96c836f9318..095ef8703c0b2687178a46c5312319376d518f79 100644
--- a/drivers/dpll/dpll_netlink.c
+++ b/drivers/dpll/dpll_netlink.c
@@ -89,17 +89,6 @@ static struct dpll_pin *dpll_netdev_pin(const struct net_device *dev)
 	return rcu_dereference_rtnl(dev->dpll_pin);
 }
 
-/**
- * dpll_netdev_pin_handle_size - get size of pin handle attribute of a netdev
- * @dev: netdev from which to get the pin
- *
- * Return: byte size of pin handle attribute, or 0 if @dev has no pin.
- */
-size_t dpll_netdev_pin_handle_size(const struct net_device *dev)
-{
-	return dpll_netdev_pin(dev) ? nla_total_size(4) : 0; /* DPLL_A_PIN_ID */
-}
-
 int dpll_netdev_add_pin_handle(struct sk_buff *msg,
 			       const struct net_device *dev)
 {
diff --git a/include/linux/dpll.h b/include/linux/dpll.h
index 82dfadd9f593b780c11d1d05cd00b62a32d4f534..4071fd974dd714eca92cae70e40bcde5a87a4706 100644
--- a/include/linux/dpll.h
+++ b/include/linux/dpll.h
@@ -13,6 +13,7 @@
 #include <linux/netdevice.h>
 #include <linux/notifier.h>
 #include <linux/rtnetlink.h>
+#include <net/netlink.h>
 
 struct dpll_device;
 struct dpll_pin;
@@ -238,7 +239,11 @@ struct dpll_pin_notifier_info {
 void dpll_netdev_pin_set(struct net_device *dev, struct dpll_pin *dpll_pin);
 void dpll_netdev_pin_clear(struct net_device *dev);
 
-size_t dpll_netdev_pin_handle_size(const struct net_device *dev);
+static inline size_t dpll_netdev_pin_handle_size(void)
+{
+	return nla_total_size(4); /* DPLL_A_PIN_ID */
+}
+
 int dpll_netdev_add_pin_handle(struct sk_buff *msg,
 			       const struct net_device *dev);
 
@@ -249,7 +254,7 @@ static inline void
 dpll_netdev_pin_set(struct net_device *dev, struct dpll_pin *dpll_pin) { }
 static inline void dpll_netdev_pin_clear(struct net_device *dev) { }
 
-static inline size_t dpll_netdev_pin_handle_size(const struct net_device *dev)
+static inline size_t dpll_netdev_pin_handle_size(void)
 {
 	return 0;
 }
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 6a5e9ace55a0880d7b1e4303d12dc0a8b8b7c5ed..d64600aa8adfe9ce7a0c45677ae36db73ee3d886 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1264,11 +1264,11 @@ static size_t rtnl_devlink_port_size(const struct net_device *dev)
 	return size;
 }
 
-static size_t rtnl_dpll_pin_size(const struct net_device *dev)
+static size_t rtnl_dpll_pin_size(void)
 {
 	size_t size = nla_total_size(0); /* nest IFLA_DPLL_PIN */
 
-	size += dpll_netdev_pin_handle_size(dev);
+	size += dpll_netdev_pin_handle_size();
 
 	return size;
 }
@@ -1349,7 +1349,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
 	       + nla_total_size(4)  /* IFLA_MAX_MTU */
 	       + nla_total_size(MAX_ADDR_LEN) /* IFLA_PERM_ADDRESS */
 	       + rtnl_devlink_port_size(dev)
-	       + rtnl_dpll_pin_size(dev)
+	       + rtnl_dpll_pin_size()
 	       + nla_total_size(8)  /* IFLA_MAX_PACING_OFFLOAD_HORIZON */
 	       + nla_total_size(2)  /* IFLA_HEADROOM */
 	       + nla_total_size(2)  /* IFLA_TAILROOM */
-- 
2.54.0.746.g67dd491aae-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] dpll: change dpll_netdev_pin_handle_size() to assume DPLL_A_PIN_ID will be used
  2026-05-21 17:14 [PATCH net-next] dpll: change dpll_netdev_pin_handle_size() to assume DPLL_A_PIN_ID will be used Eric Dumazet
@ 2026-05-21 22:26 ` Vadim Fedorenko
  0 siblings, 0 replies; 2+ messages in thread
From: Vadim Fedorenko @ 2026-05-21 22:26 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, eric.dumazet, Arkadiusz Kubalewski,
	Jiri Pirko

On 21.05.2026 18:14, Eric Dumazet wrote:
> We plan to no longer hold RTNL in "ip link show", and use RCU instead.
> 
> Assume rtnl_fill_dpll_pin() will have to fill DPLL_A_PIN_ID.
> 
> It is fine to over-estimate skb size (by 8 bytes) in if_nlmsg_size().
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>
> Cc: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
> Cc: Jiri Pirko <jiri@resnulli.us>
> ---
>   drivers/dpll/dpll_netlink.c | 11 -----------
>   include/linux/dpll.h        |  9 +++++++--
>   net/core/rtnetlink.c        |  6 +++---
>   3 files changed, 10 insertions(+), 16 deletions(-)

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-21 22:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-21 17:14 [PATCH net-next] dpll: change dpll_netdev_pin_handle_size() to assume DPLL_A_PIN_ID will be used Eric Dumazet
2026-05-21 22:26 ` Vadim Fedorenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox