Commit e9838ef2 authored by WingMan Kwok's avatar WingMan Kwok Committed by David S. Miller

net: netcp: ethss: fix errors in ethtool ops

In ethtool ops, it needs to retrieve the corresponding
ethss module (gbe or xgbe) from the net_device structure.
Prior to this patch, the retrieving procedure only
checks for the gbe module.  This patch fixes the issue
by checking the xgbe module if the net_device structure
does not correspond to the gbe module.
Signed-off-by: default avatarWingMan Kwok <w-kwok2@ti.com>
Signed-off-by: default avatarMurali Karicheri <m-karicheri2@ti.com>
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 04fddde3
...@@ -1746,6 +1746,17 @@ static void keystone_set_msglevel(struct net_device *ndev, u32 value) ...@@ -1746,6 +1746,17 @@ static void keystone_set_msglevel(struct net_device *ndev, u32 value)
netcp->msg_enable = value; netcp->msg_enable = value;
} }
static struct gbe_intf *keystone_get_intf_data(struct netcp_intf *netcp)
{
struct gbe_intf *gbe_intf;
gbe_intf = netcp_module_get_intf_data(&gbe_module, netcp);
if (!gbe_intf)
gbe_intf = netcp_module_get_intf_data(&xgbe_module, netcp);
return gbe_intf;
}
static void keystone_get_stat_strings(struct net_device *ndev, static void keystone_get_stat_strings(struct net_device *ndev,
uint32_t stringset, uint8_t *data) uint32_t stringset, uint8_t *data)
{ {
...@@ -1754,7 +1765,7 @@ static void keystone_get_stat_strings(struct net_device *ndev, ...@@ -1754,7 +1765,7 @@ static void keystone_get_stat_strings(struct net_device *ndev,
struct gbe_priv *gbe_dev; struct gbe_priv *gbe_dev;
int i; int i;
gbe_intf = netcp_module_get_intf_data(&gbe_module, netcp); gbe_intf = keystone_get_intf_data(netcp);
if (!gbe_intf) if (!gbe_intf)
return; return;
gbe_dev = gbe_intf->gbe_dev; gbe_dev = gbe_intf->gbe_dev;
...@@ -1778,7 +1789,7 @@ static int keystone_get_sset_count(struct net_device *ndev, int stringset) ...@@ -1778,7 +1789,7 @@ static int keystone_get_sset_count(struct net_device *ndev, int stringset)
struct gbe_intf *gbe_intf; struct gbe_intf *gbe_intf;
struct gbe_priv *gbe_dev; struct gbe_priv *gbe_dev;
gbe_intf = netcp_module_get_intf_data(&gbe_module, netcp); gbe_intf = keystone_get_intf_data(netcp);
if (!gbe_intf) if (!gbe_intf)
return -EINVAL; return -EINVAL;
gbe_dev = gbe_intf->gbe_dev; gbe_dev = gbe_intf->gbe_dev;
...@@ -1896,7 +1907,7 @@ static void keystone_get_ethtool_stats(struct net_device *ndev, ...@@ -1896,7 +1907,7 @@ static void keystone_get_ethtool_stats(struct net_device *ndev,
struct gbe_intf *gbe_intf; struct gbe_intf *gbe_intf;
struct gbe_priv *gbe_dev; struct gbe_priv *gbe_dev;
gbe_intf = netcp_module_get_intf_data(&gbe_module, netcp); gbe_intf = keystone_get_intf_data(netcp);
if (!gbe_intf) if (!gbe_intf)
return; return;
...@@ -1920,7 +1931,7 @@ static int keystone_get_link_ksettings(struct net_device *ndev, ...@@ -1920,7 +1931,7 @@ static int keystone_get_link_ksettings(struct net_device *ndev,
if (!phy) if (!phy)
return -EINVAL; return -EINVAL;
gbe_intf = netcp_module_get_intf_data(&gbe_module, netcp); gbe_intf = keystone_get_intf_data(netcp);
if (!gbe_intf) if (!gbe_intf)
return -EINVAL; return -EINVAL;
...@@ -1953,7 +1964,7 @@ static int keystone_set_link_ksettings(struct net_device *ndev, ...@@ -1953,7 +1964,7 @@ static int keystone_set_link_ksettings(struct net_device *ndev,
if (!phy) if (!phy)
return -EINVAL; return -EINVAL;
gbe_intf = netcp_module_get_intf_data(&gbe_module, netcp); gbe_intf = keystone_get_intf_data(netcp);
if (!gbe_intf) if (!gbe_intf)
return -EINVAL; return -EINVAL;
......
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