Commit 5369c71f authored by Ivan Mikhaylov's avatar Ivan Mikhaylov Committed by David S. Miller

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: default avatarIvan Mikhaylov <ivan@ru.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c260c2f1
...@@ -2084,12 +2084,8 @@ static void emac_ethtool_get_pauseparam(struct net_device *ndev, ...@@ -2084,12 +2084,8 @@ static void emac_ethtool_get_pauseparam(struct net_device *ndev,
static int emac_get_regs_len(struct emac_instance *dev) static int emac_get_regs_len(struct emac_instance *dev)
{ {
if (emac_has_feature(dev, EMAC_FTR_EMAC4))
return sizeof(struct emac_ethtool_regs_subhdr) +
EMAC4_ETHTOOL_REGS_SIZE(dev);
else
return sizeof(struct emac_ethtool_regs_subhdr) + return sizeof(struct emac_ethtool_regs_subhdr) +
EMAC_ETHTOOL_REGS_SIZE(dev); sizeof(struct emac_regs);
} }
static int emac_ethtool_get_regs_len(struct net_device *ndev) static 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,15 +2110,15 @@ static void *emac_dump_regs(struct emac_instance *dev, void *buf)
struct emac_ethtool_regs_subhdr *hdr = buf; struct emac_ethtool_regs_subhdr *hdr = buf;
hdr->index = dev->cell_index; hdr->index = dev->cell_index;
if (emac_has_feature(dev, EMAC_FTR_EMAC4)) { if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) {
hdr->version = EMAC4SYNC_ETHTOOL_REGS_VER;
} else if (emac_has_feature(dev, EMAC_FTR_EMAC4)) {
hdr->version = EMAC4_ETHTOOL_REGS_VER; hdr->version = EMAC4_ETHTOOL_REGS_VER;
memcpy_fromio(hdr + 1, dev->emacp, EMAC4_ETHTOOL_REGS_SIZE(dev));
return (void *)(hdr + 1) + EMAC4_ETHTOOL_REGS_SIZE(dev);
} else { } else {
hdr->version = EMAC_ETHTOOL_REGS_VER; hdr->version = EMAC_ETHTOOL_REGS_VER;
memcpy_fromio(hdr + 1, dev->emacp, EMAC_ETHTOOL_REGS_SIZE(dev));
return (void *)(hdr + 1) + EMAC_ETHTOOL_REGS_SIZE(dev);
} }
memcpy_fromio(hdr + 1, dev->emacp, sizeof(struct emac_regs));
return (void *)(hdr + 1) + sizeof(struct emac_regs);
} }
static void emac_ethtool_get_regs(struct net_device *ndev, static void emac_ethtool_get_regs(struct net_device *ndev,
......
...@@ -461,10 +461,7 @@ struct emac_ethtool_regs_subhdr { ...@@ -461,10 +461,7 @@ struct emac_ethtool_regs_subhdr {
}; };
#define EMAC_ETHTOOL_REGS_VER 0 #define EMAC_ETHTOOL_REGS_VER 0
#define EMAC_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \ #define EMAC4_ETHTOOL_REGS_VER 1
(dev)->rsrc_regs.start + 1) #define EMAC4SYNC_ETHTOOL_REGS_VER 2
#define EMAC4_ETHTOOL_REGS_VER 1
#define EMAC4_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \
(dev)->rsrc_regs.start + 1)
#endif /* __IBM_NEWEMAC_CORE_H */ #endif /* __IBM_NEWEMAC_CORE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment