summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorWingMan Kwok <w-kwok2@ti.com>2016-12-19 17:55:56 -0500
committerDavid S. Miller <davem@davemloft.net>2016-12-20 14:07:17 -0500
commite9838ef2d6f3f3ccb058514d4ac03a6f6155ecc2 (patch)
tree71e7736c1c9d39dec43814c94797d5f0db036f99 /drivers/net
parent04fddde37642dd270ecb430b879f311536cfd6a5 (diff)
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: WingMan Kwok <w-kwok2@ti.com> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/ti/netcp_ethss.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
index c7e547e4f2b1..a31931cdac53 100644
--- a/drivers/net/ethernet/ti/netcp_ethss.c
+++ b/drivers/net/ethernet/ti/netcp_ethss.c
@@ -1746,6 +1746,17 @@ static void keystone_set_msglevel(struct net_device *ndev, u32 value)
1746 netcp->msg_enable = value; 1746 netcp->msg_enable = value;
1747} 1747}
1748 1748
1749static struct gbe_intf *keystone_get_intf_data(struct netcp_intf *netcp)
1750{
1751 struct gbe_intf *gbe_intf;
1752
1753 gbe_intf = netcp_module_get_intf_data(&gbe_module, netcp);
1754 if (!gbe_intf)
1755 gbe_intf = netcp_module_get_intf_data(&xgbe_module, netcp);
1756
1757 return gbe_intf;
1758}
1759
1749static void keystone_get_stat_strings(struct net_device *ndev, 1760static void keystone_get_stat_strings(struct net_device *ndev,
1750 uint32_t stringset, uint8_t *data) 1761 uint32_t stringset, uint8_t *data)
1751{ 1762{
@@ -1754,7 +1765,7 @@ static void keystone_get_stat_strings(struct net_device *ndev,
1754 struct gbe_priv *gbe_dev; 1765 struct gbe_priv *gbe_dev;
1755 int i; 1766 int i;
1756 1767
1757 gbe_intf = netcp_module_get_intf_data(&gbe_module, netcp); 1768 gbe_intf = keystone_get_intf_data(netcp);
1758 if (!gbe_intf) 1769 if (!gbe_intf)
1759 return; 1770 return;
1760 gbe_dev = gbe_intf->gbe_dev; 1771 gbe_dev = gbe_intf->gbe_dev;
@@ -1778,7 +1789,7 @@ static int keystone_get_sset_count(struct net_device *ndev, int stringset)
1778 struct gbe_intf *gbe_intf; 1789 struct gbe_intf *gbe_intf;
1779 struct gbe_priv *gbe_dev; 1790 struct gbe_priv *gbe_dev;
1780 1791
1781 gbe_intf = netcp_module_get_intf_data(&gbe_module, netcp); 1792 gbe_intf = keystone_get_intf_data(netcp);
1782 if (!gbe_intf) 1793 if (!gbe_intf)
1783 return -EINVAL; 1794 return -EINVAL;
1784 gbe_dev = gbe_intf->gbe_dev; 1795 gbe_dev = gbe_intf->gbe_dev;
@@ -1896,7 +1907,7 @@ static void keystone_get_ethtool_stats(struct net_device *ndev,
1896 struct gbe_intf *gbe_intf; 1907 struct gbe_intf *gbe_intf;
1897 struct gbe_priv *gbe_dev; 1908 struct gbe_priv *gbe_dev;
1898 1909
1899 gbe_intf = netcp_module_get_intf_data(&gbe_module, netcp); 1910 gbe_intf = keystone_get_intf_data(netcp);
1900 if (!gbe_intf) 1911 if (!gbe_intf)
1901 return; 1912 return;
1902 1913
@@ -1920,7 +1931,7 @@ static int keystone_get_link_ksettings(struct net_device *ndev,
1920 if (!phy) 1931 if (!phy)
1921 return -EINVAL; 1932 return -EINVAL;
1922 1933
1923 gbe_intf = netcp_module_get_intf_data(&gbe_module, netcp); 1934 gbe_intf = keystone_get_intf_data(netcp);
1924 if (!gbe_intf) 1935 if (!gbe_intf)
1925 return -EINVAL; 1936 return -EINVAL;
1926 1937
@@ -1953,7 +1964,7 @@ static int keystone_set_link_ksettings(struct net_device *ndev,
1953 if (!phy) 1964 if (!phy)
1954 return -EINVAL; 1965 return -EINVAL;
1955 1966
1956 gbe_intf = netcp_module_get_intf_data(&gbe_module, netcp); 1967 gbe_intf = keystone_get_intf_data(netcp);
1957 if (!gbe_intf) 1968 if (!gbe_intf)
1958 return -EINVAL; 1969 return -EINVAL;
1959 1970