Re: [net-next 14/14] i40e: always print aqtx answer

Joe Perches
2014-07-24T18:42:35Z

On Thu, 2014-07-24 at 06:13 -0700, Jeff Kirsher wrote:
> From: Shannon Nelson <shannon.nelson@intel.com>
>
> Sometimes the AQTX answer comes back with no data, but we still want to print
> the descriptor that got written back.

Maybe this does some reads from buffer beyond its size
in i40e_debug_aq? Is that always safe?

> diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.c b/drivers/net/ethernet/intel/i40e/i40e_adminq.c
[]
> @@ -889,11 +889,9 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,
> hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval;
> }
>
> - if (le16_to_cpu(desc->datalen) == buff_size) {
> - i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
> - "AQTX: desc and buffer writeback:\n");
> - i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff);
> - }
> + i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
> + "AQTX: desc and buffer writeback:\n");
> + i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff);

void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
void *buffer)
{
struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc;
u8 *aq_buffer = (u8 *)buffer;
[]
for (i = 0; i < le16_to_cpu(aq_desc->datalen); i++) {
data[((i % 16) / 4)] |=
((u32)aq_buffer[i]) << (8 * (i % 4));
if ((i % 16) == 15) {
i40e_debug(hw, mask,
"\t0x%04X %08X %08X %08X %08X\n",
i - 15, data[0], data[1], data[2],
data[3]);
memset(data, 0, sizeof(data));
}