netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next] team: add ethtool support
@ 2012-12-30  2:37 Flavio Leitner
  2012-12-30  8:51 ` Jiri Pirko
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Flavio Leitner @ 2012-12-30  2:37 UTC (permalink / raw)
  To: netdev; +Cc: Jiri Pirko, Flavio Leitner

This patch adds few ethtool operations to team driver.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
---
v2 - removed generic statistics from ethtool

 drivers/net/team/team.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index ad86660..7665a088 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -28,6 +28,7 @@
 #include <net/genetlink.h>
 #include <net/netlink.h>
 #include <net/sch_generic.h>
+#include <generated/utsrelease.h>
 #include <linux/if_team.h>
 
 #define DRV_NAME "team"
@@ -1731,6 +1732,21 @@ static const struct net_device_ops team_netdev_ops = {
 	.ndo_fix_features	= team_fix_features,
 };
 
+/***********************
+ * ethtool interface
+ ***********************/
+
+static void team_ethtool_get_drvinfo(struct net_device *dev,
+				     struct ethtool_drvinfo *drvinfo)
+{
+	strncpy(drvinfo->driver, DRV_NAME, 32);
+	strncpy(drvinfo->version, UTS_RELEASE, 32);
+}
+
+static const struct ethtool_ops team_ethtool_ops = {
+	.get_drvinfo		= team_ethtool_get_drvinfo,
+	.get_link		= ethtool_op_get_link,
+};
 
 /***********************
  * rt netlink interface
@@ -1780,6 +1796,7 @@ static void team_setup(struct net_device *dev)
 	ether_setup(dev);
 
 	dev->netdev_ops = &team_netdev_ops;
+	dev->ethtool_ops = &team_ethtool_ops;
 	dev->destructor	= team_destructor;
 	dev->tx_queue_len = 0;
 	dev->flags |= IFF_MULTICAST;
-- 
1.8.0.1

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

* Re: [PATCH v2 net-next] team: add ethtool support
  2012-12-30  2:37 [PATCH v2 net-next] team: add ethtool support Flavio Leitner
@ 2012-12-30  8:51 ` Jiri Pirko
  2012-12-30 10:33 ` David Miller
  2012-12-31 22:16 ` Ben Hutchings
  2 siblings, 0 replies; 5+ messages in thread
From: Jiri Pirko @ 2012-12-30  8:51 UTC (permalink / raw)
  To: Flavio Leitner; +Cc: netdev

Sun, Dec 30, 2012 at 03:37:33AM CET, fbl@redhat.com wrote:
>This patch adds few ethtool operations to team driver.
>
>Signed-off-by: Flavio Leitner <fbl@redhat.com>
>---
>v2 - removed generic statistics from ethtool
>
> drivers/net/team/team.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index ad86660..7665a088 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -28,6 +28,7 @@
> #include <net/genetlink.h>
> #include <net/netlink.h>
> #include <net/sch_generic.h>
>+#include <generated/utsrelease.h>
> #include <linux/if_team.h>
> 
> #define DRV_NAME "team"
>@@ -1731,6 +1732,21 @@ static const struct net_device_ops team_netdev_ops = {
> 	.ndo_fix_features	= team_fix_features,
> };
> 
>+/***********************
>+ * ethtool interface
>+ ***********************/
>+
>+static void team_ethtool_get_drvinfo(struct net_device *dev,
>+				     struct ethtool_drvinfo *drvinfo)
>+{
>+	strncpy(drvinfo->driver, DRV_NAME, 32);
>+	strncpy(drvinfo->version, UTS_RELEASE, 32);
>+}
>+
>+static const struct ethtool_ops team_ethtool_ops = {
>+	.get_drvinfo		= team_ethtool_get_drvinfo,
>+	.get_link		= ethtool_op_get_link,
>+};
> 
> /***********************
>  * rt netlink interface
>@@ -1780,6 +1796,7 @@ static void team_setup(struct net_device *dev)
> 	ether_setup(dev);
> 
> 	dev->netdev_ops = &team_netdev_ops;
>+	dev->ethtool_ops = &team_ethtool_ops;
> 	dev->destructor	= team_destructor;
> 	dev->tx_queue_len = 0;
> 	dev->flags |= IFF_MULTICAST;
>-- 
>1.8.0.1
>

Acked-by: Jiri Pirko <jiri@resnulli.us>

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

* Re: [PATCH v2 net-next] team: add ethtool support
  2012-12-30  2:37 [PATCH v2 net-next] team: add ethtool support Flavio Leitner
  2012-12-30  8:51 ` Jiri Pirko
@ 2012-12-30 10:33 ` David Miller
  2012-12-31 22:16 ` Ben Hutchings
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2012-12-30 10:33 UTC (permalink / raw)
  To: fbl; +Cc: netdev, jiri

From: Flavio Leitner <fbl@redhat.com>
Date: Sun, 30 Dec 2012 00:37:33 -0200

> This patch adds few ethtool operations to team driver.
> 
> Signed-off-by: Flavio Leitner <fbl@redhat.com>

Applied.

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

* Re: [PATCH v2 net-next] team: add ethtool support
  2012-12-30  2:37 [PATCH v2 net-next] team: add ethtool support Flavio Leitner
  2012-12-30  8:51 ` Jiri Pirko
  2012-12-30 10:33 ` David Miller
@ 2012-12-31 22:16 ` Ben Hutchings
  2013-01-03 12:32   ` Flavio Leitner
  2 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2012-12-31 22:16 UTC (permalink / raw)
  To: Flavio Leitner; +Cc: netdev, Jiri Pirko

On Sun, 2012-12-30 at 00:37 -0200, Flavio Leitner wrote:
> This patch adds few ethtool operations to team driver.
> 
> Signed-off-by: Flavio Leitner <fbl@redhat.com>
> ---
> v2 - removed generic statistics from ethtool
> 
>  drivers/net/team/team.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
> index ad86660..7665a088 100644
> --- a/drivers/net/team/team.c
> +++ b/drivers/net/team/team.c
[...]
> +static void team_ethtool_get_drvinfo(struct net_device *dev,
> +				     struct ethtool_drvinfo *drvinfo)
> +{
> +	strncpy(drvinfo->driver, DRV_NAME, 32);
> +	strncpy(drvinfo->version, UTS_RELEASE, 32);
> +}
[...]

These must be null-terminated, so use strlcpy() not strncpy().

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.

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

* Re: [PATCH v2 net-next] team: add ethtool support
  2012-12-31 22:16 ` Ben Hutchings
@ 2013-01-03 12:32   ` Flavio Leitner
  0 siblings, 0 replies; 5+ messages in thread
From: Flavio Leitner @ 2013-01-03 12:32 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: netdev, Jiri Pirko

On Mon, Dec 31, 2012 at 10:16:26PM +0000, Ben Hutchings wrote:
> On Sun, 2012-12-30 at 00:37 -0200, Flavio Leitner wrote:
> > This patch adds few ethtool operations to team driver.
> > 
> > Signed-off-by: Flavio Leitner <fbl@redhat.com>
> > ---
> > v2 - removed generic statistics from ethtool
> > 
> >  drivers/net/team/team.c | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> > 
> > diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
> > index ad86660..7665a088 100644
> > --- a/drivers/net/team/team.c
> > +++ b/drivers/net/team/team.c
> [...]
> > +static void team_ethtool_get_drvinfo(struct net_device *dev,
> > +				     struct ethtool_drvinfo *drvinfo)
> > +{
> > +	strncpy(drvinfo->driver, DRV_NAME, 32);
> > +	strncpy(drvinfo->version, UTS_RELEASE, 32);
> > +}
> [...]
> 
> These must be null-terminated, so use strlcpy() not strncpy().

Ok, I will post another patch fixing this and few other  drivers as
well.

Thank you!
-- 
fbl

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

end of thread, other threads:[~2013-01-03 12:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-30  2:37 [PATCH v2 net-next] team: add ethtool support Flavio Leitner
2012-12-30  8:51 ` Jiri Pirko
2012-12-30 10:33 ` David Miller
2012-12-31 22:16 ` Ben Hutchings
2013-01-03 12:32   ` Flavio Leitner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).