From: Vikas Gupta <vikas.gupta@broadcom.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
bhargava.marreddy@broadcom.com, rahul-rg.gupta@broadcom.com,
vsrama-krishna.nemani@broadcom.com,
rajashekar.hudumula@broadcom.com, dharmender.garg@broadcom.com,
ajit.khaparde@broadcom.com,
Vikas Gupta <vikas.gupta@broadcom.com>
Subject: [PATCH net-next 4/4] bnge: send hwrm for interface down/up transitions
Date: Fri, 24 Jul 2026 19:59:54 +0530 [thread overview]
Message-ID: <20260724142954.3101980-5-vikas.gupta@broadcom.com> (raw)
In-Reply-To: <20260724142954.3101980-1-vikas.gupta@broadcom.com>
Firmware expects HWRM_FUNC_DRV_IF_CHANGE on interface down/up
transitions to coordinate resource management.
Add bnge_hwrm_if_change() to send this notification.
Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Reviewed-by: Dharmender Garg <dharmender.garg@broadcom.com>
Reviewed-by: Rahul Gupta <rahul-rg.gupta@broadcom.com>
---
.../net/ethernet/broadcom/bnge/bnge_netdev.c | 32 +++++++++++++++++--
.../net/ethernet/broadcom/bnge/bnge_netdev.h | 2 ++
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
index e67536a8c430..220bdcced0db 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
@@ -20,6 +20,7 @@
#include <net/page_pool/helpers.h>
#include "bnge.h"
+#include "bnge_hwrm.h"
#include "bnge_hwrm_lib.h"
#include "bnge_ethtool.h"
#include "bnge_rmem.h"
@@ -2861,6 +2862,24 @@ static void bnge_tx_enable(struct bnge_net *bn)
netif_carrier_on(bn->netdev);
}
+static int bnge_hwrm_if_change(struct bnge_dev *bd, bool up)
+{
+ struct hwrm_func_drv_if_change_input *req;
+ int rc;
+
+ if (!(bd->fw_cap & BNGE_FW_CAP_IF_CHANGE))
+ return 0;
+
+ rc = bnge_hwrm_req_init(bd, req, HWRM_FUNC_DRV_IF_CHANGE);
+ if (rc)
+ return rc;
+
+ if (up)
+ req->flags = cpu_to_le32(FUNC_DRV_IF_CHANGE_REQ_FLAGS_UP);
+
+ return bnge_hwrm_req_send(bd, req);
+}
+
static int bnge_open_core(struct bnge_net *bn)
{
struct bnge_dev *bd = bn->bd;
@@ -2868,16 +2887,22 @@ static int bnge_open_core(struct bnge_net *bn)
netif_carrier_off(bn->netdev);
+ rc = bnge_hwrm_if_change(bd, true);
+ if (rc) {
+ netdev_err(bn->netdev, "bnge_hwrm_if_change err: %d\n", rc);
+ return rc;
+ }
+
rc = bnge_reserve_rings(bd);
if (rc) {
netdev_err(bn->netdev, "bnge_reserve_rings err: %d\n", rc);
- return rc;
+ goto err_if_change;
}
rc = bnge_alloc_core(bn);
if (rc) {
netdev_err(bn->netdev, "bnge_alloc_core err: %d\n", rc);
- return rc;
+ goto err_if_change;
}
bnge_init_napi(bn);
@@ -2924,6 +2949,8 @@ static int bnge_open_core(struct bnge_net *bn)
err_del_napi:
bnge_del_napi(bn);
bnge_free_core(bn);
+err_if_change:
+ bnge_hwrm_if_change(bd, false);
return rc;
}
@@ -3154,6 +3181,7 @@ static int bnge_close(struct net_device *dev)
bnge_close_core(bn);
bnge_hwrm_shutdown_link(bn->bd);
+ bnge_hwrm_if_change(bn->bd, false);
bn->sp_event = 0;
return 0;
diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h
index d177919c2e11..a1a939496ebd 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.h
@@ -275,6 +275,8 @@ enum bnge_net_flag {
BNGE_FLAG_PORT_STATS_EXT = BIT(1),
};
+#define BNGE_FW_IF_RETRY 10
+
enum bnge_sp_event {
BNGE_LINK_CHNG_SP_EVENT,
BNGE_LINK_SPEED_CHNG_SP_EVENT,
--
2.47.1
prev parent reply other threads:[~2026-07-24 14:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 14:29 [PATCH net-next 0/4] bnge: add more functionality Vikas Gupta
2026-07-24 14:29 ` [PATCH net-next 1/4] bnge: add steps in bnge_shutdown() Vikas Gupta
2026-07-24 14:29 ` [PATCH net-next 2/4] bnge: refactor rx mode helpers to accept explicit address lists Vikas Gupta
2026-07-24 14:29 ` [PATCH net-next 3/4] bnge: add ndo_set_rx_mode_async support Vikas Gupta
2026-07-24 14:29 ` Vikas Gupta [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260724142954.3101980-5-vikas.gupta@broadcom.com \
--to=vikas.gupta@broadcom.com \
--cc=ajit.khaparde@broadcom.com \
--cc=andrew+netdev@lunn.ch \
--cc=bhargava.marreddy@broadcom.com \
--cc=davem@davemloft.net \
--cc=dharmender.garg@broadcom.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rahul-rg.gupta@broadcom.com \
--cc=rajashekar.hudumula@broadcom.com \
--cc=vsrama-krishna.nemani@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox