Re: [v7, net-next 05/10] bng_en: Initialise core resources
flat view
From: Simon Horman <horms@kernel.org>
Date: 2025-09-16 15:45:05
Also in:
lkml
On Fri, Sep 12, 2025 at 01:05:00AM +0530, Bhargava Marreddy wrote:
quoted hunk ↗ jump to hunk
Add initial settings to all core resources, such as the RX, AGG, TX, CQ, and NQ rings, as well as the VNIC. This will help enable these resources in future patches. Signed-off-by: Bhargava Marreddy <redacted> Reviewed-by: Vikas Gupta <vikas.gupta@broadcom.com> Reviewed-by: Rajashekar Hudumula <redacted> --- .../net/ethernet/broadcom/bnge/bnge_netdev.c | 213 ++++++++++++++++++ .../net/ethernet/broadcom/bnge/bnge_netdev.h | 50 ++++ .../net/ethernet/broadcom/bnge/bnge_rmem.h | 1 + 3 files changed, 264 insertions(+)diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
...
quoted hunk ↗ jump to hunk
+static int bnge_init_tx_rings(struct bnge_net *bn) +{ + int i; + + bn->tx_wake_thresh = max_t(int, bn->tx_ring_size / 2, + BNGE_MIN_TX_DESC_CNT);
The use of max_t caught my eye. And I'm curious to know why tx_wake_thresh is signed. I don't see it used in this patchset other than being set on the line above. In any case, I expect that max() can be used instead of max_t() here.
quoted hunk ↗ jump to hunk
+ + for (i = 0; i < bn->bd->tx_nr_rings; i++) { + struct bnge_tx_ring_info *txr = &bn->tx_ring[i]; + struct bnge_ring_struct *ring = &txr->tx_ring_struct; + + ring->fw_ring_id = INVALID_HW_RING_ID; + + netif_queue_set_napi(bn->netdev, i, NETDEV_QUEUE_TYPE_TX, + &txr->bnapi->napi); + } + + return 0; +}
...
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h
...
quoted hunk ↗ jump to hunk
@@ -176,9 +212,19 @@ struct bnge_net { u16 *tx_ring_map; enum dma_data_direction rx_dir; + /* grp_info indexed by napi/nq index */ + struct bnge_ring_grp_info *grp_info; struct bnge_vnic_info *vnic_info; int nr_vnics; int total_irqs; + + int tx_wake_thresh; + u16 rx_offset; + u16 rx_dma_offset; + + u8 rss_hash_key[HW_HASH_KEY_SIZE]; + u8 rss_hash_key_valid:1; + u8 rss_hash_key_updated:1; };
...