RDMA/nes: Update copyright and branding string
[safe/jmp/linux-2.6] / drivers / infiniband / hw / nes / nes_nic.c
index 025ed9f..5a7b554 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 - 2009 Intel-NE, Inc.  All rights reserved.
+ * Copyright (c) 2006 - 2009 Intel Corporation.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -111,7 +111,7 @@ static int nes_netdev_poll(struct napi_struct *napi, int budget)
        nes_nic_ce_handler(nesdev, nescq);
 
        if (nescq->cqes_pending == 0) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                /* clear out completed cqes and arm */
                nes_write32(nesdev->regs+NES_CQE_ALLOC, NES_CQE_ALLOC_NOTIFY_NEXT |
                                nescq->cq_number | (nescq->cqe_allocs_pending << 16));
@@ -1426,49 +1426,55 @@ static int nes_netdev_get_settings(struct net_device *netdev, struct ethtool_cmd
        struct nes_vnic *nesvnic = netdev_priv(netdev);
        struct nes_device *nesdev = nesvnic->nesdev;
        struct nes_adapter *nesadapter = nesdev->nesadapter;
+       u32 mac_index = nesdev->mac_index;
+       u8 phy_type = nesadapter->phy_type[mac_index];
+       u8 phy_index = nesadapter->phy_index[mac_index];
        u16 phy_data;
 
        et_cmd->duplex = DUPLEX_FULL;
        et_cmd->port   = PORT_MII;
+       et_cmd->maxtxpkt = 511;
+       et_cmd->maxrxpkt = 511;
 
        if (nesadapter->OneG_Mode) {
                et_cmd->speed = SPEED_1000;
-               if (nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_PUMA_1G) {
+               if (phy_type == NES_PHY_TYPE_PUMA_1G) {
                        et_cmd->supported   = SUPPORTED_1000baseT_Full;
                        et_cmd->advertising = ADVERTISED_1000baseT_Full;
                        et_cmd->autoneg     = AUTONEG_DISABLE;
                        et_cmd->transceiver = XCVR_INTERNAL;
-                       et_cmd->phy_address = nesdev->mac_index;
+                       et_cmd->phy_address = mac_index;
                } else {
-                       et_cmd->supported   = SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg;
-                       et_cmd->advertising = ADVERTISED_1000baseT_Full | ADVERTISED_Autoneg;
-                       nes_read_1G_phy_reg(nesdev, 0, nesadapter->phy_index[nesdev->mac_index], &phy_data);
+                       et_cmd->supported   = SUPPORTED_1000baseT_Full
+                                           | SUPPORTED_Autoneg;
+                       et_cmd->advertising = ADVERTISED_1000baseT_Full
+                                           | ADVERTISED_Autoneg;
+                       nes_read_1G_phy_reg(nesdev, 0, phy_index, &phy_data);
                        if (phy_data & 0x1000)
                                et_cmd->autoneg = AUTONEG_ENABLE;
                        else
                                et_cmd->autoneg = AUTONEG_DISABLE;
                        et_cmd->transceiver = XCVR_EXTERNAL;
-                       et_cmd->phy_address = nesadapter->phy_index[nesdev->mac_index];
+                       et_cmd->phy_address = phy_index;
                }
+               return 0;
+       }
+       if ((phy_type == NES_PHY_TYPE_IRIS) ||
+           (phy_type == NES_PHY_TYPE_ARGUS) ||
+           (phy_type == NES_PHY_TYPE_SFP_D)) {
+               et_cmd->transceiver = XCVR_EXTERNAL;
+               et_cmd->port        = PORT_FIBRE;
+               et_cmd->supported   = SUPPORTED_FIBRE;
+               et_cmd->advertising = ADVERTISED_FIBRE;
+               et_cmd->phy_address = phy_index;
        } else {
-               if ((nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_IRIS) ||
-                   (nesadapter->phy_type[nesdev->mac_index] == NES_PHY_TYPE_ARGUS)) {
-                       et_cmd->transceiver = XCVR_EXTERNAL;
-                       et_cmd->port        = PORT_FIBRE;
-                       et_cmd->supported   = SUPPORTED_FIBRE;
-                       et_cmd->advertising = ADVERTISED_FIBRE;
-                       et_cmd->phy_address = nesadapter->phy_index[nesdev->mac_index];
-               } else {
-                       et_cmd->transceiver = XCVR_INTERNAL;
-                       et_cmd->supported   = SUPPORTED_10000baseT_Full;
-                       et_cmd->advertising = ADVERTISED_10000baseT_Full;
-                       et_cmd->phy_address = nesdev->mac_index;
-               }
-               et_cmd->speed = SPEED_10000;
-               et_cmd->autoneg = AUTONEG_DISABLE;
+               et_cmd->transceiver = XCVR_INTERNAL;
+               et_cmd->supported   = SUPPORTED_10000baseT_Full;
+               et_cmd->advertising = ADVERTISED_10000baseT_Full;
+               et_cmd->phy_address = mac_index;
        }
-       et_cmd->maxtxpkt = 511;
-       et_cmd->maxrxpkt = 511;
+       et_cmd->speed = SPEED_10000;
+       et_cmd->autoneg = AUTONEG_DISABLE;
        return 0;
 }
 
@@ -1502,7 +1508,7 @@ static int nes_netdev_set_settings(struct net_device *netdev, struct ethtool_cmd
 }
 
 
-static struct ethtool_ops nes_ethtool_ops = {
+static const struct ethtool_ops nes_ethtool_ops = {
        .get_link = ethtool_op_get_link,
        .get_settings = nes_netdev_get_settings,
        .set_settings = nes_netdev_set_settings,
@@ -1551,6 +1557,18 @@ static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_g
        spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
 }
 
+static const struct net_device_ops nes_netdev_ops = {
+       .ndo_open               = nes_netdev_open,
+       .ndo_stop               = nes_netdev_stop,
+       .ndo_start_xmit         = nes_netdev_start_xmit,
+       .ndo_get_stats          = nes_netdev_get_stats,
+       .ndo_tx_timeout         = nes_netdev_tx_timeout,
+       .ndo_set_mac_address    = nes_netdev_set_mac_address,
+       .ndo_set_multicast_list = nes_netdev_set_multicast_list,
+       .ndo_change_mtu         = nes_netdev_change_mtu,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_vlan_rx_register   = nes_netdev_vlan_rx_register,
+};
 
 /**
  * nes_netdev_init - initialize network device
@@ -1559,7 +1577,7 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
                void __iomem *mmio_addr)
 {
        u64 u64temp;
-       struct nes_vnic *nesvnic = NULL;
+       struct nes_vnic *nesvnic;
        struct net_device *netdev;
        struct nic_qp_map *curr_qp_map;
        u32 u32temp;
@@ -1571,22 +1589,12 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
                printk(KERN_ERR PFX "nesvnic etherdev alloc failed");
                return NULL;
        }
+       nesvnic = netdev_priv(netdev);
 
        nes_debug(NES_DBG_INIT, "netdev = %p, %s\n", netdev, netdev->name);
 
        SET_NETDEV_DEV(netdev, &nesdev->pcidev->dev);
 
-       nesvnic = netdev_priv(netdev);
-       memset(nesvnic, 0, sizeof(*nesvnic));
-
-       netdev->open = nes_netdev_open;
-       netdev->stop = nes_netdev_stop;
-       netdev->hard_start_xmit = nes_netdev_start_xmit;
-       netdev->get_stats = nes_netdev_get_stats;
-       netdev->tx_timeout = nes_netdev_tx_timeout;
-       netdev->set_mac_address = nes_netdev_set_mac_address;
-       netdev->set_multicast_list = nes_netdev_set_multicast_list;
-       netdev->change_mtu = nes_netdev_change_mtu;
        netdev->watchdog_timeo = NES_TX_TIMEOUT;
        netdev->irq = nesdev->pcidev->irq;
        netdev->mtu = ETH_DATA_LEN;
@@ -1594,11 +1602,11 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
        netdev->addr_len = ETH_ALEN;
        netdev->type = ARPHRD_ETHER;
        netdev->features = NETIF_F_HIGHDMA;
+       netdev->netdev_ops = &nes_netdev_ops;
        netdev->ethtool_ops = &nes_ethtool_ops;
        netif_napi_add(netdev, &nesvnic->napi, nes_netdev_poll, 128);
        nes_debug(NES_DBG_INIT, "Enabling VLAN Insert/Delete.\n");
        netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
-       netdev->vlan_rx_register = nes_netdev_vlan_rx_register;
 
        /* Fill in the port structure */
        nesvnic->netdev = netdev;