diff --git a/src/ixgbe_lib.c b/src/ixgbe_lib.c index 5db6141..36832f2 100644 --- a/src/ixgbe_lib.c +++ b/src/ixgbe_lib.c @@ -1125,9 +1125,6 @@ static void ixgbe_free_q_vector(struct ixgbe_adapter *adapter, int v_idx) adapter->tx_ring[ring->queue_index] = NULL; } - if (static_key_enabled((struct static_key *)&ixgbe_xdp_locking_key)) - static_branch_dec(&ixgbe_xdp_locking_key); - ixgbe_for_each_ring(ring, q_vector->rx) adapter->rx_ring[ring->queue_index] = NULL; diff --git a/src/ixgbe_main.c b/src/ixgbe_main.c index 5fd2d87..7687823 100644 --- a/src/ixgbe_main.c +++ b/src/ixgbe_main.c @@ -8618,6 +8618,11 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter) adapter->tx_work_limit = IXGBE_DEFAULT_TX_WORK; set_bit(__IXGBE_DOWN, &adapter->state); + + /* enable locking for XDP_TX if we have more CPUs than queues */ + if (nr_cpu_ids > IXGBE_MAX_XDP_QS) + static_branch_enable(&ixgbe_xdp_locking_key); + out: return err; } @@ -13234,8 +13239,6 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog) */ if (nr_cpu_ids > IXGBE_MAX_XDP_QS * 2) return -ENOMEM; - else if (nr_cpu_ids > IXGBE_MAX_XDP_QS) - static_branch_inc(&ixgbe_xdp_locking_key); old_prog = xchg(&adapter->xdp_prog, prog); need_reset = (!!prog != !!old_prog);