Skip to content

Commit a7f3f63

Browse files
brettcreeleykuba-moo
authored andcommitted
ionic: Fully reconfigure queues when going to/from a NULL XDP program
Currently when going to/from a NULL XDP program the driver uses ionic_stop_queues_reconfig() and then ionic_start_queues_reconfig() in order to re-register the xdp_rxq_info and re-init the queues. This is fine until page_pool(s) are used in an upcoming patch. In preparation for adding page_pool support make sure to completely rebuild the queues when going to/from a NULL XDP program. Without this change the call to mem_allocator_disconnect() never happens when going to a NULL XDP program, which eventually results in xdp_rxq_info_reg_mem_model() failing with -ENOSPC due to the mem_id_pool ida having no remaining space. Signed-off-by: Brett Creeley <[email protected]> Signed-off-by: Shannon Nelson <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 668e423 commit a7f3f63

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

drivers/net/ethernet/pensando/ionic/ionic_lif.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2745,10 +2745,13 @@ static int ionic_xdp_config(struct net_device *netdev, struct netdev_bpf *bpf)
27452745
if (!netif_running(netdev)) {
27462746
old_prog = xchg(&lif->xdp_prog, bpf->prog);
27472747
} else {
2748+
struct ionic_queue_params qparams;
2749+
2750+
ionic_init_queue_params(lif, &qparams);
2751+
qparams.xdp_prog = bpf->prog;
27482752
mutex_lock(&lif->queue_lock);
2749-
ionic_stop_queues_reconfig(lif);
2753+
ionic_reconfigure_queues(lif, &qparams);
27502754
old_prog = xchg(&lif->xdp_prog, bpf->prog);
2751-
ionic_start_queues_reconfig(lif);
27522755
mutex_unlock(&lif->queue_lock);
27532756
}
27542757

@@ -2908,7 +2911,8 @@ int ionic_reconfigure_queues(struct ionic_lif *lif,
29082911
}
29092912
if (qparam->nxqs != lif->nxqs ||
29102913
qparam->nrxq_descs != lif->nrxq_descs ||
2911-
qparam->rxq_features != lif->rxq_features) {
2914+
qparam->rxq_features != lif->rxq_features ||
2915+
qparam->xdp_prog != lif->xdp_prog) {
29122916
rx_qcqs = devm_kcalloc(lif->ionic->dev, lif->ionic->nrxqs_per_lif,
29132917
sizeof(struct ionic_qcq *), GFP_KERNEL);
29142918
if (!rx_qcqs) {
@@ -2984,6 +2988,7 @@ int ionic_reconfigure_queues(struct ionic_lif *lif,
29842988
goto err_out;
29852989

29862990
rx_qcqs[i]->q.features = qparam->rxq_features;
2991+
rx_qcqs[i]->q.xdp_prog = qparam->xdp_prog;
29872992
}
29882993
}
29892994

drivers/net/ethernet/pensando/ionic/ionic_lif.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ struct ionic_queue_params {
268268
unsigned int ntxq_descs;
269269
unsigned int nrxq_descs;
270270
u64 rxq_features;
271+
struct bpf_prog *xdp_prog;
271272
bool intr_split;
272273
bool cmb_tx;
273274
bool cmb_rx;
@@ -280,6 +281,7 @@ static inline void ionic_init_queue_params(struct ionic_lif *lif,
280281
qparam->ntxq_descs = lif->ntxq_descs;
281282
qparam->nrxq_descs = lif->nrxq_descs;
282283
qparam->rxq_features = lif->rxq_features;
284+
qparam->xdp_prog = lif->xdp_prog;
283285
qparam->intr_split = test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state);
284286
qparam->cmb_tx = test_bit(IONIC_LIF_F_CMB_TX_RINGS, lif->state);
285287
qparam->cmb_rx = test_bit(IONIC_LIF_F_CMB_RX_RINGS, lif->state);

0 commit comments

Comments
 (0)