From: Shijith Thotton Date: Sat, 25 Mar 2017 06:24:25 +0000 (+0530) Subject: net/liquidio: add API to setup IQ X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=04443cf25844b4c122adef80ec1098c9713f5d32;p=dpdk.git net/liquidio: add API to setup IQ Map instruction queue registers and set queue size. Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S Signed-off-by: Mallesham Jatharakonda --- diff --git a/drivers/net/liquidio/base/lio_23xx_vf.c b/drivers/net/liquidio/base/lio_23xx_vf.c index ed5b8302a3..181f830298 100644 --- a/drivers/net/liquidio/base/lio_23xx_vf.c +++ b/drivers/net/liquidio/base/lio_23xx_vf.c @@ -198,6 +198,40 @@ cn23xx_vf_setup_device_regs(struct lio_device *lio_dev) return 0; } +static void +cn23xx_vf_setup_iq_regs(struct lio_device *lio_dev, uint32_t iq_no) +{ + struct lio_instr_queue *iq = lio_dev->instr_queue[iq_no]; + uint64_t pkt_in_done = 0; + + PMD_INIT_FUNC_TRACE(); + + /* Write the start of the input queue's ring and its size */ + lio_write_csr64(lio_dev, CN23XX_SLI_IQ_BASE_ADDR64(iq_no), + iq->base_addr_dma); + lio_write_csr(lio_dev, CN23XX_SLI_IQ_SIZE(iq_no), iq->max_count); + + /* Remember the doorbell & instruction count register addr + * for this queue + */ + iq->doorbell_reg = (uint8_t *)lio_dev->hw_addr + + CN23XX_SLI_IQ_DOORBELL(iq_no); + iq->inst_cnt_reg = (uint8_t *)lio_dev->hw_addr + + CN23XX_SLI_IQ_INSTR_COUNT64(iq_no); + lio_dev_dbg(lio_dev, "InstQ[%d]:dbell reg @ 0x%p instcnt_reg @ 0x%p\n", + iq_no, iq->doorbell_reg, iq->inst_cnt_reg); + + /* Store the current instruction counter (used in flush_iq + * calculation) + */ + pkt_in_done = rte_read64(iq->inst_cnt_reg); + + /* Clear the count by writing back what we read, but don't + * enable data traffic here + */ + rte_write64(pkt_in_done, iq->inst_cnt_reg); +} + static void cn23xx_vf_free_mbox(struct lio_device *lio_dev) { @@ -298,8 +332,8 @@ cn23xx_pfvf_handshake(struct lio_device *lio_dev) { struct lio_mbox_cmd mbox_cmd; struct lio_version *lio_ver = (struct lio_version *)&mbox_cmd.data[0]; + uint32_t q_no, count = 0; rte_atomic64_t status; - uint32_t count = 0; uint32_t pfmajor; uint32_t vfmajor; uint32_t ret; @@ -341,6 +375,10 @@ cn23xx_pfvf_handshake(struct lio_device *lio_dev) return -1; } + for (q_no = 0; q_no < lio_dev->num_iqs; q_no++) + lio_dev->instr_queue[q_no]->txpciq.s.pkind = + lio_dev->pfvf_hsword.pkind; + vfmajor = LIO_BASE_MAJOR_VERSION; pfmajor = ret >> 16; if (pfmajor != vfmajor) { @@ -355,6 +393,9 @@ cn23xx_pfvf_handshake(struct lio_device *lio_dev) ret = 0; } + lio_dev_dbg(lio_dev, "got data from PF pkind is %d\n", + lio_dev->pfvf_hsword.pkind); + return ret; } @@ -394,6 +435,7 @@ cn23xx_vf_setup_device(struct lio_device *lio_dev) if (lio_dev->default_config == NULL) return -1; + lio_dev->fn_list.setup_iq_regs = cn23xx_vf_setup_iq_regs; lio_dev->fn_list.setup_mbox = cn23xx_vf_setup_mbox; lio_dev->fn_list.free_mbox = cn23xx_vf_free_mbox; diff --git a/drivers/net/liquidio/lio_rxtx.c b/drivers/net/liquidio/lio_rxtx.c index de98fc625c..4a687d82c3 100644 --- a/drivers/net/liquidio/lio_rxtx.c +++ b/drivers/net/liquidio/lio_rxtx.c @@ -141,6 +141,8 @@ lio_init_instr_queue(struct lio_device *lio_dev, lio_dev->io_qmask.iq64B |= ((instr_type == 64) << iq_no); iq->iqcmd_64B = (instr_type == 64); + lio_dev->fn_list.setup_iq_regs(lio_dev, iq_no); + return 0; } diff --git a/drivers/net/liquidio/lio_struct.h b/drivers/net/liquidio/lio_struct.h index 29059a5e88..2806c379de 100644 --- a/drivers/net/liquidio/lio_struct.h +++ b/drivers/net/liquidio/lio_struct.h @@ -155,6 +155,8 @@ struct lio_io_enable { }; struct lio_fn_list { + void (*setup_iq_regs)(struct lio_device *, uint32_t); + int (*setup_mbox)(struct lio_device *); void (*free_mbox)(struct lio_device *);