aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorIvan Mikhaylov <ivan@ru.ibm.com>2015-05-21 11:11:02 -0400
committerDavid S. Miller <davem@davemloft.net>2015-05-25 16:38:55 -0400
commit5369c71f7ca24f6472f8fa883e05fa7469fab284 (patch)
tree80f4a493dc8b175788dde88447ded26a6fe0f08d /drivers/net
parentc260c2f1e35621c41aaa0c7f5bddced3307f0039 (diff)
net/ibm/emac: fix size of emac dump memory areas
Fix in send of emac regs dump to ethtool which causing in wrong data interpretation on ethtool layer for MII and EMAC. Signed-off-by: Ivan Mikhaylov <ivan@ru.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/ibm/emac/core.c16
-rw-r--r--drivers/net/ethernet/ibm/emac/core.h7
2 files changed, 8 insertions, 15 deletions
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index de7919322190..b9df0cbd0a38 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -2084,12 +2084,8 @@ static void emac_ethtool_get_pauseparam(struct net_device *ndev,
2084 2084
2085static int emac_get_regs_len(struct emac_instance *dev) 2085static int emac_get_regs_len(struct emac_instance *dev)
2086{ 2086{
2087 if (emac_has_feature(dev, EMAC_FTR_EMAC4))
2088 return sizeof(struct emac_ethtool_regs_subhdr) +
2089 EMAC4_ETHTOOL_REGS_SIZE(dev);
2090 else
2091 return sizeof(struct emac_ethtool_regs_subhdr) + 2087 return sizeof(struct emac_ethtool_regs_subhdr) +
2092 EMAC_ETHTOOL_REGS_SIZE(dev); 2088 sizeof(struct emac_regs);
2093} 2089}
2094 2090
2095static int emac_ethtool_get_regs_len(struct net_device *ndev) 2091static int emac_ethtool_get_regs_len(struct net_device *ndev)
@@ -2114,15 +2110,15 @@ static void *emac_dump_regs(struct emac_instance *dev, void *buf)
2114 struct emac_ethtool_regs_subhdr *hdr = buf; 2110 struct emac_ethtool_regs_subhdr *hdr = buf;
2115 2111
2116 hdr->index = dev->cell_index; 2112 hdr->index = dev->cell_index;
2117 if (emac_has_feature(dev, EMAC_FTR_EMAC4)) { 2113 if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) {
2114 hdr->version = EMAC4SYNC_ETHTOOL_REGS_VER;
2115 } else if (emac_has_feature(dev, EMAC_FTR_EMAC4)) {
2118 hdr->version = EMAC4_ETHTOOL_REGS_VER; 2116 hdr->version = EMAC4_ETHTOOL_REGS_VER;
2119 memcpy_fromio(hdr + 1, dev->emacp, EMAC4_ETHTOOL_REGS_SIZE(dev));
2120 return (void *)(hdr + 1) + EMAC4_ETHTOOL_REGS_SIZE(dev);
2121 } else { 2117 } else {
2122 hdr->version = EMAC_ETHTOOL_REGS_VER; 2118 hdr->version = EMAC_ETHTOOL_REGS_VER;
2123 memcpy_fromio(hdr + 1, dev->emacp, EMAC_ETHTOOL_REGS_SIZE(dev));
2124 return (void *)(hdr + 1) + EMAC_ETHTOOL_REGS_SIZE(dev);
2125 } 2119 }
2120 memcpy_fromio(hdr + 1, dev->emacp, sizeof(struct emac_regs));
2121 return (void *)(hdr + 1) + sizeof(struct emac_regs);
2126} 2122}
2127 2123
2128static void emac_ethtool_get_regs(struct net_device *ndev, 2124static void emac_ethtool_get_regs(struct net_device *ndev,
diff --git a/drivers/net/ethernet/ibm/emac/core.h b/drivers/net/ethernet/ibm/emac/core.h
index 67f342a9f65e..28df37420da9 100644
--- a/drivers/net/ethernet/ibm/emac/core.h
+++ b/drivers/net/ethernet/ibm/emac/core.h
@@ -461,10 +461,7 @@ struct emac_ethtool_regs_subhdr {
461}; 461};
462 462
463#define EMAC_ETHTOOL_REGS_VER 0 463#define EMAC_ETHTOOL_REGS_VER 0
464#define EMAC_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \ 464#define EMAC4_ETHTOOL_REGS_VER 1
465 (dev)->rsrc_regs.start + 1) 465#define EMAC4SYNC_ETHTOOL_REGS_VER 2
466#define EMAC4_ETHTOOL_REGS_VER 1
467#define EMAC4_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \
468 (dev)->rsrc_regs.start + 1)
469 466
470#endif /* __IBM_NEWEMAC_CORE_H */ 467#endif /* __IBM_NEWEMAC_CORE_H */