]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
octeontx2-pf: Initialize new NIX SQ context for cn20k
authorSubbaraya Sundeep <sbhatta@marvell.com>
Sat, 25 Oct 2025 10:32:44 +0000 (16:02 +0530)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 30 Oct 2025 09:44:09 +0000 (10:44 +0100)
cn20k has different NIX context for send queue hence use
the new cn20k mailbox to init SQ context.

Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Link: https://patch.msgid.link/1761388367-16579-9-git-send-email-sbhatta@marvell.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c

index 6063025824ec51b293f80a56741c62919ea36f05..a60f8cf53febb1c2bf547979c074cc2ede757e31 100644 (file)
@@ -397,11 +397,45 @@ static int cn20k_pool_aq_init(struct otx2_nic *pfvf, u16 pool_id,
        return 0;
 }
 
+static int cn20k_sq_aq_init(void *dev, u16 qidx, u8 chan_offset, u16 sqb_aura)
+{
+       struct nix_cn20k_aq_enq_req *aq;
+       struct otx2_nic *pfvf = dev;
+
+       /* Get memory to put this msg */
+       aq = otx2_mbox_alloc_msg_nix_cn20k_aq_enq(&pfvf->mbox);
+       if (!aq)
+               return -ENOMEM;
+
+       aq->sq.cq = pfvf->hw.rx_queues + qidx;
+       aq->sq.max_sqe_size = NIX_MAXSQESZ_W16; /* 128 byte */
+       aq->sq.cq_ena = 1;
+       aq->sq.ena = 1;
+       aq->sq.smq = otx2_get_smq_idx(pfvf, qidx);
+       aq->sq.smq_rr_weight = mtu_to_dwrr_weight(pfvf, pfvf->tx_max_pktlen);
+       aq->sq.default_chan = pfvf->hw.tx_chan_base + chan_offset;
+       aq->sq.sqe_stype = NIX_STYPE_STF; /* Cache SQB */
+       aq->sq.sqb_aura = sqb_aura;
+       aq->sq.sq_int_ena = NIX_SQINT_BITS;
+       aq->sq.qint_idx = 0;
+       /* Due pipelining impact minimum 2000 unused SQ CQE's
+        * need to maintain to avoid CQ overflow.
+        */
+       aq->sq.cq_limit = (SEND_CQ_SKID * 256) / (pfvf->qset.sqe_cnt);
+
+       /* Fill AQ info */
+       aq->qidx = qidx;
+       aq->ctype = NIX_AQ_CTYPE_SQ;
+       aq->op = NIX_AQ_INSTOP_INIT;
+
+       return otx2_sync_mbox_msg(&pfvf->mbox);
+}
+
 static struct dev_hw_ops cn20k_hw_ops = {
        .pfaf_mbox_intr_handler = cn20k_pfaf_mbox_intr_handler,
        .vfaf_mbox_intr_handler = cn20k_vfaf_mbox_intr_handler,
        .pfvf_mbox_intr_handler = cn20k_pfvf_mbox_intr_handler,
-       .sq_aq_init = cn10k_sq_aq_init,
+       .sq_aq_init = cn20k_sq_aq_init,
        .sqe_flush = cn10k_sqe_flush,
        .aura_freeptr = cn10k_aura_freeptr,
        .refill_pool_ptrs = cn10k_refill_pool_ptrs,