aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic/qlcnic_ethtool.c
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-04-18 23:03:57 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-20 04:30:44 -0400
commit135d84a9f28854f875f32f97485737b0013c99d6 (patch)
tree5e42b4b9321c7a69908090efde029517cc868191 /drivers/net/qlcnic/qlcnic_ethtool.c
parentb9367bf3ee6da380e0c338bd75bb8e8e4e0b981b (diff)
net: qlcnic: convert to hw_features
Bit more than minimal conversion. There might be some issues because of qlcnic_set_netdev_features() if it's called after netdev init. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic/qlcnic_ethtool.c')
-rw-r--r--drivers/net/qlcnic/qlcnic_ethtool.c120
1 files changed, 0 insertions, 120 deletions
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 3cd8a169694a..615a5ab88456 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -764,73 +764,6 @@ qlcnic_get_ethtool_stats(struct net_device *dev,
764 qlcnic_fill_device_stats(&index, data, &port_stats.tx); 764 qlcnic_fill_device_stats(&index, data, &port_stats.tx);
765} 765}
766 766
767static int qlcnic_set_tx_csum(struct net_device *dev, u32 data)
768{
769 struct qlcnic_adapter *adapter = netdev_priv(dev);
770
771 if ((adapter->flags & QLCNIC_ESWITCH_ENABLED))
772 return -EOPNOTSUPP;
773 if (data)
774 dev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
775 else
776 dev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
777
778 return 0;
779
780}
781static u32 qlcnic_get_tx_csum(struct net_device *dev)
782{
783 return dev->features & NETIF_F_IP_CSUM;
784}
785
786static u32 qlcnic_get_rx_csum(struct net_device *dev)
787{
788 struct qlcnic_adapter *adapter = netdev_priv(dev);
789 return adapter->rx_csum;
790}
791
792static int qlcnic_set_rx_csum(struct net_device *dev, u32 data)
793{
794 struct qlcnic_adapter *adapter = netdev_priv(dev);
795
796 if ((adapter->flags & QLCNIC_ESWITCH_ENABLED))
797 return -EOPNOTSUPP;
798 if (!!data) {
799 adapter->rx_csum = !!data;
800 return 0;
801 }
802
803 if (dev->features & NETIF_F_LRO) {
804 if (qlcnic_config_hw_lro(adapter, QLCNIC_LRO_DISABLED))
805 return -EIO;
806
807 dev->features &= ~NETIF_F_LRO;
808 qlcnic_send_lro_cleanup(adapter);
809 dev_info(&adapter->pdev->dev,
810 "disabling LRO as rx_csum is off\n");
811 }
812 adapter->rx_csum = !!data;
813 return 0;
814}
815
816static u32 qlcnic_get_tso(struct net_device *dev)
817{
818 return (dev->features & (NETIF_F_TSO | NETIF_F_TSO6)) != 0;
819}
820
821static int qlcnic_set_tso(struct net_device *dev, u32 data)
822{
823 struct qlcnic_adapter *adapter = netdev_priv(dev);
824 if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_TSO))
825 return -EOPNOTSUPP;
826 if (data)
827 dev->features |= (NETIF_F_TSO | NETIF_F_TSO6);
828 else
829 dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
830
831 return 0;
832}
833
834static int qlcnic_set_led(struct net_device *dev, 767static int qlcnic_set_led(struct net_device *dev,
835 enum ethtool_phys_id_state state) 768 enum ethtool_phys_id_state state)
836{ 769{
@@ -993,50 +926,6 @@ static int qlcnic_get_intr_coalesce(struct net_device *netdev,
993 return 0; 926 return 0;
994} 927}
995 928
996static int qlcnic_set_flags(struct net_device *netdev, u32 data)
997{
998 struct qlcnic_adapter *adapter = netdev_priv(netdev);
999 int hw_lro;
1000
1001 if (ethtool_invalid_flags(netdev, data, ETH_FLAG_LRO))
1002 return -EINVAL;
1003
1004 if (data & ETH_FLAG_LRO) {
1005
1006 if (netdev->features & NETIF_F_LRO)
1007 return 0;
1008
1009 if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO))
1010 return -EINVAL;
1011
1012 if (!adapter->rx_csum) {
1013 dev_info(&adapter->pdev->dev, "rx csum is off, "
1014 "cannot toggle lro\n");
1015 return -EINVAL;
1016 }
1017
1018 hw_lro = QLCNIC_LRO_ENABLED;
1019 netdev->features |= NETIF_F_LRO;
1020
1021 } else {
1022
1023 if (!(netdev->features & NETIF_F_LRO))
1024 return 0;
1025
1026 hw_lro = 0;
1027 netdev->features &= ~NETIF_F_LRO;
1028 }
1029
1030 if (qlcnic_config_hw_lro(adapter, hw_lro))
1031 return -EIO;
1032
1033 if ((hw_lro == 0) && qlcnic_send_lro_cleanup(adapter))
1034 return -EIO;
1035
1036
1037 return 0;
1038}
1039
1040static u32 qlcnic_get_msglevel(struct net_device *netdev) 929static u32 qlcnic_get_msglevel(struct net_device *netdev)
1041{ 930{
1042 struct qlcnic_adapter *adapter = netdev_priv(netdev); 931 struct qlcnic_adapter *adapter = netdev_priv(netdev);
@@ -1064,23 +953,14 @@ const struct ethtool_ops qlcnic_ethtool_ops = {
1064 .set_ringparam = qlcnic_set_ringparam, 953 .set_ringparam = qlcnic_set_ringparam,
1065 .get_pauseparam = qlcnic_get_pauseparam, 954 .get_pauseparam = qlcnic_get_pauseparam,
1066 .set_pauseparam = qlcnic_set_pauseparam, 955 .set_pauseparam = qlcnic_set_pauseparam,
1067 .get_tx_csum = qlcnic_get_tx_csum,
1068 .set_tx_csum = qlcnic_set_tx_csum,
1069 .set_sg = ethtool_op_set_sg,
1070 .get_tso = qlcnic_get_tso,
1071 .set_tso = qlcnic_set_tso,
1072 .get_wol = qlcnic_get_wol, 956 .get_wol = qlcnic_get_wol,
1073 .set_wol = qlcnic_set_wol, 957 .set_wol = qlcnic_set_wol,
1074 .self_test = qlcnic_diag_test, 958 .self_test = qlcnic_diag_test,
1075 .get_strings = qlcnic_get_strings, 959 .get_strings = qlcnic_get_strings,
1076 .get_ethtool_stats = qlcnic_get_ethtool_stats, 960 .get_ethtool_stats = qlcnic_get_ethtool_stats,
1077 .get_sset_count = qlcnic_get_sset_count, 961 .get_sset_count = qlcnic_get_sset_count,
1078 .get_rx_csum = qlcnic_get_rx_csum,
1079 .set_rx_csum = qlcnic_set_rx_csum,
1080 .get_coalesce = qlcnic_get_intr_coalesce, 962 .get_coalesce = qlcnic_get_intr_coalesce,
1081 .set_coalesce = qlcnic_set_intr_coalesce, 963 .set_coalesce = qlcnic_set_intr_coalesce,
1082 .get_flags = ethtool_op_get_flags,
1083 .set_flags = qlcnic_set_flags,
1084 .set_phys_id = qlcnic_set_led, 964 .set_phys_id = qlcnic_set_led,
1085 .set_msglevel = qlcnic_set_msglevel, 965 .set_msglevel = qlcnic_set_msglevel,
1086 .get_msglevel = qlcnic_get_msglevel, 966 .get_msglevel = qlcnic_get_msglevel,