i40e: refactor AQ CMD buffer debug printing

This patch refactors the '%*ph' printk format specifier to instead use
the print_hex_dump function, as recommended by the '%*ph' documentation.
This produces better/more standardized output.

Change-ID: Id56700b4e8abc40ff8c04bc8379e7df04cb4d6fd
Signed-off-by: Alan Brady <alan.brady@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
Alan Brady 2016-12-12 15:44:13 -08:00 committed by Jeff Kirsher
parent 3c234c4709
commit 773d4023ba
2 changed files with 24 additions and 14 deletions

View File

@ -300,7 +300,6 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc; struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc;
u16 len; u16 len;
u8 *buf = (u8 *)buffer; u8 *buf = (u8 *)buffer;
u16 i = 0;
if ((!(mask & hw->debug_mask)) || (desc == NULL)) if ((!(mask & hw->debug_mask)) || (desc == NULL))
return; return;
@ -328,12 +327,18 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
if (buf_len < len) if (buf_len < len)
len = buf_len; len = buf_len;
/* write the full 16-byte chunks */ /* write the full 16-byte chunks */
for (i = 0; i < (len - 16); i += 16) if (hw->debug_mask & mask) {
i40e_debug(hw, mask, "\t0x%04X %16ph\n", i, buf + i); char prefix[20];
/* write whatever's left over without overrunning the buffer */
if (i < len) snprintf(prefix, 20,
i40e_debug(hw, mask, "\t0x%04X %*ph\n", "i40e %02x:%02x.%x: \t0x",
i, len - i, buf + i); hw->bus.bus_id,
hw->bus.device,
hw->bus.func);
print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET,
16, 1, buf, len, false);
}
} }
} }

View File

@ -304,7 +304,6 @@ void i40evf_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
{ {
struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc; struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc;
u8 *buf = (u8 *)buffer; u8 *buf = (u8 *)buffer;
u16 i = 0;
if ((!(mask & hw->debug_mask)) || (desc == NULL)) if ((!(mask & hw->debug_mask)) || (desc == NULL))
return; return;
@ -332,12 +331,18 @@ void i40evf_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
if (buf_len < len) if (buf_len < len)
len = buf_len; len = buf_len;
/* write the full 16-byte chunks */ /* write the full 16-byte chunks */
for (i = 0; i < (len - 16); i += 16) if (hw->debug_mask & mask) {
i40e_debug(hw, mask, "\t0x%04X %16ph\n", i, buf + i); char prefix[20];
/* write whatever's left over without overrunning the buffer */
if (i < len) snprintf(prefix, 20,
i40e_debug(hw, mask, "\t0x%04X %*ph\n", "i40evf %02x:%02x.%x: \t0x",
i, len - i, buf + i); hw->bus.bus_id,
hw->bus.device,
hw->bus.func);
print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET,
16, 1, buf, len, false);
}
} }
} }