diff mbox

[net-next,2/2] sunvnet: implement basic ethtool get_settings

Message ID 1498061394-233018-3-git-send-email-shannon.nelson@oracle.com
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Shannon Nelson June 21, 2017, 4:09 p.m. UTC
Add the get_settings callback so that both the ldmvsw and sunvnet
drivers will give a little more information when asked for its
basic settings.  These aren't necessarily very useful, but they
make some users happier.  Also, a side effect is that the speed
attribute in /sys/class/net/<dev> is now readable, which makes
a couple of the ldom management tools happier.

Orabug: 26175474

Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
---
 drivers/net/ethernet/sun/ldmvsw.c         |    1 +
 drivers/net/ethernet/sun/sunvnet.c        |    1 +
 drivers/net/ethernet/sun/sunvnet_common.c |   11 +++++++++++
 drivers/net/ethernet/sun/sunvnet_common.h |    2 ++
 4 files changed, 15 insertions(+), 0 deletions(-)

Comments

David Miller June 21, 2017, 7:06 p.m. UTC | #1
From: Shannon Nelson <shannon.nelson@oracle.com>
Date: Wed, 21 Jun 2017 09:09:54 -0700

> Add the get_settings callback so that both the ldmvsw and sunvnet
> drivers will give a little more information when asked for its
> basic settings.  These aren't necessarily very useful, but they
> make some users happier.  Also, a side effect is that the speed
> attribute in /sys/class/net/<dev> is now readable, which makes
> a couple of the ldom management tools happier.
> 
> Orabug: 26175474
> 
> Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>

I would set the speed to something other than zero, and also
consider the ramifications of this change upon things like
'bonding' and 'team'.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shannon Nelson June 21, 2017, 8:59 p.m. UTC | #2
On 6/21/2017 12:06 PM, David Miller wrote:
> From: Shannon Nelson <shannon.nelson@oracle.com>
> Date: Wed, 21 Jun 2017 09:09:54 -0700
> 
>> Add the get_settings callback so that both the ldmvsw and sunvnet
>> drivers will give a little more information when asked for its
>> basic settings.  These aren't necessarily very useful, but they
>> make some users happier.  Also, a side effect is that the speed
>> attribute in /sys/class/net/<dev> is now readable, which makes
>> a couple of the ldom management tools happier.
>>
>> Orabug: 26175474
>>
>> Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
> 
> I would set the speed to something other than zero, and also

I kept looking at that and wasn't sure which value to pretend with.  I 
looked at what was reported in the Solaris world and saw '0' so went 
with that.  I suppose using SPEED_10000 shouldn't hurt anything, and is 
close enough to observed client-to-client speeds.

> consider the ramifications of this change upon things like
> 'bonding' and 'team'.

The request I was responding to with this was really more targeted at 
the ldmvsw (host) side of the connection, the vif device, which I 
believe only ever gets connected to the vsw bridge.  You're right, tho', 
because the eth0 in the ldom client *does* get sucked into teams.  I may 
drop the sunvnet/client side of this patch and stick with just the 
host/ldmvsw side.

Thanks,
sln
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller June 21, 2017, 9:28 p.m. UTC | #3
From: Shannon Nelson <shannon.nelson@oracle.com>
Date: Wed, 21 Jun 2017 13:59:45 -0700

> On 6/21/2017 12:06 PM, David Miller wrote:
>> From: Shannon Nelson <shannon.nelson@oracle.com>
>> Date: Wed, 21 Jun 2017 09:09:54 -0700
>> 
>>> Add the get_settings callback so that both the ldmvsw and sunvnet
>>> drivers will give a little more information when asked for its
>>> basic settings.  These aren't necessarily very useful, but they
>>> make some users happier.  Also, a side effect is that the speed
>>> attribute in /sys/class/net/<dev> is now readable, which makes
>>> a couple of the ldom management tools happier.
>>>
>>> Orabug: 26175474
>>>
>>> Signed-off-by: Shannon Nelson <shannon.nelson@oracle.com>
>> I would set the speed to something other than zero, and also
> 
> I kept looking at that and wasn't sure which value to pretend with.  I
> looked at what was reported in the Solaris world and saw '0' so went
> with that.  I suppose using SPEED_10000 shouldn't hurt anything, and
> is close enough to observed client-to-client speeds.
> 
>> consider the ramifications of this change upon things like
>> 'bonding' and 'team'.
> 
> The request I was responding to with this was really more targeted at
> the ldmvsw (host) side of the connection, the vif device, which I
> believe only ever gets connected to the vsw bridge.  You're right,
> tho', because the eth0 in the ldom client *does* get sucked into
> teams.  I may drop the sunvnet/client side of this patch and stick
> with just the host/ldmvsw side.

Usually if possible you propagate the speed of the underlying physical
layer, if applicable.

You can see what some other software devices do in the case of ethtool
link speed settings.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/sun/ldmvsw.c b/drivers/net/ethernet/sun/ldmvsw.c
index de512ef..0ac389b 100644
--- a/drivers/net/ethernet/sun/ldmvsw.c
+++ b/drivers/net/ethernet/sun/ldmvsw.c
@@ -88,6 +88,7 @@  static void vsw_set_msglevel(struct net_device *dev, u32 value)
 }
 
 static const struct ethtool_ops vsw_ethtool_ops = {
+	.get_settings		= sunvnet_get_settings,
 	.get_drvinfo		= vsw_get_drvinfo,
 	.get_msglevel		= vsw_get_msglevel,
 	.set_msglevel		= vsw_set_msglevel,
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index 75b167e..d16c351 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -189,6 +189,7 @@  static void vnet_get_ethtool_stats(struct net_device *dev,
 }
 
 static const struct ethtool_ops vnet_ethtool_ops = {
+	.get_settings		= sunvnet_get_settings,
 	.get_drvinfo		= vnet_get_drvinfo,
 	.get_msglevel		= vnet_get_msglevel,
 	.set_msglevel		= vnet_set_msglevel,
diff --git a/drivers/net/ethernet/sun/sunvnet_common.c b/drivers/net/ethernet/sun/sunvnet_common.c
index 9e86833..6ca27b0 100644
--- a/drivers/net/ethernet/sun/sunvnet_common.c
+++ b/drivers/net/ethernet/sun/sunvnet_common.c
@@ -1759,3 +1759,14 @@  void sunvnet_port_rm_txq_common(struct vnet_port *port)
 	port->q_index = 0;
 }
 EXPORT_SYMBOL_GPL(sunvnet_port_rm_txq_common);
+
+int sunvnet_get_settings(struct net_device *netdev,
+			 struct ethtool_cmd *ecmd)
+{
+	ethtool_cmd_speed_set(ecmd, 0);
+	ecmd->duplex = DUPLEX_FULL;
+	ecmd->port = PORT_NONE;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(sunvnet_get_settings);
diff --git a/drivers/net/ethernet/sun/sunvnet_common.h b/drivers/net/ethernet/sun/sunvnet_common.h
index b20d6fa..c566ec9 100644
--- a/drivers/net/ethernet/sun/sunvnet_common.h
+++ b/drivers/net/ethernet/sun/sunvnet_common.h
@@ -151,5 +151,7 @@  int sunvnet_start_xmit_common(struct sk_buff *skb, struct net_device *dev,
 bool sunvnet_port_is_up_common(struct vnet_port *vnet);
 void sunvnet_port_add_txq_common(struct vnet_port *port);
 void sunvnet_port_rm_txq_common(struct vnet_port *port);
+int sunvnet_get_settings(struct net_device *netdev,
+			 struct ethtool_cmd *ecmd);
 
 #endif /* _SUNVNETCOMMON_H */