]> git.dujemihanovic.xyz Git - linux.git/commitdiff
ionic: Fully reconfigure queues when going to/from a NULL XDP program
authorBrett Creeley <brett.creeley@amd.com>
Fri, 6 Sep 2024 23:26:21 +0000 (16:26 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 10 Sep 2024 02:18:15 +0000 (19:18 -0700)
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 <brett.creeley@amd.com>
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Link: https://patch.msgid.link/20240906232623.39651-6-brett.creeley@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/pensando/ionic/ionic_lif.c
drivers/net/ethernet/pensando/ionic/ionic_lif.h

index 6da6774d4d3060a968ef10fc222b0c6dee52ca76..54e5519d1110ec6f438e177fe4f70882b77d61e5 100644 (file)
@@ -2745,10 +2745,13 @@ static int ionic_xdp_config(struct net_device *netdev, struct netdev_bpf *bpf)
        if (!netif_running(netdev)) {
                old_prog = xchg(&lif->xdp_prog, bpf->prog);
        } else {
+               struct ionic_queue_params qparams;
+
+               ionic_init_queue_params(lif, &qparams);
+               qparams.xdp_prog = bpf->prog;
                mutex_lock(&lif->queue_lock);
-               ionic_stop_queues_reconfig(lif);
+               ionic_reconfigure_queues(lif, &qparams);
                old_prog = xchg(&lif->xdp_prog, bpf->prog);
-               ionic_start_queues_reconfig(lif);
                mutex_unlock(&lif->queue_lock);
        }
 
@@ -2908,7 +2911,8 @@ int ionic_reconfigure_queues(struct ionic_lif *lif,
        }
        if (qparam->nxqs != lif->nxqs ||
            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,
                                       sizeof(struct ionic_qcq *), GFP_KERNEL);
                if (!rx_qcqs) {
@@ -2984,6 +2988,7 @@ int ionic_reconfigure_queues(struct ionic_lif *lif,
                                goto err_out;
 
                        rx_qcqs[i]->q.features = qparam->rxq_features;
+                       rx_qcqs[i]->q.xdp_prog = qparam->xdp_prog;
                }
        }
 
index 3e1005293c4a1ea0b29a023f12c342ea04ecb115..e01756fb7fdded9407c52712cfb1febc0e85da62 100644 (file)
@@ -268,6 +268,7 @@ struct ionic_queue_params {
        unsigned int ntxq_descs;
        unsigned int nrxq_descs;
        u64 rxq_features;
+       struct bpf_prog *xdp_prog;
        bool intr_split;
        bool cmb_tx;
        bool cmb_rx;
@@ -280,6 +281,7 @@ static inline void ionic_init_queue_params(struct ionic_lif *lif,
        qparam->ntxq_descs = lif->ntxq_descs;
        qparam->nrxq_descs = lif->nrxq_descs;
        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->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);