#include "enic.h"
#define ENIC_NOTIFY_TIMER_PERIOD (2 * HZ)
-#define ENIC_JUMBO_FIRST_BUF_SIZE 256
/* Supported devices */
static struct pci_device_id enic_id_table[] = {
}
}
-static int enic_get_stats_count(struct net_device *netdev)
+static int enic_get_sset_count(struct net_device *netdev, int sset)
{
- return enic_n_tx_stats + enic_n_rx_stats;
+ switch (sset) {
+ case ETH_SS_STATS:
+ return enic_n_tx_stats + enic_n_rx_stats;
+ default:
+ return -EOPNOTSUPP;
+ }
}
static void enic_get_ethtool_stats(struct net_device *netdev,
{
struct enic *enic = netdev_priv(netdev);
- enic->csum_rx_enabled =
- (data && ENIC_SETTING(enic, RXCSUM)) ? 1 : 0;
+ if (data && !ENIC_SETTING(enic, RXCSUM))
+ return -EINVAL;
+
+ enic->csum_rx_enabled = !!data;
return 0;
}
{
struct enic *enic = netdev_priv(netdev);
- if (data && ENIC_SETTING(enic, TXCSUM))
+ if (data && !ENIC_SETTING(enic, TXCSUM))
+ return -EINVAL;
+
+ if (data)
netdev->features |= NETIF_F_HW_CSUM;
else
netdev->features &= ~NETIF_F_HW_CSUM;
{
struct enic *enic = netdev_priv(netdev);
- if (data && ENIC_SETTING(enic, TSO))
+ if (data && !ENIC_SETTING(enic, TSO))
+ return -EINVAL;
+
+ if (data)
netdev->features |=
NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN;
else
.set_msglevel = enic_set_msglevel,
.get_link = ethtool_op_get_link,
.get_strings = enic_get_strings,
- .get_stats_count = enic_get_stats_count,
+ .get_sset_count = enic_get_sset_count,
.get_ethtool_stats = enic_get_ethtool_stats,
.get_rx_csum = enic_get_rx_csum,
.set_rx_csum = enic_set_rx_csum,
static struct net_device_stats *enic_get_stats(struct net_device *netdev)
{
struct enic *enic = netdev_priv(netdev);
+ struct net_device_stats *net_stats = &netdev->stats;
struct vnic_stats *stats;
spin_lock(&enic->devcmd_lock);
vnic_dev_stats_dump(enic->vdev, &stats);
spin_unlock(&enic->devcmd_lock);
- enic->net_stats.tx_packets = stats->tx.tx_frames_ok;
- enic->net_stats.tx_bytes = stats->tx.tx_bytes_ok;
- enic->net_stats.tx_errors = stats->tx.tx_errors;
- enic->net_stats.tx_dropped = stats->tx.tx_drops;
+ net_stats->tx_packets = stats->tx.tx_frames_ok;
+ net_stats->tx_bytes = stats->tx.tx_bytes_ok;
+ net_stats->tx_errors = stats->tx.tx_errors;
+ net_stats->tx_dropped = stats->tx.tx_drops;
- enic->net_stats.rx_packets = stats->rx.rx_frames_ok;
- enic->net_stats.rx_bytes = stats->rx.rx_bytes_ok;
- enic->net_stats.rx_errors = stats->rx.rx_errors;
- enic->net_stats.multicast = stats->rx.rx_multicast_frames_ok;
- enic->net_stats.rx_crc_errors = stats->rx.rx_crc_errors;
- enic->net_stats.rx_dropped = stats->rx.rx_no_bufs;
+ net_stats->rx_packets = stats->rx.rx_frames_ok;
+ net_stats->rx_bytes = stats->rx.rx_bytes_ok;
+ net_stats->rx_errors = stats->rx.rx_errors;
+ net_stats->multicast = stats->rx.rx_multicast_frames_ok;
+ net_stats->rx_crc_errors = stats->rx.rx_crc_errors;
+ net_stats->rx_dropped = stats->rx.rx_no_bufs;
- return &enic->net_stats;
+ return net_stats;
}
static void enic_reset_mcaddrs(struct enic *enic)
enic_notify_check(enic);
- mod_timer(&enic->notify_timer, round_jiffies(ENIC_NOTIFY_TIMER_PERIOD));
+ mod_timer(&enic->notify_timer,
+ round_jiffies(jiffies + ENIC_NOTIFY_TIMER_PERIOD));
}
static void enic_free_intr(struct enic *enic)
struct enic *enic = netdev_priv(netdev);
int running = netif_running(netdev);
+ if (new_mtu < ENIC_MIN_MTU || new_mtu > ENIC_MAX_MTU)
+ return -EINVAL;
+
if (running)
enic_stop(netdev);
- if (new_mtu < ENIC_MIN_MTU)
- new_mtu = ENIC_MIN_MTU;
- if (new_mtu > ENIC_MAX_MTU)
- new_mtu = ENIC_MAX_MTU;
-
netdev->mtu = new_mtu;
if (netdev->mtu > enic->port_mtu)