diff options
Diffstat (limited to 'drivers/net/netxen/netxen_nic_ethtool.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 116 |
1 files changed, 115 insertions, 1 deletions
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 381d55a52162..48ee06b6f4e9 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -752,6 +752,117 @@ static int netxen_nic_set_rx_csum(struct net_device *dev, u32 data) | |||
752 | return 0; | 752 | return 0; |
753 | } | 753 | } |
754 | 754 | ||
755 | static u32 netxen_nic_get_tso(struct net_device *dev) | ||
756 | { | ||
757 | struct netxen_adapter *adapter = netdev_priv(dev); | ||
758 | |||
759 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
760 | return (dev->features & (NETIF_F_TSO | NETIF_F_TSO6)) != 0; | ||
761 | |||
762 | return (dev->features & NETIF_F_TSO) != 0; | ||
763 | } | ||
764 | |||
765 | static int netxen_nic_set_tso(struct net_device *dev, u32 data) | ||
766 | { | ||
767 | if (data) { | ||
768 | struct netxen_adapter *adapter = netdev_priv(dev); | ||
769 | |||
770 | dev->features |= NETIF_F_TSO; | ||
771 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
772 | dev->features |= NETIF_F_TSO6; | ||
773 | } else | ||
774 | dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6); | ||
775 | |||
776 | return 0; | ||
777 | } | ||
778 | |||
779 | /* | ||
780 | * Set the coalescing parameters. Currently only normal is supported. | ||
781 | * If rx_coalesce_usecs == 0 or rx_max_coalesced_frames == 0 then set the | ||
782 | * firmware coalescing to default. | ||
783 | */ | ||
784 | static int netxen_set_intr_coalesce(struct net_device *netdev, | ||
785 | struct ethtool_coalesce *ethcoal) | ||
786 | { | ||
787 | struct netxen_adapter *adapter = netdev_priv(netdev); | ||
788 | |||
789 | if (!NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
790 | return -EINVAL; | ||
791 | |||
792 | if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) | ||
793 | return -EINVAL; | ||
794 | |||
795 | /* | ||
796 | * Return Error if unsupported values or | ||
797 | * unsupported parameters are set. | ||
798 | */ | ||
799 | if (ethcoal->rx_coalesce_usecs > 0xffff || | ||
800 | ethcoal->rx_max_coalesced_frames > 0xffff || | ||
801 | ethcoal->tx_coalesce_usecs > 0xffff || | ||
802 | ethcoal->tx_max_coalesced_frames > 0xffff || | ||
803 | ethcoal->rx_coalesce_usecs_irq || | ||
804 | ethcoal->rx_max_coalesced_frames_irq || | ||
805 | ethcoal->tx_coalesce_usecs_irq || | ||
806 | ethcoal->tx_max_coalesced_frames_irq || | ||
807 | ethcoal->stats_block_coalesce_usecs || | ||
808 | ethcoal->use_adaptive_rx_coalesce || | ||
809 | ethcoal->use_adaptive_tx_coalesce || | ||
810 | ethcoal->pkt_rate_low || | ||
811 | ethcoal->rx_coalesce_usecs_low || | ||
812 | ethcoal->rx_max_coalesced_frames_low || | ||
813 | ethcoal->tx_coalesce_usecs_low || | ||
814 | ethcoal->tx_max_coalesced_frames_low || | ||
815 | ethcoal->pkt_rate_high || | ||
816 | ethcoal->rx_coalesce_usecs_high || | ||
817 | ethcoal->rx_max_coalesced_frames_high || | ||
818 | ethcoal->tx_coalesce_usecs_high || | ||
819 | ethcoal->tx_max_coalesced_frames_high) | ||
820 | return -EINVAL; | ||
821 | |||
822 | if (!ethcoal->rx_coalesce_usecs || | ||
823 | !ethcoal->rx_max_coalesced_frames) { | ||
824 | adapter->coal.flags = NETXEN_NIC_INTR_DEFAULT; | ||
825 | adapter->coal.normal.data.rx_time_us = | ||
826 | NETXEN_DEFAULT_INTR_COALESCE_RX_TIME_US; | ||
827 | adapter->coal.normal.data.rx_packets = | ||
828 | NETXEN_DEFAULT_INTR_COALESCE_RX_PACKETS; | ||
829 | } else { | ||
830 | adapter->coal.flags = 0; | ||
831 | adapter->coal.normal.data.rx_time_us = | ||
832 | ethcoal->rx_coalesce_usecs; | ||
833 | adapter->coal.normal.data.rx_packets = | ||
834 | ethcoal->rx_max_coalesced_frames; | ||
835 | } | ||
836 | adapter->coal.normal.data.tx_time_us = ethcoal->tx_coalesce_usecs; | ||
837 | adapter->coal.normal.data.tx_packets = | ||
838 | ethcoal->tx_max_coalesced_frames; | ||
839 | |||
840 | netxen_config_intr_coalesce(adapter); | ||
841 | |||
842 | return 0; | ||
843 | } | ||
844 | |||
845 | static int netxen_get_intr_coalesce(struct net_device *netdev, | ||
846 | struct ethtool_coalesce *ethcoal) | ||
847 | { | ||
848 | struct netxen_adapter *adapter = netdev_priv(netdev); | ||
849 | |||
850 | if (!NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
851 | return -EINVAL; | ||
852 | |||
853 | if (adapter->is_up != NETXEN_ADAPTER_UP_MAGIC) | ||
854 | return -EINVAL; | ||
855 | |||
856 | ethcoal->rx_coalesce_usecs = adapter->coal.normal.data.rx_time_us; | ||
857 | ethcoal->tx_coalesce_usecs = adapter->coal.normal.data.tx_time_us; | ||
858 | ethcoal->rx_max_coalesced_frames = | ||
859 | adapter->coal.normal.data.rx_packets; | ||
860 | ethcoal->tx_max_coalesced_frames = | ||
861 | adapter->coal.normal.data.tx_packets; | ||
862 | |||
863 | return 0; | ||
864 | } | ||
865 | |||
755 | struct ethtool_ops netxen_nic_ethtool_ops = { | 866 | struct ethtool_ops netxen_nic_ethtool_ops = { |
756 | .get_settings = netxen_nic_get_settings, | 867 | .get_settings = netxen_nic_get_settings, |
757 | .set_settings = netxen_nic_set_settings, | 868 | .set_settings = netxen_nic_set_settings, |
@@ -769,11 +880,14 @@ struct ethtool_ops netxen_nic_ethtool_ops = { | |||
769 | .set_pauseparam = netxen_nic_set_pauseparam, | 880 | .set_pauseparam = netxen_nic_set_pauseparam, |
770 | .set_tx_csum = ethtool_op_set_tx_csum, | 881 | .set_tx_csum = ethtool_op_set_tx_csum, |
771 | .set_sg = ethtool_op_set_sg, | 882 | .set_sg = ethtool_op_set_sg, |
772 | .set_tso = ethtool_op_set_tso, | 883 | .get_tso = netxen_nic_get_tso, |
884 | .set_tso = netxen_nic_set_tso, | ||
773 | .self_test = netxen_nic_diag_test, | 885 | .self_test = netxen_nic_diag_test, |
774 | .get_strings = netxen_nic_get_strings, | 886 | .get_strings = netxen_nic_get_strings, |
775 | .get_ethtool_stats = netxen_nic_get_ethtool_stats, | 887 | .get_ethtool_stats = netxen_nic_get_ethtool_stats, |
776 | .get_sset_count = netxen_get_sset_count, | 888 | .get_sset_count = netxen_get_sset_count, |
777 | .get_rx_csum = netxen_nic_get_rx_csum, | 889 | .get_rx_csum = netxen_nic_get_rx_csum, |
778 | .set_rx_csum = netxen_nic_set_rx_csum, | 890 | .set_rx_csum = netxen_nic_set_rx_csum, |
891 | .get_coalesce = netxen_get_intr_coalesce, | ||
892 | .set_coalesce = netxen_set_intr_coalesce, | ||
779 | }; | 893 | }; |