Commit a7f3f635 authored by Brett Creeley's avatar Brett Creeley Committed by Jakub Kicinski

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: default avatarBrett Creeley <brett.creeley@amd.com>
Signed-off-by: default avatarShannon Nelson <shannon.nelson@amd.com>
Link: https://patch.msgid.link/20240906232623.39651-6-brett.creeley@amd.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 668e4239
...@@ -2745,10 +2745,13 @@ static int ionic_xdp_config(struct net_device *netdev, struct netdev_bpf *bpf) ...@@ -2745,10 +2745,13 @@ static int ionic_xdp_config(struct net_device *netdev, struct netdev_bpf *bpf)
if (!netif_running(netdev)) { if (!netif_running(netdev)) {
old_prog = xchg(&lif->xdp_prog, bpf->prog); old_prog = xchg(&lif->xdp_prog, bpf->prog);
} else { } else {
struct ionic_queue_params qparams;
ionic_init_queue_params(lif, &qparams);
qparams.xdp_prog = bpf->prog;
mutex_lock(&lif->queue_lock); mutex_lock(&lif->queue_lock);
ionic_stop_queues_reconfig(lif); ionic_reconfigure_queues(lif, &qparams);
old_prog = xchg(&lif->xdp_prog, bpf->prog); old_prog = xchg(&lif->xdp_prog, bpf->prog);
ionic_start_queues_reconfig(lif);
mutex_unlock(&lif->queue_lock); mutex_unlock(&lif->queue_lock);
} }
...@@ -2908,7 +2911,8 @@ int ionic_reconfigure_queues(struct ionic_lif *lif, ...@@ -2908,7 +2911,8 @@ int ionic_reconfigure_queues(struct ionic_lif *lif,
} }
if (qparam->nxqs != lif->nxqs || if (qparam->nxqs != lif->nxqs ||
qparam->nrxq_descs != lif->nrxq_descs || qparam->nrxq_descs != lif->nrxq_descs ||
qparam->rxq_features != lif->rxq_features) { qparam->rxq_features != lif->rxq_features ||
qparam->xdp_prog != lif->xdp_prog) {
rx_qcqs = devm_kcalloc(lif->ionic->dev, lif->ionic->nrxqs_per_lif, rx_qcqs = devm_kcalloc(lif->ionic->dev, lif->ionic->nrxqs_per_lif,
sizeof(struct ionic_qcq *), GFP_KERNEL); sizeof(struct ionic_qcq *), GFP_KERNEL);
if (!rx_qcqs) { if (!rx_qcqs) {
...@@ -2984,6 +2988,7 @@ int ionic_reconfigure_queues(struct ionic_lif *lif, ...@@ -2984,6 +2988,7 @@ int ionic_reconfigure_queues(struct ionic_lif *lif,
goto err_out; goto err_out;
rx_qcqs[i]->q.features = qparam->rxq_features; rx_qcqs[i]->q.features = qparam->rxq_features;
rx_qcqs[i]->q.xdp_prog = qparam->xdp_prog;
} }
} }
......
...@@ -268,6 +268,7 @@ struct ionic_queue_params { ...@@ -268,6 +268,7 @@ struct ionic_queue_params {
unsigned int ntxq_descs; unsigned int ntxq_descs;
unsigned int nrxq_descs; unsigned int nrxq_descs;
u64 rxq_features; u64 rxq_features;
struct bpf_prog *xdp_prog;
bool intr_split; bool intr_split;
bool cmb_tx; bool cmb_tx;
bool cmb_rx; bool cmb_rx;
...@@ -280,6 +281,7 @@ static inline void ionic_init_queue_params(struct ionic_lif *lif, ...@@ -280,6 +281,7 @@ static inline void ionic_init_queue_params(struct ionic_lif *lif,
qparam->ntxq_descs = lif->ntxq_descs; qparam->ntxq_descs = lif->ntxq_descs;
qparam->nrxq_descs = lif->nrxq_descs; qparam->nrxq_descs = lif->nrxq_descs;
qparam->rxq_features = lif->rxq_features; qparam->rxq_features = lif->rxq_features;
qparam->xdp_prog = lif->xdp_prog;
qparam->intr_split = test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state); qparam->intr_split = test_bit(IONIC_LIF_F_SPLIT_INTR, lif->state);
qparam->cmb_tx = test_bit(IONIC_LIF_F_CMB_TX_RINGS, lif->state); qparam->cmb_tx = test_bit(IONIC_LIF_F_CMB_TX_RINGS, lif->state);
qparam->cmb_rx = test_bit(IONIC_LIF_F_CMB_RX_RINGS, lif->state); qparam->cmb_rx = test_bit(IONIC_LIF_F_CMB_RX_RINGS, lif->state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment