[PATCH v4 071/103] net/ice/base: allow passing flags to sbq command
Anatoly Burakov
anatoly.burakov at intel.com
Wed Jun 26 13:41:59 CEST 2024
From: Aviraj CJ <aviraj.cj at intel.com>
Currently, sending a command to Sideband Queue (SBQ) is done with
unconditionally setting `ICE_AQ_FLAG_RD` flag. This patch allows the caller to
pass flags to the SBQ command function, and amends all call sites as needed.
Signed-off-by: Aviraj CJ <aviraj.cj at intel.com>
Signed-off-by: Ian Stokes <ian.stokes at intel.com>
---
drivers/net/ice/base/ice_common.c | 12 +++++++-----
drivers/net/ice/base/ice_common.h | 6 +++---
drivers/net/ice/base/ice_ptp_hw.c | 20 ++++++++++----------
3 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index de87df8f60..7b899f0782 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -1770,11 +1770,12 @@ ice_sbq_send_cmd_nolock(struct ice_hw *hw, struct ice_sbq_cmd_desc *desc,
* ice_sbq_rw_reg_lp - Fill Sideband Queue command, with lock parameter
* @hw: pointer to the HW struct
* @in: message info to be filled in descriptor
+ * @flag: flag to fill desc structure
* @lock: true to lock the sq_lock (the usual case); false if the sq_lock has
* already been locked at a higher level
*/
-int ice_sbq_rw_reg_lp(struct ice_hw *hw,
- struct ice_sbq_msg_input *in, bool lock)
+int ice_sbq_rw_reg_lp(struct ice_hw *hw, struct ice_sbq_msg_input *in,
+ u16 flag, bool lock)
{
struct ice_sbq_cmd_desc desc = {0};
struct ice_sbq_msg_req msg = {0};
@@ -1798,7 +1799,7 @@ int ice_sbq_rw_reg_lp(struct ice_hw *hw,
*/
msg_len -= sizeof(msg.data);
- desc.flags = CPU_TO_LE16(ICE_AQ_FLAG_RD);
+ desc.flags = CPU_TO_LE16(flag);
desc.opcode = CPU_TO_LE16(ice_sbq_opc_neigh_dev_req);
desc.param0.cmd_len = CPU_TO_LE16(msg_len);
if (lock)
@@ -1816,10 +1817,11 @@ int ice_sbq_rw_reg_lp(struct ice_hw *hw,
* ice_sbq_rw_reg - Fill Sideband Queue command
* @hw: pointer to the HW struct
* @in: message info to be filled in descriptor
+ * @flag: flag to fill desc structure
*/
-int ice_sbq_rw_reg(struct ice_hw *hw, struct ice_sbq_msg_input *in)
+int ice_sbq_rw_reg(struct ice_hw *hw, struct ice_sbq_msg_input *in, u16 flag)
{
- return ice_sbq_rw_reg_lp(hw, in, true);
+ return ice_sbq_rw_reg_lp(hw, in, flag, true);
}
/**
diff --git a/drivers/net/ice/base/ice_common.h b/drivers/net/ice/base/ice_common.h
index d06742aa77..2f1b212812 100644
--- a/drivers/net/ice/base/ice_common.h
+++ b/drivers/net/ice/base/ice_common.h
@@ -245,11 +245,11 @@ int ice_replay_vsi(struct ice_hw *hw, u16 vsi_handle);
void ice_replay_post(struct ice_hw *hw);
struct ice_q_ctx *
ice_get_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 q_handle);
-int ice_sbq_rw_reg_lp(struct ice_hw *hw,
- struct ice_sbq_msg_input *in, bool lock);
+int ice_sbq_rw_reg_lp(struct ice_hw *hw, struct ice_sbq_msg_input *in,
+ u16 flag, bool lock);
void ice_sbq_lock(struct ice_hw *hw);
void ice_sbq_unlock(struct ice_hw *hw);
-int ice_sbq_rw_reg(struct ice_hw *hw, struct ice_sbq_msg_input *in);
+int ice_sbq_rw_reg(struct ice_hw *hw, struct ice_sbq_msg_input *in, u16 flag);
int
ice_aq_get_sensor_reading(struct ice_hw *hw, u8 sensor, u8 format,
struct ice_aqc_get_sensor_reading_resp *data,
diff --git a/drivers/net/ice/base/ice_ptp_hw.c b/drivers/net/ice/base/ice_ptp_hw.c
index 77e30c2306..0d2968c528 100644
--- a/drivers/net/ice/base/ice_ptp_hw.c
+++ b/drivers/net/ice/base/ice_ptp_hw.c
@@ -122,7 +122,7 @@ ice_read_cgu_reg_e82x(struct ice_hw *hw, u16 addr, u32 *val)
cgu_msg.msg_addr_low = addr;
cgu_msg.msg_addr_high = 0x0;
- err = ice_sbq_rw_reg_lp(hw, &cgu_msg, true);
+ err = ice_sbq_rw_reg_lp(hw, &cgu_msg, ICE_AQ_FLAG_RD, true);
if (err) {
ice_debug(hw, ICE_DBG_PTP, "Failed to read CGU register 0x%04x, err %d\n",
addr, err);
@@ -155,7 +155,7 @@ ice_write_cgu_reg_e82x(struct ice_hw *hw, u16 addr, u32 val)
cgu_msg.msg_addr_high = 0x0;
cgu_msg.data = val;
- err = ice_sbq_rw_reg_lp(hw, &cgu_msg, true);
+ err = ice_sbq_rw_reg_lp(hw, &cgu_msg, ICE_AQ_FLAG_RD, true);
if (err) {
ice_debug(hw, ICE_DBG_PTP, "Failed to write CGU register 0x%04x, err %d\n",
addr, err);
@@ -948,7 +948,7 @@ ice_write_phy_eth56g_raw_lp(struct ice_hw *hw, u8 phy_index, u32 reg_addr,
phy_msg.data = val;
phy_msg.dest_dev = hw->phy_addr[phy_index];
- err = ice_sbq_rw_reg_lp(hw, &phy_msg, lock_sbq);
+ err = ice_sbq_rw_reg_lp(hw, &phy_msg, ICE_AQ_FLAG_RD, lock_sbq);
if (err)
ice_debug(hw, ICE_DBG_PTP, "PTP failed to send msg to phy %d\n",
@@ -980,7 +980,7 @@ ice_read_phy_eth56g_raw_lp(struct ice_hw *hw, u8 phy_index, u32 reg_addr,
phy_msg.data = 0;
phy_msg.dest_dev = hw->phy_addr[phy_index];
- err = ice_sbq_rw_reg_lp(hw, &phy_msg, lock_sbq);
+ err = ice_sbq_rw_reg_lp(hw, &phy_msg, ICE_AQ_FLAG_RD, lock_sbq);
if (err)
ice_debug(hw, ICE_DBG_PTP, "PTP failed to send msg to phy %d\n",
@@ -2530,7 +2530,7 @@ ice_read_phy_reg_e822_lp(struct ice_hw *hw, u8 port, u16 offset, u32 *val,
ice_fill_phy_msg_e822(&msg, port, offset);
msg.opcode = ice_sbq_msg_rd;
- err = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
+ err = ice_sbq_rw_reg_lp(hw, &msg, ICE_AQ_FLAG_RD, lock_sbq);
if (err) {
ice_debug(hw, ICE_DBG_PTP, "Failed to send message to PHY, err %d\n",
err);
@@ -2663,7 +2663,7 @@ ice_write_phy_reg_e822_lp(struct ice_hw *hw, u8 port, u16 offset, u32 val,
msg.opcode = ice_sbq_msg_wr;
msg.data = val;
- err = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
+ err = ice_sbq_rw_reg_lp(hw, &msg, ICE_AQ_FLAG_RD, lock_sbq);
if (err) {
ice_debug(hw, ICE_DBG_PTP, "Failed to send message to PHY, err %d\n",
err);
@@ -2827,7 +2827,7 @@ ice_read_quad_reg_e822_lp(struct ice_hw *hw, u8 quad, u16 offset, u32 *val,
msg.opcode = ice_sbq_msg_rd;
- err = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
+ err = ice_sbq_rw_reg_lp(hw, &msg, ICE_AQ_FLAG_RD, lock_sbq);
if (err) {
ice_debug(hw, ICE_DBG_PTP, "Failed to send message to PHY, err %d\n",
err);
@@ -2870,7 +2870,7 @@ ice_write_quad_reg_e822_lp(struct ice_hw *hw, u8 quad, u16 offset, u32 val,
msg.opcode = ice_sbq_msg_wr;
msg.data = val;
- err = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
+ err = ice_sbq_rw_reg_lp(hw, &msg, ICE_AQ_FLAG_RD, lock_sbq);
if (err) {
ice_debug(hw, ICE_DBG_PTP, "Failed to send message to PHY, err %d\n",
err);
@@ -4700,7 +4700,7 @@ ice_read_phy_reg_e810_lp(struct ice_hw *hw, u32 addr, u32 *val, bool lock_sbq)
msg.opcode = ice_sbq_msg_rd;
msg.dest_dev = rmn_0;
- err = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
+ err = ice_sbq_rw_reg_lp(hw, &msg, ICE_AQ_FLAG_RD, lock_sbq);
if (err) {
ice_debug(hw, ICE_DBG_PTP, "Failed to send message to PHY, err %d\n",
err);
@@ -4738,7 +4738,7 @@ ice_write_phy_reg_e810_lp(struct ice_hw *hw, u32 addr, u32 val, bool lock_sbq)
msg.dest_dev = rmn_0;
msg.data = val;
- err = ice_sbq_rw_reg_lp(hw, &msg, lock_sbq);
+ err = ice_sbq_rw_reg_lp(hw, &msg, ICE_AQ_FLAG_RD, lock_sbq);
if (err) {
ice_debug(hw, ICE_DBG_PTP, "Failed to send message to PHY, err %d\n",
err);
--
2.43.0
More information about the dev
mailing list