Thread (36 messages) flat view 36 messages, 3 authors, 2020-01-24

Re: [PATCH v4 03/17] octeontx2-pf: Attach NIX and NPA block LFs

From: Sunil Kovvuri <hidden>
Date: 2020-01-22 19:28:09

On Tue, Jan 21, 2020 at 9:30 PM Jakub Kicinski [off-list ref] wrote:
On Tue, 21 Jan 2020 18:51:37 +0530, sunil.kovvuri@gmail.com wrote:
quoted
+int otx2_config_npa(struct otx2_nic *pfvf)
+{
+     struct otx2_qset *qset = &pfvf->qset;
+     struct npa_lf_alloc_req  *npalf;
+     struct otx2_hw *hw = &pfvf->hw;
+     int aura_cnt, err;
+
+     /* Pool - Stack of free buffer pointers
+      * Aura - Alloc/frees pointers from/to pool for NIX DMA.
+      */
+
+     if (!hw->pool_cnt)
+             return -EINVAL;
+
+     qset->pool = devm_kzalloc(pfvf->dev, sizeof(struct otx2_pool) *
+                               hw->pool_cnt, GFP_KERNEL);
+     if (!qset->pool)
+             return -ENOMEM;
+
+     /* Get memory to put this msg */
+     npalf = otx2_mbox_alloc_msg_npa_lf_alloc(&pfvf->mbox);
+     if (!npalf)
+             return -ENOMEM;
+
+     /* Set aura and pool counts */
+     npalf->nr_pools = hw->pool_cnt;
+     aura_cnt = ilog2(roundup_pow_of_two(hw->pool_cnt));
+     npalf->aura_sz = (aura_cnt >= ilog2(128)) ? (aura_cnt - 6) : 1;
+
+     err = otx2_sync_mbox_msg(&pfvf->mbox);
+     if (err)
+             return err;
+     return 0;
return otx2_sync..

directly
quoted
+}
quoted
+static int otx2_realloc_msix_vectors(struct otx2_nic *pf)
+{
+     struct otx2_hw *hw = &pf->hw;
+     int num_vec, err;
+
+     /* NPA interrupts are inot registered, so alloc only
+      * upto NIX vector offset.
+      */
+     num_vec = hw->nix_msixoff;
+#define NIX_LF_CINT_VEC_START                        0x40
+     num_vec += NIX_LF_CINT_VEC_START + hw->max_queues;
+
+     otx2_disable_mbox_intr(pf);
+     pci_free_irq_vectors(hw->pdev);
+     pci_free_irq_vectors(hw->pdev);
+     err = pci_alloc_irq_vectors(hw->pdev, num_vec, num_vec, PCI_IRQ_MSIX);
+     if (err < 0) {
+             dev_err(pf->dev, "%s: Failed to realloc %d IRQ vectors\n",
+                     __func__, num_vec);
+             return err;
+     }
+
+     err = otx2_register_mbox_intr(pf, false);
+     if (err)
+             return err;
+     return 0;
+}
ditto, please fix this everywhere in the submission
Thanks, will fix and resubmit.

Sunil.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help