DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org, zaiyuwang@trustnetic.com
Cc: Jiawen Wu <jiawenwu@trustnetic.com>
Subject: [PATCH] net/txgbe: fix the missing old mailbox interface calls
Date: Wed, 19 Nov 2025 16:56:24 +0800	[thread overview]
Message-ID: <A4E8D8476CBBC191+20251119085624.73210-1-jiawenwu@trustnetic.com> (raw)

There are some SW-FW interactions still call the old mailbox interface
function, which is used for SP devices. It causes the interaction
command to time out.

Adjust the interaction flow to use a unified function pointer.

Fixes: 6a139ade82e7 ("net/txgbe: add new SW-FW mailbox interface")
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/txgbe/base/txgbe_aml.c    |  4 ++++
 drivers/net/txgbe/base/txgbe_aml40.c  |  4 ++++
 drivers/net/txgbe/base/txgbe_eeprom.c | 16 +++++++-------
 drivers/net/txgbe/base/txgbe_hw.c     |  4 ++++
 drivers/net/txgbe/base/txgbe_mng.c    | 32 ++++++++++++---------------
 drivers/net/txgbe/base/txgbe_mng.h    |  4 ++++
 drivers/net/txgbe/base/txgbe_type.h   |  2 ++
 7 files changed, 40 insertions(+), 26 deletions(-)

diff --git a/drivers/net/txgbe/base/txgbe_aml.c b/drivers/net/txgbe/base/txgbe_aml.c
index 867cf4c2d3..b2c870973e 100644
--- a/drivers/net/txgbe/base/txgbe_aml.c
+++ b/drivers/net/txgbe/base/txgbe_aml.c
@@ -17,6 +17,7 @@ void txgbe_init_ops_aml(struct txgbe_hw *hw)
 {
 	struct txgbe_mac_info *mac = &hw->mac;
 	struct txgbe_phy_info *phy = &hw->phy;
+	struct txgbe_mbx_info *mbx = &hw->mbx;
 
 	txgbe_init_ops_generic(hw);
 
@@ -27,6 +28,9 @@ void txgbe_init_ops_aml(struct txgbe_hw *hw)
 	mac->init_mac_link_ops = txgbe_init_mac_link_ops_aml;
 	mac->get_link_capabilities = txgbe_get_link_capabilities_aml;
 	mac->check_link = txgbe_check_mac_link_aml;
+
+	/* MAILBOX */
+	mbx->host_interface_command = txgbe_host_interface_command_aml;
 }
 
 s32 txgbe_check_mac_link_aml(struct txgbe_hw *hw, u32 *speed,
diff --git a/drivers/net/txgbe/base/txgbe_aml40.c b/drivers/net/txgbe/base/txgbe_aml40.c
index c7d64cade6..08e8a7e5d2 100644
--- a/drivers/net/txgbe/base/txgbe_aml40.c
+++ b/drivers/net/txgbe/base/txgbe_aml40.c
@@ -18,6 +18,7 @@ void txgbe_init_ops_aml40(struct txgbe_hw *hw)
 {
 	struct txgbe_mac_info *mac = &hw->mac;
 	struct txgbe_phy_info *phy = &hw->phy;
+	struct txgbe_mbx_info *mbx = &hw->mbx;
 
 	txgbe_init_ops_generic(hw);
 
@@ -28,6 +29,9 @@ void txgbe_init_ops_aml40(struct txgbe_hw *hw)
 	mac->init_mac_link_ops = txgbe_init_mac_link_ops_aml40;
 	mac->get_link_capabilities = txgbe_get_link_capabilities_aml40;
 	mac->check_link = txgbe_check_mac_link_aml40;
+
+	/* MAILBOX */
+	mbx->host_interface_command = txgbe_host_interface_command_aml;
 }
 
 s32 txgbe_check_mac_link_aml40(struct txgbe_hw *hw, u32 *speed,
diff --git a/drivers/net/txgbe/base/txgbe_eeprom.c b/drivers/net/txgbe/base/txgbe_eeprom.c
index eb53b35a19..b1d90f6f6b 100644
--- a/drivers/net/txgbe/base/txgbe_eeprom.c
+++ b/drivers/net/txgbe/base/txgbe_eeprom.c
@@ -137,7 +137,7 @@ void txgbe_release_eeprom_semaphore(struct txgbe_hw *hw)
 s32 txgbe_ee_read16(struct txgbe_hw *hw, u32 offset,
 			      u16 *data)
 {
-	const u32 mask = TXGBE_MNGSEM_SWMBX | TXGBE_MNGSEM_SWFLASH;
+	const u32 mask = TXGBE_MNGSEM_SWFLASH;
 	u32 addr = (offset << 1);
 	int err;
 
@@ -164,7 +164,7 @@ s32 txgbe_ee_read16(struct txgbe_hw *hw, u32 offset,
 s32 txgbe_ee_readw_buffer(struct txgbe_hw *hw,
 				     u32 offset, u32 words, void *data)
 {
-	const u32 mask = TXGBE_MNGSEM_SWMBX | TXGBE_MNGSEM_SWFLASH;
+	const u32 mask = TXGBE_MNGSEM_SWFLASH;
 	u32 addr = (offset << 1);
 	u32 len = (words << 1);
 	u8 *buf = (u8 *)data;
@@ -195,7 +195,7 @@ s32 txgbe_ee_readw_buffer(struct txgbe_hw *hw,
 s32 txgbe_ee_readw_sw(struct txgbe_hw *hw, u32 offset,
 			      u16 *data)
 {
-	const u32 mask = TXGBE_MNGSEM_SWMBX | TXGBE_MNGSEM_SWFLASH;
+	const u32 mask = TXGBE_MNGSEM_SWFLASH;
 	u32 addr = hw->rom.sw_addr + (offset << 1);
 	int err;
 
@@ -220,7 +220,7 @@ s32 txgbe_ee_readw_sw(struct txgbe_hw *hw, u32 offset,
  **/
 s32 txgbe_ee_read32(struct txgbe_hw *hw, u32 addr, u32 *data)
 {
-	const u32 mask = TXGBE_MNGSEM_SWMBX | TXGBE_MNGSEM_SWFLASH;
+	const u32 mask = TXGBE_MNGSEM_SWFLASH;
 	int err;
 
 	err = hw->mac.acquire_swfw_sync(hw, mask);
@@ -245,7 +245,7 @@ s32 txgbe_ee_read32(struct txgbe_hw *hw, u32 addr, u32 *data)
 s32 txgbe_ee_write16(struct txgbe_hw *hw, u32 offset,
 			       u16 data)
 {
-	const u32 mask = TXGBE_MNGSEM_SWMBX | TXGBE_MNGSEM_SWFLASH;
+	const u32 mask = TXGBE_MNGSEM_SWFLASH;
 	u32 addr = (offset << 1);
 	int err;
 
@@ -272,7 +272,7 @@ s32 txgbe_ee_write16(struct txgbe_hw *hw, u32 offset,
 s32 txgbe_ee_writew_buffer(struct txgbe_hw *hw,
 				      u32 offset, u32 words, void *data)
 {
-	const u32 mask = TXGBE_MNGSEM_SWMBX | TXGBE_MNGSEM_SWFLASH;
+	const u32 mask = TXGBE_MNGSEM_SWFLASH;
 	u32 addr = (offset << 1);
 	u32 len = (words << 1);
 	u8 *buf = (u8 *)data;
@@ -301,7 +301,7 @@ s32 txgbe_ee_writew_buffer(struct txgbe_hw *hw,
 s32 txgbe_ee_writew_sw(struct txgbe_hw *hw, u32 offset,
 			       u16 data)
 {
-	const u32 mask = TXGBE_MNGSEM_SWMBX | TXGBE_MNGSEM_SWFLASH;
+	const u32 mask = TXGBE_MNGSEM_SWFLASH;
 	u32 addr = hw->rom.sw_addr + (offset << 1);
 	int err;
 
@@ -326,7 +326,7 @@ s32 txgbe_ee_writew_sw(struct txgbe_hw *hw, u32 offset,
  **/
 s32 txgbe_ee_write32(struct txgbe_hw *hw, u32 addr, u32 data)
 {
-	const u32 mask = TXGBE_MNGSEM_SWMBX | TXGBE_MNGSEM_SWFLASH;
+	const u32 mask = TXGBE_MNGSEM_SWFLASH;
 	int err;
 
 	err = hw->mac.acquire_swfw_sync(hw, mask);
diff --git a/drivers/net/txgbe/base/txgbe_hw.c b/drivers/net/txgbe/base/txgbe_hw.c
index 5017886896..c911234822 100644
--- a/drivers/net/txgbe/base/txgbe_hw.c
+++ b/drivers/net/txgbe/base/txgbe_hw.c
@@ -2998,6 +2998,7 @@ void txgbe_init_ops_sp(struct txgbe_hw *hw)
 {
 	struct txgbe_mac_info *mac = &hw->mac;
 	struct txgbe_phy_info *phy = &hw->phy;
+	struct txgbe_mbx_info *mbx = &hw->mbx;
 
 	txgbe_init_ops_generic(hw);
 
@@ -3008,6 +3009,9 @@ void txgbe_init_ops_sp(struct txgbe_hw *hw)
 	mac->init_mac_link_ops = txgbe_init_mac_link_ops_sp;
 	mac->get_link_capabilities = txgbe_get_link_capabilities_sp;
 	mac->check_link = txgbe_check_mac_link_sp;
+
+	/* MAILBOX */
+	mbx->host_interface_command = txgbe_host_interface_command_sp;
 }
 
 /**
diff --git a/drivers/net/txgbe/base/txgbe_mng.c b/drivers/net/txgbe/base/txgbe_mng.c
index 05eb07c0e2..a1974820b6 100644
--- a/drivers/net/txgbe/base/txgbe_mng.c
+++ b/drivers/net/txgbe/base/txgbe_mng.c
@@ -79,7 +79,7 @@ txgbe_hic_unlocked(struct txgbe_hw *hw, u32 *buffer, u32 length, u32 timeout)
 }
 
 /**
- *  txgbe_host_interface_command - Issue command to manageability block
+ *  txgbe_host_interface_command_sp - Issue command to manageability block
  *  @hw: pointer to the HW structure
  *  @buffer: contains the command to write and where the return status will
  *   be placed
@@ -96,9 +96,9 @@ txgbe_hic_unlocked(struct txgbe_hw *hw, u32 *buffer, u32 length, u32 timeout)
  *  else returns semaphore error when encountering an error acquiring
  *  semaphore or TXGBE_ERR_HOST_INTERFACE_COMMAND when command fails.
  **/
-static s32
-txgbe_host_interface_command(struct txgbe_hw *hw, u32 *buffer,
-				 u32 length, u32 timeout, bool return_data)
+s32
+txgbe_host_interface_command_sp(struct txgbe_hw *hw, u32 *buffer,
+				u32 length, u32 timeout, bool return_data)
 {
 	u32 hdr_size = sizeof(struct txgbe_hic_hdr);
 	struct txgbe_hic_hdr *resp = (struct txgbe_hic_hdr *)buffer;
@@ -160,7 +160,7 @@ txgbe_host_interface_command(struct txgbe_hw *hw, u32 *buffer,
 	return err;
 }
 
-static s32
+s32
 txgbe_host_interface_command_aml(struct txgbe_hw *hw, u32 *buffer,
 				 u32 length, u32 timeout, bool return_data)
 {
@@ -303,12 +303,8 @@ s32 txgbe_hic_sr_read(struct txgbe_hw *hw, u32 addr, u8 *buf, int len)
 	command.address = cpu_to_be32(addr);
 	command.length = cpu_to_be16(len);
 
-	if (hw->mac.type == txgbe_mac_aml || hw->mac.type == txgbe_mac_aml40)
-		err = txgbe_host_interface_command_aml(hw, (u32 *)&command,
-				sizeof(command), TXGBE_HI_COMMAND_TIMEOUT, false);
-	else
-		err = txgbe_hic_unlocked(hw, (u32 *)&command,
-				sizeof(command), TXGBE_HI_COMMAND_TIMEOUT);
+	err = hw->mbx.host_interface_command(hw, (u32 *)&command,
+			sizeof(command), TXGBE_HI_COMMAND_TIMEOUT, false);
 	if (err)
 		return err;
 
@@ -381,7 +377,7 @@ s32 txgbe_close_notify(struct txgbe_hw *hw)
 	buffer.length = 0;
 	buffer.address = 0;
 
-	status = txgbe_host_interface_command(hw, (u32 *)&buffer,
+	status = hw->mbx.host_interface_command(hw, (u32 *)&buffer,
 					      sizeof(buffer),
 					      TXGBE_HI_COMMAND_TIMEOUT, false);
 	if (status)
@@ -411,7 +407,7 @@ s32 txgbe_open_notify(struct txgbe_hw *hw)
 	buffer.length = 0;
 	buffer.address = 0;
 
-	status = txgbe_host_interface_command(hw, (u32 *)&buffer,
+	status = hw->mbx.host_interface_command(hw, (u32 *)&buffer,
 					      sizeof(buffer),
 					      TXGBE_HI_COMMAND_TIMEOUT, false);
 	if (status)
@@ -466,7 +462,7 @@ s32 txgbe_hic_set_drv_ver(struct txgbe_hw *hw, u8 maj, u8 min,
 				(FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len));
 
 	for (i = 0; i <= FW_CEM_MAX_RETRIES; i++) {
-		ret_val = txgbe_host_interface_command(hw, (u32 *)&fw_cmd,
+		ret_val = hw->mbx.host_interface_command(hw, (u32 *)&fw_cmd,
 						       sizeof(fw_cmd),
 						       TXGBE_HI_COMMAND_TIMEOUT,
 						       true);
@@ -511,7 +507,7 @@ txgbe_hic_reset(struct txgbe_hw *hw)
 				(FW_CEM_HDR_LEN + reset_cmd.hdr.buf_len));
 
 	for (i = 0; i <= FW_CEM_MAX_RETRIES; i++) {
-		err = txgbe_host_interface_command(hw, (u32 *)&reset_cmd,
+		err = hw->mbx.host_interface_command(hw, (u32 *)&reset_cmd,
 						       sizeof(reset_cmd),
 						       TXGBE_HI_COMMAND_TIMEOUT,
 						       true);
@@ -568,7 +564,7 @@ s32 txgbe_hic_get_lldp(struct txgbe_hw *hw)
 	buffer.hdr.checksum = FW_DEFAULT_CHECKSUM;
 	buffer.func = hw->bus.lan_id;
 
-	err = txgbe_host_interface_command(hw, (u32 *)&buffer, sizeof(buffer),
+	err = hw->mbx.host_interface_command(hw, (u32 *)&buffer, sizeof(buffer),
 					   TXGBE_HI_COMMAND_TIMEOUT, true);
 	if (err)
 		return err;
@@ -599,7 +595,7 @@ s32 txgbe_hic_set_lldp(struct txgbe_hw *hw, bool on)
 	buffer.hdr.checksum = FW_DEFAULT_CHECKSUM;
 	buffer.func = hw->bus.lan_id;
 
-	return txgbe_host_interface_command(hw, (u32 *)&buffer, sizeof(buffer),
+	return hw->mbx.host_interface_command(hw, (u32 *)&buffer, sizeof(buffer),
 					    TXGBE_HI_COMMAND_TIMEOUT, false);
 }
 
@@ -619,7 +615,7 @@ s32 txgbe_hic_ephy_set_link(struct txgbe_hw *hw, u8 speed, u8 autoneg, u8 duplex
 	buffer.duplex = duplex;
 
 	for (i = 0; i <= FW_CEM_MAX_RETRIES; i++) {
-		status = txgbe_host_interface_command(hw, (u32 *)&buffer,
+		status = hw->mbx.host_interface_command(hw, (u32 *)&buffer,
 						      sizeof(buffer),
 						      TXGBE_HI_COMMAND_TIMEOUT_SHORT, true);
 		if (status != 0) {
diff --git a/drivers/net/txgbe/base/txgbe_mng.h b/drivers/net/txgbe/base/txgbe_mng.h
index 53c5cd5487..da5efecefd 100644
--- a/drivers/net/txgbe/base/txgbe_mng.h
+++ b/drivers/net/txgbe/base/txgbe_mng.h
@@ -208,6 +208,10 @@ struct txgbe_hic_write_lldp {
 	u16 pad3;
 };
 
+s32 txgbe_host_interface_command_sp(struct txgbe_hw *hw, u32 *buffer,
+				u32 length, u32 timeout, bool return_data);
+s32 txgbe_host_interface_command_aml(struct txgbe_hw *hw, u32 *buffer,
+				u32 length, u32 timeout, bool return_data);
 s32 txgbe_hic_sr_read(struct txgbe_hw *hw, u32 addr, u8 *buf, int len);
 s32 txgbe_hic_sr_write(struct txgbe_hw *hw, u32 addr, u8 *buf, int len);
 s32 txgbe_close_notify(struct txgbe_hw *hw);
diff --git a/drivers/net/txgbe/base/txgbe_type.h b/drivers/net/txgbe/base/txgbe_type.h
index b5dbc9b755..ede780321f 100644
--- a/drivers/net/txgbe/base/txgbe_type.h
+++ b/drivers/net/txgbe/base/txgbe_type.h
@@ -786,6 +786,8 @@ struct txgbe_mbx_info {
 	s32  (*check_for_msg)(struct txgbe_hw *hw, u16 mbx_id);
 	s32  (*check_for_ack)(struct txgbe_hw *hw, u16 mbx_id);
 	s32  (*check_for_rst)(struct txgbe_hw *hw, u16 mbx_id);
+	s32  (*host_interface_command)(struct txgbe_hw *hw, u32 *buffer,
+				u32 length, u32 timeout, bool return_data);
 
 	struct txgbe_mbx_stats stats;
 	u32 timeout;
-- 
2.48.1


                 reply	other threads:[~2025-11-19  8:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=A4E8D8476CBBC191+20251119085624.73210-1-jiawenwu@trustnetic.com \
    --to=jiawenwu@trustnetic.com \
    --cc=dev@dpdk.org \
    --cc=zaiyuwang@trustnetic.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;
as well as URLs for NNTP newsgroup(s).