mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 23:22:31 +02:00
net: ena: Always register RX queue info
The RX queue info contains information about the RX queue which might be relevant to the kernel. To avoid configuring this queue for different scenarios, this patch moves the RX queue configuration to ena_up()/ena_down() function and makes it configured every interface state toggle. Signed-off-by: Shay Agroskin <shayagr@amazon.com> Signed-off-by: David Arinzon <darinzon@amazon.com> Link: https://lore.kernel.org/r/20240101190855.18739-10-darinzon@amazon.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
2b02e332c1
commit
ea5c460023
|
|
@ -753,6 +753,7 @@ static void ena_destroy_all_rx_queues(struct ena_adapter *adapter)
|
|||
for (i = 0; i < adapter->num_io_queues; i++) {
|
||||
ena_qid = ENA_IO_RXQ_IDX(i);
|
||||
cancel_work_sync(&adapter->ena_napi[i].dim.work);
|
||||
ena_xdp_unregister_rxq_info(&adapter->rx_ring[i]);
|
||||
ena_com_destroy_io_queue(adapter->ena_dev, ena_qid);
|
||||
}
|
||||
}
|
||||
|
|
@ -1984,12 +1985,15 @@ static int ena_create_all_io_rx_queues(struct ena_adapter *adapter)
|
|||
if (rc)
|
||||
goto create_err;
|
||||
INIT_WORK(&adapter->ena_napi[i].dim.work, ena_dim_work);
|
||||
|
||||
ena_xdp_register_rxq_info(&adapter->rx_ring[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
create_err:
|
||||
while (i--) {
|
||||
ena_xdp_unregister_rxq_info(&adapter->rx_ring[i]);
|
||||
cancel_work_sync(&adapter->ena_napi[i].dim.work);
|
||||
ena_com_destroy_io_queue(ena_dev, ENA_IO_RXQ_IDX(i));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,12 +191,14 @@ int ena_setup_and_create_all_xdp_queues(struct ena_adapter *adapter)
|
|||
/* Provides a way for both kernel and bpf-prog to know
|
||||
* more about the RX-queue a given XDP frame arrived on.
|
||||
*/
|
||||
static int ena_xdp_register_rxq_info(struct ena_ring *rx_ring)
|
||||
int ena_xdp_register_rxq_info(struct ena_ring *rx_ring)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = xdp_rxq_info_reg(&rx_ring->xdp_rxq, rx_ring->netdev, rx_ring->qid, 0);
|
||||
|
||||
netif_dbg(rx_ring->adapter, ifup, rx_ring->netdev, "Registering RX info for queue %d",
|
||||
rx_ring->qid);
|
||||
if (rc) {
|
||||
netif_err(rx_ring->adapter, ifup, rx_ring->netdev,
|
||||
"Failed to register xdp rx queue info. RX queue num %d rc: %d\n",
|
||||
|
|
@ -217,8 +219,11 @@ static int ena_xdp_register_rxq_info(struct ena_ring *rx_ring)
|
|||
return rc;
|
||||
}
|
||||
|
||||
static void ena_xdp_unregister_rxq_info(struct ena_ring *rx_ring)
|
||||
void ena_xdp_unregister_rxq_info(struct ena_ring *rx_ring)
|
||||
{
|
||||
netif_dbg(rx_ring->adapter, ifdown, rx_ring->netdev,
|
||||
"Unregistering RX info for queue %d",
|
||||
rx_ring->qid);
|
||||
xdp_rxq_info_unreg_mem_model(&rx_ring->xdp_rxq);
|
||||
xdp_rxq_info_unreg(&rx_ring->xdp_rxq);
|
||||
}
|
||||
|
|
@ -236,10 +241,8 @@ void ena_xdp_exchange_program_rx_in_range(struct ena_adapter *adapter,
|
|||
old_bpf_prog = xchg(&rx_ring->xdp_bpf_prog, prog);
|
||||
|
||||
if (!old_bpf_prog && prog) {
|
||||
ena_xdp_register_rxq_info(rx_ring);
|
||||
rx_ring->rx_headroom = XDP_PACKET_HEADROOM;
|
||||
} else if (old_bpf_prog && !prog) {
|
||||
ena_xdp_unregister_rxq_info(rx_ring);
|
||||
rx_ring->rx_headroom = NET_SKB_PAD;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ int ena_xdp_xmit_frame(struct ena_ring *tx_ring,
|
|||
int ena_xdp_xmit(struct net_device *dev, int n,
|
||||
struct xdp_frame **frames, u32 flags);
|
||||
int ena_xdp(struct net_device *netdev, struct netdev_bpf *bpf);
|
||||
int ena_xdp_register_rxq_info(struct ena_ring *rx_ring);
|
||||
void ena_xdp_unregister_rxq_info(struct ena_ring *rx_ring);
|
||||
|
||||
enum ena_xdp_errors_t {
|
||||
ENA_XDP_ALLOWED = 0,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user