Thread (51 messages) 51 messages, 7 authors, 2014-10-26

Re: [PATCH 11/14] net: dsa: Add support for reading switch registers with ethtool

From: Guenter Roeck <linux@roeck-us.net>
Date: 2014-10-23 05:21:33
Also in: lkml

On 10/22/2014 09:40 PM, Florian Fainelli wrote:
2014-10-22 21:03 GMT-07:00 Guenter Roeck [off-list ref]:
quoted
Add support for reading switch registers with 'ethtool -d'.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
[snip]
quoted
+static int dsa_slave_get_regs_len(struct net_device *dev)
+{
+       struct dsa_slave_priv *p = netdev_priv(dev);
+       struct dsa_switch *ds = p->parent;
+
+       if (ds->drv->get_regs_len != NULL)
+               return ds->drv->get_regs_len(ds, p->port);
Most of the checks in this file are just:

if (ds->drv->callback)
      return ds->drv->callback(...)
Hi Florian,

To be fair, that wasn't the case when I wrote the code ;-).
No problem, I'll do the same.
quoted
+
+       return -EOPNOTSUPP;
+}
+
+static void
+dsa_slave_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *_p)
+{
+       struct dsa_slave_priv *p = netdev_priv(dev);
+       struct dsa_switch *ds = p->parent;
+
+       ds->drv->get_regs(ds, p->port, regs, _p);
We need to check that the driver does implement this callback here as well.
Obviously, and embarrassing ;-).

Thanks a lot for the review!
Guenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help