[ETHTOOL] Provide default behaviors for a few ethtool sub-ioctls
[powerpc.git] / drivers / net / chelsio / cxgb2.c
index c3b1648..7029f13 100644 (file)
@@ -255,8 +255,11 @@ static int cxgb_open(struct net_device *dev)
        struct adapter *adapter = dev->priv;
        int other_ports = adapter->open_device_map & PORT_MASK;
 
-       if (!adapter->open_device_map && (err = cxgb_up(adapter)) < 0)
+       napi_enable(&adapter->napi);
+       if (!adapter->open_device_map && (err = cxgb_up(adapter)) < 0) {
+               napi_disable(&adapter->napi);
                return err;
+       }
 
        __set_bit(dev->if_port, &adapter->open_device_map);
        link_start(&adapter->port[dev->if_port]);
@@ -274,6 +277,7 @@ static int cxgb_close(struct net_device *dev)
        struct cmac *mac = p->mac;
 
        netif_stop_queue(dev);
+       napi_disable(&adapter->napi);
        mac->ops->disable(mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX);
        netif_carrier_off(dev);
 
@@ -454,51 +458,21 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats,
        const struct cmac_statistics *s;
        const struct sge_intr_counts *t;
        struct sge_port_stats ss;
+       unsigned int len;
 
        s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL);
 
-       *data++ = s->TxOctetsOK;
-       *data++ = s->TxOctetsBad;
-       *data++ = s->TxUnicastFramesOK;
-       *data++ = s->TxMulticastFramesOK;
-       *data++ = s->TxBroadcastFramesOK;
-       *data++ = s->TxPauseFrames;
-       *data++ = s->TxFramesWithDeferredXmissions;
-       *data++ = s->TxLateCollisions;
-       *data++ = s->TxTotalCollisions;
-       *data++ = s->TxFramesAbortedDueToXSCollisions;
-       *data++ = s->TxUnderrun;
-       *data++ = s->TxLengthErrors;
-       *data++ = s->TxInternalMACXmitError;
-       *data++ = s->TxFramesWithExcessiveDeferral;
-       *data++ = s->TxFCSErrors;
-
-       *data++ = s->RxOctetsOK;
-       *data++ = s->RxOctetsBad;
-       *data++ = s->RxUnicastFramesOK;
-       *data++ = s->RxMulticastFramesOK;
-       *data++ = s->RxBroadcastFramesOK;
-       *data++ = s->RxPauseFrames;
-       *data++ = s->RxFCSErrors;
-       *data++ = s->RxAlignErrors;
-       *data++ = s->RxSymbolErrors;
-       *data++ = s->RxDataErrors;
-       *data++ = s->RxSequenceErrors;
-       *data++ = s->RxRuntErrors;
-       *data++ = s->RxJabberErrors;
-       *data++ = s->RxInternalMACRcvError;
-       *data++ = s->RxInRangeLengthErrors;
-       *data++ = s->RxOutOfRangeLengthField;
-       *data++ = s->RxFrameTooLongErrors;
+       len = sizeof(u64)*(&s->TxFCSErrors + 1 - &s->TxOctetsOK);
+       memcpy(data, &s->TxOctetsOK, len);
+       data += len;
+
+       len = sizeof(u64)*(&s->RxFrameTooLongErrors + 1 - &s->RxOctetsOK);
+       memcpy(data, &s->RxOctetsOK, len);
+       data += len;
 
        t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss);
-       *data++ = ss.rx_packets;
-       *data++ = ss.rx_cso_good;
-       *data++ = ss.tx_packets;
-       *data++ = ss.tx_cso;
-       *data++ = ss.tx_tso;
-       *data++ = ss.vlan_xtract;
-       *data++ = ss.vlan_insert;
+       memcpy(data, &ss, sizeof(ss));
+       data += sizeof(ss);
 
        t = t1_sge_get_intr_counts(adapter->sge);
        *data++ = t->rx_drops;
@@ -820,9 +794,7 @@ static const struct ethtool_ops t1_ethtool_ops = {
        .set_pauseparam    = set_pauseparam,
        .get_rx_csum       = get_rx_csum,
        .set_rx_csum       = set_rx_csum,
-       .get_tx_csum       = ethtool_op_get_tx_csum,
        .set_tx_csum       = ethtool_op_set_tx_csum,
-       .get_sg            = ethtool_op_get_sg,
        .set_sg            = ethtool_op_set_sg,
        .get_link          = ethtool_op_get_link,
        .get_strings       = get_strings,
@@ -830,7 +802,6 @@ static const struct ethtool_ops t1_ethtool_ops = {
        .get_ethtool_stats = get_stats,
        .get_regs_len      = get_regs_len,
        .get_regs          = get_regs,
-       .get_tso           = ethtool_op_get_tso,
        .set_tso           = set_tso,
 };
 
@@ -913,16 +884,6 @@ static void vlan_rx_register(struct net_device *dev,
        t1_set_vlan_accel(adapter, grp != NULL);
        spin_unlock_irq(&adapter->async_lock);
 }
-
-static void vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
-{
-       struct adapter *adapter = dev->priv;
-
-       spin_lock_irq(&adapter->async_lock);
-       if (adapter->vlan_grp)
-               adapter->vlan_grp->vlan_devices[vid] = NULL;
-       spin_unlock_irq(&adapter->async_lock);
-}
 #endif
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1072,7 +1033,6 @@ static int __devinit init_one(struct pci_dev *pdev,
                        goto out_free_dev;
                }
 
-               SET_MODULE_OWNER(netdev);
                SET_NETDEV_DEV(netdev, &pdev->dev);
 
                if (!adapter) {
@@ -1130,7 +1090,6 @@ static int __devinit init_one(struct pci_dev *pdev,
                        netdev->features |=
                                NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
                        netdev->vlan_rx_register = vlan_rx_register;
-                       netdev->vlan_rx_kill_vid = vlan_rx_kill_vid;
 #endif
 
                        /* T204: disable TSO */
@@ -1154,8 +1113,7 @@ static int __devinit init_one(struct pci_dev *pdev,
                netdev->poll_controller = t1_netpoll;
 #endif
 #ifdef CONFIG_CHELSIO_T1_NAPI
-               netdev->weight = 64;
-               netdev->poll = t1_poll;
+               netif_napi_add(netdev, &adapter->napi, t1_poll, 64);
 #endif
 
                SET_ETHTOOL_OPS(netdev, &t1_ethtool_ops);