From: Jingjing Wu Date: Sat, 10 Dec 2016 11:24:44 +0000 (+0800) Subject: net/i40e/base: fix NVM access interfering X-Git-Tag: spdx-start~5018 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=c5846a125b261c4960561f72848c270202c1596c;p=dpdk.git net/i40e/base: fix NVM access interfering Acquire NVM lock before reads on all devices. Previously, locks were only used for X722 and later. Fixes an issue where simultaneous X710 NVM accesses were interfering with each other. Fixes: 8db9e2a1b232 ("i40e: base driver") Signed-off-by: Jingjing Wu --- diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c index eb69e496c0..1f345a528f 100644 --- a/drivers/net/i40e/base/i40e_nvm.c +++ b/drivers/net/i40e/base/i40e_nvm.c @@ -219,19 +219,19 @@ enum i40e_status_code i40e_read_nvm_word(struct i40e_hw *hw, u16 offset, { enum i40e_status_code ret_code = I40E_SUCCESS; + ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ); + if (!ret_code) { #ifdef X722_SUPPORT - if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE) { - ret_code = i40e_acquire_nvm(hw, I40E_RESOURCE_READ); - if (!ret_code) { + if (hw->flags & I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE) { ret_code = i40e_read_nvm_word_aq(hw, offset, data); - i40e_release_nvm(hw); + } else { + ret_code = i40e_read_nvm_word_srctl(hw, offset, data); } - } else { - ret_code = i40e_read_nvm_word_srctl(hw, offset, data); - } #else - ret_code = i40e_read_nvm_word_srctl(hw, offset, data); + ret_code = i40e_read_nvm_word_srctl(hw, offset, data); #endif + i40e_release_nvm(hw); + } return ret_code; }