diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_drv.c | 40 | ||||
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_ethtool.c | 67 | ||||
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_int.h | 7 |
3 files changed, 28 insertions, 86 deletions
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 0d47c3a05307..7a494f79c88f 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -1082,7 +1082,7 @@ vmxnet3_rx_csum(struct vmxnet3_adapter *adapter, | |||
1082 | struct sk_buff *skb, | 1082 | struct sk_buff *skb, |
1083 | union Vmxnet3_GenericDesc *gdesc) | 1083 | union Vmxnet3_GenericDesc *gdesc) |
1084 | { | 1084 | { |
1085 | if (!gdesc->rcd.cnc && adapter->rxcsum) { | 1085 | if (!gdesc->rcd.cnc && adapter->netdev->features & NETIF_F_RXCSUM) { |
1086 | /* typical case: TCP/UDP over IP and both csums are correct */ | 1086 | /* typical case: TCP/UDP over IP and both csums are correct */ |
1087 | if ((le32_to_cpu(gdesc->dword[3]) & VMXNET3_RCD_CSUM_OK) == | 1087 | if ((le32_to_cpu(gdesc->dword[3]) & VMXNET3_RCD_CSUM_OK) == |
1088 | VMXNET3_RCD_CSUM_OK) { | 1088 | VMXNET3_RCD_CSUM_OK) { |
@@ -2081,10 +2081,10 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter) | |||
2081 | devRead->misc.ddLen = cpu_to_le32(sizeof(struct vmxnet3_adapter)); | 2081 | devRead->misc.ddLen = cpu_to_le32(sizeof(struct vmxnet3_adapter)); |
2082 | 2082 | ||
2083 | /* set up feature flags */ | 2083 | /* set up feature flags */ |
2084 | if (adapter->rxcsum) | 2084 | if (adapter->netdev->features & NETIF_F_RXCSUM) |
2085 | devRead->misc.uptFeatures |= UPT1_F_RXCSUM; | 2085 | devRead->misc.uptFeatures |= UPT1_F_RXCSUM; |
2086 | 2086 | ||
2087 | if (adapter->lro) { | 2087 | if (adapter->netdev->features & NETIF_F_LRO) { |
2088 | devRead->misc.uptFeatures |= UPT1_F_LRO; | 2088 | devRead->misc.uptFeatures |= UPT1_F_LRO; |
2089 | devRead->misc.maxNumRxSG = cpu_to_le16(1 + MAX_SKB_FRAGS); | 2089 | devRead->misc.maxNumRxSG = cpu_to_le16(1 + MAX_SKB_FRAGS); |
2090 | } | 2090 | } |
@@ -2593,9 +2593,6 @@ vmxnet3_change_mtu(struct net_device *netdev, int new_mtu) | |||
2593 | if (new_mtu < VMXNET3_MIN_MTU || new_mtu > VMXNET3_MAX_MTU) | 2593 | if (new_mtu < VMXNET3_MIN_MTU || new_mtu > VMXNET3_MAX_MTU) |
2594 | return -EINVAL; | 2594 | return -EINVAL; |
2595 | 2595 | ||
2596 | if (new_mtu > 1500 && !adapter->jumbo_frame) | ||
2597 | return -EINVAL; | ||
2598 | |||
2599 | netdev->mtu = new_mtu; | 2596 | netdev->mtu = new_mtu; |
2600 | 2597 | ||
2601 | /* | 2598 | /* |
@@ -2641,28 +2638,18 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64) | |||
2641 | { | 2638 | { |
2642 | struct net_device *netdev = adapter->netdev; | 2639 | struct net_device *netdev = adapter->netdev; |
2643 | 2640 | ||
2644 | netdev->features = NETIF_F_SG | | 2641 | netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM | |
2645 | NETIF_F_HW_CSUM | | 2642 | NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_TX | |
2646 | NETIF_F_HW_VLAN_TX | | 2643 | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO; |
2647 | NETIF_F_HW_VLAN_RX | | 2644 | if (dma64) |
2648 | NETIF_F_HW_VLAN_FILTER | | ||
2649 | NETIF_F_TSO | | ||
2650 | NETIF_F_TSO6 | | ||
2651 | NETIF_F_LRO; | ||
2652 | |||
2653 | printk(KERN_INFO "features: sg csum vlan jf tso tsoIPv6 lro"); | ||
2654 | |||
2655 | adapter->rxcsum = true; | ||
2656 | adapter->jumbo_frame = true; | ||
2657 | adapter->lro = true; | ||
2658 | |||
2659 | if (dma64) { | ||
2660 | netdev->features |= NETIF_F_HIGHDMA; | 2645 | netdev->features |= NETIF_F_HIGHDMA; |
2661 | printk(" highDMA"); | 2646 | netdev->vlan_features = netdev->hw_features & ~NETIF_F_HW_VLAN_TX; |
2662 | } | 2647 | netdev->features = netdev->hw_features | |
2648 | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; | ||
2663 | 2649 | ||
2664 | netdev->vlan_features = netdev->features; | 2650 | netdev_info(adapter->netdev, |
2665 | printk("\n"); | 2651 | "features: sg csum vlan jf tso tsoIPv6 lro%s\n", |
2652 | dma64 ? " highDMA" : ""); | ||
2666 | } | 2653 | } |
2667 | 2654 | ||
2668 | 2655 | ||
@@ -2874,6 +2861,7 @@ vmxnet3_probe_device(struct pci_dev *pdev, | |||
2874 | .ndo_start_xmit = vmxnet3_xmit_frame, | 2861 | .ndo_start_xmit = vmxnet3_xmit_frame, |
2875 | .ndo_set_mac_address = vmxnet3_set_mac_addr, | 2862 | .ndo_set_mac_address = vmxnet3_set_mac_addr, |
2876 | .ndo_change_mtu = vmxnet3_change_mtu, | 2863 | .ndo_change_mtu = vmxnet3_change_mtu, |
2864 | .ndo_set_features = vmxnet3_set_features, | ||
2877 | .ndo_get_stats = vmxnet3_get_stats, | 2865 | .ndo_get_stats = vmxnet3_get_stats, |
2878 | .ndo_tx_timeout = vmxnet3_tx_timeout, | 2866 | .ndo_tx_timeout = vmxnet3_tx_timeout, |
2879 | .ndo_set_multicast_list = vmxnet3_set_mc, | 2867 | .ndo_set_multicast_list = vmxnet3_set_mc, |
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index 51f2ef142a5b..70c1ab96ed27 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c | |||
@@ -33,40 +33,6 @@ struct vmxnet3_stat_desc { | |||
33 | }; | 33 | }; |
34 | 34 | ||
35 | 35 | ||
36 | static u32 | ||
37 | vmxnet3_get_rx_csum(struct net_device *netdev) | ||
38 | { | ||
39 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
40 | return adapter->rxcsum; | ||
41 | } | ||
42 | |||
43 | |||
44 | static int | ||
45 | vmxnet3_set_rx_csum(struct net_device *netdev, u32 val) | ||
46 | { | ||
47 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | ||
48 | unsigned long flags; | ||
49 | |||
50 | if (adapter->rxcsum != val) { | ||
51 | adapter->rxcsum = val; | ||
52 | if (netif_running(netdev)) { | ||
53 | if (val) | ||
54 | adapter->shared->devRead.misc.uptFeatures |= | ||
55 | UPT1_F_RXCSUM; | ||
56 | else | ||
57 | adapter->shared->devRead.misc.uptFeatures &= | ||
58 | ~UPT1_F_RXCSUM; | ||
59 | |||
60 | spin_lock_irqsave(&adapter->cmd_lock, flags); | ||
61 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | ||
62 | VMXNET3_CMD_UPDATE_FEATURE); | ||
63 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); | ||
64 | } | ||
65 | } | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | |||
70 | /* per tq stats maintained by the device */ | 36 | /* per tq stats maintained by the device */ |
71 | static const struct vmxnet3_stat_desc | 37 | static const struct vmxnet3_stat_desc |
72 | vmxnet3_tq_dev_stats[] = { | 38 | vmxnet3_tq_dev_stats[] = { |
@@ -296,28 +262,27 @@ vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) | |||
296 | } | 262 | } |
297 | } | 263 | } |
298 | 264 | ||
299 | static int | 265 | int vmxnet3_set_features(struct net_device *netdev, u32 features) |
300 | vmxnet3_set_flags(struct net_device *netdev, u32 data) | ||
301 | { | 266 | { |
302 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | 267 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
303 | u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1; | ||
304 | u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1; | ||
305 | unsigned long flags; | 268 | unsigned long flags; |
269 | u32 changed = features ^ netdev->features; | ||
306 | 270 | ||
307 | if (ethtool_invalid_flags(netdev, data, ETH_FLAG_LRO)) | 271 | if (changed & (NETIF_F_RXCSUM|NETIF_F_LRO)) { |
308 | return -EINVAL; | 272 | if (features & NETIF_F_RXCSUM) |
309 | 273 | adapter->shared->devRead.misc.uptFeatures |= | |
310 | if (lro_requested ^ lro_present) { | 274 | UPT1_F_RXCSUM; |
311 | /* toggle the LRO feature*/ | 275 | else |
312 | netdev->features ^= NETIF_F_LRO; | 276 | adapter->shared->devRead.misc.uptFeatures &= |
277 | ~UPT1_F_RXCSUM; | ||
313 | 278 | ||
314 | /* update harware LRO capability accordingly */ | 279 | if (features & NETIF_F_LRO) |
315 | if (lro_requested) | ||
316 | adapter->shared->devRead.misc.uptFeatures |= | 280 | adapter->shared->devRead.misc.uptFeatures |= |
317 | UPT1_F_LRO; | 281 | UPT1_F_LRO; |
318 | else | 282 | else |
319 | adapter->shared->devRead.misc.uptFeatures &= | 283 | adapter->shared->devRead.misc.uptFeatures &= |
320 | ~UPT1_F_LRO; | 284 | ~UPT1_F_LRO; |
285 | |||
321 | spin_lock_irqsave(&adapter->cmd_lock, flags); | 286 | spin_lock_irqsave(&adapter->cmd_lock, flags); |
322 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | 287 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, |
323 | VMXNET3_CMD_UPDATE_FEATURE); | 288 | VMXNET3_CMD_UPDATE_FEATURE); |
@@ -654,17 +619,7 @@ static struct ethtool_ops vmxnet3_ethtool_ops = { | |||
654 | .get_wol = vmxnet3_get_wol, | 619 | .get_wol = vmxnet3_get_wol, |
655 | .set_wol = vmxnet3_set_wol, | 620 | .set_wol = vmxnet3_set_wol, |
656 | .get_link = ethtool_op_get_link, | 621 | .get_link = ethtool_op_get_link, |
657 | .get_rx_csum = vmxnet3_get_rx_csum, | ||
658 | .set_rx_csum = vmxnet3_set_rx_csum, | ||
659 | .get_tx_csum = ethtool_op_get_tx_csum, | ||
660 | .set_tx_csum = ethtool_op_set_tx_hw_csum, | ||
661 | .get_sg = ethtool_op_get_sg, | ||
662 | .set_sg = ethtool_op_set_sg, | ||
663 | .get_tso = ethtool_op_get_tso, | ||
664 | .set_tso = ethtool_op_set_tso, | ||
665 | .get_strings = vmxnet3_get_strings, | 622 | .get_strings = vmxnet3_get_strings, |
666 | .get_flags = ethtool_op_get_flags, | ||
667 | .set_flags = vmxnet3_set_flags, | ||
668 | .get_sset_count = vmxnet3_get_sset_count, | 623 | .get_sset_count = vmxnet3_get_sset_count, |
669 | .get_ethtool_stats = vmxnet3_get_ethtool_stats, | 624 | .get_ethtool_stats = vmxnet3_get_ethtool_stats, |
670 | .get_ringparam = vmxnet3_get_ringparam, | 625 | .get_ringparam = vmxnet3_get_ringparam, |
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index fb5d245ac878..8ba7b5f67de2 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
@@ -329,10 +329,6 @@ struct vmxnet3_adapter { | |||
329 | u8 __iomem *hw_addr0; /* for BAR 0 */ | 329 | u8 __iomem *hw_addr0; /* for BAR 0 */ |
330 | u8 __iomem *hw_addr1; /* for BAR 1 */ | 330 | u8 __iomem *hw_addr1; /* for BAR 1 */ |
331 | 331 | ||
332 | /* feature control */ | ||
333 | bool rxcsum; | ||
334 | bool lro; | ||
335 | bool jumbo_frame; | ||
336 | #ifdef VMXNET3_RSS | 332 | #ifdef VMXNET3_RSS |
337 | struct UPT1_RSSConf *rss_conf; | 333 | struct UPT1_RSSConf *rss_conf; |
338 | bool rss; | 334 | bool rss; |
@@ -404,6 +400,9 @@ void | |||
404 | vmxnet3_rq_destroy_all(struct vmxnet3_adapter *adapter); | 400 | vmxnet3_rq_destroy_all(struct vmxnet3_adapter *adapter); |
405 | 401 | ||
406 | int | 402 | int |
403 | vmxnet3_set_features(struct net_device *netdev, u32 features); | ||
404 | |||
405 | int | ||
407 | vmxnet3_create_queues(struct vmxnet3_adapter *adapter, | 406 | vmxnet3_create_queues(struct vmxnet3_adapter *adapter, |
408 | u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size); | 407 | u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size); |
409 | 408 | ||