]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/myri10ge/myri10ge.c
myri10ge: update driver version
[karo-tx-linux.git] / drivers / net / myri10ge / myri10ge.c
index 5edcbfe93065edd2584d65c9d3551c6c7becf919..e0d76c75aea0f6af724da31864c1ab2c58a356c4 100644 (file)
@@ -75,7 +75,7 @@
 #include "myri10ge_mcp.h"
 #include "myri10ge_mcp_gen_header.h"
 
-#define MYRI10GE_VERSION_STR "1.3.2-1.287"
+#define MYRI10GE_VERSION_STR "1.3.99-1.347"
 
 MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
 MODULE_AUTHOR("Maintainer: help@myri.com");
@@ -194,6 +194,7 @@ struct myri10ge_priv {
        int csum_flag;          /* rx_csums?            */
        int small_bytes;
        int big_bytes;
+       int max_intr_slots;
        struct net_device *dev;
        struct net_device_stats stats;
        spinlock_t stats_lock;
@@ -252,10 +253,6 @@ static int myri10ge_ecrc_enable = 1;
 module_param(myri10ge_ecrc_enable, int, S_IRUGO);
 MODULE_PARM_DESC(myri10ge_ecrc_enable, "Enable Extended CRC on PCI-E");
 
-static int myri10ge_max_intr_slots = 1024;
-module_param(myri10ge_max_intr_slots, int, S_IRUGO);
-MODULE_PARM_DESC(myri10ge_max_intr_slots, "Interrupt queue slots");
-
 static int myri10ge_small_bytes = -1;  /* -1 == auto */
 module_param(myri10ge_small_bytes, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(myri10ge_small_bytes, "Threshold of small packets");
@@ -634,13 +631,38 @@ static int myri10ge_adopt_running_firmware(struct myri10ge_priv *mgp)
        return status;
 }
 
+static int myri10ge_get_firmware_capabilities(struct myri10ge_priv *mgp)
+{
+       struct myri10ge_cmd cmd;
+       int status;
+
+       /* probe for IPv6 TSO support */
+       mgp->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO;
+       status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE,
+                                  &cmd, 0);
+       if (status == 0) {
+               mgp->max_tso6 = cmd.data0;
+               mgp->features |= NETIF_F_TSO6;
+       }
+
+       status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0);
+       if (status != 0) {
+               dev_err(&mgp->pdev->dev,
+                       "failed MXGEFW_CMD_GET_RX_RING_SIZE\n");
+               return -ENXIO;
+       }
+
+       mgp->max_intr_slots = 2 * (cmd.data0 / sizeof(struct mcp_dma_addr));
+
+       return 0;
+}
+
 static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
 {
        char __iomem *submit;
        __be32 buf[16] __attribute__ ((__aligned__(8)));
        u32 dma_low, dma_high, size;
        int status, i;
-       struct myri10ge_cmd cmd;
 
        size = 0;
        status = myri10ge_load_hotplug_firmware(mgp, &size);
@@ -672,6 +694,8 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
 
                mgp->fw_name = "adopted";
                mgp->tx_boundary = 2048;
+               myri10ge_dummy_rdma(mgp, 1);
+               status = myri10ge_get_firmware_capabilities(mgp);
                return status;
        }
 
@@ -714,18 +738,10 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp)
                dev_err(&mgp->pdev->dev, "handoff failed\n");
                return -ENXIO;
        }
-       dev_info(&mgp->pdev->dev, "handoff confirmed\n");
        myri10ge_dummy_rdma(mgp, 1);
+       status = myri10ge_get_firmware_capabilities(mgp);
 
-       /* probe for IPv6 TSO support */
-       mgp->features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_TSO;
-       status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_MAX_TSO6_HDR_SIZE,
-                                  &cmd, 0);
-       if (status == 0) {
-               mgp->max_tso6 = cmd.data0;
-               mgp->features |= NETIF_F_TSO6;
-       }
-       return 0;
+       return status;
 }
 
 static int myri10ge_update_mac_address(struct myri10ge_priv *mgp, u8 * addr)
@@ -859,7 +875,7 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
 
        /* Now exchange information about interrupts  */
 
-       bytes = myri10ge_max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
+       bytes = mgp->max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
        memset(mgp->ss.rx_done.entry, 0, bytes);
        cmd.data0 = (u32) bytes;
        status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_INTRQ_SIZE, &cmd, 0);
@@ -1197,7 +1213,7 @@ myri10ge_clean_rx_done(struct myri10ge_slice_state *ss, int budget)
                rx_packets += rx_ok;
                rx_bytes += rx_ok * (unsigned long)length;
                cnt++;
-               idx = cnt & (myri10ge_max_intr_slots - 1);
+               idx = cnt & (mgp->max_intr_slots - 1);
                work_done++;
        }
        rx_done->idx = idx;
@@ -3198,7 +3214,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                netdev->dev_addr[i] = mgp->mac_addr[i];
 
        /* allocate rx done ring */
-       bytes = myri10ge_max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
+       bytes = mgp->max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
        mgp->ss.rx_done.entry = dma_alloc_coherent(&pdev->dev, bytes,
                                                &mgp->ss.rx_done.bus, GFP_KERNEL);
        if (mgp->ss.rx_done.entry == NULL)
@@ -3275,7 +3291,7 @@ abort_with_firmware:
        myri10ge_dummy_rdma(mgp, 0);
 
 abort_with_rx_done:
-       bytes = myri10ge_max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
+       bytes = mgp->max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
        dma_free_coherent(&pdev->dev, bytes,
                          mgp->ss.rx_done.entry, mgp->ss.rx_done.bus);
 
@@ -3326,7 +3342,7 @@ static void myri10ge_remove(struct pci_dev *pdev)
        /* avoid a memory leak */
        pci_restore_state(pdev);
 
-       bytes = myri10ge_max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
+       bytes = mgp->max_intr_slots * sizeof(*mgp->ss.rx_done.entry);
        dma_free_coherent(&pdev->dev, bytes,
                          mgp->ss.rx_done.entry, mgp->ss.rx_done.bus);