* [net-next PATCH 0/4] Refactoring RVU NIC driver
@ 2024-09-03 12:40 Geetha sowjanya
2024-09-03 12:40 ` [net-next PATCH 1/4] octeontx2-pf: Defines common API for HW resources configuration Geetha sowjanya
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Geetha sowjanya @ 2024-09-03 12:40 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: kuba, davem, pabeni, jiri, edumazet, sgoutham, gakula, sbhatta,
hkelam
This is a preparation pathset for follow-up "Introducing RVU representors driver"
patches. The RVU representor driver creates representor netdev of each rvu device
when switch dev mode is enabled.
RVU representor and NIC have a similar set of HW resources(NIX_LF,RQ/SQ/CQ)
and implements a subset of NIC functionality.
This patchset groups hw resources and queue configuration code into separate
APIs and export the existing functions so, that code can be shared between
NIC and representor drivers.
These patches are part of "Introduce RVU representors" patchset.
https://lore.kernel.org/all/ZsdJ-w00yCI4NQ8T@nanopsycho.orion/T/
As suggested by "Jiri Pirko", submitting as separate patchset.
Geetha sowjanya (4):
octeontx2-pf: Defines common API for HW resources configuration
octeontx2-pf: Add new APIs for queue memory alloc/free.
octeontx2-pf: Reuse max mtu value
octeontx2-pf: Export common APIs
.../marvell/octeontx2/nic/otx2_common.c | 6 +-
.../marvell/octeontx2/nic/otx2_common.h | 15 ++
.../ethernet/marvell/octeontx2/nic/otx2_pf.c | 243 +++++++++++-------
.../marvell/octeontx2/nic/otx2_txrx.c | 17 +-
.../marvell/octeontx2/nic/otx2_txrx.h | 3 +-
.../ethernet/marvell/octeontx2/nic/otx2_vf.c | 7 +-
6 files changed, 186 insertions(+), 105 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [net-next PATCH 1/4] octeontx2-pf: Defines common API for HW resources configuration
2024-09-03 12:40 [net-next PATCH 0/4] Refactoring RVU NIC driver Geetha sowjanya
@ 2024-09-03 12:40 ` Geetha sowjanya
2024-09-03 14:55 ` Jiri Pirko
2024-09-03 14:57 ` Pavan Chebbi
2024-09-03 12:40 ` [net-next PATCH 2/4] octeontx2-pf: Add new APIs for queue memory alloc/free Geetha sowjanya
` (2 subsequent siblings)
3 siblings, 2 replies; 13+ messages in thread
From: Geetha sowjanya @ 2024-09-03 12:40 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: kuba, davem, pabeni, jiri, edumazet, sgoutham, gakula, sbhatta,
hkelam
Defines new API "otx2_init_rsrc" and moves the HW blocks
NIX/NPA resources configuration code under this API. So, that
it can be used by the RVU representor driver that has similar
resources of RVU NIC.
Signed-off-by: Geetha sowjanya <gakula@marvell.com>
---
.../marvell/octeontx2/nic/otx2_common.h | 1 +
.../ethernet/marvell/octeontx2/nic/otx2_pf.c | 146 ++++++++++--------
2 files changed, 84 insertions(+), 63 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index f27a3456ae64..a47001a2b93f 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -996,6 +996,7 @@ int otx2_pool_init(struct otx2_nic *pfvf, u16 pool_id,
int stack_pages, int numptrs, int buf_size, int type);
int otx2_aura_init(struct otx2_nic *pfvf, int aura_id,
int pool_id, int numptrs);
+int otx2_init_rsrc(struct pci_dev *pdev, struct otx2_nic *pf);
/* RSS configuration APIs*/
int otx2_rss_init(struct otx2_nic *pfvf);
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index 5492dea547a1..4cfeca5ca626 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -2872,6 +2872,88 @@ static void otx2_sriov_vfcfg_cleanup(struct otx2_nic *pf)
}
}
+int otx2_init_rsrc(struct pci_dev *pdev, struct otx2_nic *pf)
+{
+ struct device *dev = &pdev->dev;
+ struct otx2_hw *hw = &pf->hw;
+ int num_vec, err;
+
+ num_vec = pci_msix_vec_count(pdev);
+ hw->irq_name = devm_kmalloc_array(&hw->pdev->dev, num_vec, NAME_SIZE,
+ GFP_KERNEL);
+ if (!hw->irq_name)
+ return -ENOMEM;
+
+ hw->affinity_mask = devm_kcalloc(&hw->pdev->dev, num_vec,
+ sizeof(cpumask_var_t), GFP_KERNEL);
+ if (!hw->affinity_mask)
+ return -ENOMEM;
+
+ /* Map CSRs */
+ pf->reg_base = pcim_iomap(pdev, PCI_CFG_REG_BAR_NUM, 0);
+ if (!pf->reg_base) {
+ dev_err(dev, "Unable to map physical function CSRs, aborting\n");
+ return -ENOMEM;
+ }
+
+ err = otx2_check_pf_usable(pf);
+ if (err)
+ return err;
+
+ err = pci_alloc_irq_vectors(hw->pdev, RVU_PF_INT_VEC_CNT,
+ RVU_PF_INT_VEC_CNT, PCI_IRQ_MSIX);
+ if (err < 0) {
+ dev_err(dev, "%s: Failed to alloc %d IRQ vectors\n",
+ __func__, num_vec);
+ return err;
+ }
+
+ otx2_setup_dev_hw_settings(pf);
+
+ /* Init PF <=> AF mailbox stuff */
+ err = otx2_pfaf_mbox_init(pf);
+ if (err)
+ goto err_free_irq_vectors;
+
+ /* Register mailbox interrupt */
+ err = otx2_register_mbox_intr(pf, true);
+ if (err)
+ goto err_mbox_destroy;
+
+ /* Request AF to attach NPA and NIX LFs to this PF.
+ * NIX and NPA LFs are needed for this PF to function as a NIC.
+ */
+ err = otx2_attach_npa_nix(pf);
+ if (err)
+ goto err_disable_mbox_intr;
+
+ err = otx2_realloc_msix_vectors(pf);
+ if (err)
+ goto err_detach_rsrc;
+
+ err = cn10k_lmtst_init(pf);
+ if (err)
+ goto err_detach_rsrc;
+
+ return 0;
+
+err_detach_rsrc:
+ if (pf->hw.lmt_info)
+ free_percpu(pf->hw.lmt_info);
+ if (test_bit(CN10K_LMTST, &pf->hw.cap_flag))
+ qmem_free(pf->dev, pf->dync_lmt);
+ otx2_detach_resources(&pf->mbox);
+err_disable_mbox_intr:
+ otx2_disable_mbox_intr(pf);
+err_mbox_destroy:
+ otx2_pfaf_mbox_destroy(pf);
+err_free_irq_vectors:
+ pci_free_irq_vectors(hw->pdev);
+
+ return err;
+}
+EXPORT_SYMBOL(otx2_init_rsrc);
+
static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
struct device *dev = &pdev->dev;
@@ -2879,7 +2961,6 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
struct net_device *netdev;
struct otx2_nic *pf;
struct otx2_hw *hw;
- int num_vec;
err = pcim_enable_device(pdev);
if (err) {
@@ -2930,72 +3011,14 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* Use CQE of 128 byte descriptor size by default */
hw->xqe_size = 128;
- num_vec = pci_msix_vec_count(pdev);
- hw->irq_name = devm_kmalloc_array(&hw->pdev->dev, num_vec, NAME_SIZE,
- GFP_KERNEL);
- if (!hw->irq_name) {
- err = -ENOMEM;
- goto err_free_netdev;
- }
-
- hw->affinity_mask = devm_kcalloc(&hw->pdev->dev, num_vec,
- sizeof(cpumask_var_t), GFP_KERNEL);
- if (!hw->affinity_mask) {
- err = -ENOMEM;
- goto err_free_netdev;
- }
-
- /* Map CSRs */
- pf->reg_base = pcim_iomap(pdev, PCI_CFG_REG_BAR_NUM, 0);
- if (!pf->reg_base) {
- dev_err(dev, "Unable to map physical function CSRs, aborting\n");
- err = -ENOMEM;
- goto err_free_netdev;
- }
-
- err = otx2_check_pf_usable(pf);
+ err = otx2_init_rsrc(pdev, pf);
if (err)
goto err_free_netdev;
- err = pci_alloc_irq_vectors(hw->pdev, RVU_PF_INT_VEC_CNT,
- RVU_PF_INT_VEC_CNT, PCI_IRQ_MSIX);
- if (err < 0) {
- dev_err(dev, "%s: Failed to alloc %d IRQ vectors\n",
- __func__, num_vec);
- goto err_free_netdev;
- }
-
- otx2_setup_dev_hw_settings(pf);
-
- /* Init PF <=> AF mailbox stuff */
- err = otx2_pfaf_mbox_init(pf);
- if (err)
- goto err_free_irq_vectors;
-
- /* Register mailbox interrupt */
- err = otx2_register_mbox_intr(pf, true);
- if (err)
- goto err_mbox_destroy;
-
- /* Request AF to attach NPA and NIX LFs to this PF.
- * NIX and NPA LFs are needed for this PF to function as a NIC.
- */
- err = otx2_attach_npa_nix(pf);
- if (err)
- goto err_disable_mbox_intr;
-
- err = otx2_realloc_msix_vectors(pf);
- if (err)
- goto err_detach_rsrc;
-
err = otx2_set_real_num_queues(netdev, hw->tx_queues, hw->rx_queues);
if (err)
goto err_detach_rsrc;
- err = cn10k_lmtst_init(pf);
- if (err)
- goto err_detach_rsrc;
-
/* Assign default mac address */
otx2_get_mac_from_af(netdev);
@@ -3118,11 +3141,8 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (test_bit(CN10K_LMTST, &pf->hw.cap_flag))
qmem_free(pf->dev, pf->dync_lmt);
otx2_detach_resources(&pf->mbox);
-err_disable_mbox_intr:
otx2_disable_mbox_intr(pf);
-err_mbox_destroy:
otx2_pfaf_mbox_destroy(pf);
-err_free_irq_vectors:
pci_free_irq_vectors(hw->pdev);
err_free_netdev:
pci_set_drvdata(pdev, NULL);
--
2.25.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [net-next PATCH 2/4] octeontx2-pf: Add new APIs for queue memory alloc/free.
2024-09-03 12:40 [net-next PATCH 0/4] Refactoring RVU NIC driver Geetha sowjanya
2024-09-03 12:40 ` [net-next PATCH 1/4] octeontx2-pf: Defines common API for HW resources configuration Geetha sowjanya
@ 2024-09-03 12:40 ` Geetha sowjanya
2024-09-03 15:12 ` Pavan Chebbi
2024-09-03 12:40 ` [net-next PATCH 3/4] octeontx2-pf: Reuse PF max mtu value Geetha sowjanya
2024-09-03 12:40 ` [net-next PATCH 4/4] octeontx2-pf: Export common APIs Geetha sowjanya
3 siblings, 1 reply; 13+ messages in thread
From: Geetha sowjanya @ 2024-09-03 12:40 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: kuba, davem, pabeni, jiri, edumazet, sgoutham, gakula, sbhatta,
hkelam
Group the queue(RX/TX/CQ) memory allocation and free code to single APIs.
Signed-off-by: Geetha sowjanya <gakula@marvell.com>
---
.../marvell/octeontx2/nic/otx2_common.h | 2 +
.../ethernet/marvell/octeontx2/nic/otx2_pf.c | 56 +++++++++++++------
2 files changed, 41 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index a47001a2b93f..df548aeffecf 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -997,6 +997,8 @@ int otx2_pool_init(struct otx2_nic *pfvf, u16 pool_id,
int otx2_aura_init(struct otx2_nic *pfvf, int aura_id,
int pool_id, int numptrs);
int otx2_init_rsrc(struct pci_dev *pdev, struct otx2_nic *pf);
+void otx2_free_queue_mem(struct otx2_qset *qset);
+int otx2_alloc_queue_mem(struct otx2_nic *pf);
/* RSS configuration APIs*/
int otx2_rss_init(struct otx2_nic *pfvf);
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index 4cfeca5ca626..68addc975113 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -1770,15 +1770,23 @@ static void otx2_dim_work(struct work_struct *w)
dim->state = DIM_START_MEASURE;
}
-int otx2_open(struct net_device *netdev)
+void otx2_free_queue_mem(struct otx2_qset *qset)
+{
+ kfree(qset->sq);
+ qset->sq = NULL;
+ kfree(qset->cq);
+ qset->cq = NULL;
+ kfree(qset->rq);
+ qset->rq = NULL;
+ kfree(qset->napi);
+}
+EXPORT_SYMBOL(otx2_free_queue_mem);
+int otx2_alloc_queue_mem(struct otx2_nic *pf)
{
- struct otx2_nic *pf = netdev_priv(netdev);
- struct otx2_cq_poll *cq_poll = NULL;
struct otx2_qset *qset = &pf->qset;
- int err = 0, qidx, vec;
- char *irq_name;
+ struct otx2_cq_poll *cq_poll;
+ int err = -ENOMEM;
- netif_carrier_off(netdev);
/* RQ and SQs are mapped to different CQs,
* so find out max CQ IRQs (i.e CINTs) needed.
@@ -1791,14 +1799,13 @@ int otx2_open(struct net_device *netdev)
qset->napi = kcalloc(pf->hw.cint_cnt, sizeof(*cq_poll), GFP_KERNEL);
if (!qset->napi)
- return -ENOMEM;
+ return err;
/* CQ size of RQ */
qset->rqe_cnt = qset->rqe_cnt ? qset->rqe_cnt : Q_COUNT(Q_SIZE_256);
/* CQ size of SQ */
qset->sqe_cnt = qset->sqe_cnt ? qset->sqe_cnt : Q_COUNT(Q_SIZE_4K);
- err = -ENOMEM;
qset->cq = kcalloc(pf->qset.cq_cnt,
sizeof(struct otx2_cq_queue), GFP_KERNEL);
if (!qset->cq)
@@ -1814,6 +1821,28 @@ int otx2_open(struct net_device *netdev)
if (!qset->rq)
goto err_free_mem;
+ return 0;
+
+err_free_mem:
+ otx2_free_queue_mem(qset);
+ return err;
+}
+EXPORT_SYMBOL(otx2_alloc_queue_mem);
+
+int otx2_open(struct net_device *netdev)
+{
+ struct otx2_nic *pf = netdev_priv(netdev);
+ struct otx2_cq_poll *cq_poll = NULL;
+ struct otx2_qset *qset = &pf->qset;
+ int err = 0, qidx, vec;
+ char *irq_name;
+
+ netif_carrier_off(netdev);
+
+ err = otx2_alloc_queue_mem(pf);
+ if (err)
+ return err;
+
err = otx2_init_hw_resources(pf);
if (err)
goto err_free_mem;
@@ -1979,10 +2008,7 @@ int otx2_open(struct net_device *netdev)
otx2_disable_napi(pf);
otx2_free_hw_resources(pf);
err_free_mem:
- kfree(qset->sq);
- kfree(qset->cq);
- kfree(qset->rq);
- kfree(qset->napi);
+ otx2_free_queue_mem(qset);
return err;
}
EXPORT_SYMBOL(otx2_open);
@@ -2047,11 +2073,7 @@ int otx2_stop(struct net_device *netdev)
for (qidx = 0; qidx < netdev->num_tx_queues; qidx++)
netdev_tx_reset_queue(netdev_get_tx_queue(netdev, qidx));
-
- kfree(qset->sq);
- kfree(qset->cq);
- kfree(qset->rq);
- kfree(qset->napi);
+ otx2_free_queue_mem(qset);
/* Do not clear RQ/SQ ringsize settings */
memset_startat(qset, 0, sqe_cnt);
return 0;
--
2.25.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [net-next PATCH 3/4] octeontx2-pf: Reuse PF max mtu value
2024-09-03 12:40 [net-next PATCH 0/4] Refactoring RVU NIC driver Geetha sowjanya
2024-09-03 12:40 ` [net-next PATCH 1/4] octeontx2-pf: Defines common API for HW resources configuration Geetha sowjanya
2024-09-03 12:40 ` [net-next PATCH 2/4] octeontx2-pf: Add new APIs for queue memory alloc/free Geetha sowjanya
@ 2024-09-03 12:40 ` Geetha sowjanya
2024-09-03 12:40 ` [net-next PATCH 4/4] octeontx2-pf: Export common APIs Geetha sowjanya
3 siblings, 0 replies; 13+ messages in thread
From: Geetha sowjanya @ 2024-09-03 12:40 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: kuba, davem, pabeni, jiri, edumazet, sgoutham, gakula, sbhatta,
hkelam
Reuse the maximum support HW MTU value that is fetch during probe.
Instead of fetching through mbox each time mtu is changed as the
value is fixed for interface.
Signed-off-by: Geetha sowjanya <gakula@marvell.com>
---
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 4 ++--
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 1 +
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 1 +
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 1 +
4 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
index 87d5776e3b88..34e76cfd941b 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
@@ -227,7 +227,7 @@ int otx2_hw_set_mtu(struct otx2_nic *pfvf, int mtu)
u16 maxlen;
int err;
- maxlen = otx2_get_max_mtu(pfvf) + OTX2_ETH_HLEN + OTX2_HW_TIMESTAMP_LEN;
+ maxlen = pfvf->hw.max_mtu + OTX2_ETH_HLEN + OTX2_HW_TIMESTAMP_LEN;
mutex_lock(&pfvf->mbox.lock);
req = otx2_mbox_alloc_msg_nix_set_hw_frs(&pfvf->mbox);
@@ -236,7 +236,7 @@ int otx2_hw_set_mtu(struct otx2_nic *pfvf, int mtu)
return -ENOMEM;
}
- req->maxlen = pfvf->netdev->mtu + OTX2_ETH_HLEN + OTX2_HW_TIMESTAMP_LEN;
+ req->maxlen = mtu + OTX2_ETH_HLEN + OTX2_HW_TIMESTAMP_LEN;
/* Use max receive length supported by hardware for loopback devices */
if (is_otx2_lbkvf(pfvf->pdev))
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index df548aeffecf..b36b87dae2cb 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -228,6 +228,7 @@ struct otx2_hw {
u16 txschq_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
u16 matchall_ipolicer;
u32 dwrr_mtu;
+ u32 max_mtu;
u8 smq_link_type;
/* HW settings, coalescing etc */
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index 68addc975113..5bb6db5a3a73 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -3103,6 +3103,7 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
netdev->min_mtu = OTX2_MIN_MTU;
netdev->max_mtu = otx2_get_max_mtu(pf);
+ hw->max_mtu = netdev->max_mtu;
/* reset CGX/RPM MAC stats */
otx2_reset_mac_stats(pf);
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
index 99fcc5661674..79a8acac6283 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
@@ -671,6 +671,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
netdev->min_mtu = OTX2_MIN_MTU;
netdev->max_mtu = otx2_get_max_mtu(vf);
+ hw->max_mtu = netdev->max_mtu;
/* To distinguish, for LBK VFs set netdev name explicitly */
if (is_otx2_lbkvf(vf->pdev)) {
--
2.25.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [net-next PATCH 4/4] octeontx2-pf: Export common APIs
2024-09-03 12:40 [net-next PATCH 0/4] Refactoring RVU NIC driver Geetha sowjanya
` (2 preceding siblings ...)
2024-09-03 12:40 ` [net-next PATCH 3/4] octeontx2-pf: Reuse PF max mtu value Geetha sowjanya
@ 2024-09-03 12:40 ` Geetha sowjanya
2024-09-03 15:00 ` Jiri Pirko
3 siblings, 1 reply; 13+ messages in thread
From: Geetha sowjanya @ 2024-09-03 12:40 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: kuba, davem, pabeni, jiri, edumazet, sgoutham, gakula, sbhatta,
hkelam
Export mbox, hw resources and interrupt configuration functions.
So, that they can be used later by the RVU representor driver.
Signed-off-by: Geetha sowjanya <gakula@marvell.com>
---
.../marvell/octeontx2/nic/otx2_common.c | 2 +
.../marvell/octeontx2/nic/otx2_common.h | 11 +++++
.../ethernet/marvell/octeontx2/nic/otx2_pf.c | 40 +++++++++++++------
.../marvell/octeontx2/nic/otx2_txrx.c | 17 +++++---
.../marvell/octeontx2/nic/otx2_txrx.h | 3 +-
.../ethernet/marvell/octeontx2/nic/otx2_vf.c | 6 +--
6 files changed, 56 insertions(+), 23 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
index 34e76cfd941b..e38b3eea11f3 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
@@ -246,6 +246,7 @@ int otx2_hw_set_mtu(struct otx2_nic *pfvf, int mtu)
mutex_unlock(&pfvf->mbox.lock);
return err;
}
+EXPORT_SYMBOL(otx2_hw_set_mtu);
int otx2_config_pause_frm(struct otx2_nic *pfvf)
{
@@ -1782,6 +1783,7 @@ void otx2_free_cints(struct otx2_nic *pfvf, int n)
free_irq(vector, &qset->napi[qidx]);
}
}
+EXPORT_SYMBOL(otx2_free_cints);
void otx2_set_cints_affinity(struct otx2_nic *pfvf)
{
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
index b36b87dae2cb..327254e578d5 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
@@ -1000,6 +1000,17 @@ int otx2_aura_init(struct otx2_nic *pfvf, int aura_id,
int otx2_init_rsrc(struct pci_dev *pdev, struct otx2_nic *pf);
void otx2_free_queue_mem(struct otx2_qset *qset);
int otx2_alloc_queue_mem(struct otx2_nic *pf);
+int otx2_init_hw_resources(struct otx2_nic *pfvf);
+void otx2_free_hw_resources(struct otx2_nic *pf);
+int otx2_wq_init(struct otx2_nic *pf);
+int otx2_check_pf_usable(struct otx2_nic *pf);
+int otx2_pfaf_mbox_init(struct otx2_nic *pf);
+int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af);
+int otx2_realloc_msix_vectors(struct otx2_nic *pf);
+void otx2_pfaf_mbox_destroy(struct otx2_nic *pf);
+void otx2_disable_mbox_intr(struct otx2_nic *pf);
+void otx2_disable_napi(struct otx2_nic *pf);
+irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq);
/* RSS configuration APIs*/
int otx2_rss_init(struct otx2_nic *pfvf);
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index 5bb6db5a3a73..b4fa2c12721d 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -1008,7 +1008,7 @@ static irqreturn_t otx2_pfaf_mbox_intr_handler(int irq, void *pf_irq)
return IRQ_HANDLED;
}
-static void otx2_disable_mbox_intr(struct otx2_nic *pf)
+void otx2_disable_mbox_intr(struct otx2_nic *pf)
{
int vector = pci_irq_vector(pf->pdev, RVU_PF_INT_VEC_AFPF_MBOX);
@@ -1016,8 +1016,9 @@ static void otx2_disable_mbox_intr(struct otx2_nic *pf)
otx2_write64(pf, RVU_PF_INT_ENA_W1C, BIT_ULL(0));
free_irq(vector, pf);
}
+EXPORT_SYMBOL(otx2_disable_mbox_intr);
-static int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af)
+int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af)
{
struct otx2_hw *hw = &pf->hw;
struct msg_req *req;
@@ -1060,8 +1061,9 @@ static int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af)
return 0;
}
+EXPORT_SYMBOL(otx2_register_mbox_intr);
-static void otx2_pfaf_mbox_destroy(struct otx2_nic *pf)
+void otx2_pfaf_mbox_destroy(struct otx2_nic *pf)
{
struct mbox *mbox = &pf->mbox;
@@ -1076,8 +1078,9 @@ static void otx2_pfaf_mbox_destroy(struct otx2_nic *pf)
otx2_mbox_destroy(&mbox->mbox);
otx2_mbox_destroy(&mbox->mbox_up);
}
+EXPORT_SYMBOL(otx2_pfaf_mbox_destroy);
-static int otx2_pfaf_mbox_init(struct otx2_nic *pf)
+int otx2_pfaf_mbox_init(struct otx2_nic *pf)
{
struct mbox *mbox = &pf->mbox;
void __iomem *hwbase;
@@ -1124,6 +1127,7 @@ static int otx2_pfaf_mbox_init(struct otx2_nic *pf)
otx2_pfaf_mbox_destroy(pf);
return err;
}
+EXPORT_SYMBOL(otx2_pfaf_mbox_init);
static int otx2_cgx_config_linkevents(struct otx2_nic *pf, bool enable)
{
@@ -1379,7 +1383,7 @@ static irqreturn_t otx2_q_intr_handler(int irq, void *data)
return IRQ_HANDLED;
}
-static irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq)
+irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq)
{
struct otx2_cq_poll *cq_poll = (struct otx2_cq_poll *)cq_irq;
struct otx2_nic *pf = (struct otx2_nic *)cq_poll->dev;
@@ -1398,20 +1402,25 @@ static irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq)
return IRQ_HANDLED;
}
+EXPORT_SYMBOL(otx2_cq_intr_handler);
-static void otx2_disable_napi(struct otx2_nic *pf)
+void otx2_disable_napi(struct otx2_nic *pf)
{
struct otx2_qset *qset = &pf->qset;
struct otx2_cq_poll *cq_poll;
+ struct work_struct *work;
int qidx;
for (qidx = 0; qidx < pf->hw.cint_cnt; qidx++) {
cq_poll = &qset->napi[qidx];
- cancel_work_sync(&cq_poll->dim.work);
+ work = &cq_poll->dim.work;
+ if (work->func)
+ cancel_work_sync(work);
napi_disable(&cq_poll->napi);
netif_napi_del(&cq_poll->napi);
}
}
+EXPORT_SYMBOL(otx2_disable_napi);
static void otx2_free_cq_res(struct otx2_nic *pf)
{
@@ -1477,7 +1486,7 @@ static int otx2_get_rbuf_size(struct otx2_nic *pf, int mtu)
return ALIGN(rbuf_size, 2048);
}
-static int otx2_init_hw_resources(struct otx2_nic *pf)
+int otx2_init_hw_resources(struct otx2_nic *pf)
{
struct nix_lf_free_req *free_req;
struct mbox *mbox = &pf->mbox;
@@ -1601,8 +1610,9 @@ static int otx2_init_hw_resources(struct otx2_nic *pf)
mutex_unlock(&mbox->lock);
return err;
}
+EXPORT_SYMBOL(otx2_init_hw_resources);
-static void otx2_free_hw_resources(struct otx2_nic *pf)
+void otx2_free_hw_resources(struct otx2_nic *pf)
{
struct otx2_qset *qset = &pf->qset;
struct nix_lf_free_req *free_req;
@@ -1688,6 +1698,7 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)
}
mutex_unlock(&mbox->lock);
}
+EXPORT_SYMBOL(otx2_free_hw_resources);
static bool otx2_promisc_use_mce_list(struct otx2_nic *pfvf)
{
@@ -1781,6 +1792,7 @@ void otx2_free_queue_mem(struct otx2_qset *qset)
kfree(qset->napi);
}
EXPORT_SYMBOL(otx2_free_queue_mem);
+
int otx2_alloc_queue_mem(struct otx2_nic *pf)
{
struct otx2_qset *qset = &pf->qset;
@@ -2103,7 +2115,7 @@ static netdev_tx_t otx2_xmit(struct sk_buff *skb, struct net_device *netdev)
sq = &pf->qset.sq[sq_idx];
txq = netdev_get_tx_queue(netdev, qidx);
- if (!otx2_sq_append_skb(netdev, sq, skb, qidx)) {
+ if (!otx2_sq_append_skb(pf, txq, sq, skb, qidx)) {
netif_tx_stop_queue(txq);
/* Check again, incase SQBs got freed up */
@@ -2808,7 +2820,7 @@ static const struct net_device_ops otx2_netdev_ops = {
.ndo_set_vf_trust = otx2_ndo_set_vf_trust,
};
-static int otx2_wq_init(struct otx2_nic *pf)
+int otx2_wq_init(struct otx2_nic *pf)
{
pf->otx2_wq = create_singlethread_workqueue("otx2_wq");
if (!pf->otx2_wq)
@@ -2819,7 +2831,7 @@ static int otx2_wq_init(struct otx2_nic *pf)
return 0;
}
-static int otx2_check_pf_usable(struct otx2_nic *nic)
+int otx2_check_pf_usable(struct otx2_nic *nic)
{
u64 rev;
@@ -2836,8 +2848,9 @@ static int otx2_check_pf_usable(struct otx2_nic *nic)
}
return 0;
}
+EXPORT_SYMBOL(otx2_check_pf_usable);
-static int otx2_realloc_msix_vectors(struct otx2_nic *pf)
+int otx2_realloc_msix_vectors(struct otx2_nic *pf)
{
struct otx2_hw *hw = &pf->hw;
int num_vec, err;
@@ -2859,6 +2872,7 @@ static int otx2_realloc_msix_vectors(struct otx2_nic *pf)
return otx2_register_mbox_intr(pf, false);
}
+EXPORT_SYMBOL(otx2_realloc_msix_vectors);
static int otx2_sriov_vfcfg_init(struct otx2_nic *pf)
{
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
index 3eb85949677a..fbd9fe98259f 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
@@ -131,6 +131,7 @@ static void otx2_xdp_snd_pkt_handler(struct otx2_nic *pfvf,
}
static void otx2_snd_pkt_handler(struct otx2_nic *pfvf,
+ struct net_device *ndev,
struct otx2_cq_queue *cq,
struct otx2_snd_queue *sq,
struct nix_cqe_tx_s *cqe,
@@ -145,7 +146,7 @@ static void otx2_snd_pkt_handler(struct otx2_nic *pfvf,
if (unlikely(snd_comp->status) && netif_msg_tx_err(pfvf))
net_err_ratelimited("%s: TX%d: Error in send CQ status:%x\n",
- pfvf->netdev->name, cq->cint_idx,
+ ndev->name, cq->cint_idx,
snd_comp->status);
sg = &sq->sg[snd_comp->sqe_id];
@@ -453,6 +454,7 @@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
int tx_pkts = 0, tx_bytes = 0, qidx;
struct otx2_snd_queue *sq;
struct nix_cqe_tx_s *cqe;
+ struct net_device *ndev;
int processed_cqe = 0;
if (cq->pend_cqe >= budget)
@@ -464,6 +466,7 @@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
process_cqe:
qidx = cq->cq_idx - pfvf->hw.rx_queues;
sq = &pfvf->qset.sq[qidx];
+ ndev = pfvf->netdev;
while (likely(processed_cqe < budget) && cq->pend_cqe) {
cqe = (struct nix_cqe_tx_s *)otx2_get_next_cqe(cq);
@@ -478,7 +481,8 @@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
if (cq->cq_type == CQ_XDP)
otx2_xdp_snd_pkt_handler(pfvf, sq, cqe);
else
- otx2_snd_pkt_handler(pfvf, cq, &pfvf->qset.sq[qidx],
+ otx2_snd_pkt_handler(pfvf, ndev, cq,
+ &pfvf->qset.sq[qidx],
cqe, budget, &tx_pkts, &tx_bytes);
cqe->hdr.cqe_type = NIX_XQE_TYPE_INVALID;
@@ -505,7 +509,7 @@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
/* Check if queue was stopped earlier due to ring full */
smp_mb();
if (netif_tx_queue_stopped(txq) &&
- netif_carrier_ok(pfvf->netdev))
+ netif_carrier_ok(ndev))
netif_tx_wake_queue(txq);
}
return 0;
@@ -594,6 +598,7 @@ int otx2_napi_handler(struct napi_struct *napi, int budget)
}
return workdone;
}
+EXPORT_SYMBOL(otx2_napi_handler);
void otx2_sqe_flush(void *dev, struct otx2_snd_queue *sq,
int size, int qidx)
@@ -1141,13 +1146,13 @@ static void otx2_set_txtstamp(struct otx2_nic *pfvf, struct sk_buff *skb,
}
}
-bool otx2_sq_append_skb(struct net_device *netdev, struct otx2_snd_queue *sq,
+bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq,
+ struct otx2_snd_queue *sq,
struct sk_buff *skb, u16 qidx)
{
- struct netdev_queue *txq = netdev_get_tx_queue(netdev, qidx);
- struct otx2_nic *pfvf = netdev_priv(netdev);
int offset, num_segs, free_desc;
struct nix_sqe_hdr_s *sqe_hdr;
+ struct otx2_nic *pfvf = dev;
/* Check if there is enough room between producer
* and consumer index.
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
index 3f1d2655ff77..e1db5f961877 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
@@ -167,7 +167,8 @@ static inline u64 otx2_iova_to_phys(void *iommu_domain, dma_addr_t dma_addr)
}
int otx2_napi_handler(struct napi_struct *napi, int budget);
-bool otx2_sq_append_skb(struct net_device *netdev, struct otx2_snd_queue *sq,
+bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq,
+ struct otx2_snd_queue *sq,
struct sk_buff *skb, u16 qidx);
void cn10k_sqe_flush(void *dev, struct otx2_snd_queue *sq,
int size, int qidx);
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
index 79a8acac6283..0486fca8b573 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
@@ -395,7 +395,7 @@ static netdev_tx_t otx2vf_xmit(struct sk_buff *skb, struct net_device *netdev)
sq = &vf->qset.sq[qidx];
txq = netdev_get_tx_queue(netdev, qidx);
- if (!otx2_sq_append_skb(netdev, sq, skb, qidx)) {
+ if (!otx2_sq_append_skb(vf, txq, sq, skb, qidx)) {
netif_tx_stop_queue(txq);
/* Check again, incase SQBs got freed up */
@@ -500,7 +500,7 @@ static const struct net_device_ops otx2vf_netdev_ops = {
.ndo_setup_tc = otx2_setup_tc,
};
-static int otx2_wq_init(struct otx2_nic *vf)
+static int otx2_vf_wq_init(struct otx2_nic *vf)
{
vf->otx2_wq = create_singlethread_workqueue("otx2vf_wq");
if (!vf->otx2_wq)
@@ -689,7 +689,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto err_ptp_destroy;
}
- err = otx2_wq_init(vf);
+ err = otx2_vf_wq_init(vf);
if (err)
goto err_unreg_netdev;
--
2.25.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [net-next PATCH 1/4] octeontx2-pf: Defines common API for HW resources configuration
2024-09-03 12:40 ` [net-next PATCH 1/4] octeontx2-pf: Defines common API for HW resources configuration Geetha sowjanya
@ 2024-09-03 14:55 ` Jiri Pirko
2024-09-03 14:57 ` Pavan Chebbi
1 sibling, 0 replies; 13+ messages in thread
From: Jiri Pirko @ 2024-09-03 14:55 UTC (permalink / raw)
To: Geetha sowjanya
Cc: netdev, linux-kernel, kuba, davem, pabeni, edumazet, sgoutham,
sbhatta, hkelam
Tue, Sep 03, 2024 at 02:40:45PM CEST, gakula@marvell.com wrote:
>Defines new API "otx2_init_rsrc" and moves the HW blocks
s/Defines/Define/ (in subject of the patch as well)
s/moves/move/
Otherwise that patch looks ok.
>NIX/NPA resources configuration code under this API. So, that
>it can be used by the RVU representor driver that has similar
>resources of RVU NIC.
>
>Signed-off-by: Geetha sowjanya <gakula@marvell.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [net-next PATCH 1/4] octeontx2-pf: Defines common API for HW resources configuration
2024-09-03 12:40 ` [net-next PATCH 1/4] octeontx2-pf: Defines common API for HW resources configuration Geetha sowjanya
2024-09-03 14:55 ` Jiri Pirko
@ 2024-09-03 14:57 ` Pavan Chebbi
2024-09-04 5:48 ` [EXTERNAL] " Geethasowjanya Akula
1 sibling, 1 reply; 13+ messages in thread
From: Pavan Chebbi @ 2024-09-03 14:57 UTC (permalink / raw)
To: Geetha sowjanya
Cc: netdev, linux-kernel, kuba, davem, pabeni, jiri, edumazet,
sgoutham, sbhatta, hkelam
[-- Attachment #1: Type: text/plain, Size: 818 bytes --]
On Tue, Sep 3, 2024 at 6:11 PM Geetha sowjanya <gakula@marvell.com> wrote:
>
> -
> /* Assign default mac address */
> otx2_get_mac_from_af(netdev);
>
> @@ -3118,11 +3141,8 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> if (test_bit(CN10K_LMTST, &pf->hw.cap_flag))
> qmem_free(pf->dev, pf->dync_lmt);
> otx2_detach_resources(&pf->mbox);
Isn't some of this unwinding/cleanup already moved to the new
function? Looks like duplicate code to me.
> -err_disable_mbox_intr:
> otx2_disable_mbox_intr(pf);
> -err_mbox_destroy:
> otx2_pfaf_mbox_destroy(pf);
> -err_free_irq_vectors:
> pci_free_irq_vectors(hw->pdev);
> err_free_netdev:
> pci_set_drvdata(pdev, NULL);
> --
> 2.25.1
>
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [net-next PATCH 4/4] octeontx2-pf: Export common APIs
2024-09-03 12:40 ` [net-next PATCH 4/4] octeontx2-pf: Export common APIs Geetha sowjanya
@ 2024-09-03 15:00 ` Jiri Pirko
2024-09-04 6:20 ` [EXTERNAL] " Geethasowjanya Akula
0 siblings, 1 reply; 13+ messages in thread
From: Jiri Pirko @ 2024-09-03 15:00 UTC (permalink / raw)
To: Geetha sowjanya
Cc: netdev, linux-kernel, kuba, davem, pabeni, edumazet, sgoutham,
sbhatta, hkelam
Tue, Sep 03, 2024 at 02:40:48PM CEST, gakula@marvell.com wrote:
>Export mbox, hw resources and interrupt configuration functions.
>So, that they can be used later by the RVU representor driver.
>
>Signed-off-by: Geetha sowjanya <gakula@marvell.com>
>---
> .../marvell/octeontx2/nic/otx2_common.c | 2 +
> .../marvell/octeontx2/nic/otx2_common.h | 11 +++++
> .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 40 +++++++++++++------
> .../marvell/octeontx2/nic/otx2_txrx.c | 17 +++++---
> .../marvell/octeontx2/nic/otx2_txrx.h | 3 +-
> .../ethernet/marvell/octeontx2/nic/otx2_vf.c | 6 +--
> 6 files changed, 56 insertions(+), 23 deletions(-)
>
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>index 34e76cfd941b..e38b3eea11f3 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>@@ -246,6 +246,7 @@ int otx2_hw_set_mtu(struct otx2_nic *pfvf, int mtu)
> mutex_unlock(&pfvf->mbox.lock);
> return err;
> }
>+EXPORT_SYMBOL(otx2_hw_set_mtu);
>
> int otx2_config_pause_frm(struct otx2_nic *pfvf)
> {
>@@ -1782,6 +1783,7 @@ void otx2_free_cints(struct otx2_nic *pfvf, int n)
> free_irq(vector, &qset->napi[qidx]);
> }
> }
>+EXPORT_SYMBOL(otx2_free_cints);
>
> void otx2_set_cints_affinity(struct otx2_nic *pfvf)
> {
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>index b36b87dae2cb..327254e578d5 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>@@ -1000,6 +1000,17 @@ int otx2_aura_init(struct otx2_nic *pfvf, int aura_id,
> int otx2_init_rsrc(struct pci_dev *pdev, struct otx2_nic *pf);
> void otx2_free_queue_mem(struct otx2_qset *qset);
> int otx2_alloc_queue_mem(struct otx2_nic *pf);
>+int otx2_init_hw_resources(struct otx2_nic *pfvf);
>+void otx2_free_hw_resources(struct otx2_nic *pf);
>+int otx2_wq_init(struct otx2_nic *pf);
>+int otx2_check_pf_usable(struct otx2_nic *pf);
>+int otx2_pfaf_mbox_init(struct otx2_nic *pf);
>+int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af);
>+int otx2_realloc_msix_vectors(struct otx2_nic *pf);
>+void otx2_pfaf_mbox_destroy(struct otx2_nic *pf);
>+void otx2_disable_mbox_intr(struct otx2_nic *pf);
>+void otx2_disable_napi(struct otx2_nic *pf);
>+irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq);
>
> /* RSS configuration APIs*/
> int otx2_rss_init(struct otx2_nic *pfvf);
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>index 5bb6db5a3a73..b4fa2c12721d 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>@@ -1008,7 +1008,7 @@ static irqreturn_t otx2_pfaf_mbox_intr_handler(int irq, void *pf_irq)
> return IRQ_HANDLED;
> }
>
>-static void otx2_disable_mbox_intr(struct otx2_nic *pf)
>+void otx2_disable_mbox_intr(struct otx2_nic *pf)
> {
> int vector = pci_irq_vector(pf->pdev, RVU_PF_INT_VEC_AFPF_MBOX);
>
>@@ -1016,8 +1016,9 @@ static void otx2_disable_mbox_intr(struct otx2_nic *pf)
> otx2_write64(pf, RVU_PF_INT_ENA_W1C, BIT_ULL(0));
> free_irq(vector, pf);
> }
>+EXPORT_SYMBOL(otx2_disable_mbox_intr);
>
>-static int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af)
>+int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af)
> {
> struct otx2_hw *hw = &pf->hw;
> struct msg_req *req;
>@@ -1060,8 +1061,9 @@ static int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af)
>
> return 0;
> }
>+EXPORT_SYMBOL(otx2_register_mbox_intr);
>
>-static void otx2_pfaf_mbox_destroy(struct otx2_nic *pf)
>+void otx2_pfaf_mbox_destroy(struct otx2_nic *pf)
> {
> struct mbox *mbox = &pf->mbox;
>
>@@ -1076,8 +1078,9 @@ static void otx2_pfaf_mbox_destroy(struct otx2_nic *pf)
> otx2_mbox_destroy(&mbox->mbox);
> otx2_mbox_destroy(&mbox->mbox_up);
> }
>+EXPORT_SYMBOL(otx2_pfaf_mbox_destroy);
>
>-static int otx2_pfaf_mbox_init(struct otx2_nic *pf)
>+int otx2_pfaf_mbox_init(struct otx2_nic *pf)
> {
> struct mbox *mbox = &pf->mbox;
> void __iomem *hwbase;
>@@ -1124,6 +1127,7 @@ static int otx2_pfaf_mbox_init(struct otx2_nic *pf)
> otx2_pfaf_mbox_destroy(pf);
> return err;
> }
>+EXPORT_SYMBOL(otx2_pfaf_mbox_init);
>
> static int otx2_cgx_config_linkevents(struct otx2_nic *pf, bool enable)
> {
>@@ -1379,7 +1383,7 @@ static irqreturn_t otx2_q_intr_handler(int irq, void *data)
> return IRQ_HANDLED;
> }
>
>-static irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq)
>+irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq)
> {
> struct otx2_cq_poll *cq_poll = (struct otx2_cq_poll *)cq_irq;
> struct otx2_nic *pf = (struct otx2_nic *)cq_poll->dev;
>@@ -1398,20 +1402,25 @@ static irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq)
>
> return IRQ_HANDLED;
> }
>+EXPORT_SYMBOL(otx2_cq_intr_handler);
>
>-static void otx2_disable_napi(struct otx2_nic *pf)
>+void otx2_disable_napi(struct otx2_nic *pf)
> {
> struct otx2_qset *qset = &pf->qset;
> struct otx2_cq_poll *cq_poll;
>+ struct work_struct *work;
> int qidx;
>
> for (qidx = 0; qidx < pf->hw.cint_cnt; qidx++) {
> cq_poll = &qset->napi[qidx];
>- cancel_work_sync(&cq_poll->dim.work);
>+ work = &cq_poll->dim.work;
>+ if (work->func)
>+ cancel_work_sync(work);
> napi_disable(&cq_poll->napi);
> netif_napi_del(&cq_poll->napi);
> }
> }
>+EXPORT_SYMBOL(otx2_disable_napi);
>
> static void otx2_free_cq_res(struct otx2_nic *pf)
> {
>@@ -1477,7 +1486,7 @@ static int otx2_get_rbuf_size(struct otx2_nic *pf, int mtu)
> return ALIGN(rbuf_size, 2048);
> }
>
>-static int otx2_init_hw_resources(struct otx2_nic *pf)
>+int otx2_init_hw_resources(struct otx2_nic *pf)
> {
> struct nix_lf_free_req *free_req;
> struct mbox *mbox = &pf->mbox;
>@@ -1601,8 +1610,9 @@ static int otx2_init_hw_resources(struct otx2_nic *pf)
> mutex_unlock(&mbox->lock);
> return err;
> }
>+EXPORT_SYMBOL(otx2_init_hw_resources);
>
>-static void otx2_free_hw_resources(struct otx2_nic *pf)
>+void otx2_free_hw_resources(struct otx2_nic *pf)
> {
> struct otx2_qset *qset = &pf->qset;
> struct nix_lf_free_req *free_req;
>@@ -1688,6 +1698,7 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)
> }
> mutex_unlock(&mbox->lock);
> }
>+EXPORT_SYMBOL(otx2_free_hw_resources);
>
> static bool otx2_promisc_use_mce_list(struct otx2_nic *pfvf)
> {
>@@ -1781,6 +1792,7 @@ void otx2_free_queue_mem(struct otx2_qset *qset)
> kfree(qset->napi);
> }
> EXPORT_SYMBOL(otx2_free_queue_mem);
>+
> int otx2_alloc_queue_mem(struct otx2_nic *pf)
> {
> struct otx2_qset *qset = &pf->qset;
>@@ -2103,7 +2115,7 @@ static netdev_tx_t otx2_xmit(struct sk_buff *skb, struct net_device *netdev)
> sq = &pf->qset.sq[sq_idx];
> txq = netdev_get_tx_queue(netdev, qidx);
>
>- if (!otx2_sq_append_skb(netdev, sq, skb, qidx)) {
>+ if (!otx2_sq_append_skb(pf, txq, sq, skb, qidx)) {
> netif_tx_stop_queue(txq);
>
> /* Check again, incase SQBs got freed up */
>@@ -2808,7 +2820,7 @@ static const struct net_device_ops otx2_netdev_ops = {
> .ndo_set_vf_trust = otx2_ndo_set_vf_trust,
> };
>
>-static int otx2_wq_init(struct otx2_nic *pf)
>+int otx2_wq_init(struct otx2_nic *pf)
> {
> pf->otx2_wq = create_singlethread_workqueue("otx2_wq");
> if (!pf->otx2_wq)
>@@ -2819,7 +2831,7 @@ static int otx2_wq_init(struct otx2_nic *pf)
> return 0;
> }
>
>-static int otx2_check_pf_usable(struct otx2_nic *nic)
>+int otx2_check_pf_usable(struct otx2_nic *nic)
> {
> u64 rev;
>
>@@ -2836,8 +2848,9 @@ static int otx2_check_pf_usable(struct otx2_nic *nic)
> }
> return 0;
> }
>+EXPORT_SYMBOL(otx2_check_pf_usable);
>
>-static int otx2_realloc_msix_vectors(struct otx2_nic *pf)
>+int otx2_realloc_msix_vectors(struct otx2_nic *pf)
> {
> struct otx2_hw *hw = &pf->hw;
> int num_vec, err;
>@@ -2859,6 +2872,7 @@ static int otx2_realloc_msix_vectors(struct otx2_nic *pf)
>
> return otx2_register_mbox_intr(pf, false);
> }
>+EXPORT_SYMBOL(otx2_realloc_msix_vectors);
>
> static int otx2_sriov_vfcfg_init(struct otx2_nic *pf)
> {
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>index 3eb85949677a..fbd9fe98259f 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>@@ -131,6 +131,7 @@ static void otx2_xdp_snd_pkt_handler(struct otx2_nic *pfvf,
> }
>
> static void otx2_snd_pkt_handler(struct otx2_nic *pfvf,
>+ struct net_device *ndev,
> struct otx2_cq_queue *cq,
> struct otx2_snd_queue *sq,
> struct nix_cqe_tx_s *cqe,
>@@ -145,7 +146,7 @@ static void otx2_snd_pkt_handler(struct otx2_nic *pfvf,
>
> if (unlikely(snd_comp->status) && netif_msg_tx_err(pfvf))
> net_err_ratelimited("%s: TX%d: Error in send CQ status:%x\n",
>- pfvf->netdev->name, cq->cint_idx,
>+ ndev->name, cq->cint_idx,
> snd_comp->status);
>
> sg = &sq->sg[snd_comp->sqe_id];
>@@ -453,6 +454,7 @@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
> int tx_pkts = 0, tx_bytes = 0, qidx;
> struct otx2_snd_queue *sq;
> struct nix_cqe_tx_s *cqe;
>+ struct net_device *ndev;
> int processed_cqe = 0;
>
> if (cq->pend_cqe >= budget)
>@@ -464,6 +466,7 @@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
> process_cqe:
> qidx = cq->cq_idx - pfvf->hw.rx_queues;
> sq = &pfvf->qset.sq[qidx];
>+ ndev = pfvf->netdev;
>
> while (likely(processed_cqe < budget) && cq->pend_cqe) {
> cqe = (struct nix_cqe_tx_s *)otx2_get_next_cqe(cq);
>@@ -478,7 +481,8 @@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
> if (cq->cq_type == CQ_XDP)
> otx2_xdp_snd_pkt_handler(pfvf, sq, cqe);
> else
>- otx2_snd_pkt_handler(pfvf, cq, &pfvf->qset.sq[qidx],
>+ otx2_snd_pkt_handler(pfvf, ndev, cq,
>+ &pfvf->qset.sq[qidx],
> cqe, budget, &tx_pkts, &tx_bytes);
>
> cqe->hdr.cqe_type = NIX_XQE_TYPE_INVALID;
>@@ -505,7 +509,7 @@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
> /* Check if queue was stopped earlier due to ring full */
> smp_mb();
> if (netif_tx_queue_stopped(txq) &&
>- netif_carrier_ok(pfvf->netdev))
>+ netif_carrier_ok(ndev))
> netif_tx_wake_queue(txq);
I don't understand the this change you do in otx2_tx_napi_handler() and
otx2_snd_pkt_handler(). What are you trying to achieve?
Also, it is unrelated to the rest of the patch (export functions)
> }
> return 0;
>@@ -594,6 +598,7 @@ int otx2_napi_handler(struct napi_struct *napi, int budget)
> }
> return workdone;
> }
>+EXPORT_SYMBOL(otx2_napi_handler);
>
> void otx2_sqe_flush(void *dev, struct otx2_snd_queue *sq,
> int size, int qidx)
>@@ -1141,13 +1146,13 @@ static void otx2_set_txtstamp(struct otx2_nic *pfvf, struct sk_buff *skb,
> }
> }
>
>-bool otx2_sq_append_skb(struct net_device *netdev, struct otx2_snd_queue *sq,
>+bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq,
1) This looks like unrelated to the rest of the patch (export functions)
2) Why void *? Avoid that please. Just have arg
struct otx2_nic *pfvf
no?
>+ struct otx2_snd_queue *sq,
> struct sk_buff *skb, u16 qidx)
> {
>- struct netdev_queue *txq = netdev_get_tx_queue(netdev, qidx);
>- struct otx2_nic *pfvf = netdev_priv(netdev);
> int offset, num_segs, free_desc;
> struct nix_sqe_hdr_s *sqe_hdr;
>+ struct otx2_nic *pfvf = dev;
>
> /* Check if there is enough room between producer
> * and consumer index.
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
>index 3f1d2655ff77..e1db5f961877 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
>@@ -167,7 +167,8 @@ static inline u64 otx2_iova_to_phys(void *iommu_domain, dma_addr_t dma_addr)
> }
>
> int otx2_napi_handler(struct napi_struct *napi, int budget);
>-bool otx2_sq_append_skb(struct net_device *netdev, struct otx2_snd_queue *sq,
>+bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq,
>+ struct otx2_snd_queue *sq,
> struct sk_buff *skb, u16 qidx);
> void cn10k_sqe_flush(void *dev, struct otx2_snd_queue *sq,
> int size, int qidx);
>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>index 79a8acac6283..0486fca8b573 100644
>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>@@ -395,7 +395,7 @@ static netdev_tx_t otx2vf_xmit(struct sk_buff *skb, struct net_device *netdev)
> sq = &vf->qset.sq[qidx];
> txq = netdev_get_tx_queue(netdev, qidx);
>
>- if (!otx2_sq_append_skb(netdev, sq, skb, qidx)) {
>+ if (!otx2_sq_append_skb(vf, txq, sq, skb, qidx)) {
> netif_tx_stop_queue(txq);
>
> /* Check again, incase SQBs got freed up */
>@@ -500,7 +500,7 @@ static const struct net_device_ops otx2vf_netdev_ops = {
> .ndo_setup_tc = otx2_setup_tc,
> };
>
>-static int otx2_wq_init(struct otx2_nic *vf)
>+static int otx2_vf_wq_init(struct otx2_nic *vf)
> {
> vf->otx2_wq = create_singlethread_workqueue("otx2vf_wq");
> if (!vf->otx2_wq)
>@@ -689,7 +689,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> goto err_ptp_destroy;
> }
>
>- err = otx2_wq_init(vf);
>+ err = otx2_vf_wq_init(vf);
> if (err)
> goto err_unreg_netdev;
>
>--
>2.25.1
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [net-next PATCH 2/4] octeontx2-pf: Add new APIs for queue memory alloc/free.
2024-09-03 12:40 ` [net-next PATCH 2/4] octeontx2-pf: Add new APIs for queue memory alloc/free Geetha sowjanya
@ 2024-09-03 15:12 ` Pavan Chebbi
2024-09-04 5:35 ` [EXTERNAL] " Geethasowjanya Akula
0 siblings, 1 reply; 13+ messages in thread
From: Pavan Chebbi @ 2024-09-03 15:12 UTC (permalink / raw)
To: Geetha sowjanya
Cc: netdev, linux-kernel, kuba, davem, pabeni, jiri, edumazet,
sgoutham, sbhatta, hkelam
[-- Attachment #1: Type: text/plain, Size: 2377 bytes --]
On Tue, Sep 3, 2024 at 6:12 PM Geetha sowjanya <gakula@marvell.com> wrote:
>
> Group the queue(RX/TX/CQ) memory allocation and free code to single APIs.
>
> Signed-off-by: Geetha sowjanya <gakula@marvell.com>
> ---
> .../marvell/octeontx2/nic/otx2_common.h | 2 +
> .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 56 +++++++++++++------
> 2 files changed, 41 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
> index a47001a2b93f..df548aeffecf 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
> @@ -997,6 +997,8 @@ int otx2_pool_init(struct otx2_nic *pfvf, u16 pool_id,
> int otx2_aura_init(struct otx2_nic *pfvf, int aura_id,
> int pool_id, int numptrs);
> int otx2_init_rsrc(struct pci_dev *pdev, struct otx2_nic *pf);
> +void otx2_free_queue_mem(struct otx2_qset *qset);
> +int otx2_alloc_queue_mem(struct otx2_nic *pf);
>
> /* RSS configuration APIs*/
> int otx2_rss_init(struct otx2_nic *pfvf);
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> index 4cfeca5ca626..68addc975113 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> @@ -1770,15 +1770,23 @@ static void otx2_dim_work(struct work_struct *w)
> dim->state = DIM_START_MEASURE;
> }
>
> -int otx2_open(struct net_device *netdev)
> +void otx2_free_queue_mem(struct otx2_qset *qset)
> +{
> + kfree(qset->sq);
> + qset->sq = NULL;
> + kfree(qset->cq);
> + qset->cq = NULL;
> + kfree(qset->rq);
> + qset->rq = NULL;
> + kfree(qset->napi);
> +}
> +EXPORT_SYMBOL(otx2_free_queue_mem);
> +int otx2_alloc_queue_mem(struct otx2_nic *pf)
> {
> - struct otx2_nic *pf = netdev_priv(netdev);
> - struct otx2_cq_poll *cq_poll = NULL;
> struct otx2_qset *qset = &pf->qset;
> - int err = 0, qidx, vec;
> - char *irq_name;
> + struct otx2_cq_poll *cq_poll;
> + int err = -ENOMEM;
I don't see 'err' getting set to anything else. Can avoid the variable
and directly return -ENOMEM everywhere?
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [EXTERNAL] Re: [net-next PATCH 2/4] octeontx2-pf: Add new APIs for queue memory alloc/free.
2024-09-03 15:12 ` Pavan Chebbi
@ 2024-09-04 5:35 ` Geethasowjanya Akula
0 siblings, 0 replies; 13+ messages in thread
From: Geethasowjanya Akula @ 2024-09-04 5:35 UTC (permalink / raw)
To: Pavan Chebbi
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com,
jiri@resnulli.us, edumazet@google.com, Sunil Kovvuri Goutham,
Subbaraya Sundeep Bhatta, Hariprasad Kelam
>-----Original Message-----
>From: Pavan Chebbi <pavan.chebbi@broadcom.com>
>Sent: Tuesday, September 3, 2024 8:42 PM
>To: Geethasowjanya Akula <gakula@marvell.com>
>Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; kuba@kernel.org;
>davem@davemloft.net; pabeni@redhat.com; jiri@resnulli.us;
>edumazet@google.com; Sunil Kovvuri Goutham <sgoutham@marvell.com>;
>Subbaraya Sundeep Bhatta <sbhatta@marvell.com>; Hariprasad Kelam
><hkelam@marvell.com>
>Subject: [EXTERNAL] Re: [net-next PATCH 2/4] octeontx2-pf: Add new APIs for
>queue memory alloc/free.
>
>On Tue, Sep 3, 2024 at 6:12 PM Geetha sowjanya <gakula@marvell.com>
>wrote:
>>
>> Group the queue(RX/TX/CQ) memory allocation and free code to single APIs.
>>
>> Signed-off-by: Geetha sowjanya <gakula@marvell.com>
>> ---
>> .../marvell/octeontx2/nic/otx2_common.h | 2 +
>> .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 56 +++++++++++++------
>> 2 files changed, 41 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>> index a47001a2b93f..df548aeffecf 100644
>> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>> @@ -997,6 +997,8 @@ int otx2_pool_init(struct otx2_nic *pfvf, u16 pool_id,
>> int otx2_aura_init(struct otx2_nic *pfvf, int aura_id,
>> int pool_id, int numptrs);
>> int otx2_init_rsrc(struct pci_dev *pdev, struct otx2_nic *pf);
>> +void otx2_free_queue_mem(struct otx2_qset *qset);
>> +int otx2_alloc_queue_mem(struct otx2_nic *pf);
>>
>> /* RSS configuration APIs*/
>> int otx2_rss_init(struct otx2_nic *pfvf);
>> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>> index 4cfeca5ca626..68addc975113 100644
>> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>> @@ -1770,15 +1770,23 @@ static void otx2_dim_work(struct work_struct
>*w)
>> dim->state = DIM_START_MEASURE;
>> }
>>
>> -int otx2_open(struct net_device *netdev)
>> +void otx2_free_queue_mem(struct otx2_qset *qset)
>> +{
>> + kfree(qset->sq);
>> + qset->sq = NULL;
>> + kfree(qset->cq);
>> + qset->cq = NULL;
>> + kfree(qset->rq);
>> + qset->rq = NULL;
>> + kfree(qset->napi);
>> +}
>> +EXPORT_SYMBOL(otx2_free_queue_mem);
>> +int otx2_alloc_queue_mem(struct otx2_nic *pf)
>> {
>> - struct otx2_nic *pf = netdev_priv(netdev);
>> - struct otx2_cq_poll *cq_poll = NULL;
>> struct otx2_qset *qset = &pf->qset;
>> - int err = 0, qidx, vec;
>> - char *irq_name;
>> + struct otx2_cq_poll *cq_poll;
>> + int err = -ENOMEM;
>I don't see 'err' getting set to anything else. Can avoid the variable
>and directly return -ENOMEM everywhere?
Will fix it in next version.
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [EXTERNAL] Re: [net-next PATCH 1/4] octeontx2-pf: Defines common API for HW resources configuration
2024-09-03 14:57 ` Pavan Chebbi
@ 2024-09-04 5:48 ` Geethasowjanya Akula
2024-09-04 6:18 ` Pavan Chebbi
0 siblings, 1 reply; 13+ messages in thread
From: Geethasowjanya Akula @ 2024-09-04 5:48 UTC (permalink / raw)
To: Pavan Chebbi
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com,
jiri@resnulli.us, edumazet@google.com, Sunil Kovvuri Goutham,
Subbaraya Sundeep Bhatta, Hariprasad Kelam
>-----Original Message-----
>From: Pavan Chebbi <pavan.chebbi@broadcom.com>
>Sent: Tuesday, September 3, 2024 8:27 PM
>To: Geethasowjanya Akula <gakula@marvell.com>
>Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; kuba@kernel.org;
>davem@davemloft.net; pabeni@redhat.com; jiri@resnulli.us;
>edumazet@google.com; Sunil Kovvuri Goutham <sgoutham@marvell.com>;
>Subbaraya Sundeep Bhatta <sbhatta@marvell.com>; Hariprasad Kelam
><hkelam@marvell.com>
>Subject: [EXTERNAL] Re: [net-next PATCH 1/4] octeontx2-pf: Defines common
>API for HW resources configuration
>
>On Tue, Sep 3, 2024 at 6:11 PM Geetha sowjanya <gakula@marvell.com>
>wrote:
>>
>> -
>> /* Assign default mac address */
>> otx2_get_mac_from_af(netdev);
>>
>> @@ -3118,11 +3141,8 @@ static int otx2_probe(struct pci_dev *pdev, const
>struct pci_device_id *id)
>> if (test_bit(CN10K_LMTST, &pf->hw.cap_flag))
>> qmem_free(pf->dev, pf->dync_lmt);
>> otx2_detach_resources(&pf->mbox);
>Isn't some of this unwinding/cleanup already moved to the new
>function? Looks like duplicate code to me.
No. If the otx2_probe () fails in any of the function after " otx2_init_rsrc()" function call.
Then below code cleanup the resources allocated.
>
>> -err_disable_mbox_intr:
>> otx2_disable_mbox_intr(pf);
>> -err_mbox_destroy:
>> otx2_pfaf_mbox_destroy(pf);
>> -err_free_irq_vectors:
>> pci_free_irq_vectors(hw->pdev);
>> err_free_netdev:
>> pci_set_drvdata(pdev, NULL);
>> --
>> 2.25.1
>>
>>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [EXTERNAL] Re: [net-next PATCH 1/4] octeontx2-pf: Defines common API for HW resources configuration
2024-09-04 5:48 ` [EXTERNAL] " Geethasowjanya Akula
@ 2024-09-04 6:18 ` Pavan Chebbi
0 siblings, 0 replies; 13+ messages in thread
From: Pavan Chebbi @ 2024-09-04 6:18 UTC (permalink / raw)
To: Geethasowjanya Akula
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com,
jiri@resnulli.us, edumazet@google.com, Sunil Kovvuri Goutham,
Subbaraya Sundeep Bhatta, Hariprasad Kelam
[-- Attachment #1: Type: text/plain, Size: 1860 bytes --]
On Wed, Sep 4, 2024 at 11:18 AM Geethasowjanya Akula <gakula@marvell.com> wrote:
>
>
>
> >-----Original Message-----
> >From: Pavan Chebbi <pavan.chebbi@broadcom.com>
> >Sent: Tuesday, September 3, 2024 8:27 PM
> >To: Geethasowjanya Akula <gakula@marvell.com>
> >Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; kuba@kernel.org;
> >davem@davemloft.net; pabeni@redhat.com; jiri@resnulli.us;
> >edumazet@google.com; Sunil Kovvuri Goutham <sgoutham@marvell.com>;
> >Subbaraya Sundeep Bhatta <sbhatta@marvell.com>; Hariprasad Kelam
> ><hkelam@marvell.com>
> >Subject: [EXTERNAL] Re: [net-next PATCH 1/4] octeontx2-pf: Defines common
> >API for HW resources configuration
> >
> >On Tue, Sep 3, 2024 at 6:11 PM Geetha sowjanya <gakula@marvell.com>
> >wrote:
> >>
> >> -
> >> /* Assign default mac address */
> >> otx2_get_mac_from_af(netdev);
> >>
> >> @@ -3118,11 +3141,8 @@ static int otx2_probe(struct pci_dev *pdev, const
> >struct pci_device_id *id)
> >> if (test_bit(CN10K_LMTST, &pf->hw.cap_flag))
> >> qmem_free(pf->dev, pf->dync_lmt);
> >> otx2_detach_resources(&pf->mbox);
> >Isn't some of this unwinding/cleanup already moved to the new
> >function? Looks like duplicate code to me.
> No. If the otx2_probe () fails in any of the function after " otx2_init_rsrc()" function call.
> Then below code cleanup the resources allocated.
Ack. I missed to see that otx2_init_rsrc() is being carved out in
order to be called independently also.
> >
> >> -err_disable_mbox_intr:
> >> otx2_disable_mbox_intr(pf);
> >> -err_mbox_destroy:
> >> otx2_pfaf_mbox_destroy(pf);
> >> -err_free_irq_vectors:
> >> pci_free_irq_vectors(hw->pdev);
> >> err_free_netdev:
> >> pci_set_drvdata(pdev, NULL);
> >> --
> >> 2.25.1
> >>
> >>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [EXTERNAL] Re: [net-next PATCH 4/4] octeontx2-pf: Export common APIs
2024-09-03 15:00 ` Jiri Pirko
@ 2024-09-04 6:20 ` Geethasowjanya Akula
0 siblings, 0 replies; 13+ messages in thread
From: Geethasowjanya Akula @ 2024-09-04 6:20 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com,
edumazet@google.com, Sunil Kovvuri Goutham,
Subbaraya Sundeep Bhatta, Hariprasad Kelam
>-----Original Message-----
>From: Jiri Pirko <jiri@resnulli.us>
>Sent: Tuesday, September 3, 2024 8:31 PM
>To: Geethasowjanya Akula <gakula@marvell.com>
>Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; kuba@kernel.org;
>davem@davemloft.net; pabeni@redhat.com; edumazet@google.com; Sunil
>Kovvuri Goutham <sgoutham@marvell.com>; Subbaraya Sundeep Bhatta
><sbhatta@marvell.com>; Hariprasad Kelam <hkelam@marvell.com>
>Subject: [EXTERNAL] Re: [net-next PATCH 4/4] octeontx2-pf: Export common
>APIs
>
>Tue, Sep 03, 2024 at 02: 40: 48PM CEST, gakula@ marvell. com wrote: >Export
>mbox, hw resources and interrupt configuration functions. >So, that they can
>be used later by the RVU representor driver. > >Signed-off-by: Geetha sowjanya
><gakula@ marvell. com>
>Tue, Sep 03, 2024 at 02:40:48PM CEST, gakula@marvell.com wrote:
>>Export mbox, hw resources and interrupt configuration functions.
>>So, that they can be used later by the RVU representor driver.
>>
>>Signed-off-by: Geetha sowjanya <gakula@marvell.com>
>>---
>> .../marvell/octeontx2/nic/otx2_common.c | 2 +
>> .../marvell/octeontx2/nic/otx2_common.h | 11 +++++
>> .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 40 +++++++++++++------
>> .../marvell/octeontx2/nic/otx2_txrx.c | 17 +++++---
>> .../marvell/octeontx2/nic/otx2_txrx.h | 3 +-
>> .../ethernet/marvell/octeontx2/nic/otx2_vf.c | 6 +--
>> 6 files changed, 56 insertions(+), 23 deletions(-)
>>
>>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>>index 34e76cfd941b..e38b3eea11f3 100644
>>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
>>@@ -246,6 +246,7 @@ int otx2_hw_set_mtu(struct otx2_nic *pfvf, int mtu)
>> mutex_unlock(&pfvf->mbox.lock);
>> return err;
>> }
>>+EXPORT_SYMBOL(otx2_hw_set_mtu);
>>
>> int otx2_config_pause_frm(struct otx2_nic *pfvf) { @@ -1782,6 +1783,7
>>@@ void otx2_free_cints(struct otx2_nic *pfvf, int n)
>> free_irq(vector, &qset->napi[qidx]);
>> }
>> }
>>+EXPORT_SYMBOL(otx2_free_cints);
>>
>> void otx2_set_cints_affinity(struct otx2_nic *pfvf) { diff --git
>>a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>>index b36b87dae2cb..327254e578d5 100644
>>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
>>@@ -1000,6 +1000,17 @@ int otx2_aura_init(struct otx2_nic *pfvf, int
>>aura_id, int otx2_init_rsrc(struct pci_dev *pdev, struct otx2_nic
>>*pf); void otx2_free_queue_mem(struct otx2_qset *qset); int
>>otx2_alloc_queue_mem(struct otx2_nic *pf);
>>+int otx2_init_hw_resources(struct otx2_nic *pfvf); void
>>+otx2_free_hw_resources(struct otx2_nic *pf); int otx2_wq_init(struct
>>+otx2_nic *pf); int otx2_check_pf_usable(struct otx2_nic *pf); int
>>+otx2_pfaf_mbox_init(struct otx2_nic *pf); int
>>+otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af); int
>>+otx2_realloc_msix_vectors(struct otx2_nic *pf); void
>>+otx2_pfaf_mbox_destroy(struct otx2_nic *pf); void
>>+otx2_disable_mbox_intr(struct otx2_nic *pf); void
>>+otx2_disable_napi(struct otx2_nic *pf); irqreturn_t
>>+otx2_cq_intr_handler(int irq, void *cq_irq);
>>
>> /* RSS configuration APIs*/
>> int otx2_rss_init(struct otx2_nic *pfvf); diff --git
>>a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>>index 5bb6db5a3a73..b4fa2c12721d 100644
>>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
>>@@ -1008,7 +1008,7 @@ static irqreturn_t otx2_pfaf_mbox_intr_handler(int
>irq, void *pf_irq)
>> return IRQ_HANDLED;
>> }
>>
>>-static void otx2_disable_mbox_intr(struct otx2_nic *pf)
>>+void otx2_disable_mbox_intr(struct otx2_nic *pf)
>> {
>> int vector = pci_irq_vector(pf->pdev, RVU_PF_INT_VEC_AFPF_MBOX);
>>
>>@@ -1016,8 +1016,9 @@ static void otx2_disable_mbox_intr(struct otx2_nic
>*pf)
>> otx2_write64(pf, RVU_PF_INT_ENA_W1C, BIT_ULL(0));
>> free_irq(vector, pf);
>> }
>>+EXPORT_SYMBOL(otx2_disable_mbox_intr);
>>
>>-static int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af)
>>+int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af)
>> {
>> struct otx2_hw *hw = &pf->hw;
>> struct msg_req *req;
>>@@ -1060,8 +1061,9 @@ static int otx2_register_mbox_intr(struct
>>otx2_nic *pf, bool probe_af)
>>
>> return 0;
>> }
>>+EXPORT_SYMBOL(otx2_register_mbox_intr);
>>
>>-static void otx2_pfaf_mbox_destroy(struct otx2_nic *pf)
>>+void otx2_pfaf_mbox_destroy(struct otx2_nic *pf)
>> {
>> struct mbox *mbox = &pf->mbox;
>>
>>@@ -1076,8 +1078,9 @@ static void otx2_pfaf_mbox_destroy(struct otx2_nic
>*pf)
>> otx2_mbox_destroy(&mbox->mbox);
>> otx2_mbox_destroy(&mbox->mbox_up);
>> }
>>+EXPORT_SYMBOL(otx2_pfaf_mbox_destroy);
>>
>>-static int otx2_pfaf_mbox_init(struct otx2_nic *pf)
>>+int otx2_pfaf_mbox_init(struct otx2_nic *pf)
>> {
>> struct mbox *mbox = &pf->mbox;
>> void __iomem *hwbase;
>>@@ -1124,6 +1127,7 @@ static int otx2_pfaf_mbox_init(struct otx2_nic *pf)
>> otx2_pfaf_mbox_destroy(pf);
>> return err;
>> }
>>+EXPORT_SYMBOL(otx2_pfaf_mbox_init);
>>
>> static int otx2_cgx_config_linkevents(struct otx2_nic *pf, bool
>>enable) { @@ -1379,7 +1383,7 @@ static irqreturn_t
>>otx2_q_intr_handler(int irq, void *data)
>> return IRQ_HANDLED;
>> }
>>
>>-static irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq)
>>+irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq)
>> {
>> struct otx2_cq_poll *cq_poll = (struct otx2_cq_poll *)cq_irq;
>> struct otx2_nic *pf = (struct otx2_nic *)cq_poll->dev; @@ -1398,20
>>+1402,25 @@ static irqreturn_t otx2_cq_intr_handler(int irq, void
>>*cq_irq)
>>
>> return IRQ_HANDLED;
>> }
>>+EXPORT_SYMBOL(otx2_cq_intr_handler);
>>
>>-static void otx2_disable_napi(struct otx2_nic *pf)
>>+void otx2_disable_napi(struct otx2_nic *pf)
>> {
>> struct otx2_qset *qset = &pf->qset;
>> struct otx2_cq_poll *cq_poll;
>>+ struct work_struct *work;
>> int qidx;
>>
>> for (qidx = 0; qidx < pf->hw.cint_cnt; qidx++) {
>> cq_poll = &qset->napi[qidx];
>>- cancel_work_sync(&cq_poll->dim.work);
>>+ work = &cq_poll->dim.work;
>>+ if (work->func)
>>+ cancel_work_sync(work);
>> napi_disable(&cq_poll->napi);
>> netif_napi_del(&cq_poll->napi);
>> }
>> }
>>+EXPORT_SYMBOL(otx2_disable_napi);
>>
>> static void otx2_free_cq_res(struct otx2_nic *pf) { @@ -1477,7
>>+1486,7 @@ static int otx2_get_rbuf_size(struct otx2_nic *pf, int mtu)
>> return ALIGN(rbuf_size, 2048);
>> }
>>
>>-static int otx2_init_hw_resources(struct otx2_nic *pf)
>>+int otx2_init_hw_resources(struct otx2_nic *pf)
>> {
>> struct nix_lf_free_req *free_req;
>> struct mbox *mbox = &pf->mbox;
>>@@ -1601,8 +1610,9 @@ static int otx2_init_hw_resources(struct otx2_nic
>*pf)
>> mutex_unlock(&mbox->lock);
>> return err;
>> }
>>+EXPORT_SYMBOL(otx2_init_hw_resources);
>>
>>-static void otx2_free_hw_resources(struct otx2_nic *pf)
>>+void otx2_free_hw_resources(struct otx2_nic *pf)
>> {
>> struct otx2_qset *qset = &pf->qset;
>> struct nix_lf_free_req *free_req;
>>@@ -1688,6 +1698,7 @@ static void otx2_free_hw_resources(struct otx2_nic
>*pf)
>> }
>> mutex_unlock(&mbox->lock);
>> }
>>+EXPORT_SYMBOL(otx2_free_hw_resources);
>>
>> static bool otx2_promisc_use_mce_list(struct otx2_nic *pfvf) { @@
>>-1781,6 +1792,7 @@ void otx2_free_queue_mem(struct otx2_qset *qset)
>> kfree(qset->napi);
>> }
>> EXPORT_SYMBOL(otx2_free_queue_mem);
>>+
>> int otx2_alloc_queue_mem(struct otx2_nic *pf) {
>> struct otx2_qset *qset = &pf->qset;
>>@@ -2103,7 +2115,7 @@ static netdev_tx_t otx2_xmit(struct sk_buff *skb,
>struct net_device *netdev)
>> sq = &pf->qset.sq[sq_idx];
>> txq = netdev_get_tx_queue(netdev, qidx);
>>
>>- if (!otx2_sq_append_skb(netdev, sq, skb, qidx)) {
>>+ if (!otx2_sq_append_skb(pf, txq, sq, skb, qidx)) {
>> netif_tx_stop_queue(txq);
>>
>> /* Check again, incase SQBs got freed up */ @@ -2808,7
>+2820,7 @@
>>static const struct net_device_ops otx2_netdev_ops = {
>> .ndo_set_vf_trust = otx2_ndo_set_vf_trust,
>> };
>>
>>-static int otx2_wq_init(struct otx2_nic *pf)
>>+int otx2_wq_init(struct otx2_nic *pf)
>> {
>> pf->otx2_wq = create_singlethread_workqueue("otx2_wq");
>> if (!pf->otx2_wq)
>>@@ -2819,7 +2831,7 @@ static int otx2_wq_init(struct otx2_nic *pf)
>> return 0;
>> }
>>
>>-static int otx2_check_pf_usable(struct otx2_nic *nic)
>>+int otx2_check_pf_usable(struct otx2_nic *nic)
>> {
>> u64 rev;
>>
>>@@ -2836,8 +2848,9 @@ static int otx2_check_pf_usable(struct otx2_nic
>*nic)
>> }
>> return 0;
>> }
>>+EXPORT_SYMBOL(otx2_check_pf_usable);
>>
>>-static int otx2_realloc_msix_vectors(struct otx2_nic *pf)
>>+int otx2_realloc_msix_vectors(struct otx2_nic *pf)
>> {
>> struct otx2_hw *hw = &pf->hw;
>> int num_vec, err;
>>@@ -2859,6 +2872,7 @@ static int otx2_realloc_msix_vectors(struct
>>otx2_nic *pf)
>>
>> return otx2_register_mbox_intr(pf, false); }
>>+EXPORT_SYMBOL(otx2_realloc_msix_vectors);
>>
>> static int otx2_sriov_vfcfg_init(struct otx2_nic *pf) { diff --git
>>a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>>index 3eb85949677a..fbd9fe98259f 100644
>>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
>>@@ -131,6 +131,7 @@ static void otx2_xdp_snd_pkt_handler(struct
>>otx2_nic *pfvf, }
>>
>> static void otx2_snd_pkt_handler(struct otx2_nic *pfvf,
>>+ struct net_device *ndev,
>> struct otx2_cq_queue *cq,
>> struct otx2_snd_queue *sq,
>> struct nix_cqe_tx_s *cqe,
>>@@ -145,7 +146,7 @@ static void otx2_snd_pkt_handler(struct otx2_nic
>>*pfvf,
>>
>> if (unlikely(snd_comp->status) && netif_msg_tx_err(pfvf))
>> net_err_ratelimited("%s: TX%d: Error in send CQ status:%x\n",
>>- pfvf->netdev->name, cq->cint_idx,
>>+ ndev->name, cq->cint_idx,
>> snd_comp->status);
>>
>> sg = &sq->sg[snd_comp->sqe_id];
>>@@ -453,6 +454,7 @@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
>> int tx_pkts = 0, tx_bytes = 0, qidx;
>> struct otx2_snd_queue *sq;
>> struct nix_cqe_tx_s *cqe;
>>+ struct net_device *ndev;
>> int processed_cqe = 0;
>>
>> if (cq->pend_cqe >= budget)
>>@@ -464,6 +466,7 @@ static int otx2_tx_napi_handler(struct otx2_nic
>>*pfvf,
>> process_cqe:
>> qidx = cq->cq_idx - pfvf->hw.rx_queues;
>> sq = &pfvf->qset.sq[qidx];
>>+ ndev = pfvf->netdev;
>>
>> while (likely(processed_cqe < budget) && cq->pend_cqe) {
>> cqe = (struct nix_cqe_tx_s *)otx2_get_next_cqe(cq); @@ -
>478,7 +481,8
>>@@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
>> if (cq->cq_type == CQ_XDP)
>> otx2_xdp_snd_pkt_handler(pfvf, sq, cqe);
>> else
>>- otx2_snd_pkt_handler(pfvf, cq, &pfvf->qset.sq[qidx],
>>+ otx2_snd_pkt_handler(pfvf, ndev, cq,
>>+ &pfvf->qset.sq[qidx],
>> cqe, budget, &tx_pkts, &tx_bytes);
>>
>> cqe->hdr.cqe_type = NIX_XQE_TYPE_INVALID; @@ -505,7
>+509,7 @@ static
>>int otx2_tx_napi_handler(struct otx2_nic *pfvf,
>> /* Check if queue was stopped earlier due to ring full */
>> smp_mb();
>> if (netif_tx_queue_stopped(txq) &&
>>- netif_carrier_ok(pfvf->netdev))
>>+ netif_carrier_ok(ndev))
>> netif_tx_wake_queue(txq);
>
>
>I don't understand the this change you do in otx2_tx_napi_handler() and
>otx2_snd_pkt_handler(). What are you trying to achieve?
Will add this changes into "Introduce RVU representors"
patchset where it explains why this changes are required.
>Also, it is unrelated to the rest of the patch (export functions)
>
>
>> }
>> return 0;
>>@@ -594,6 +598,7 @@ int otx2_napi_handler(struct napi_struct *napi, int
>budget)
>> }
>> return workdone;
>> }
>>+EXPORT_SYMBOL(otx2_napi_handler);
>>
>> void otx2_sqe_flush(void *dev, struct otx2_snd_queue *sq,
>> int size, int qidx)
>>@@ -1141,13 +1146,13 @@ static void otx2_set_txtstamp(struct otx2_nic
>*pfvf, struct sk_buff *skb,
>> }
>> }
>>
>>-bool otx2_sq_append_skb(struct net_device *netdev, struct
>>otx2_snd_queue *sq,
>>+bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq,
>
>1) This looks like unrelated to the rest of the patch (export functions)
>2) Why void *? Avoid that please. Just have arg struct otx2_nic *pfvf no?
Will change it to otx2_nic and move this change to " Introduce RVU representors"
patchset where related changes are present.
>
>
>
>>+ struct otx2_snd_queue *sq,
>> struct sk_buff *skb, u16 qidx)
>> {
>>- struct netdev_queue *txq = netdev_get_tx_queue(netdev, qidx);
>>- struct otx2_nic *pfvf = netdev_priv(netdev);
>> int offset, num_segs, free_desc;
>> struct nix_sqe_hdr_s *sqe_hdr;
>>+ struct otx2_nic *pfvf = dev;
>>
>> /* Check if there is enough room between producer
>> * and consumer index.
>>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
>>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
>>index 3f1d2655ff77..e1db5f961877 100644
>>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
>>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h
>>@@ -167,7 +167,8 @@ static inline u64 otx2_iova_to_phys(void
>>*iommu_domain, dma_addr_t dma_addr) }
>>
>> int otx2_napi_handler(struct napi_struct *napi, int budget); -bool
>>otx2_sq_append_skb(struct net_device *netdev, struct otx2_snd_queue
>>*sq,
>>+bool otx2_sq_append_skb(void *dev, struct netdev_queue *txq,
>>+ struct otx2_snd_queue *sq,
>> struct sk_buff *skb, u16 qidx);
>> void cn10k_sqe_flush(void *dev, struct otx2_snd_queue *sq,
>> int size, int qidx);
>>diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>>b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>>index 79a8acac6283..0486fca8b573 100644
>>--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>>+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
>>@@ -395,7 +395,7 @@ static netdev_tx_t otx2vf_xmit(struct sk_buff *skb,
>struct net_device *netdev)
>> sq = &vf->qset.sq[qidx];
>> txq = netdev_get_tx_queue(netdev, qidx);
>>
>>- if (!otx2_sq_append_skb(netdev, sq, skb, qidx)) {
>>+ if (!otx2_sq_append_skb(vf, txq, sq, skb, qidx)) {
>> netif_tx_stop_queue(txq);
>>
>> /* Check again, incase SQBs got freed up */ @@ -500,7 +500,7
>@@
>>static const struct net_device_ops otx2vf_netdev_ops = {
>> .ndo_setup_tc = otx2_setup_tc,
>> };
>>
>>-static int otx2_wq_init(struct otx2_nic *vf)
>>+static int otx2_vf_wq_init(struct otx2_nic *vf)
>> {
>> vf->otx2_wq = create_singlethread_workqueue("otx2vf_wq");
>> if (!vf->otx2_wq)
>>@@ -689,7 +689,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const
>struct pci_device_id *id)
>> goto err_ptp_destroy;
>> }
>>
>>- err = otx2_wq_init(vf);
>>+ err = otx2_vf_wq_init(vf);
>> if (err)
>> goto err_unreg_netdev;
>>
>>--
>>2.25.1
>>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2024-09-04 6:21 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-03 12:40 [net-next PATCH 0/4] Refactoring RVU NIC driver Geetha sowjanya
2024-09-03 12:40 ` [net-next PATCH 1/4] octeontx2-pf: Defines common API for HW resources configuration Geetha sowjanya
2024-09-03 14:55 ` Jiri Pirko
2024-09-03 14:57 ` Pavan Chebbi
2024-09-04 5:48 ` [EXTERNAL] " Geethasowjanya Akula
2024-09-04 6:18 ` Pavan Chebbi
2024-09-03 12:40 ` [net-next PATCH 2/4] octeontx2-pf: Add new APIs for queue memory alloc/free Geetha sowjanya
2024-09-03 15:12 ` Pavan Chebbi
2024-09-04 5:35 ` [EXTERNAL] " Geethasowjanya Akula
2024-09-03 12:40 ` [net-next PATCH 3/4] octeontx2-pf: Reuse PF max mtu value Geetha sowjanya
2024-09-03 12:40 ` [net-next PATCH 4/4] octeontx2-pf: Export common APIs Geetha sowjanya
2024-09-03 15:00 ` Jiri Pirko
2024-09-04 6:20 ` [EXTERNAL] " Geethasowjanya Akula
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox