[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1374250030.2796.4.camel@bwh-desktop.uk.level5networks.com>
Date: Fri, 19 Jul 2013 17:07:10 +0100
From: Ben Hutchings <bhutchings@...arflare.com>
To: Jiri Pirko <jiri@...nulli.us>
CC: <netdev@...r.kernel.org>, <davem@...emloft.net>,
<stephen@...workplumber.org>, <Narendra_K@...l.com>,
<john.r.fastabend@...el.com>
Subject: Re: [patch net-next 2/3] rtnl: export physical port id via RT
netlink
On Fri, 2013-07-19 at 15:55 +0200, Jiri Pirko wrote:
> Signed-off-by: Jiri Pirko <jiri@...nulli.us>
> ---
> include/uapi/linux/if_link.h | 1 +
> net/core/rtnetlink.c | 25 ++++++++++++++++++++++++-
> 2 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
> index 03f6170..04c0e7a 100644
> --- a/include/uapi/linux/if_link.h
> +++ b/include/uapi/linux/if_link.h
[...]
> @@ -846,6 +847,24 @@ static int rtnl_port_fill(struct sk_buff *skb, struct net_device *dev)
> return 0;
> }
>
> +static int rtnl_phys_port_id_fill(struct sk_buff *skb, struct net_device *dev)
> +{
> + int err;
> + struct netdev_phys_port_id ppid;
> +
> + if (!dev->netdev_ops->ndo_get_phys_port_id)
> + return 0;
> +
> + err = dev->netdev_ops->ndo_get_phys_port_id(dev, &ppid);
> + if (err)
> + return err;
[...]
I can imagine a driver only sometimes being able to get the physical
port ID, depending on hardware variant or firmware version. That
shouldn't require defining another instance of net_device_ops. So if
the error is -EOPNOTSUPP this should return 0, same as if the function
pointer is NULL.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists