net/liquidio: add API to disable IO queues

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>
This commit is contained in:
Shijith Thotton 2017-03-25 11:54:18 +05:30 committed by Ferruh Yigit
parent 9055da263f
commit 6aefdb5897
3 changed files with 61 additions and 0 deletions

View File

@ -65,3 +65,52 @@ cn23xx_vf_setup_device(struct lio_device *lio_dev)
return 0; 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;
}

View File

@ -80,5 +80,12 @@ lio_get_conf(struct lio_device *lio_dev)
return default_lio_conf; 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); int cn23xx_vf_setup_device(struct lio_device *lio_dev);
#endif /* _LIO_23XX_VF_H_ */ #endif /* _LIO_23XX_VF_H_ */

View File

@ -86,6 +86,11 @@ lio_first_time_init(struct lio_device *lio_dev,
return -1; 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; dpdk_queues = (int)lio_dev->sriov_info.rings_per_vf;
lio_dev->max_tx_queues = dpdk_queues; lio_dev->max_tx_queues = dpdk_queues;