diff mbox series

[11/10] eth: bnxt: link NAPI instances to queues and IRQs

Message ID 20231120235611.788520-1-kuba@kernel.org (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Introduce queue and NAPI support in netdev-genl (Was: Introduce NAPI queues support) | expand

Commit Message

Jakub Kicinski Nov. 20, 2023, 11:56 p.m. UTC
Make bnxt compatible with the newly added netlink queue GET APIs.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Nambiar, Amritha Nov. 21, 2023, 9:31 p.m. UTC | #1
On 11/20/2023 3:56 PM, Jakub Kicinski wrote:
> Make bnxt compatible with the newly added netlink queue GET APIs.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Thanks. Will add this as patch-11 to v9 of my series
(Introduce queue and NAPI support in netdev-genl).

> ---
>   drivers/net/ethernet/broadcom/bnxt/bnxt.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index e6ac1bd21bb3..ee4f4fc38bb5 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -3835,6 +3835,9 @@ static int bnxt_init_one_rx_ring(struct bnxt *bp, int ring_nr)
>   	ring = &rxr->rx_ring_struct;
>   	bnxt_init_rxbd_pages(ring, type);
>   
> +	netif_queue_set_napi(bp->dev, ring_nr, NETDEV_QUEUE_TYPE_RX,
> +			     &rxr->bnapi->napi);
> +
>   	if (BNXT_RX_PAGE_MODE(bp) && bp->xdp_prog) {
>   		bpf_prog_add(bp->xdp_prog, 1);
>   		rxr->xdp_prog = bp->xdp_prog;
> @@ -3911,6 +3914,9 @@ static int bnxt_init_tx_rings(struct bnxt *bp)
>   		struct bnxt_ring_struct *ring = &txr->tx_ring_struct;
>   
>   		ring->fw_ring_id = INVALID_HW_RING_ID;
> +
> +		netif_queue_set_napi(bp->dev, i, NETDEV_QUEUE_TYPE_TX,
> +				     &txr->bnapi->napi);
>   	}
>   
>   	return 0;
> @@ -9536,6 +9542,7 @@ static int bnxt_request_irq(struct bnxt *bp)
>   		if (rc)
>   			break;
>   
> +		netif_napi_set_irq(&bp->bnapi[i]->napi, irq->vector);
>   		irq->requested = 1;
>   
>   		if (zalloc_cpumask_var(&irq->cpu_mask, GFP_KERNEL)) {
> @@ -9563,6 +9570,11 @@ static void bnxt_del_napi(struct bnxt *bp)
>   	if (!bp->bnapi)
>   		return;
>   
> +	for (i = 0; i < bp->rx_nr_rings; i++)
> +		netif_queue_set_napi(bp->dev, i, NETDEV_QUEUE_TYPE_RX, NULL);
> +	for (i = 0; i < bp->tx_nr_rings; i++)
> +		netif_queue_set_napi(bp->dev, i, NETDEV_QUEUE_TYPE_TX, NULL);
> +
>   	for (i = 0; i < bp->cp_nr_rings; i++) {
>   		struct bnxt_napi *bnapi = bp->bnapi[i];
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index e6ac1bd21bb3..ee4f4fc38bb5 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -3835,6 +3835,9 @@  static int bnxt_init_one_rx_ring(struct bnxt *bp, int ring_nr)
 	ring = &rxr->rx_ring_struct;
 	bnxt_init_rxbd_pages(ring, type);
 
+	netif_queue_set_napi(bp->dev, ring_nr, NETDEV_QUEUE_TYPE_RX,
+			     &rxr->bnapi->napi);
+
 	if (BNXT_RX_PAGE_MODE(bp) && bp->xdp_prog) {
 		bpf_prog_add(bp->xdp_prog, 1);
 		rxr->xdp_prog = bp->xdp_prog;
@@ -3911,6 +3914,9 @@  static int bnxt_init_tx_rings(struct bnxt *bp)
 		struct bnxt_ring_struct *ring = &txr->tx_ring_struct;
 
 		ring->fw_ring_id = INVALID_HW_RING_ID;
+
+		netif_queue_set_napi(bp->dev, i, NETDEV_QUEUE_TYPE_TX,
+				     &txr->bnapi->napi);
 	}
 
 	return 0;
@@ -9536,6 +9542,7 @@  static int bnxt_request_irq(struct bnxt *bp)
 		if (rc)
 			break;
 
+		netif_napi_set_irq(&bp->bnapi[i]->napi, irq->vector);
 		irq->requested = 1;
 
 		if (zalloc_cpumask_var(&irq->cpu_mask, GFP_KERNEL)) {
@@ -9563,6 +9570,11 @@  static void bnxt_del_napi(struct bnxt *bp)
 	if (!bp->bnapi)
 		return;
 
+	for (i = 0; i < bp->rx_nr_rings; i++)
+		netif_queue_set_napi(bp->dev, i, NETDEV_QUEUE_TYPE_RX, NULL);
+	for (i = 0; i < bp->tx_nr_rings; i++)
+		netif_queue_set_napi(bp->dev, i, NETDEV_QUEUE_TYPE_TX, NULL);
+
 	for (i = 0; i < bp->cp_nr_rings; i++) {
 		struct bnxt_napi *bnapi = bp->bnapi[i];