Commit e892406f authored by David S. Miller's avatar David S. Miller

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2015-10-03

This series contains updates to i40e and i40evf, some of which are to
resolve more Red Hat bugzilla issues.

Jiang Liu updates the i40e and i40evf drivers to use numa_mem_id()
instead of numa_node_id() to get the nearest node with memory which
better supports memoryless nodes.

Anjali fixes an issue from Dan Carpenter <dan.carpenter@oracle.com>,
to resolve a memory leak in X722 RSS configuration path, where we should
free the memory allocated before exiting.

Shannon modifies the drivers to ensure we have the spinlocks before we
clear the ARQ and ASQ management registers.  In addition, we widen the
locked portion insert a sanity check to ensure we are working with safe
register values.

Mitch fixes an issue where under certain circumstances, we can get an
extra VF_RESOURCES message from the PF driver at runtime.  When this
occurs, we need to parse it because our VSI may have changed and that
will affect the relationship with the PF driver.  But this parsing also
blows away our current MAC address, so resolve the issue by restoring
the current MAC address from the netdev struct after we parse the
resource message.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d25b8e74 8552d854
...@@ -482,8 +482,12 @@ static i40e_status i40e_shutdown_asq(struct i40e_hw *hw) ...@@ -482,8 +482,12 @@ static i40e_status i40e_shutdown_asq(struct i40e_hw *hw)
{ {
i40e_status ret_code = 0; i40e_status ret_code = 0;
if (hw->aq.asq.count == 0) mutex_lock(&hw->aq.asq_mutex);
return I40E_ERR_NOT_READY;
if (hw->aq.asq.count == 0) {
ret_code = I40E_ERR_NOT_READY;
goto shutdown_asq_out;
}
/* Stop firmware AdminQ processing */ /* Stop firmware AdminQ processing */
wr32(hw, hw->aq.asq.head, 0); wr32(hw, hw->aq.asq.head, 0);
...@@ -492,16 +496,13 @@ static i40e_status i40e_shutdown_asq(struct i40e_hw *hw) ...@@ -492,16 +496,13 @@ static i40e_status i40e_shutdown_asq(struct i40e_hw *hw)
wr32(hw, hw->aq.asq.bal, 0); wr32(hw, hw->aq.asq.bal, 0);
wr32(hw, hw->aq.asq.bah, 0); wr32(hw, hw->aq.asq.bah, 0);
/* make sure lock is available */
mutex_lock(&hw->aq.asq_mutex);
hw->aq.asq.count = 0; /* to indicate uninitialized queue */ hw->aq.asq.count = 0; /* to indicate uninitialized queue */
/* free ring buffers */ /* free ring buffers */
i40e_free_asq_bufs(hw); i40e_free_asq_bufs(hw);
shutdown_asq_out:
mutex_unlock(&hw->aq.asq_mutex); mutex_unlock(&hw->aq.asq_mutex);
return ret_code; return ret_code;
} }
...@@ -515,8 +516,12 @@ static i40e_status i40e_shutdown_arq(struct i40e_hw *hw) ...@@ -515,8 +516,12 @@ static i40e_status i40e_shutdown_arq(struct i40e_hw *hw)
{ {
i40e_status ret_code = 0; i40e_status ret_code = 0;
if (hw->aq.arq.count == 0) mutex_lock(&hw->aq.arq_mutex);
return I40E_ERR_NOT_READY;
if (hw->aq.arq.count == 0) {
ret_code = I40E_ERR_NOT_READY;
goto shutdown_arq_out;
}
/* Stop firmware AdminQ processing */ /* Stop firmware AdminQ processing */
wr32(hw, hw->aq.arq.head, 0); wr32(hw, hw->aq.arq.head, 0);
...@@ -525,16 +530,13 @@ static i40e_status i40e_shutdown_arq(struct i40e_hw *hw) ...@@ -525,16 +530,13 @@ static i40e_status i40e_shutdown_arq(struct i40e_hw *hw)
wr32(hw, hw->aq.arq.bal, 0); wr32(hw, hw->aq.arq.bal, 0);
wr32(hw, hw->aq.arq.bah, 0); wr32(hw, hw->aq.arq.bah, 0);
/* make sure lock is available */
mutex_lock(&hw->aq.arq_mutex);
hw->aq.arq.count = 0; /* to indicate uninitialized queue */ hw->aq.arq.count = 0; /* to indicate uninitialized queue */
/* free ring buffers */ /* free ring buffers */
i40e_free_arq_bufs(hw); i40e_free_arq_bufs(hw);
shutdown_arq_out:
mutex_unlock(&hw->aq.arq_mutex); mutex_unlock(&hw->aq.arq_mutex);
return ret_code; return ret_code;
} }
...@@ -745,19 +747,21 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw, ...@@ -745,19 +747,21 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,
u16 retval = 0; u16 retval = 0;
u32 val = 0; u32 val = 0;
val = rd32(hw, hw->aq.asq.head); mutex_lock(&hw->aq.asq_mutex);
if (val >= hw->aq.num_asq_entries) {
if (hw->aq.asq.count == 0) {
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
"AQTX: head overrun at %d\n", val); "AQTX: Admin queue not initialized.\n");
status = I40E_ERR_QUEUE_EMPTY; status = I40E_ERR_QUEUE_EMPTY;
goto asq_send_command_exit; goto asq_send_command_error;
} }
if (hw->aq.asq.count == 0) { val = rd32(hw, hw->aq.asq.head);
if (val >= hw->aq.num_asq_entries) {
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
"AQTX: Admin queue not initialized.\n"); "AQTX: head overrun at %d\n", val);
status = I40E_ERR_QUEUE_EMPTY; status = I40E_ERR_QUEUE_EMPTY;
goto asq_send_command_exit; goto asq_send_command_error;
} }
details = I40E_ADMINQ_DETAILS(hw->aq.asq, hw->aq.asq.next_to_use); details = I40E_ADMINQ_DETAILS(hw->aq.asq, hw->aq.asq.next_to_use);
...@@ -782,8 +786,6 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw, ...@@ -782,8 +786,6 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,
desc->flags &= ~cpu_to_le16(details->flags_dis); desc->flags &= ~cpu_to_le16(details->flags_dis);
desc->flags |= cpu_to_le16(details->flags_ena); desc->flags |= cpu_to_le16(details->flags_ena);
mutex_lock(&hw->aq.asq_mutex);
if (buff_size > hw->aq.asq_buf_size) { if (buff_size > hw->aq.asq_buf_size) {
i40e_debug(hw, i40e_debug(hw,
I40E_DEBUG_AQ_MESSAGE, I40E_DEBUG_AQ_MESSAGE,
...@@ -907,7 +909,6 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw, ...@@ -907,7 +909,6 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,
asq_send_command_error: asq_send_command_error:
mutex_unlock(&hw->aq.asq_mutex); mutex_unlock(&hw->aq.asq_mutex);
asq_send_command_exit:
return status; return status;
} }
......
...@@ -7625,7 +7625,7 @@ static int i40e_config_rss_aq(struct i40e_vsi *vsi, const u8 *seed) ...@@ -7625,7 +7625,7 @@ static int i40e_config_rss_aq(struct i40e_vsi *vsi, const u8 *seed)
"Cannot set RSS key, err %s aq_err %s\n", "Cannot set RSS key, err %s aq_err %s\n",
i40e_stat_str(&pf->hw, ret), i40e_stat_str(&pf->hw, ret),
i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
return ret; goto config_rss_aq_out;
} }
if (vsi->type == I40E_VSI_MAIN) if (vsi->type == I40E_VSI_MAIN)
...@@ -7639,6 +7639,8 @@ static int i40e_config_rss_aq(struct i40e_vsi *vsi, const u8 *seed) ...@@ -7639,6 +7639,8 @@ static int i40e_config_rss_aq(struct i40e_vsi *vsi, const u8 *seed)
i40e_stat_str(&pf->hw, ret), i40e_stat_str(&pf->hw, ret),
i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
config_rss_aq_out:
kfree(rss_lut);
return ret; return ret;
} }
......
...@@ -1443,7 +1443,7 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget) ...@@ -1443,7 +1443,7 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)
unsigned int total_rx_bytes = 0, total_rx_packets = 0; unsigned int total_rx_bytes = 0, total_rx_packets = 0;
u16 rx_packet_len, rx_header_len, rx_sph, rx_hbo; u16 rx_packet_len, rx_header_len, rx_sph, rx_hbo;
u16 cleaned_count = I40E_DESC_UNUSED(rx_ring); u16 cleaned_count = I40E_DESC_UNUSED(rx_ring);
const int current_node = numa_node_id(); const int current_node = numa_mem_id();
struct i40e_vsi *vsi = rx_ring->vsi; struct i40e_vsi *vsi = rx_ring->vsi;
u16 i = rx_ring->next_to_clean; u16 i = rx_ring->next_to_clean;
union i40e_rx_desc *rx_desc; union i40e_rx_desc *rx_desc;
......
...@@ -469,8 +469,12 @@ static i40e_status i40e_shutdown_asq(struct i40e_hw *hw) ...@@ -469,8 +469,12 @@ static i40e_status i40e_shutdown_asq(struct i40e_hw *hw)
{ {
i40e_status ret_code = 0; i40e_status ret_code = 0;
if (hw->aq.asq.count == 0) mutex_lock(&hw->aq.asq_mutex);
return I40E_ERR_NOT_READY;
if (hw->aq.asq.count == 0) {
ret_code = I40E_ERR_NOT_READY;
goto shutdown_asq_out;
}
/* Stop firmware AdminQ processing */ /* Stop firmware AdminQ processing */
wr32(hw, hw->aq.asq.head, 0); wr32(hw, hw->aq.asq.head, 0);
...@@ -479,16 +483,13 @@ static i40e_status i40e_shutdown_asq(struct i40e_hw *hw) ...@@ -479,16 +483,13 @@ static i40e_status i40e_shutdown_asq(struct i40e_hw *hw)
wr32(hw, hw->aq.asq.bal, 0); wr32(hw, hw->aq.asq.bal, 0);
wr32(hw, hw->aq.asq.bah, 0); wr32(hw, hw->aq.asq.bah, 0);
/* make sure lock is available */
mutex_lock(&hw->aq.asq_mutex);
hw->aq.asq.count = 0; /* to indicate uninitialized queue */ hw->aq.asq.count = 0; /* to indicate uninitialized queue */
/* free ring buffers */ /* free ring buffers */
i40e_free_asq_bufs(hw); i40e_free_asq_bufs(hw);
shutdown_asq_out:
mutex_unlock(&hw->aq.asq_mutex); mutex_unlock(&hw->aq.asq_mutex);
return ret_code; return ret_code;
} }
...@@ -502,8 +503,12 @@ static i40e_status i40e_shutdown_arq(struct i40e_hw *hw) ...@@ -502,8 +503,12 @@ static i40e_status i40e_shutdown_arq(struct i40e_hw *hw)
{ {
i40e_status ret_code = 0; i40e_status ret_code = 0;
if (hw->aq.arq.count == 0) mutex_lock(&hw->aq.arq_mutex);
return I40E_ERR_NOT_READY;
if (hw->aq.arq.count == 0) {
ret_code = I40E_ERR_NOT_READY;
goto shutdown_arq_out;
}
/* Stop firmware AdminQ processing */ /* Stop firmware AdminQ processing */
wr32(hw, hw->aq.arq.head, 0); wr32(hw, hw->aq.arq.head, 0);
...@@ -512,16 +517,13 @@ static i40e_status i40e_shutdown_arq(struct i40e_hw *hw) ...@@ -512,16 +517,13 @@ static i40e_status i40e_shutdown_arq(struct i40e_hw *hw)
wr32(hw, hw->aq.arq.bal, 0); wr32(hw, hw->aq.arq.bal, 0);
wr32(hw, hw->aq.arq.bah, 0); wr32(hw, hw->aq.arq.bah, 0);
/* make sure lock is available */
mutex_lock(&hw->aq.arq_mutex);
hw->aq.arq.count = 0; /* to indicate uninitialized queue */ hw->aq.arq.count = 0; /* to indicate uninitialized queue */
/* free ring buffers */ /* free ring buffers */
i40e_free_arq_bufs(hw); i40e_free_arq_bufs(hw);
shutdown_arq_out:
mutex_unlock(&hw->aq.arq_mutex); mutex_unlock(&hw->aq.arq_mutex);
return ret_code; return ret_code;
} }
...@@ -685,19 +687,21 @@ i40e_status i40evf_asq_send_command(struct i40e_hw *hw, ...@@ -685,19 +687,21 @@ i40e_status i40evf_asq_send_command(struct i40e_hw *hw,
u16 retval = 0; u16 retval = 0;
u32 val = 0; u32 val = 0;
val = rd32(hw, hw->aq.asq.head); mutex_lock(&hw->aq.asq_mutex);
if (val >= hw->aq.num_asq_entries) {
if (hw->aq.asq.count == 0) {
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
"AQTX: head overrun at %d\n", val); "AQTX: Admin queue not initialized.\n");
status = I40E_ERR_QUEUE_EMPTY; status = I40E_ERR_QUEUE_EMPTY;
goto asq_send_command_exit; goto asq_send_command_error;
} }
if (hw->aq.asq.count == 0) { val = rd32(hw, hw->aq.asq.head);
if (val >= hw->aq.num_asq_entries) {
i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
"AQTX: Admin queue not initialized.\n"); "AQTX: head overrun at %d\n", val);
status = I40E_ERR_QUEUE_EMPTY; status = I40E_ERR_QUEUE_EMPTY;
goto asq_send_command_exit; goto asq_send_command_error;
} }
details = I40E_ADMINQ_DETAILS(hw->aq.asq, hw->aq.asq.next_to_use); details = I40E_ADMINQ_DETAILS(hw->aq.asq, hw->aq.asq.next_to_use);
...@@ -722,8 +726,6 @@ i40e_status i40evf_asq_send_command(struct i40e_hw *hw, ...@@ -722,8 +726,6 @@ i40e_status i40evf_asq_send_command(struct i40e_hw *hw,
desc->flags &= ~cpu_to_le16(details->flags_dis); desc->flags &= ~cpu_to_le16(details->flags_dis);
desc->flags |= cpu_to_le16(details->flags_ena); desc->flags |= cpu_to_le16(details->flags_ena);
mutex_lock(&hw->aq.asq_mutex);
if (buff_size > hw->aq.asq_buf_size) { if (buff_size > hw->aq.asq_buf_size) {
i40e_debug(hw, i40e_debug(hw,
I40E_DEBUG_AQ_MESSAGE, I40E_DEBUG_AQ_MESSAGE,
...@@ -848,7 +850,6 @@ i40e_status i40evf_asq_send_command(struct i40e_hw *hw, ...@@ -848,7 +850,6 @@ i40e_status i40evf_asq_send_command(struct i40e_hw *hw,
asq_send_command_error: asq_send_command_error:
mutex_unlock(&hw->aq.asq_mutex); mutex_unlock(&hw->aq.asq_mutex);
asq_send_command_exit:
return status; return status;
} }
......
...@@ -917,7 +917,7 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget) ...@@ -917,7 +917,7 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)
unsigned int total_rx_bytes = 0, total_rx_packets = 0; unsigned int total_rx_bytes = 0, total_rx_packets = 0;
u16 rx_packet_len, rx_header_len, rx_sph, rx_hbo; u16 rx_packet_len, rx_header_len, rx_sph, rx_hbo;
u16 cleaned_count = I40E_DESC_UNUSED(rx_ring); u16 cleaned_count = I40E_DESC_UNUSED(rx_ring);
const int current_node = numa_node_id(); const int current_node = numa_mem_id();
struct i40e_vsi *vsi = rx_ring->vsi; struct i40e_vsi *vsi = rx_ring->vsi;
u16 i = rx_ring->next_to_clean; u16 i = rx_ring->next_to_clean;
union i40e_rx_desc *rx_desc; union i40e_rx_desc *rx_desc;
......
...@@ -756,6 +756,8 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter, ...@@ -756,6 +756,8 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
sizeof(struct i40e_virtchnl_vsi_resource); sizeof(struct i40e_virtchnl_vsi_resource);
memcpy(adapter->vf_res, msg, min(msglen, len)); memcpy(adapter->vf_res, msg, min(msglen, len));
i40e_vf_parse_hw_config(&adapter->hw, adapter->vf_res); i40e_vf_parse_hw_config(&adapter->hw, adapter->vf_res);
/* restore current mac address */
ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr);
i40evf_process_config(adapter); i40evf_process_config(adapter);
} }
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment