net/liquidio: add APIs to enable and 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:37 +05:30 committed by Ferruh Yigit
parent 990c41eea8
commit d749e52f3e
4 changed files with 90 additions and 0 deletions

View File

@ -310,6 +310,73 @@ cn23xx_vf_setup_mbox(struct lio_device *lio_dev)
return 0;
}
static int
cn23xx_vf_enable_io_queues(struct lio_device *lio_dev)
{
uint32_t q_no;
PMD_INIT_FUNC_TRACE();
for (q_no = 0; q_no < lio_dev->num_iqs; q_no++) {
uint64_t reg_val;
/* set the corresponding IQ IS_64B bit */
if (lio_dev->io_qmask.iq64B & (1ULL << q_no)) {
reg_val = lio_read_csr64(
lio_dev,
CN23XX_SLI_IQ_PKT_CONTROL64(q_no));
reg_val = reg_val | CN23XX_PKT_INPUT_CTL_IS_64B;
lio_write_csr64(lio_dev,
CN23XX_SLI_IQ_PKT_CONTROL64(q_no),
reg_val);
}
/* set the corresponding IQ ENB bit */
if (lio_dev->io_qmask.iq & (1ULL << q_no)) {
reg_val = lio_read_csr64(
lio_dev,
CN23XX_SLI_IQ_PKT_CONTROL64(q_no));
reg_val = reg_val | CN23XX_PKT_INPUT_CTL_RING_ENB;
lio_write_csr64(lio_dev,
CN23XX_SLI_IQ_PKT_CONTROL64(q_no),
reg_val);
}
}
for (q_no = 0; q_no < lio_dev->num_oqs; q_no++) {
uint32_t reg_val;
/* set the corresponding OQ ENB bit */
if (lio_dev->io_qmask.oq & (1ULL << q_no)) {
reg_val = lio_read_csr(
lio_dev,
CN23XX_SLI_OQ_PKT_CONTROL(q_no));
reg_val = reg_val | CN23XX_PKT_OUTPUT_CTL_RING_ENB;
lio_write_csr(lio_dev,
CN23XX_SLI_OQ_PKT_CONTROL(q_no),
reg_val);
}
}
return 0;
}
static void
cn23xx_vf_disable_io_queues(struct lio_device *lio_dev)
{
uint32_t num_queues;
PMD_INIT_FUNC_TRACE();
/* per HRM, rings can only be disabled via reset operation,
* NOT via SLI_PKT()_INPUT/OUTPUT_CONTROL[ENB]
*/
num_queues = lio_dev->num_iqs;
if (num_queues < lio_dev->num_oqs)
num_queues = lio_dev->num_oqs;
cn23xx_vf_reset_io_queues(lio_dev, num_queues);
}
void
cn23xx_vf_ask_pf_to_do_flr(struct lio_device *lio_dev)
{
@ -463,6 +530,9 @@ cn23xx_vf_setup_device(struct lio_device *lio_dev)
lio_dev->fn_list.setup_device_regs = cn23xx_vf_setup_device_regs;
lio_dev->fn_list.enable_io_queues = cn23xx_vf_enable_io_queues;
lio_dev->fn_list.disable_io_queues = cn23xx_vf_disable_io_queues;
return 0;
}

View File

@ -361,6 +361,15 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev)
lio_free_soft_command(sc);
/* Disable iq_0 for reconf */
lio_dev->fn_list.disable_io_queues(lio_dev);
/* Reset ioq regs */
lio_dev->fn_list.setup_device_regs(lio_dev);
/* Free iq_0 used during init */
lio_free_instr_queue0(lio_dev);
return 0;
nic_config_fail:
@ -487,6 +496,10 @@ lio_first_time_init(struct lio_device *lio_dev,
lio_dev->max_tx_queues = dpdk_queues;
lio_dev->max_rx_queues = dpdk_queues;
/* Enable input and output queues for this device */
if (lio_dev->fn_list.enable_io_queues(lio_dev))
goto error;
return 0;
error:

View File

@ -892,9 +892,14 @@ lio_setup_iq(struct lio_device *lio_dev, int q_index,
goto release_lio_iq;
lio_dev->num_iqs++;
if (lio_dev->fn_list.enable_io_queues(lio_dev))
goto delete_lio_iq;
return 0;
delete_lio_iq:
lio_delete_instr_queue(lio_dev, iq_no);
lio_dev->num_iqs--;
release_lio_iq:
rte_free(lio_dev->instr_queue[iq_no]);
lio_dev->instr_queue[iq_no] = NULL;

View File

@ -347,6 +347,8 @@ struct lio_fn_list {
void (*free_mbox)(struct lio_device *);
int (*setup_device_regs)(struct lio_device *);
int (*enable_io_queues)(struct lio_device *);
void (*disable_io_queues)(struct lio_device *);
};
struct lio_pf_vf_hs_word {