RDMA/nes: Add wqm_quanta module option
authorChien Tung <ctung@neteffect.com>
Fri, 26 Sep 2008 20:08:10 +0000 (15:08 -0500)
committerRoland Dreier <rolandd@cisco.com>
Tue, 30 Sep 2008 22:35:46 +0000 (15:35 -0700)
Add a module parameter wqm_quanta.  It controls the number of segments
transmitted at a time.

Signed-off-by: Sweta Bhatt <sweta.bhatt@einfochips.com>
Signed-off-by: Chien Tung <ctung@neteffect.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/nes/nes.c
drivers/infiniband/hw/nes/nes.h
drivers/infiniband/hw/nes/nes_hw.c
drivers/infiniband/hw/nes/nes_hw.h

index 30c93db..a2b04d6 100644 (file)
@@ -91,6 +91,10 @@ unsigned int nes_debug_level = 0;
 module_param_named(debug_level, nes_debug_level, uint, 0644);
 MODULE_PARM_DESC(debug_level, "Enable debug output level");
 
+unsigned int wqm_quanta = 0x10000;
+module_param(wqm_quanta, int, 0644);
+MODULE_PARM_DESC(wqm_quanta, "WQM quanta");
+
 LIST_HEAD(nes_adapter_list);
 static LIST_HEAD(nes_dev_list);
 
@@ -557,6 +561,7 @@ static int __devinit nes_probe(struct pci_dev *pcidev, const struct pci_device_i
                goto bail5;
        }
        nesdev->nesadapter->et_rx_coalesce_usecs_irq = interrupt_mod_interval;
+       nesdev->nesadapter->wqm_quanta = wqm_quanta;
 
        /* nesdev->base_doorbell_index =
                        nesdev->nesadapter->pd_config_base[PCI_FUNC(nesdev->pcidev->devfn)]; */
@@ -1069,6 +1074,55 @@ static ssize_t nes_store_idx_data(struct device_driver *ddp,
        return strnlen(buf, count);
 }
 
+
+/**
+ * nes_show_wqm_quanta
+ */
+static ssize_t nes_show_wqm_quanta(struct device_driver *ddp, char *buf)
+{
+       u32 wqm_quanta_value = 0xdead;
+       u32 i = 0;
+       struct nes_device *nesdev;
+
+       list_for_each_entry(nesdev, &nes_dev_list, list) {
+               if (i == ee_flsh_adapter) {
+                       wqm_quanta_value = nesdev->nesadapter->wqm_quanta;
+                       break;
+               }
+               i++;
+       }
+
+       return  snprintf(buf, PAGE_SIZE, "0x%X\n", wqm_quanta);
+}
+
+
+/**
+ * nes_store_wqm_quanta
+ */
+static ssize_t nes_store_wqm_quanta(struct device_driver *ddp,
+                                       const char *buf, size_t count)
+{
+       unsigned long wqm_quanta_value;
+       u32 wqm_config1;
+       u32 i = 0;
+       struct nes_device *nesdev;
+
+       strict_strtoul(buf, 0, &wqm_quanta_value);
+       list_for_each_entry(nesdev, &nes_dev_list, list) {
+               if (i == ee_flsh_adapter) {
+                       nesdev->nesadapter->wqm_quanta = wqm_quanta_value;
+                       wqm_config1 = nes_read_indexed(nesdev,
+                                               NES_IDX_WQM_CONFIG1);
+                       nes_write_indexed(nesdev, NES_IDX_WQM_CONFIG1,
+                                       ((wqm_quanta_value << 1) |
+                                       (wqm_config1 & 0x00000001)));
+                       break;
+               }
+               i++;
+       }
+       return strnlen(buf, count);
+}
+
 static DRIVER_ATTR(adapter, S_IRUSR | S_IWUSR,
                   nes_show_adapter, nes_store_adapter);
 static DRIVER_ATTR(eeprom_cmd, S_IRUSR | S_IWUSR,
@@ -1087,6 +1141,8 @@ static DRIVER_ATTR(idx_addr, S_IRUSR | S_IWUSR,
                   nes_show_idx_addr, nes_store_idx_addr);
 static DRIVER_ATTR(idx_data, S_IRUSR | S_IWUSR,
                   nes_show_idx_data, nes_store_idx_data);
+static DRIVER_ATTR(wqm_quanta, S_IRUSR | S_IWUSR,
+                  nes_show_wqm_quanta, nes_store_wqm_quanta);
 
 static int nes_create_driver_sysfs(struct pci_driver *drv)
 {
@@ -1100,6 +1156,7 @@ static int nes_create_driver_sysfs(struct pci_driver *drv)
        error |= driver_create_file(&drv->driver, &driver_attr_nonidx_data);
        error |= driver_create_file(&drv->driver, &driver_attr_idx_addr);
        error |= driver_create_file(&drv->driver, &driver_attr_idx_data);
+       error |= driver_create_file(&drv->driver, &driver_attr_wqm_quanta);
        return error;
 }
 
@@ -1114,6 +1171,7 @@ static void nes_remove_driver_sysfs(struct pci_driver *drv)
        driver_remove_file(&drv->driver, &driver_attr_nonidx_data);
        driver_remove_file(&drv->driver, &driver_attr_idx_addr);
        driver_remove_file(&drv->driver, &driver_attr_idx_data);
+       driver_remove_file(&drv->driver, &driver_attr_wqm_quanta);
 }
 
 /**
index 8eb7ae9..1595dc7 100644 (file)
@@ -169,7 +169,7 @@ extern int disable_mpa_crc;
 extern unsigned int send_first;
 extern unsigned int nes_drv_opt;
 extern unsigned int nes_debug_level;
-
+extern unsigned int wqm_quanta;
 extern struct list_head nes_adapter_list;
 
 extern atomic_t cm_connects;
index bdd98e6..0e259a8 100644 (file)
@@ -861,7 +861,8 @@ static void nes_init_csr_ne020(struct nes_device *nesdev, u8 hw_rev, u8 port_cou
 
        nes_write_indexed(nesdev, 0x00005000, 0x00018000);
        /* nes_write_indexed(nesdev, 0x00005000, 0x00010000); */
-       nes_write_indexed(nesdev, 0x00005004, 0x00020001);
+       nes_write_indexed(nesdev, NES_IDX_WQM_CONFIG1, (wqm_quanta << 1) |
+                                                        0x00000001);
        nes_write_indexed(nesdev, 0x00005008, 0x1F1F1F1F);
        nes_write_indexed(nesdev, 0x00005010, 0x1F1F1F1F);
        nes_write_indexed(nesdev, 0x00005018, 0x1F1F1F1F);
index fc0f063..82d0676 100644 (file)
@@ -156,6 +156,7 @@ enum indexed_regs {
        NES_IDX_ENDNODE0_NSTAT_TX_OCTETS_HI = 0x7004,
        NES_IDX_ENDNODE0_NSTAT_TX_FRAMES_LO = 0x7008,
        NES_IDX_ENDNODE0_NSTAT_TX_FRAMES_HI = 0x700c,
+       NES_IDX_WQM_CONFIG1 = 0x5004,
        NES_IDX_CM_CONFIG = 0x5100,
        NES_IDX_NIC_LOGPORT_TO_PHYPORT = 0x6000,
        NES_IDX_NIC_PHYPORT_TO_USW = 0x6008,
@@ -1079,6 +1080,7 @@ struct nes_adapter {
        u32 et_rx_max_coalesced_frames_high;
        u32 et_rate_sample_interval;
        u32 timer_int_limit;
+       u32 wqm_quanta;
 
        /* Adapter base MAC address */
        u32 mac_addr_low;