]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/cxgb3/cxgb3_main.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
[linux-2.6-omap-h63xx.git] / drivers / net / cxgb3 / cxgb3_main.c
index 1b20f4060e2d7a1fbdb00b9154d88103a4127625..dc5d26988bb3e912030ae2a35bb91020a45ca5f4 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/proc_fs.h>
 #include <linux/rtnetlink.h>
 #include <linux/firmware.h>
+#include <linux/log2.h>
 #include <asm/uaccess.h>
 
 #include "common.h"
@@ -1582,7 +1583,6 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
        .get_wol = get_wol,
        .get_tso = ethtool_op_get_tso,
        .set_tso = ethtool_op_set_tso,
-       .get_perm_addr = ethtool_op_get_perm_addr
 };
 
 static int in_range(int val, int lo, int hi)
@@ -1818,8 +1818,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
                        return -EBUSY;
                if (copy_from_user(&m, useraddr, sizeof(m)))
                        return -EFAULT;
-               if (!m.rx_pg_sz || (m.rx_pg_sz & (m.rx_pg_sz - 1)) ||
-                       !m.tx_pg_sz || (m.tx_pg_sz & (m.tx_pg_sz - 1)))
+               if (!is_power_of_2(m.rx_pg_sz) ||
+                       !is_power_of_2(m.tx_pg_sz))
                        return -EINVAL; /* not power of 2 */
                if (!(m.rx_pg_sz & 0x14000))
                        return -EINVAL; /* not 16KB or 64KB */
@@ -2071,13 +2071,59 @@ static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
 static void cxgb_netpoll(struct net_device *dev)
 {
        struct adapter *adapter = dev->priv;
-       struct sge_qset *qs = dev2qset(dev);
+       struct port_info *pi = netdev_priv(dev);
+       int qidx;
+
+       for (qidx = pi->first_qset; qidx < pi->first_qset + pi->nqsets; qidx++) {
+               struct sge_qset *qs = &adapter->sge.qs[qidx];
+               void *source;
+               
+               if (adapter->flags & USING_MSIX)
+                       source = qs;
+               else
+                       source = adapter;
 
-       t3_intr_handler(adapter, qs->rspq.polling) (adapter->pdev->irq,
-                                                   adapter);
+               t3_intr_handler(adapter, qs->rspq.polling) (0, source);
+       }
 }
 #endif
 
+#define TPSRAM_NAME "t3%c_protocol_sram-%d.%d.%d.bin"
+int update_tpsram(struct adapter *adap)
+{
+       const struct firmware *tpsram;
+       char buf[64];
+       struct device *dev = &adap->pdev->dev;
+       int ret;
+       char rev;
+       
+       rev = adap->params.rev == T3_REV_B2 ? 'b' : 'a';
+
+       snprintf(buf, sizeof(buf), TPSRAM_NAME, rev,
+                TP_VERSION_MAJOR, TP_VERSION_MINOR, TP_VERSION_MICRO);
+
+       ret = request_firmware(&tpsram, buf, dev);
+       if (ret < 0) {
+               dev_err(dev, "could not load TP SRAM: unable to load %s\n",
+                       buf);
+               return ret;
+       }
+       
+       ret = t3_check_tpsram(adap, tpsram->data, tpsram->size);
+       if (ret)
+               goto release_tpsram;    
+
+       ret = t3_set_proto_sram(adap, tpsram->data);
+       if (ret)
+               dev_err(dev, "loading protocol SRAM failed\n");
+
+release_tpsram:
+       release_firmware(tpsram);
+       
+       return ret;
+}
+
+
 /*
  * Periodic accumulation of MAC statistics.
  */
@@ -2427,6 +2473,13 @@ static int __devinit init_one(struct pci_dev *pdev,
                goto out_free_dev;
        }
 
+       err = t3_check_tpsram_version(adapter);
+       if (err == -EINVAL)
+               err = update_tpsram(adapter);
+
+       if (err)
+               goto out_free_dev;
+               
        /*
         * The card is now ready to go.  If any errors occur during device
         * registration we do not fail the whole card but rather proceed only