[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <FC41C24E35F18A40888AACA1A36F3E418ACFCB94@fmsmsx115.amr.corp.intel.com>
Date: Thu, 24 Jul 2014 19:20:48 +0000
From: "Nelson, Shannon" <shannon.nelson@...el.com>
To: Joe Perches <joe@...ches.com>,
"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"nhorman@...hat.com" <nhorman@...hat.com>,
"sassmann@...hat.com" <sassmann@...hat.com>
Subject: RE: [net-next 14/14] i40e: always print aqtx answer
> From: Joe Perches [mailto:joe@...ches.com]
> Sent: Thursday, July 24, 2014 11:43 AM
>
> On Thu, 2014-07-24 at 06:13 -0700, Jeff Kirsher wrote:
> > From: Shannon Nelson <shannon.nelson@...el.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?
This is safe because we'll only print the descriptor in this case, not the buffer. There's a check in i40e_debug_aq() for NULL or zero-length buffer.
sln
>
> > 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));
> }
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists