aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/myri10ge/myri10ge.c66
1 files changed, 12 insertions, 54 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 1446de59ae53..e7f801643c12 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -205,7 +205,6 @@ struct myri10ge_priv {
205 int tx_boundary; /* boundary transmits cannot cross */ 205 int tx_boundary; /* boundary transmits cannot cross */
206 int num_slices; 206 int num_slices;
207 int running; /* running? */ 207 int running; /* running? */
208 int csum_flag; /* rx_csums? */
209 int small_bytes; 208 int small_bytes;
210 int big_bytes; 209 int big_bytes;
211 int max_intr_slots; 210 int max_intr_slots;
@@ -1386,7 +1385,7 @@ myri10ge_rx_done(struct myri10ge_slice_state *ss, int len, __wsum csum,
1386 skb->protocol = eth_type_trans(skb, dev); 1385 skb->protocol = eth_type_trans(skb, dev);
1387 skb_record_rx_queue(skb, ss - &mgp->ss[0]); 1386 skb_record_rx_queue(skb, ss - &mgp->ss[0]);
1388 1387
1389 if (mgp->csum_flag) { 1388 if (dev->features & NETIF_F_RXCSUM) {
1390 if ((skb->protocol == htons(ETH_P_IP)) || 1389 if ((skb->protocol == htons(ETH_P_IP)) ||
1391 (skb->protocol == htons(ETH_P_IPV6))) { 1390 (skb->protocol == htons(ETH_P_IPV6))) {
1392 skb->csum = csum; 1391 skb->csum = csum;
@@ -1757,43 +1756,6 @@ myri10ge_get_ringparam(struct net_device *netdev,
1757 ring->tx_pending = ring->tx_max_pending; 1756 ring->tx_pending = ring->tx_max_pending;
1758} 1757}
1759 1758
1760static u32 myri10ge_get_rx_csum(struct net_device *netdev)
1761{
1762 struct myri10ge_priv *mgp = netdev_priv(netdev);
1763
1764 if (mgp->csum_flag)
1765 return 1;
1766 else
1767 return 0;
1768}
1769
1770static int myri10ge_set_rx_csum(struct net_device *netdev, u32 csum_enabled)
1771{
1772 struct myri10ge_priv *mgp = netdev_priv(netdev);
1773 int err = 0;
1774
1775 if (csum_enabled)
1776 mgp->csum_flag = MXGEFW_FLAGS_CKSUM;
1777 else {
1778 netdev->features &= ~NETIF_F_LRO;
1779 mgp->csum_flag = 0;
1780
1781 }
1782 return err;
1783}
1784
1785static int myri10ge_set_tso(struct net_device *netdev, u32 tso_enabled)
1786{
1787 struct myri10ge_priv *mgp = netdev_priv(netdev);
1788 u32 flags = mgp->features & (NETIF_F_TSO6 | NETIF_F_TSO);
1789
1790 if (tso_enabled)
1791 netdev->features |= flags;
1792 else
1793 netdev->features &= ~flags;
1794 return 0;
1795}
1796
1797static const char myri10ge_gstrings_main_stats[][ETH_GSTRING_LEN] = { 1759static const char myri10ge_gstrings_main_stats[][ETH_GSTRING_LEN] = {
1798 "rx_packets", "tx_packets", "rx_bytes", "tx_bytes", "rx_errors", 1760 "rx_packets", "tx_packets", "rx_bytes", "tx_bytes", "rx_errors",
1799 "tx_errors", "rx_dropped", "tx_dropped", "multicast", "collisions", 1761 "tx_errors", "rx_dropped", "tx_dropped", "multicast", "collisions",
@@ -1944,11 +1906,6 @@ static u32 myri10ge_get_msglevel(struct net_device *netdev)
1944 return mgp->msg_enable; 1906 return mgp->msg_enable;
1945} 1907}
1946 1908
1947static int myri10ge_set_flags(struct net_device *netdev, u32 value)
1948{
1949 return ethtool_op_set_flags(netdev, value, ETH_FLAG_LRO);
1950}
1951
1952static const struct ethtool_ops myri10ge_ethtool_ops = { 1909static const struct ethtool_ops myri10ge_ethtool_ops = {
1953 .get_settings = myri10ge_get_settings, 1910 .get_settings = myri10ge_get_settings,
1954 .get_drvinfo = myri10ge_get_drvinfo, 1911 .get_drvinfo = myri10ge_get_drvinfo,
@@ -1957,19 +1914,12 @@ static const struct ethtool_ops myri10ge_ethtool_ops = {
1957 .get_pauseparam = myri10ge_get_pauseparam, 1914 .get_pauseparam = myri10ge_get_pauseparam,
1958 .set_pauseparam = myri10ge_set_pauseparam, 1915 .set_pauseparam = myri10ge_set_pauseparam,
1959 .get_ringparam = myri10ge_get_ringparam, 1916 .get_ringparam = myri10ge_get_ringparam,
1960 .get_rx_csum = myri10ge_get_rx_csum,
1961 .set_rx_csum = myri10ge_set_rx_csum,
1962 .set_tx_csum = ethtool_op_set_tx_hw_csum,
1963 .set_sg = ethtool_op_set_sg,
1964 .set_tso = myri10ge_set_tso,
1965 .get_link = ethtool_op_get_link, 1917 .get_link = ethtool_op_get_link,
1966 .get_strings = myri10ge_get_strings, 1918 .get_strings = myri10ge_get_strings,
1967 .get_sset_count = myri10ge_get_sset_count, 1919 .get_sset_count = myri10ge_get_sset_count,
1968 .get_ethtool_stats = myri10ge_get_ethtool_stats, 1920 .get_ethtool_stats = myri10ge_get_ethtool_stats,
1969 .set_msglevel = myri10ge_set_msglevel, 1921 .set_msglevel = myri10ge_set_msglevel,
1970 .get_msglevel = myri10ge_get_msglevel, 1922 .get_msglevel = myri10ge_get_msglevel,
1971 .get_flags = ethtool_op_get_flags,
1972 .set_flags = myri10ge_set_flags
1973}; 1923};
1974 1924
1975static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss) 1925static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss)
@@ -3136,6 +3086,14 @@ static int myri10ge_set_mac_address(struct net_device *dev, void *addr)
3136 return 0; 3086 return 0;
3137} 3087}
3138 3088
3089static u32 myri10ge_fix_features(struct net_device *dev, u32 features)
3090{
3091 if (!(features & NETIF_F_RXCSUM))
3092 features &= ~NETIF_F_LRO;
3093
3094 return features;
3095}
3096
3139static int myri10ge_change_mtu(struct net_device *dev, int new_mtu) 3097static int myri10ge_change_mtu(struct net_device *dev, int new_mtu)
3140{ 3098{
3141 struct myri10ge_priv *mgp = netdev_priv(dev); 3099 struct myri10ge_priv *mgp = netdev_priv(dev);
@@ -3834,6 +3792,7 @@ static const struct net_device_ops myri10ge_netdev_ops = {
3834 .ndo_get_stats = myri10ge_get_stats, 3792 .ndo_get_stats = myri10ge_get_stats,
3835 .ndo_validate_addr = eth_validate_addr, 3793 .ndo_validate_addr = eth_validate_addr,
3836 .ndo_change_mtu = myri10ge_change_mtu, 3794 .ndo_change_mtu = myri10ge_change_mtu,
3795 .ndo_fix_features = myri10ge_fix_features,
3837 .ndo_set_multicast_list = myri10ge_set_multicast_list, 3796 .ndo_set_multicast_list = myri10ge_set_multicast_list,
3838 .ndo_set_mac_address = myri10ge_set_mac_address, 3797 .ndo_set_mac_address = myri10ge_set_mac_address,
3839}; 3798};
@@ -3860,7 +3819,6 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3860 mgp = netdev_priv(netdev); 3819 mgp = netdev_priv(netdev);
3861 mgp->dev = netdev; 3820 mgp->dev = netdev;
3862 mgp->pdev = pdev; 3821 mgp->pdev = pdev;
3863 mgp->csum_flag = MXGEFW_FLAGS_CKSUM;
3864 mgp->pause = myri10ge_flow_control; 3822 mgp->pause = myri10ge_flow_control;
3865 mgp->intr_coal_delay = myri10ge_intr_coal_delay; 3823 mgp->intr_coal_delay = myri10ge_intr_coal_delay;
3866 mgp->msg_enable = netif_msg_init(myri10ge_debug, MYRI10GE_MSG_DEFAULT); 3824 mgp->msg_enable = netif_msg_init(myri10ge_debug, MYRI10GE_MSG_DEFAULT);
@@ -3976,11 +3934,11 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3976 netdev->netdev_ops = &myri10ge_netdev_ops; 3934 netdev->netdev_ops = &myri10ge_netdev_ops;
3977 netdev->mtu = myri10ge_initial_mtu; 3935 netdev->mtu = myri10ge_initial_mtu;
3978 netdev->base_addr = mgp->iomem_base; 3936 netdev->base_addr = mgp->iomem_base;
3979 netdev->features = mgp->features; 3937 netdev->hw_features = mgp->features | NETIF_F_LRO | NETIF_F_RXCSUM;
3938 netdev->features = netdev->hw_features;
3980 3939
3981 if (dac_enabled) 3940 if (dac_enabled)
3982 netdev->features |= NETIF_F_HIGHDMA; 3941 netdev->features |= NETIF_F_HIGHDMA;
3983 netdev->features |= NETIF_F_LRO;
3984 3942
3985 netdev->vlan_features |= mgp->features; 3943 netdev->vlan_features |= mgp->features;
3986 if (mgp->fw_ver_tiny < 37) 3944 if (mgp->fw_ver_tiny < 37)