i40e/base: minor clean up
Use INLINE macro for better cross-platform code management. Clean up some unnecessary logic jumping and drop a variable. There was one more __FUNCTION__ reference that wasn't needed. Signed-off-by: Jingjing Wu <jingjing.wu@intel.com> Acked-by: Helin Zhang <helin.zhang@intel.com> Tested-by: Huilong Xu <huilongx.xu@intel.com>
This commit is contained in:
parent
869b94700e
commit
e31d665baa
@ -747,16 +747,16 @@ u16 i40e_clean_asq(struct i40e_hw *hw)
|
||||
|
||||
desc = I40E_ADMINQ_DESC(*asq, ntc);
|
||||
details = I40E_ADMINQ_DETAILS(*asq, ntc);
|
||||
|
||||
while (rd32(hw, hw->aq.asq.head) != ntc) {
|
||||
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
|
||||
"%s: ntc %d head %d.\n", __FUNCTION__, ntc,
|
||||
rd32(hw, hw->aq.asq.head));
|
||||
"ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head));
|
||||
|
||||
if (details->callback) {
|
||||
I40E_ADMINQ_CALLBACK cb_func =
|
||||
(I40E_ADMINQ_CALLBACK)details->callback;
|
||||
i40e_memcpy(&desc_cb, desc,
|
||||
sizeof(struct i40e_aq_desc), I40E_DMA_TO_DMA);
|
||||
i40e_memcpy(&desc_cb, desc, sizeof(struct i40e_aq_desc),
|
||||
I40E_DMA_TO_DMA);
|
||||
cb_func(hw, &desc_cb);
|
||||
}
|
||||
i40e_memset(desc, 0, sizeof(*desc), I40E_DMA_MEM);
|
||||
|
@ -119,7 +119,7 @@ struct i40e_adminq_info {
|
||||
* aq_ret: AdminQ handler error code can override aq_rc
|
||||
* aq_rc: AdminQ firmware error code to convert
|
||||
**/
|
||||
STATIC inline int i40e_aq_rc_to_posix(int aq_ret, int aq_rc)
|
||||
STATIC INLINE int i40e_aq_rc_to_posix(int aq_ret, int aq_rc)
|
||||
{
|
||||
int aq_to_posix[] = {
|
||||
0, /* I40E_AQ_RC_OK */
|
||||
|
@ -300,21 +300,15 @@ enum i40e_status_code i40e_remove_sd_bp_new(struct i40e_hw *hw,
|
||||
u32 idx, bool is_pf)
|
||||
{
|
||||
struct i40e_hmc_sd_entry *sd_entry;
|
||||
enum i40e_status_code ret_code = I40E_SUCCESS;
|
||||
|
||||
if (!is_pf)
|
||||
return I40E_NOT_SUPPORTED;
|
||||
|
||||
/* get the entry and decrease its ref counter */
|
||||
sd_entry = &hmc_info->sd_table.sd_entry[idx];
|
||||
if (is_pf) {
|
||||
I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_DIRECT);
|
||||
} else {
|
||||
ret_code = I40E_NOT_SUPPORTED;
|
||||
goto exit;
|
||||
}
|
||||
ret_code = i40e_free_dma_mem(hw, &(sd_entry->u.bp.addr));
|
||||
if (I40E_SUCCESS != ret_code)
|
||||
goto exit;
|
||||
exit:
|
||||
return ret_code;
|
||||
I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_DIRECT);
|
||||
|
||||
return i40e_free_dma_mem(hw, &(sd_entry->u.bp.addr));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -354,20 +348,13 @@ enum i40e_status_code i40e_remove_pd_page_new(struct i40e_hw *hw,
|
||||
struct i40e_hmc_info *hmc_info,
|
||||
u32 idx, bool is_pf)
|
||||
{
|
||||
enum i40e_status_code ret_code = I40E_SUCCESS;
|
||||
struct i40e_hmc_sd_entry *sd_entry;
|
||||
|
||||
if (!is_pf)
|
||||
return I40E_NOT_SUPPORTED;
|
||||
|
||||
sd_entry = &hmc_info->sd_table.sd_entry[idx];
|
||||
if (is_pf) {
|
||||
I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_PAGED);
|
||||
} else {
|
||||
ret_code = I40E_NOT_SUPPORTED;
|
||||
goto exit;
|
||||
}
|
||||
/* free memory here */
|
||||
ret_code = i40e_free_dma_mem(hw, &(sd_entry->u.pd_table.pd_page_addr));
|
||||
if (I40E_SUCCESS != ret_code)
|
||||
goto exit;
|
||||
exit:
|
||||
return ret_code;
|
||||
I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_PAGED);
|
||||
|
||||
return i40e_free_dma_mem(hw, &(sd_entry->u.pd_table.pd_page_addr));
|
||||
}
|
||||
|
@ -438,9 +438,8 @@ exit_sd_error:
|
||||
pd_idx1 = max(pd_idx,
|
||||
((j - 1) * I40E_HMC_MAX_BP_COUNT));
|
||||
pd_lmt1 = min(pd_lmt, (j * I40E_HMC_MAX_BP_COUNT));
|
||||
for (i = pd_idx1; i < pd_lmt1; i++) {
|
||||
for (i = pd_idx1; i < pd_lmt1; i++)
|
||||
i40e_remove_pd_bp(hw, info->hmc_info, i);
|
||||
}
|
||||
i40e_remove_pd_page(hw, info->hmc_info, (j - 1));
|
||||
break;
|
||||
case I40E_SD_TYPE_DIRECT:
|
||||
|
@ -729,11 +729,11 @@ STATIC enum i40e_status_code i40e_nvmupd_exec_aq(struct i40e_hw *hw,
|
||||
STATIC enum i40e_status_code i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
|
||||
struct i40e_nvm_access *cmd,
|
||||
u8 *bytes, int *perrno);
|
||||
STATIC inline u8 i40e_nvmupd_get_module(u32 val)
|
||||
STATIC INLINE u8 i40e_nvmupd_get_module(u32 val)
|
||||
{
|
||||
return (u8)(val & I40E_NVM_MOD_PNT_MASK);
|
||||
}
|
||||
STATIC inline u8 i40e_nvmupd_get_transaction(u32 val)
|
||||
STATIC INLINE u8 i40e_nvmupd_get_transaction(u32 val)
|
||||
{
|
||||
return (u8)((val & I40E_NVM_TRANS_MASK) >> I40E_NVM_TRANS_SHIFT);
|
||||
}
|
||||
|
@ -638,7 +638,7 @@ struct i40e_hw {
|
||||
#endif /* I40E_NDIS_SUPPORT */
|
||||
};
|
||||
|
||||
static inline bool i40e_is_vf(struct i40e_hw *hw)
|
||||
STATIC INLINE bool i40e_is_vf(struct i40e_hw *hw)
|
||||
{
|
||||
return hw->mac.type == I40E_MAC_VF;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user