net/liquidio: add API to disable IO queues
authorShijith Thotton <shijith.thotton@caviumnetworks.com>
Sat, 25 Mar 2017 06:24:18 +0000 (11:54 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 16:59:47 +0000 (18:59 +0200)
Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Venkat Koppula <venkat.koppula@caviumnetworks.com>
Signed-off-by: Srisivasubramanian S <ssrinivasan@caviumnetworks.com>
Signed-off-by: Mallesham Jatharakonda <mjatharakonda@oneconvergence.com>
drivers/net/liquidio/base/lio_23xx_vf.c
drivers/net/liquidio/base/lio_23xx_vf.h
drivers/net/liquidio/lio_ethdev.c

index dd5e3a6..d9b9e2a 100644 (file)
@@ -65,3 +65,52 @@ cn23xx_vf_setup_device(struct lio_device *lio_dev)
 
        return 0;
 }
+
+int
+cn23xx_vf_set_io_queues_off(struct lio_device *lio_dev)
+{
+       uint32_t loop = CN23XX_VF_BUSY_READING_REG_LOOP_COUNT;
+       uint64_t q_no;
+
+       /* Disable the i/p and o/p queues for this Octeon.
+        * IOQs will already be in reset.
+        * If RST bit is set, wait for Quiet bit to be set
+        * Once Quiet bit is set, clear the RST bit
+        */
+       PMD_INIT_FUNC_TRACE();
+
+       for (q_no = 0; q_no < lio_dev->sriov_info.rings_per_vf; q_no++) {
+               volatile uint64_t reg_val;
+
+               reg_val = lio_read_csr64(lio_dev,
+                                        CN23XX_SLI_IQ_PKT_CONTROL64(q_no));
+               while ((reg_val & CN23XX_PKT_INPUT_CTL_RST) && !(reg_val &
+                                        CN23XX_PKT_INPUT_CTL_QUIET) && loop) {
+                       reg_val = lio_read_csr64(
+                                       lio_dev,
+                                       CN23XX_SLI_IQ_PKT_CONTROL64(q_no));
+                       loop = loop - 1;
+               }
+
+               if (loop == 0) {
+                       lio_dev_err(lio_dev,
+                                   "clearing the reset reg failed or setting the quiet reg failed for qno %lu\n",
+                                   (unsigned long)q_no);
+                       return -1;
+               }
+
+               reg_val = reg_val & ~CN23XX_PKT_INPUT_CTL_RST;
+               lio_write_csr64(lio_dev, CN23XX_SLI_IQ_PKT_CONTROL64(q_no),
+                               reg_val);
+
+               reg_val = lio_read_csr64(lio_dev,
+                                        CN23XX_SLI_IQ_PKT_CONTROL64(q_no));
+               if (reg_val & CN23XX_PKT_INPUT_CTL_RST) {
+                       lio_dev_err(lio_dev, "unable to reset qno %lu\n",
+                                   (unsigned long)q_no);
+                       return -1;
+               }
+       }
+
+       return 0;
+}
index 1c234bf..1af09d0 100644 (file)
@@ -80,5 +80,12 @@ lio_get_conf(struct lio_device *lio_dev)
        return default_lio_conf;
 }
 
+/** Turns off the input and output queues for the device
+ *  @param lio_dev which device io queues to disable
+ */
+int cn23xx_vf_set_io_queues_off(struct lio_device *lio_dev);
+
+#define CN23XX_VF_BUSY_READING_REG_LOOP_COUNT  100000
+
 int cn23xx_vf_setup_device(struct lio_device  *lio_dev);
 #endif /* _LIO_23XX_VF_H_  */
index 734f6c4..0487f3d 100644 (file)
@@ -86,6 +86,11 @@ lio_first_time_init(struct lio_device *lio_dev,
                return -1;
        }
 
+       if (cn23xx_vf_set_io_queues_off(lio_dev)) {
+               lio_dev_err(lio_dev, "Setting io queues off failed\n");
+               return -1;
+       }
+
        dpdk_queues = (int)lio_dev->sriov_info.rings_per_vf;
 
        lio_dev->max_tx_queues = dpdk_queues;