git: 10746040820e - main - ixgbe: rename VF message type macros
Date: Thu, 19 Sep 2024 21:03:41 UTC
The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=10746040820ee5186caf4d4d61cf88196ec213ba commit 10746040820ee5186caf4d4d61cf88196ec213ba Author: Jakub Chylkowski <jakubx.chylkowski@intel.com> AuthorDate: 2024-09-19 21:02:06 +0000 Commit: Kevin Bowling <kbowling@FreeBSD.org> CommitDate: 2024-09-19 21:03:18 +0000 ixgbe: rename VF message type macros DPDK commit message There is name similarity within IXGBE_VT_MSGTYPE_ACK and PFMAILBOX.ACK / VFMAILBOX.ACK which may cause confusion. Rename MSGTYPE macros to SUCCESS and FAILURE as they are not specified in datasheet and now will be easily distinguishable. Signed-off-by: Jakub Chylkowski <jakubx.chylkowski@intel.com> Reviewed-by: Marek Zalfresso-jundzillo <marekx.zalfresso-jundzillo@intel.com> Reviewed-by: Alice Michael <alice.michael@intel.com> Reviewed-by: Piotr Skajewski <piotrx.skajewski@intel.com> Reviewed-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com> Tested-by: Piotr Skajewski <piotrx.skajewski@intel.com> Tested-by: Alice Michael <alice.michael@intel.com> Obtained from: DPDK (4f675c9) MFC after: 1 week --- sys/dev/ixgbe/if_sriov.c | 10 +++++----- sys/dev/ixgbe/ixgbe_mbx.h | 14 +++++++------- sys/dev/ixgbe/ixgbe_vf.c | 34 ++++++++++++++++++---------------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/sys/dev/ixgbe/if_sriov.c b/sys/dev/ixgbe/if_sriov.c index 7cdd287b85bf..a16092c9f688 100644 --- a/sys/dev/ixgbe/if_sriov.c +++ b/sys/dev/ixgbe/if_sriov.c @@ -107,14 +107,14 @@ static inline void ixgbe_send_vf_ack(struct ixgbe_softc *sc, struct ixgbe_vf *vf, u32 msg) { msg &= IXGBE_VT_MSG_MASK; - ixgbe_send_vf_msg(sc, vf, msg | IXGBE_VT_MSGTYPE_ACK); + ixgbe_send_vf_msg(sc, vf, msg | IXGBE_VT_MSGTYPE_SUCCESS); } static inline void ixgbe_send_vf_nack(struct ixgbe_softc *sc, struct ixgbe_vf *vf, u32 msg) { msg &= IXGBE_VT_MSG_MASK; - ixgbe_send_vf_msg(sc, vf, msg | IXGBE_VT_MSGTYPE_NACK); + ixgbe_send_vf_msg(sc, vf, msg | IXGBE_VT_MSGTYPE_FAILURE); } static inline void @@ -362,9 +362,9 @@ ixgbe_vf_reset_msg(struct ixgbe_softc *sc, struct ixgbe_vf *vf, uint32_t *msg) if (ixgbe_validate_mac_addr(vf->ether_addr) == 0) { ixgbe_set_rar(&sc->hw, vf->rar_index, vf->ether_addr, vf->pool, true); - ack = IXGBE_VT_MSGTYPE_ACK; + ack = IXGBE_VT_MSGTYPE_SUCCESS; } else - ack = IXGBE_VT_MSGTYPE_NACK; + ack = IXGBE_VT_MSGTYPE_FAILURE; ixgbe_vf_enable_transmit(sc, vf); ixgbe_vf_enable_receive(sc, vf); @@ -556,7 +556,7 @@ ixgbe_vf_get_queues(struct ixgbe_softc *sc, struct ixgbe_vf *vf, uint32_t *msg) return; } - resp[0] = IXGBE_VF_GET_QUEUES | IXGBE_VT_MSGTYPE_ACK | + resp[0] = IXGBE_VF_GET_QUEUES | IXGBE_VT_MSGTYPE_SUCCESS | IXGBE_VT_MSGTYPE_CTS; num_queues = ixgbe_vf_queues(sc->iov_mode); diff --git a/sys/dev/ixgbe/ixgbe_mbx.h b/sys/dev/ixgbe/ixgbe_mbx.h index 47b9327bb896..fa407c4969d1 100644 --- a/sys/dev/ixgbe/ixgbe_mbx.h +++ b/sys/dev/ixgbe/ixgbe_mbx.h @@ -68,14 +68,14 @@ /* If it's a IXGBE_VF_* msg then it originates in the VF and is sent to the * PF. The reverse is true if it is IXGBE_PF_*. - * Message ACK's are the value or'd with 0xF0000000 + * Message results are the value or'd with 0xF0000000 */ -#define IXGBE_VT_MSGTYPE_ACK 0x80000000 /* Messages below or'd with - * this are the ACK */ -#define IXGBE_VT_MSGTYPE_NACK 0x40000000 /* Messages below or'd with - * this are the NACK */ -#define IXGBE_VT_MSGTYPE_CTS 0x20000000 /* Indicates that VF is still - * clear to send requests */ +#define IXGBE_VT_MSGTYPE_SUCCESS 0x80000000 /* Messages or'd with this + * have succeeded */ +#define IXGBE_VT_MSGTYPE_FAILURE 0x40000000 /* Messages or'd with this + * have failed */ +#define IXGBE_VT_MSGTYPE_CTS 0x20000000 /* Indicates that VF is still + * clear to send requests */ #define IXGBE_VT_MSGINFO_SHIFT 16 /* bits 23:16 are used for extra info for certain messages */ #define IXGBE_VT_MSGINFO_MASK (0xFF << IXGBE_VT_MSGINFO_SHIFT) diff --git a/sys/dev/ixgbe/ixgbe_vf.c b/sys/dev/ixgbe/ixgbe_vf.c index beef259de339..4624c2b5c0a3 100644 --- a/sys/dev/ixgbe/ixgbe_vf.c +++ b/sys/dev/ixgbe/ixgbe_vf.c @@ -223,11 +223,11 @@ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw) if (ret_val) return ret_val; - if (msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK) && - msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_NACK)) + if (msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_SUCCESS) && + msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_FAILURE)) return IXGBE_ERR_INVALID_MAC_ADDR; - if (msgbuf[0] == (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK)) + if (msgbuf[0] == (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_SUCCESS)) memcpy(hw->mac.perm_addr, addr, IXGBE_ETH_LENGTH_OF_ADDRESS); hw->mac.mc_filter_type = msgbuf[IXGBE_VF_MC_TYPE_WORD]; @@ -356,9 +356,9 @@ s32 ixgbe_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vmdq, msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; - /* if nacked the address was rejected, use "perm_addr" */ + /* if we had failure, the address was rejected, use "perm_addr" */ if (!ret_val && - (msgbuf[0] == (IXGBE_VF_SET_MAC_ADDR | IXGBE_VT_MSGTYPE_NACK))) { + (msgbuf[0] == (IXGBE_VF_SET_MAC_ADDR | IXGBE_VT_MSGTYPE_FAILURE))) { ixgbe_get_mac_addr_vf(hw, hw->mac.addr); return IXGBE_ERR_MBX; } @@ -447,7 +447,7 @@ s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw, int xcast_mode) return err; msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; - if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK)) + if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_FAILURE)) return IXGBE_ERR_FEATURE_NOT_SUPPORTED; return IXGBE_SUCCESS; } @@ -470,7 +470,7 @@ s32 ixgbe_get_link_state_vf(struct ixgbe_hw *hw, bool *link_state) err = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2); - if (err || (msgbuf[0] & IXGBE_VT_MSGTYPE_NACK)) { + if (err || (msgbuf[0] & IXGBE_VT_MSGTYPE_FAILURE)) { ret_val = IXGBE_ERR_MBX; } else { ret_val = IXGBE_SUCCESS; @@ -503,10 +503,10 @@ s32 ixgbe_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT; ret_val = ixgbevf_write_msg_read_ack(hw, msgbuf, msgbuf, 2); - if (!ret_val && (msgbuf[0] & IXGBE_VT_MSGTYPE_ACK)) + if (!ret_val && (msgbuf[0] & IXGBE_VT_MSGTYPE_SUCCESS)) return IXGBE_SUCCESS; - return ret_val | (msgbuf[0] & IXGBE_VT_MSGTYPE_NACK); + return ret_val | (msgbuf[0] & IXGBE_VT_MSGTYPE_FAILURE); } /** @@ -571,7 +571,7 @@ s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr) if (!ret_val) { msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS; - if (msgbuf[0] == (msgbuf_chk | IXGBE_VT_MSGTYPE_NACK)) + if (msgbuf[0] == (msgbuf_chk | IXGBE_VT_MSGTYPE_FAILURE)) return IXGBE_ERR_OUT_OF_MEM; } @@ -674,8 +674,10 @@ s32 ixgbe_check_mac_link_vf(struct ixgbe_hw *hw, ixgbe_link_speed *speed, goto out; if (!(in_msg & IXGBE_VT_MSGTYPE_CTS)) { - /* msg is not CTS and is NACK we must have lost CTS status */ - if (in_msg & IXGBE_VT_MSGTYPE_NACK) + /* msg is not CTS and is FAILURE, + * we must have lost CTS status. + */ + if (in_msg & IXGBE_VT_MSGTYPE_FAILURE) ret_val = -1; goto out; } @@ -713,7 +715,7 @@ s32 ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size) if (retval) return retval; if ((msgbuf[0] & IXGBE_VF_SET_LPE) && - (msgbuf[0] & IXGBE_VT_MSGTYPE_NACK)) + (msgbuf[0] & IXGBE_VT_MSGTYPE_FAILURE)) return IXGBE_ERR_MBX; return 0; @@ -739,7 +741,7 @@ int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api) msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; /* Store value and return 0 on success */ - if (msg[0] == (IXGBE_VF_API_NEGOTIATE | IXGBE_VT_MSGTYPE_ACK)) { + if (msg[0] == (IXGBE_VF_API_NEGOTIATE | IXGBE_VT_MSGTYPE_SUCCESS)) { hw->api_version = api; return 0; } @@ -775,11 +777,11 @@ int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs, msg[0] &= ~IXGBE_VT_MSGTYPE_CTS; /* - * if we we didn't get an ACK there must have been + * if we we didn't get a SUCCESS there must have been * some sort of mailbox error so we should treat it * as such */ - if (msg[0] != (IXGBE_VF_GET_QUEUES | IXGBE_VT_MSGTYPE_ACK)) + if (msg[0] != (IXGBE_VF_GET_QUEUES | IXGBE_VT_MSGTYPE_SUCCESS)) return IXGBE_ERR_MBX; /* record and validate values from message */