>From: Jiri Pirko <jiri@xxxxxxxxxxx> >Sent: Tuesday, June 13, 2023 3:52 PM > >Mon, Jun 12, 2023 at 11:17:23AM CEST, poros@xxxxxxxxxx wrote: >>Arkadiusz Kubalewski píše v Pá 09. 06. 2023 v 14:18 +0200: >>> From: Jiri Pirko <jiri@xxxxxxxxxx> > >[...] > > >>> +static size_t rtnl_dpll_pin_size(const struct net_device *dev) >>> +{ >>> + size_t size = nla_total_size(0); /* nest IFLA_DPLL_PIN */ >>> + >>> + if (dev->dpll_pin) >>> + size += dpll_msg_pin_handle_size(dev->dpll_pin); >> >>Hi Arkadiusz, >> >>net_device->dpll_pin is only valid if IS_ENABLED(CONFIG_DPLL) >>But the code in net/core/rtnetlink.c doesn't respect that. >>If CONFIG_DPLL is not set, net/core/rtnetlink.c cannot be compiled. >> >>Regards, >>Petr > >You are correct. Here's the squash-patch to fix this. Arkadiusz, could >you please make the squash? Thanks! > Sure thing, will do. Thank you! Arkadiusz >diff --git a/drivers/dpll/dpll_netlink.c b/drivers/dpll/dpll_netlink.c >index e6efc17aaf26..00dc96c3ade4 100644 >--- a/drivers/dpll/dpll_netlink.c >+++ b/drivers/dpll/dpll_netlink.c >@@ -303,12 +303,14 @@ dpll_cmd_pin_fill_details(struct sk_buff *msg, struct >dpll_pin *pin, > > size_t dpll_msg_pin_handle_size(struct dpll_pin *pin) > { >- return nla_total_size(4); /* DPLL_A_PIN_ID */ >+ return pin ? nla_total_size(4) : 0; /* DPLL_A_PIN_ID */ > } > EXPORT_SYMBOL_GPL(dpll_msg_pin_handle_size); > > int dpll_msg_add_pin_handle(struct sk_buff *msg, struct dpll_pin *pin) > { >+ if (!pin) >+ return 0; > if (nla_put_u32(msg, DPLL_A_PIN_ID, pin->id)) > return -EMSGSIZE; > return 0; >diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h >index b002e3cc9943..82ad12fd4266 100644 >--- a/include/linux/netdevice.h >+++ b/include/linux/netdevice.h >@@ -3967,6 +3967,16 @@ int dev_get_port_parent_id(struct net_device *dev, > bool netdev_port_same_parent_id(struct net_device *a, struct net_device >*b); > void netdev_dpll_pin_set(struct net_device *dev, struct dpll_pin >*dpll_pin); > void netdev_dpll_pin_clear(struct net_device *dev); >+ >+static inline struct dpll_pin *netdev_dpll_pin(const struct net_device >*dev) >+{ >+#if IS_ENABLED(CONFIG_DPLL) >+ return dev->dpll_pin; >+#else >+ return NULL; >+#endif >+} >+ > struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct >net_device *dev, bool *again); > struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device >*dev, > struct netdev_queue *txq, int *ret); >diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c >index ebe9ae8608fc..67dd455e15c7 100644 >--- a/net/core/rtnetlink.c >+++ b/net/core/rtnetlink.c >@@ -1056,8 +1056,7 @@ static size_t rtnl_dpll_pin_size(const struct >net_device *dev) > { > size_t size = nla_total_size(0); /* nest IFLA_DPLL_PIN */ > >- if (dev->dpll_pin) >- size += dpll_msg_pin_handle_size(dev->dpll_pin); >+ size += dpll_msg_pin_handle_size(netdev_dpll_pin(dev)); > > return size; > } >@@ -1790,11 +1789,9 @@ static int rtnl_fill_dpll_pin(struct sk_buff *skb, > if (!dpll_pin_nest) > return -EMSGSIZE; > >- if (dev->dpll_pin) { >- ret = dpll_msg_add_pin_handle(skb, dev->dpll_pin); >- if (ret < 0) >- goto nest_cancel; >- } >+ ret = dpll_msg_add_pin_handle(skb, netdev_dpll_pin(dev)); >+ if (ret < 0) >+ goto nest_cancel; > > nla_nest_end(skb, dpll_pin_nest); > return 0;