[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR11MB4657B7316954968658B40CE39B5AA@DM6PR11MB4657.namprd11.prod.outlook.com>
Date: Wed, 14 Jun 2023 12:25:07 +0000
From: "Kubalewski, Arkadiusz" <arkadiusz.kubalewski@...el.com>
To: Jiri Pirko <jiri@...nulli.us>, poros <poros@...hat.com>
CC: "kuba@...nel.org" <kuba@...nel.org>,
"vadfed@...a.com" <vadfed@...a.com>,
"jonathan.lemon@...il.com" <jonathan.lemon@...il.com>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"corbet@....net" <corbet@....net>,
"davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"vadfed@...com" <vadfed@...com>,
"Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
"Nguyen, Anthony L" <anthony.l.nguyen@...el.com>,
"M, Saeed" <saeedm@...dia.com>,
"leon@...nel.org" <leon@...nel.org>,
"richardcochran@...il.com" <richardcochran@...il.com>,
"sj@...nel.org" <sj@...nel.org>,
"javierm@...hat.com" <javierm@...hat.com>,
"ricardo.canuelo@...labora.com" <ricardo.canuelo@...labora.com>,
"mst@...hat.com" <mst@...hat.com>,
"tzimmermann@...e.de" <tzimmermann@...e.de>,
"Michalik, Michal" <michal.michalik@...el.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"jacek.lawrynowicz@...ux.intel.com"
<jacek.lawrynowicz@...ux.intel.com>,
"airlied@...hat.com" <airlied@...hat.com>,
"ogabbay@...nel.org" <ogabbay@...nel.org>,
"arnd@...db.de" <arnd@...db.de>,
"nipun.gupta@....com" <nipun.gupta@....com>,
"axboe@...nel.dk" <axboe@...nel.dk>,
"linux@...y.sk" <linux@...y.sk>,
"masahiroy@...nel.org" <masahiroy@...nel.org>,
"benjamin.tissoires@...hat.com" <benjamin.tissoires@...hat.com>,
"geert+renesas@...der.be" <geert+renesas@...der.be>,
"Olech, Milena" <milena.olech@...el.com>,
"kuniyu@...zon.com" <kuniyu@...zon.com>,
"liuhangbin@...il.com" <liuhangbin@...il.com>,
"hkallweit1@...il.com" <hkallweit1@...il.com>,
"andy.ren@...cruise.com" <andy.ren@...cruise.com>,
"razor@...ckwall.org" <razor@...ckwall.org>,
"idosch@...dia.com" <idosch@...dia.com>,
"lucien.xin@...il.com" <lucien.xin@...il.com>,
"nicolas.dichtel@...nd.com" <nicolas.dichtel@...nd.com>,
"phil@....cc" <phil@....cc>,
"claudiajkang@...il.com" <claudiajkang@...il.com>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
mschmidt <mschmidt@...hat.com>,
"linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
"vadim.fedorenko@...ux.dev" <vadim.fedorenko@...ux.dev>,
Jiri Pirko <jiri@...dia.com>
Subject: RE: [RFC PATCH v8 06/10] netdev: expose DPLL pin handle for netdevice
>From: Jiri Pirko <jiri@...nulli.us>
>Sent: Tuesday, June 13, 2023 3:52 PM
>
>Mon, Jun 12, 2023 at 11:17:23AM CEST, poros@...hat.com wrote:
>>Arkadiusz Kubalewski píše v Pá 09. 06. 2023 v 14:18 +0200:
>>> From: Jiri Pirko <jiri@...dia.com>
>
>[...]
>
>
>>> +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;
Powered by blists - more mailing lists