Skip to content

Commit 04f647c

Browse files
Geetha sowjanyaPaolo Abeni
authored andcommitted
octeontx2-pf: Remove xdp queues on program detach
XDP queues are created/destroyed when a XDP program is attached/detached. In current driver xdp_queues are not getting destroyed on program exit due to incorrect xdp_queue and tot_tx_queue count values. This patch fixes the issue by setting tot_tx_queue and xdp_queue count to correct values. It also fixes xdp.data_hard_start address. Fixes: 06059a1 ("octeontx2-pf: Add XDP support to netdev PF") Signed-off-by: Geetha sowjanya <gakula@marvell.com> Link: https://lore.kernel.org/r/20240130120610.16673-1-gakula@marvell.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent b59af30 commit 04f647c

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ static int otx2_set_channels(struct net_device *dev,
314314
pfvf->hw.tx_queues = channel->tx_count;
315315
if (pfvf->xdp_prog)
316316
pfvf->hw.xdp_queues = channel->rx_count;
317-
pfvf->hw.non_qos_queues = pfvf->hw.tx_queues + pfvf->hw.xdp_queues;
318317

319318
if (if_up)
320319
err = dev->netdev_ops->ndo_open(dev);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,6 +1744,7 @@ int otx2_open(struct net_device *netdev)
17441744
/* RQ and SQs are mapped to different CQs,
17451745
* so find out max CQ IRQs (i.e CINTs) needed.
17461746
*/
1747+
pf->hw.non_qos_queues = pf->hw.tx_queues + pf->hw.xdp_queues;
17471748
pf->hw.cint_cnt = max3(pf->hw.rx_queues, pf->hw.tx_queues,
17481749
pf->hw.tc_tx_queues);
17491750

@@ -2643,8 +2644,6 @@ static int otx2_xdp_setup(struct otx2_nic *pf, struct bpf_prog *prog)
26432644
xdp_features_clear_redirect_target(dev);
26442645
}
26452646

2646-
pf->hw.non_qos_queues += pf->hw.xdp_queues;
2647-
26482647
if (if_up)
26492648
otx2_open(pf->netdev);
26502649

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,7 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
14031403
struct otx2_cq_queue *cq,
14041404
bool *need_xdp_flush)
14051405
{
1406-
unsigned char *hard_start, *data;
1406+
unsigned char *hard_start;
14071407
int qidx = cq->cq_idx;
14081408
struct xdp_buff xdp;
14091409
struct page *page;
@@ -1417,9 +1417,8 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
14171417

14181418
xdp_init_buff(&xdp, pfvf->rbsize, &cq->xdp_rxq);
14191419

1420-
data = (unsigned char *)phys_to_virt(pa);
1421-
hard_start = page_address(page);
1422-
xdp_prepare_buff(&xdp, hard_start, data - hard_start,
1420+
hard_start = (unsigned char *)phys_to_virt(pa);
1421+
xdp_prepare_buff(&xdp, hard_start, OTX2_HEAD_ROOM,
14231422
cqe->sg.seg_size, false);
14241423

14251424
act = bpf_prog_run_xdp(prog, &xdp);

0 commit comments

Comments
 (0)