Skip to content

Commit 78bd5d8

Browse files
Geetha sowjanyakuba-moo
authored andcommitted
octeontx2-pf: Move shared APIs to header file
Move mbox, hw resources and interrupt configuration functions to common header file. So, that they can be used later by the RVU representor driver. Signed-off-by: Geetha sowjanya <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent dec6f5e commit 78bd5d8

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,17 @@ int otx2_aura_init(struct otx2_nic *pfvf, int aura_id,
10001000
int otx2_init_rsrc(struct pci_dev *pdev, struct otx2_nic *pf);
10011001
void otx2_free_queue_mem(struct otx2_qset *qset);
10021002
int otx2_alloc_queue_mem(struct otx2_nic *pf);
1003+
int otx2_init_hw_resources(struct otx2_nic *pfvf);
1004+
void otx2_free_hw_resources(struct otx2_nic *pf);
1005+
int otx2_wq_init(struct otx2_nic *pf);
1006+
int otx2_check_pf_usable(struct otx2_nic *pf);
1007+
int otx2_pfaf_mbox_init(struct otx2_nic *pf);
1008+
int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af);
1009+
int otx2_realloc_msix_vectors(struct otx2_nic *pf);
1010+
void otx2_pfaf_mbox_destroy(struct otx2_nic *pf);
1011+
void otx2_disable_mbox_intr(struct otx2_nic *pf);
1012+
void otx2_disable_napi(struct otx2_nic *pf);
1013+
irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq);
10031014

10041015
/* RSS configuration APIs*/
10051016
int otx2_rss_init(struct otx2_nic *pfvf);

drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ static irqreturn_t otx2_pfaf_mbox_intr_handler(int irq, void *pf_irq)
10081008
return IRQ_HANDLED;
10091009
}
10101010

1011-
static void otx2_disable_mbox_intr(struct otx2_nic *pf)
1011+
void otx2_disable_mbox_intr(struct otx2_nic *pf)
10121012
{
10131013
int vector = pci_irq_vector(pf->pdev, RVU_PF_INT_VEC_AFPF_MBOX);
10141014

@@ -1017,7 +1017,7 @@ static void otx2_disable_mbox_intr(struct otx2_nic *pf)
10171017
free_irq(vector, pf);
10181018
}
10191019

1020-
static int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af)
1020+
int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af)
10211021
{
10221022
struct otx2_hw *hw = &pf->hw;
10231023
struct msg_req *req;
@@ -1061,7 +1061,7 @@ static int otx2_register_mbox_intr(struct otx2_nic *pf, bool probe_af)
10611061
return 0;
10621062
}
10631063

1064-
static void otx2_pfaf_mbox_destroy(struct otx2_nic *pf)
1064+
void otx2_pfaf_mbox_destroy(struct otx2_nic *pf)
10651065
{
10661066
struct mbox *mbox = &pf->mbox;
10671067

@@ -1077,7 +1077,7 @@ static void otx2_pfaf_mbox_destroy(struct otx2_nic *pf)
10771077
otx2_mbox_destroy(&mbox->mbox_up);
10781078
}
10791079

1080-
static int otx2_pfaf_mbox_init(struct otx2_nic *pf)
1080+
int otx2_pfaf_mbox_init(struct otx2_nic *pf)
10811081
{
10821082
struct mbox *mbox = &pf->mbox;
10831083
void __iomem *hwbase;
@@ -1379,7 +1379,7 @@ static irqreturn_t otx2_q_intr_handler(int irq, void *data)
13791379
return IRQ_HANDLED;
13801380
}
13811381

1382-
static irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq)
1382+
irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq)
13831383
{
13841384
struct otx2_cq_poll *cq_poll = (struct otx2_cq_poll *)cq_irq;
13851385
struct otx2_nic *pf = (struct otx2_nic *)cq_poll->dev;
@@ -1399,15 +1399,18 @@ static irqreturn_t otx2_cq_intr_handler(int irq, void *cq_irq)
13991399
return IRQ_HANDLED;
14001400
}
14011401

1402-
static void otx2_disable_napi(struct otx2_nic *pf)
1402+
void otx2_disable_napi(struct otx2_nic *pf)
14031403
{
14041404
struct otx2_qset *qset = &pf->qset;
14051405
struct otx2_cq_poll *cq_poll;
1406+
struct work_struct *work;
14061407
int qidx;
14071408

14081409
for (qidx = 0; qidx < pf->hw.cint_cnt; qidx++) {
14091410
cq_poll = &qset->napi[qidx];
1410-
cancel_work_sync(&cq_poll->dim.work);
1411+
work = &cq_poll->dim.work;
1412+
if (work->func)
1413+
cancel_work_sync(work);
14111414
napi_disable(&cq_poll->napi);
14121415
netif_napi_del(&cq_poll->napi);
14131416
}
@@ -1477,7 +1480,7 @@ static int otx2_get_rbuf_size(struct otx2_nic *pf, int mtu)
14771480
return ALIGN(rbuf_size, 2048);
14781481
}
14791482

1480-
static int otx2_init_hw_resources(struct otx2_nic *pf)
1483+
int otx2_init_hw_resources(struct otx2_nic *pf)
14811484
{
14821485
struct nix_lf_free_req *free_req;
14831486
struct mbox *mbox = &pf->mbox;
@@ -1602,7 +1605,7 @@ static int otx2_init_hw_resources(struct otx2_nic *pf)
16021605
return err;
16031606
}
16041607

1605-
static void otx2_free_hw_resources(struct otx2_nic *pf)
1608+
void otx2_free_hw_resources(struct otx2_nic *pf)
16061609
{
16071610
struct otx2_qset *qset = &pf->qset;
16081611
struct nix_lf_free_req *free_req;
@@ -2807,7 +2810,7 @@ static const struct net_device_ops otx2_netdev_ops = {
28072810
.ndo_set_vf_trust = otx2_ndo_set_vf_trust,
28082811
};
28092812

2810-
static int otx2_wq_init(struct otx2_nic *pf)
2813+
int otx2_wq_init(struct otx2_nic *pf)
28112814
{
28122815
pf->otx2_wq = create_singlethread_workqueue("otx2_wq");
28132816
if (!pf->otx2_wq)
@@ -2818,7 +2821,7 @@ static int otx2_wq_init(struct otx2_nic *pf)
28182821
return 0;
28192822
}
28202823

2821-
static int otx2_check_pf_usable(struct otx2_nic *nic)
2824+
int otx2_check_pf_usable(struct otx2_nic *nic)
28222825
{
28232826
u64 rev;
28242827

@@ -2836,7 +2839,7 @@ static int otx2_check_pf_usable(struct otx2_nic *nic)
28362839
return 0;
28372840
}
28382841

2839-
static int otx2_realloc_msix_vectors(struct otx2_nic *pf)
2842+
int otx2_realloc_msix_vectors(struct otx2_nic *pf)
28402843
{
28412844
struct otx2_hw *hw = &pf->hw;
28422845
int num_vec, err;

drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ static const struct net_device_ops otx2vf_netdev_ops = {
500500
.ndo_setup_tc = otx2_setup_tc,
501501
};
502502

503-
static int otx2_wq_init(struct otx2_nic *vf)
503+
static int otx2_vf_wq_init(struct otx2_nic *vf)
504504
{
505505
vf->otx2_wq = create_singlethread_workqueue("otx2vf_wq");
506506
if (!vf->otx2_wq)
@@ -689,7 +689,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
689689
goto err_ptp_destroy;
690690
}
691691

692-
err = otx2_wq_init(vf);
692+
err = otx2_vf_wq_init(vf);
693693
if (err)
694694
goto err_unreg_netdev;
695695

0 commit comments

Comments
 (0)