diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2011-04-18 09:31:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-19 02:03:58 -0400 |
commit | b437a8cc7de4c9d8d0bdb37e7621c119f7640967 (patch) | |
tree | 607185508bf82d05f000a4af9c2e9b22791c27ce | |
parent | e5cb966c0838e4da43a3b0751bdcac7fe719f7b4 (diff) |
net: s2io: convert to hw_features
This removes advertising HW_CSUM as driver does not support it.
Note: driver advertises TSO6 but not IPV6_CSUM - bug maybe?
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/s2io.c | 100 |
1 files changed, 20 insertions, 80 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 2302d9743744..58b78f46e54f 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -6618,25 +6618,6 @@ static int s2io_ethtool_get_regs_len(struct net_device *dev) | |||
6618 | } | 6618 | } |
6619 | 6619 | ||
6620 | 6620 | ||
6621 | static u32 s2io_ethtool_get_rx_csum(struct net_device *dev) | ||
6622 | { | ||
6623 | struct s2io_nic *sp = netdev_priv(dev); | ||
6624 | |||
6625 | return sp->rx_csum; | ||
6626 | } | ||
6627 | |||
6628 | static int s2io_ethtool_set_rx_csum(struct net_device *dev, u32 data) | ||
6629 | { | ||
6630 | struct s2io_nic *sp = netdev_priv(dev); | ||
6631 | |||
6632 | if (data) | ||
6633 | sp->rx_csum = 1; | ||
6634 | else | ||
6635 | sp->rx_csum = 0; | ||
6636 | |||
6637 | return 0; | ||
6638 | } | ||
6639 | |||
6640 | static int s2io_get_eeprom_len(struct net_device *dev) | 6621 | static int s2io_get_eeprom_len(struct net_device *dev) |
6641 | { | 6622 | { |
6642 | return XENA_EEPROM_SPACE; | 6623 | return XENA_EEPROM_SPACE; |
@@ -6688,61 +6669,27 @@ static void s2io_ethtool_get_strings(struct net_device *dev, | |||
6688 | } | 6669 | } |
6689 | } | 6670 | } |
6690 | 6671 | ||
6691 | static int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) | 6672 | static int s2io_set_features(struct net_device *dev, u32 features) |
6692 | { | ||
6693 | if (data) | ||
6694 | dev->features |= NETIF_F_IP_CSUM; | ||
6695 | else | ||
6696 | dev->features &= ~NETIF_F_IP_CSUM; | ||
6697 | |||
6698 | return 0; | ||
6699 | } | ||
6700 | |||
6701 | static u32 s2io_ethtool_op_get_tso(struct net_device *dev) | ||
6702 | { | ||
6703 | return (dev->features & NETIF_F_TSO) != 0; | ||
6704 | } | ||
6705 | |||
6706 | static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data) | ||
6707 | { | ||
6708 | if (data) | ||
6709 | dev->features |= (NETIF_F_TSO | NETIF_F_TSO6); | ||
6710 | else | ||
6711 | dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6); | ||
6712 | |||
6713 | return 0; | ||
6714 | } | ||
6715 | |||
6716 | static int s2io_ethtool_set_flags(struct net_device *dev, u32 data) | ||
6717 | { | 6673 | { |
6718 | struct s2io_nic *sp = netdev_priv(dev); | 6674 | struct s2io_nic *sp = netdev_priv(dev); |
6719 | int rc = 0; | 6675 | u32 changed = (features ^ dev->features) & NETIF_F_LRO; |
6720 | int changed = 0; | ||
6721 | |||
6722 | if (ethtool_invalid_flags(dev, data, ETH_FLAG_LRO)) | ||
6723 | return -EINVAL; | ||
6724 | |||
6725 | if (data & ETH_FLAG_LRO) { | ||
6726 | if (!(dev->features & NETIF_F_LRO)) { | ||
6727 | dev->features |= NETIF_F_LRO; | ||
6728 | changed = 1; | ||
6729 | } | ||
6730 | } else if (dev->features & NETIF_F_LRO) { | ||
6731 | dev->features &= ~NETIF_F_LRO; | ||
6732 | changed = 1; | ||
6733 | } | ||
6734 | 6676 | ||
6735 | if (changed && netif_running(dev)) { | 6677 | if (changed && netif_running(dev)) { |
6678 | int rc; | ||
6679 | |||
6736 | s2io_stop_all_tx_queue(sp); | 6680 | s2io_stop_all_tx_queue(sp); |
6737 | s2io_card_down(sp); | 6681 | s2io_card_down(sp); |
6682 | dev->features = features; | ||
6738 | rc = s2io_card_up(sp); | 6683 | rc = s2io_card_up(sp); |
6739 | if (rc) | 6684 | if (rc) |
6740 | s2io_reset(sp); | 6685 | s2io_reset(sp); |
6741 | else | 6686 | else |
6742 | s2io_start_all_tx_queue(sp); | 6687 | s2io_start_all_tx_queue(sp); |
6688 | |||
6689 | return rc ? rc : 1; | ||
6743 | } | 6690 | } |
6744 | 6691 | ||
6745 | return rc; | 6692 | return 0; |
6746 | } | 6693 | } |
6747 | 6694 | ||
6748 | static const struct ethtool_ops netdev_ethtool_ops = { | 6695 | static const struct ethtool_ops netdev_ethtool_ops = { |
@@ -6758,15 +6705,6 @@ static const struct ethtool_ops netdev_ethtool_ops = { | |||
6758 | .get_ringparam = s2io_ethtool_gringparam, | 6705 | .get_ringparam = s2io_ethtool_gringparam, |
6759 | .get_pauseparam = s2io_ethtool_getpause_data, | 6706 | .get_pauseparam = s2io_ethtool_getpause_data, |
6760 | .set_pauseparam = s2io_ethtool_setpause_data, | 6707 | .set_pauseparam = s2io_ethtool_setpause_data, |
6761 | .get_rx_csum = s2io_ethtool_get_rx_csum, | ||
6762 | .set_rx_csum = s2io_ethtool_set_rx_csum, | ||
6763 | .set_tx_csum = s2io_ethtool_op_set_tx_csum, | ||
6764 | .set_flags = s2io_ethtool_set_flags, | ||
6765 | .get_flags = ethtool_op_get_flags, | ||
6766 | .set_sg = ethtool_op_set_sg, | ||
6767 | .get_tso = s2io_ethtool_op_get_tso, | ||
6768 | .set_tso = s2io_ethtool_op_set_tso, | ||
6769 | .set_ufo = ethtool_op_set_ufo, | ||
6770 | .self_test = s2io_ethtool_test, | 6708 | .self_test = s2io_ethtool_test, |
6771 | .get_strings = s2io_ethtool_get_strings, | 6709 | .get_strings = s2io_ethtool_get_strings, |
6772 | .set_phys_id = s2io_ethtool_set_led, | 6710 | .set_phys_id = s2io_ethtool_set_led, |
@@ -7538,7 +7476,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp) | |||
7538 | if ((rxdp->Control_1 & TCP_OR_UDP_FRAME) && | 7476 | if ((rxdp->Control_1 & TCP_OR_UDP_FRAME) && |
7539 | ((!ring_data->lro) || | 7477 | ((!ring_data->lro) || |
7540 | (ring_data->lro && (!(rxdp->Control_1 & RXD_FRAME_IP_FRAG)))) && | 7478 | (ring_data->lro && (!(rxdp->Control_1 & RXD_FRAME_IP_FRAG)))) && |
7541 | (sp->rx_csum)) { | 7479 | (dev->features & NETIF_F_RXCSUM)) { |
7542 | l3_csum = RXD_GET_L3_CKSUM(rxdp->Control_1); | 7480 | l3_csum = RXD_GET_L3_CKSUM(rxdp->Control_1); |
7543 | l4_csum = RXD_GET_L4_CKSUM(rxdp->Control_1); | 7481 | l4_csum = RXD_GET_L4_CKSUM(rxdp->Control_1); |
7544 | if ((l3_csum == L3_CKSUM_OK) && (l4_csum == L4_CKSUM_OK)) { | 7482 | if ((l3_csum == L3_CKSUM_OK) && (l4_csum == L4_CKSUM_OK)) { |
@@ -7799,6 +7737,7 @@ static const struct net_device_ops s2io_netdev_ops = { | |||
7799 | .ndo_do_ioctl = s2io_ioctl, | 7737 | .ndo_do_ioctl = s2io_ioctl, |
7800 | .ndo_set_mac_address = s2io_set_mac_addr, | 7738 | .ndo_set_mac_address = s2io_set_mac_addr, |
7801 | .ndo_change_mtu = s2io_change_mtu, | 7739 | .ndo_change_mtu = s2io_change_mtu, |
7740 | .ndo_set_features = s2io_set_features, | ||
7802 | .ndo_vlan_rx_register = s2io_vlan_rx_register, | 7741 | .ndo_vlan_rx_register = s2io_vlan_rx_register, |
7803 | .ndo_vlan_rx_kill_vid = s2io_vlan_rx_kill_vid, | 7742 | .ndo_vlan_rx_kill_vid = s2io_vlan_rx_kill_vid, |
7804 | .ndo_tx_timeout = s2io_tx_watchdog, | 7743 | .ndo_tx_timeout = s2io_tx_watchdog, |
@@ -8040,17 +7979,18 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
8040 | /* Driver entry points */ | 7979 | /* Driver entry points */ |
8041 | dev->netdev_ops = &s2io_netdev_ops; | 7980 | dev->netdev_ops = &s2io_netdev_ops; |
8042 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 7981 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
8043 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | 7982 | dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | |
8044 | dev->features |= NETIF_F_LRO; | 7983 | NETIF_F_TSO | NETIF_F_TSO6 | |
8045 | dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; | 7984 | NETIF_F_RXCSUM | NETIF_F_LRO; |
7985 | dev->features |= dev->hw_features | | ||
7986 | NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | ||
7987 | if (sp->device_type & XFRAME_II_DEVICE) { | ||
7988 | dev->hw_features |= NETIF_F_UFO; | ||
7989 | if (ufo) | ||
7990 | dev->features |= NETIF_F_UFO; | ||
7991 | } | ||
8046 | if (sp->high_dma_flag == true) | 7992 | if (sp->high_dma_flag == true) |
8047 | dev->features |= NETIF_F_HIGHDMA; | 7993 | dev->features |= NETIF_F_HIGHDMA; |
8048 | dev->features |= NETIF_F_TSO; | ||
8049 | dev->features |= NETIF_F_TSO6; | ||
8050 | if ((sp->device_type & XFRAME_II_DEVICE) && (ufo)) { | ||
8051 | dev->features |= NETIF_F_UFO; | ||
8052 | dev->features |= NETIF_F_HW_CSUM; | ||
8053 | } | ||
8054 | dev->watchdog_timeo = WATCH_DOG_TIMEOUT; | 7994 | dev->watchdog_timeo = WATCH_DOG_TIMEOUT; |
8055 | INIT_WORK(&sp->rst_timer_task, s2io_restart_nic); | 7995 | INIT_WORK(&sp->rst_timer_task, s2io_restart_nic); |
8056 | INIT_WORK(&sp->set_link_task, s2io_set_link); | 7996 | INIT_WORK(&sp->set_link_task, s2io_set_link); |