diff options
Diffstat (limited to 'drivers/net/enic')
-rw-r--r-- | drivers/net/enic/enic.h | 1 | ||||
-rw-r--r-- | drivers/net/enic/enic_main.c | 62 |
2 files changed, 37 insertions, 26 deletions
diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index fb83c926da58..9e0d484deb20 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h | |||
@@ -75,7 +75,6 @@ struct enic { | |||
75 | struct vnic_enet_config config; | 75 | struct vnic_enet_config config; |
76 | struct vnic_dev_bar bar0; | 76 | struct vnic_dev_bar bar0; |
77 | struct vnic_dev *vdev; | 77 | struct vnic_dev *vdev; |
78 | struct net_device_stats net_stats; | ||
79 | struct timer_list notify_timer; | 78 | struct timer_list notify_timer; |
80 | struct work_struct reset; | 79 | struct work_struct reset; |
81 | struct msix_entry msix_entry[ENIC_MSIX_MAX]; | 80 | struct msix_entry msix_entry[ENIC_MSIX_MAX]; |
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index e6d5f116ad77..03b646a5aec8 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include "enic.h" | 43 | #include "enic.h" |
44 | 44 | ||
45 | #define ENIC_NOTIFY_TIMER_PERIOD (2 * HZ) | 45 | #define ENIC_NOTIFY_TIMER_PERIOD (2 * HZ) |
46 | #define ENIC_JUMBO_FIRST_BUF_SIZE 256 | ||
47 | 46 | ||
48 | /* Supported devices */ | 47 | /* Supported devices */ |
49 | static struct pci_device_id enic_id_table[] = { | 48 | static struct pci_device_id enic_id_table[] = { |
@@ -167,9 +166,14 @@ static void enic_get_strings(struct net_device *netdev, u32 stringset, u8 *data) | |||
167 | } | 166 | } |
168 | } | 167 | } |
169 | 168 | ||
170 | static int enic_get_stats_count(struct net_device *netdev) | 169 | static int enic_get_sset_count(struct net_device *netdev, int sset) |
171 | { | 170 | { |
172 | return enic_n_tx_stats + enic_n_rx_stats; | 171 | switch (sset) { |
172 | case ETH_SS_STATS: | ||
173 | return enic_n_tx_stats + enic_n_rx_stats; | ||
174 | default: | ||
175 | return -EOPNOTSUPP; | ||
176 | } | ||
173 | } | 177 | } |
174 | 178 | ||
175 | static void enic_get_ethtool_stats(struct net_device *netdev, | 179 | static void enic_get_ethtool_stats(struct net_device *netdev, |
@@ -199,8 +203,10 @@ static int enic_set_rx_csum(struct net_device *netdev, u32 data) | |||
199 | { | 203 | { |
200 | struct enic *enic = netdev_priv(netdev); | 204 | struct enic *enic = netdev_priv(netdev); |
201 | 205 | ||
202 | enic->csum_rx_enabled = | 206 | if (data && !ENIC_SETTING(enic, RXCSUM)) |
203 | (data && ENIC_SETTING(enic, RXCSUM)) ? 1 : 0; | 207 | return -EINVAL; |
208 | |||
209 | enic->csum_rx_enabled = !!data; | ||
204 | 210 | ||
205 | return 0; | 211 | return 0; |
206 | } | 212 | } |
@@ -209,7 +215,10 @@ static int enic_set_tx_csum(struct net_device *netdev, u32 data) | |||
209 | { | 215 | { |
210 | struct enic *enic = netdev_priv(netdev); | 216 | struct enic *enic = netdev_priv(netdev); |
211 | 217 | ||
212 | if (data && ENIC_SETTING(enic, TXCSUM)) | 218 | if (data && !ENIC_SETTING(enic, TXCSUM)) |
219 | return -EINVAL; | ||
220 | |||
221 | if (data) | ||
213 | netdev->features |= NETIF_F_HW_CSUM; | 222 | netdev->features |= NETIF_F_HW_CSUM; |
214 | else | 223 | else |
215 | netdev->features &= ~NETIF_F_HW_CSUM; | 224 | netdev->features &= ~NETIF_F_HW_CSUM; |
@@ -221,7 +230,10 @@ static int enic_set_tso(struct net_device *netdev, u32 data) | |||
221 | { | 230 | { |
222 | struct enic *enic = netdev_priv(netdev); | 231 | struct enic *enic = netdev_priv(netdev); |
223 | 232 | ||
224 | if (data && ENIC_SETTING(enic, TSO)) | 233 | if (data && !ENIC_SETTING(enic, TSO)) |
234 | return -EINVAL; | ||
235 | |||
236 | if (data) | ||
225 | netdev->features |= | 237 | netdev->features |= |
226 | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN; | 238 | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN; |
227 | else | 239 | else |
@@ -250,7 +262,7 @@ static struct ethtool_ops enic_ethtool_ops = { | |||
250 | .set_msglevel = enic_set_msglevel, | 262 | .set_msglevel = enic_set_msglevel, |
251 | .get_link = ethtool_op_get_link, | 263 | .get_link = ethtool_op_get_link, |
252 | .get_strings = enic_get_strings, | 264 | .get_strings = enic_get_strings, |
253 | .get_stats_count = enic_get_stats_count, | 265 | .get_sset_count = enic_get_sset_count, |
254 | .get_ethtool_stats = enic_get_ethtool_stats, | 266 | .get_ethtool_stats = enic_get_ethtool_stats, |
255 | .get_rx_csum = enic_get_rx_csum, | 267 | .get_rx_csum = enic_get_rx_csum, |
256 | .set_rx_csum = enic_set_rx_csum, | 268 | .set_rx_csum = enic_set_rx_csum, |
@@ -652,25 +664,26 @@ static int enic_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
652 | static struct net_device_stats *enic_get_stats(struct net_device *netdev) | 664 | static struct net_device_stats *enic_get_stats(struct net_device *netdev) |
653 | { | 665 | { |
654 | struct enic *enic = netdev_priv(netdev); | 666 | struct enic *enic = netdev_priv(netdev); |
667 | struct net_device_stats *net_stats = &netdev->stats; | ||
655 | struct vnic_stats *stats; | 668 | struct vnic_stats *stats; |
656 | 669 | ||
657 | spin_lock(&enic->devcmd_lock); | 670 | spin_lock(&enic->devcmd_lock); |
658 | vnic_dev_stats_dump(enic->vdev, &stats); | 671 | vnic_dev_stats_dump(enic->vdev, &stats); |
659 | spin_unlock(&enic->devcmd_lock); | 672 | spin_unlock(&enic->devcmd_lock); |
660 | 673 | ||
661 | enic->net_stats.tx_packets = stats->tx.tx_frames_ok; | 674 | net_stats->tx_packets = stats->tx.tx_frames_ok; |
662 | enic->net_stats.tx_bytes = stats->tx.tx_bytes_ok; | 675 | net_stats->tx_bytes = stats->tx.tx_bytes_ok; |
663 | enic->net_stats.tx_errors = stats->tx.tx_errors; | 676 | net_stats->tx_errors = stats->tx.tx_errors; |
664 | enic->net_stats.tx_dropped = stats->tx.tx_drops; | 677 | net_stats->tx_dropped = stats->tx.tx_drops; |
665 | 678 | ||
666 | enic->net_stats.rx_packets = stats->rx.rx_frames_ok; | 679 | net_stats->rx_packets = stats->rx.rx_frames_ok; |
667 | enic->net_stats.rx_bytes = stats->rx.rx_bytes_ok; | 680 | net_stats->rx_bytes = stats->rx.rx_bytes_ok; |
668 | enic->net_stats.rx_errors = stats->rx.rx_errors; | 681 | net_stats->rx_errors = stats->rx.rx_errors; |
669 | enic->net_stats.multicast = stats->rx.rx_multicast_frames_ok; | 682 | net_stats->multicast = stats->rx.rx_multicast_frames_ok; |
670 | enic->net_stats.rx_crc_errors = stats->rx.rx_crc_errors; | 683 | net_stats->rx_crc_errors = stats->rx.rx_crc_errors; |
671 | enic->net_stats.rx_dropped = stats->rx.rx_no_bufs; | 684 | net_stats->rx_dropped = stats->rx.rx_no_bufs; |
672 | 685 | ||
673 | return &enic->net_stats; | 686 | return net_stats; |
674 | } | 687 | } |
675 | 688 | ||
676 | static void enic_reset_mcaddrs(struct enic *enic) | 689 | static void enic_reset_mcaddrs(struct enic *enic) |
@@ -1109,7 +1122,8 @@ static void enic_notify_timer(unsigned long data) | |||
1109 | 1122 | ||
1110 | enic_notify_check(enic); | 1123 | enic_notify_check(enic); |
1111 | 1124 | ||
1112 | mod_timer(&enic->notify_timer, round_jiffies(ENIC_NOTIFY_TIMER_PERIOD)); | 1125 | mod_timer(&enic->notify_timer, |
1126 | round_jiffies(jiffies + ENIC_NOTIFY_TIMER_PERIOD)); | ||
1113 | } | 1127 | } |
1114 | 1128 | ||
1115 | static void enic_free_intr(struct enic *enic) | 1129 | static void enic_free_intr(struct enic *enic) |
@@ -1313,14 +1327,12 @@ static int enic_change_mtu(struct net_device *netdev, int new_mtu) | |||
1313 | struct enic *enic = netdev_priv(netdev); | 1327 | struct enic *enic = netdev_priv(netdev); |
1314 | int running = netif_running(netdev); | 1328 | int running = netif_running(netdev); |
1315 | 1329 | ||
1330 | if (new_mtu < ENIC_MIN_MTU || new_mtu > ENIC_MAX_MTU) | ||
1331 | return -EINVAL; | ||
1332 | |||
1316 | if (running) | 1333 | if (running) |
1317 | enic_stop(netdev); | 1334 | enic_stop(netdev); |
1318 | 1335 | ||
1319 | if (new_mtu < ENIC_MIN_MTU) | ||
1320 | new_mtu = ENIC_MIN_MTU; | ||
1321 | if (new_mtu > ENIC_MAX_MTU) | ||
1322 | new_mtu = ENIC_MAX_MTU; | ||
1323 | |||
1324 | netdev->mtu = new_mtu; | 1336 | netdev->mtu = new_mtu; |
1325 | 1337 | ||
1326 | if (netdev->mtu > enic->port_mtu) | 1338 | if (netdev->mtu > enic->port_mtu) |