From dd59229c8bb4555727b75a2d373fcf026e8871de Mon Sep 17 00:00:00 2001 From: Helin Zhang Date: Tue, 8 Mar 2016 16:14:11 +0800 Subject: [PATCH] i40e/base: add flag for X722 register access Instead of doing the MAC check, use a flag that gets set per MAC. This way there are less chances of user error and it can enable multiple MACs with the capability in a single place rather than cluttering the code with MAC checks. Signed-off-by: Helin Zhang Acked-by: Jingjing Wu Acked-by: Remy Horton --- drivers/net/i40e/base/i40e_common.c | 5 +++++ drivers/net/i40e/base/i40e_nvm.c | 4 ++-- drivers/net/i40e/base/i40e_type.h | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index d7c940d34f..5e1b39e96f 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -1032,6 +1032,11 @@ enum i40e_status_code i40e_init_shared_code(struct i40e_hw *hw) else hw->pf_id = (u8)(func_rid & 0x7); +#ifdef X722_SUPPORT + if (hw->mac.type == I40E_MAC_X722) + hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE; + +#endif status = i40e_init_nvm(hw); return status; } diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c index bfa33157f8..a1b150a5df 100644 --- a/drivers/net/i40e/base/i40e_nvm.c +++ b/drivers/net/i40e/base/i40e_nvm.c @@ -220,7 +220,7 @@ enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset, enum i40e_status_code ret_code = I40E_SUCCESS; #ifdef X722_SUPPORT - if (hw->mac.type == I40E_MAC_X722) { + if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE) { ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ); if (!ret_code) { ret_code = i40e_read_nvm_word_aq(hw, offset, data); @@ -323,7 +323,7 @@ enum i40e_status_code i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset, enum i40e_status_code ret_code = I40E_SUCCESS; #ifdef X722_SUPPORT - if (hw->mac.type == I40E_MAC_X722) { + if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE) { ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ); if (!ret_code) { ret_code = i40e_read_nvm_buffer_aq(hw, offset, words, diff --git a/drivers/net/i40e/base/i40e_type.h b/drivers/net/i40e/base/i40e_type.h index 9483884254..f566e30210 100644 --- a/drivers/net/i40e/base/i40e_type.h +++ b/drivers/net/i40e/base/i40e_type.h @@ -658,6 +658,9 @@ struct i40e_hw { u16 wol_proxy_vsi_seid; #endif +#define I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE BIT_ULL(0) + u64 flags; + /* debug mask */ u32 debug_mask; #ifndef I40E_NDIS_SUPPORT -- 2.20.1