[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250916154501.GJ224143@horms.kernel.org>
Date: Tue, 16 Sep 2025 16:45:01 +0100
From: Simon Horman <horms@...nel.org>
To: Bhargava Marreddy <bhargava.marreddy@...adcom.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, andrew+netdev@...n.ch, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, michael.chan@...adcom.com,
pavan.chebbi@...adcom.com, vsrama-krishna.nemani@...adcom.com,
vikas.gupta@...adcom.com,
Rajashekar Hudumula <rajashekar.hudumula@...adcom.com>
Subject: Re: [v7, net-next 05/10] bng_en: Initialise core resources
On Fri, Sep 12, 2025 at 01:05:00AM +0530, Bhargava Marreddy wrote:
> 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 <bhargava.marreddy@...adcom.com>
> Reviewed-by: Vikas Gupta <vikas.gupta@...adcom.com>
> Reviewed-by: Rajashekar Hudumula <rajashekar.hudumula@...adcom.com>
> ---
> .../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
...
> +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.
> +
> + 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;
> +}
...
> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h
...
> @@ -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;
> };
...
Powered by blists - more mailing lists