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

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

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates

This series contains updates to i40e, ixgbevf, ixgbe and igb.

Don provides an ixgbevf patch to add DCB configuration into the queue
setup so that we won't have to allocate queues in a separate place when
enabling DCB.

Guenter Roeck provides 2 patches for ixgbe to simplify the code by
attaching hwmon sysfs attributes to hwmon device instead of PCI device.
Also fix an issues where the temperature sensor attribute index was
being started with the value 0 and not 1 as per the hwmon API.

Carolyn provides igb patches to fix queue allocation method to
accommodate changes during runtime.  This includes changing how the
driver initializes MSIx and checks for MSIx configuration to make it
easier to reconfigure the device when queue changes happen at runtime.

Neerav and Shannon fixes i40e debugfs commands that dump hex information
by using print_hex_dump().

Shannon provides several i40e fixes which include the prevention of
null pointer exception in the dump descriptor by checking that rings
were allocated before trying to reference them.  Fixed up a couple of
scanfs to accept various base numbers instead of silently requiring hex.

Anjali fixes up i40e where the incorrect defines were being used for
misc interrupts.

Alan Cox provides a fix for i40e where we assume that the resulting
buffer is zero terminated when we then re-use it.  The sscanf is limited
to 512 bytes but needs to be 511 to allow for a terminator.

Stephen Hemminger fixes i40e by making local functions static and removes
unused code (i40e_aq_add/remove_vlan() functions).
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 36272874 cd14ef54
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "i40e_adminq.h" #include "i40e_adminq.h"
#include "i40e_prototype.h" #include "i40e_prototype.h"
static void i40e_resume_aq(struct i40e_hw *hw);
/** /**
* i40e_adminq_init_regs - Initialize AdminQ registers * i40e_adminq_init_regs - Initialize AdminQ registers
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
...@@ -675,7 +677,7 @@ static u16 i40e_clean_asq(struct i40e_hw *hw) ...@@ -675,7 +677,7 @@ static u16 i40e_clean_asq(struct i40e_hw *hw)
* Returns true if the firmware has processed all descriptors on the * Returns true if the firmware has processed all descriptors on the
* admin send queue. Returns false if there are still requests pending. * admin send queue. Returns false if there are still requests pending.
**/ **/
bool i40e_asq_done(struct i40e_hw *hw) static bool i40e_asq_done(struct i40e_hw *hw)
{ {
/* AQ designers suggest use of head for better /* AQ designers suggest use of head for better
* timing reliability than DD bit * timing reliability than DD bit
...@@ -963,7 +965,7 @@ i40e_status i40e_clean_arq_element(struct i40e_hw *hw, ...@@ -963,7 +965,7 @@ i40e_status i40e_clean_arq_element(struct i40e_hw *hw,
return ret_code; return ret_code;
} }
void i40e_resume_aq(struct i40e_hw *hw) static void i40e_resume_aq(struct i40e_hw *hw)
{ {
u32 reg = 0; u32 reg = 0;
......
...@@ -1128,86 +1128,6 @@ i40e_status i40e_aq_remove_macvlan(struct i40e_hw *hw, u16 seid, ...@@ -1128,86 +1128,6 @@ i40e_status i40e_aq_remove_macvlan(struct i40e_hw *hw, u16 seid,
return status; return status;
} }
/**
* i40e_aq_add_vlan - Add VLAN ids to the HW filtering
* @hw: pointer to the hw struct
* @seid: VSI for the vlan filters
* @v_list: list of vlan filters to be added
* @count: length of the list
* @cmd_details: pointer to command details structure or NULL
**/
i40e_status i40e_aq_add_vlan(struct i40e_hw *hw, u16 seid,
struct i40e_aqc_add_remove_vlan_element_data *v_list,
u8 count, struct i40e_asq_cmd_details *cmd_details)
{
struct i40e_aq_desc desc;
struct i40e_aqc_macvlan *cmd =
(struct i40e_aqc_macvlan *)&desc.params.raw;
i40e_status status;
u16 buf_size;
if (count == 0 || !v_list || !hw)
return I40E_ERR_PARAM;
buf_size = count * sizeof(struct i40e_aqc_add_remove_vlan_element_data);
/* prep the rest of the request */
i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_add_vlan);
cmd->num_addresses = cpu_to_le16(count);
cmd->seid[0] = cpu_to_le16(seid | I40E_AQC_MACVLAN_CMD_SEID_VALID);
cmd->seid[1] = 0;
cmd->seid[2] = 0;
desc.flags |= cpu_to_le16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
if (buf_size > I40E_AQ_LARGE_BUF)
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB);
status = i40e_asq_send_command(hw, &desc, v_list, buf_size,
cmd_details);
return status;
}
/**
* i40e_aq_remove_vlan - Remove VLANs from the HW filtering
* @hw: pointer to the hw struct
* @seid: VSI for the vlan filters
* @v_list: list of macvlans to be removed
* @count: length of the list
* @cmd_details: pointer to command details structure or NULL
**/
i40e_status i40e_aq_remove_vlan(struct i40e_hw *hw, u16 seid,
struct i40e_aqc_add_remove_vlan_element_data *v_list,
u8 count, struct i40e_asq_cmd_details *cmd_details)
{
struct i40e_aq_desc desc;
struct i40e_aqc_macvlan *cmd =
(struct i40e_aqc_macvlan *)&desc.params.raw;
i40e_status status;
u16 buf_size;
if (count == 0 || !v_list || !hw)
return I40E_ERR_PARAM;
buf_size = count * sizeof(struct i40e_aqc_add_remove_vlan_element_data);
/* prep the rest of the request */
i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_remove_vlan);
cmd->num_addresses = cpu_to_le16(count);
cmd->seid[0] = cpu_to_le16(seid | I40E_AQC_MACVLAN_CMD_SEID_VALID);
cmd->seid[1] = 0;
cmd->seid[2] = 0;
desc.flags |= cpu_to_le16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD));
if (buf_size > I40E_AQ_LARGE_BUF)
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB);
status = i40e_asq_send_command(hw, &desc, v_list, buf_size,
cmd_details);
return status;
}
/** /**
* i40e_aq_send_msg_to_vf * i40e_aq_send_msg_to_vf
* @hw: pointer to the hardware structure * @hw: pointer to the hardware structure
......
...@@ -362,7 +362,7 @@ static ssize_t i40e_dbg_command_read(struct file *filp, char __user *buffer, ...@@ -362,7 +362,7 @@ static ssize_t i40e_dbg_command_read(struct file *filp, char __user *buffer,
} }
/** /**
* i40e_dbg_dump_vsi_seid - handles dump vsi seid write into pokem datum * i40e_dbg_dump_vsi_seid - handles dump vsi seid write into command datum
* @pf: the i40e_pf created in command write * @pf: the i40e_pf created in command write
* @seid: the seid the user put in * @seid: the seid the user put in
**/ **/
...@@ -707,8 +707,13 @@ static void i40e_dbg_dump_aq_desc(struct i40e_pf *pf) ...@@ -707,8 +707,13 @@ static void i40e_dbg_dump_aq_desc(struct i40e_pf *pf)
{ {
struct i40e_adminq_ring *ring; struct i40e_adminq_ring *ring;
struct i40e_hw *hw = &pf->hw; struct i40e_hw *hw = &pf->hw;
char hdr[32];
int i; int i;
snprintf(hdr, sizeof(hdr), "%s %s: ",
dev_driver_string(&pf->pdev->dev),
dev_name(&pf->pdev->dev));
/* first the send (command) ring, then the receive (event) ring */ /* first the send (command) ring, then the receive (event) ring */
dev_info(&pf->pdev->dev, "AdminQ Tx Ring\n"); dev_info(&pf->pdev->dev, "AdminQ Tx Ring\n");
ring = &(hw->aq.asq); ring = &(hw->aq.asq);
...@@ -718,14 +723,8 @@ static void i40e_dbg_dump_aq_desc(struct i40e_pf *pf) ...@@ -718,14 +723,8 @@ static void i40e_dbg_dump_aq_desc(struct i40e_pf *pf)
" at[%02d] flags=0x%04x op=0x%04x dlen=0x%04x ret=0x%04x cookie_h=0x%08x cookie_l=0x%08x\n", " at[%02d] flags=0x%04x op=0x%04x dlen=0x%04x ret=0x%04x cookie_h=0x%08x cookie_l=0x%08x\n",
i, d->flags, d->opcode, d->datalen, d->retval, i, d->flags, d->opcode, d->datalen, d->retval,
d->cookie_high, d->cookie_low); d->cookie_high, d->cookie_low);
dev_info(&pf->pdev->dev, print_hex_dump(KERN_INFO, hdr, DUMP_PREFIX_NONE,
" %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", 16, 1, d->params.raw, 16, 0);
d->params.raw[0], d->params.raw[1], d->params.raw[2],
d->params.raw[3], d->params.raw[4], d->params.raw[5],
d->params.raw[6], d->params.raw[7], d->params.raw[8],
d->params.raw[9], d->params.raw[10], d->params.raw[11],
d->params.raw[12], d->params.raw[13],
d->params.raw[14], d->params.raw[15]);
} }
dev_info(&pf->pdev->dev, "AdminQ Rx Ring\n"); dev_info(&pf->pdev->dev, "AdminQ Rx Ring\n");
...@@ -736,14 +735,8 @@ static void i40e_dbg_dump_aq_desc(struct i40e_pf *pf) ...@@ -736,14 +735,8 @@ static void i40e_dbg_dump_aq_desc(struct i40e_pf *pf)
" ar[%02d] flags=0x%04x op=0x%04x dlen=0x%04x ret=0x%04x cookie_h=0x%08x cookie_l=0x%08x\n", " ar[%02d] flags=0x%04x op=0x%04x dlen=0x%04x ret=0x%04x cookie_h=0x%08x cookie_l=0x%08x\n",
i, d->flags, d->opcode, d->datalen, d->retval, i, d->flags, d->opcode, d->datalen, d->retval,
d->cookie_high, d->cookie_low); d->cookie_high, d->cookie_low);
dev_info(&pf->pdev->dev, print_hex_dump(KERN_INFO, hdr, DUMP_PREFIX_NONE,
" %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", 16, 1, d->params.raw, 16, 0);
d->params.raw[0], d->params.raw[1], d->params.raw[2],
d->params.raw[3], d->params.raw[4], d->params.raw[5],
d->params.raw[6], d->params.raw[7], d->params.raw[8],
d->params.raw[9], d->params.raw[10], d->params.raw[11],
d->params.raw[12], d->params.raw[13],
d->params.raw[14], d->params.raw[15]);
} }
} }
...@@ -766,20 +759,17 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, ...@@ -766,20 +759,17 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
vsi = i40e_dbg_find_vsi(pf, vsi_seid); vsi = i40e_dbg_find_vsi(pf, vsi_seid);
if (!vsi) { if (!vsi) {
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev, "vsi %d not found\n", vsi_seid);
"vsi %d not found\n", vsi_seid);
if (is_rx_ring)
dev_info(&pf->pdev->dev, "dump desc rx <vsi_seid> <ring_id> [<desc_n>]\n");
else
dev_info(&pf->pdev->dev, "dump desc tx <vsi_seid> <ring_id> [<desc_n>]\n");
return; return;
} }
if (ring_id >= vsi->num_queue_pairs || ring_id < 0) { if (ring_id >= vsi->num_queue_pairs || ring_id < 0) {
dev_info(&pf->pdev->dev, "ring %d not found\n", ring_id); dev_info(&pf->pdev->dev, "ring %d not found\n", ring_id);
if (is_rx_ring) return;
dev_info(&pf->pdev->dev, "dump desc rx <vsi_seid> <ring_id> [<desc_n>]\n"); }
else if (!vsi->tx_rings) {
dev_info(&pf->pdev->dev, "dump desc tx <vsi_seid> <ring_id> [<desc_n>]\n"); dev_info(&pf->pdev->dev,
"descriptor rings have not been allocated for vsi %d\n",
vsi_seid);
return; return;
} }
if (is_rx_ring) if (is_rx_ring)
...@@ -830,10 +820,7 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n, ...@@ -830,10 +820,7 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
desc_n, ds->read.pkt_addr, ds->read.hdr_addr, desc_n, ds->read.pkt_addr, ds->read.hdr_addr,
ds->read.rsvd1, ds->read.rsvd2); ds->read.rsvd1, ds->read.rsvd2);
} else { } else {
if (is_rx_ring) dev_info(&pf->pdev->dev, "dump desc rx/tx <vsi_seid> <ring_id> [<desc_n>]\n");
dev_info(&pf->pdev->dev, "dump desc rx <vsi_seid> <ring_id> [<desc_n>]\n");
else
dev_info(&pf->pdev->dev, "dump desc tx <vsi_seid> <ring_id> [<desc_n>]\n");
} }
} }
...@@ -979,8 +966,7 @@ static void i40e_dbg_dump_veb_seid(struct i40e_pf *pf, int seid) ...@@ -979,8 +966,7 @@ static void i40e_dbg_dump_veb_seid(struct i40e_pf *pf, int seid)
veb = i40e_dbg_find_veb(pf, seid); veb = i40e_dbg_find_veb(pf, seid);
if (!veb) { if (!veb) {
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev, "can't find veb %d\n", seid);
"%d: can't find veb\n", seid);
return; return;
} }
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
...@@ -1022,8 +1008,6 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1022,8 +1008,6 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
char *cmd_buf, *cmd_buf_tmp; char *cmd_buf, *cmd_buf_tmp;
int bytes_not_copied; int bytes_not_copied;
struct i40e_vsi *vsi; struct i40e_vsi *vsi;
u8 *print_buf_start;
u8 *print_buf;
int vsi_seid; int vsi_seid;
int veb_seid; int veb_seid;
int cnt; int cnt;
...@@ -1048,11 +1032,6 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1048,11 +1032,6 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
count = cmd_buf_tmp - cmd_buf + 1; count = cmd_buf_tmp - cmd_buf + 1;
} }
print_buf_start = kzalloc(I40E_MAX_DEBUG_OUT_BUFFER, GFP_KERNEL);
if (!print_buf_start)
goto command_write_done;
print_buf = print_buf_start;
if (strncmp(cmd_buf, "add vsi", 7) == 0) { if (strncmp(cmd_buf, "add vsi", 7) == 0) {
vsi_seid = -1; vsi_seid = -1;
cnt = sscanf(&cmd_buf[7], "%i", &vsi_seid); cnt = sscanf(&cmd_buf[7], "%i", &vsi_seid);
...@@ -1479,7 +1458,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1479,7 +1458,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
} else if (strncmp(cmd_buf, "read", 4) == 0) { } else if (strncmp(cmd_buf, "read", 4) == 0) {
u32 address; u32 address;
u32 value; u32 value;
cnt = sscanf(&cmd_buf[4], "%x", &address); cnt = sscanf(&cmd_buf[4], "%i", &address);
if (cnt != 1) { if (cnt != 1) {
dev_info(&pf->pdev->dev, "read <reg>\n"); dev_info(&pf->pdev->dev, "read <reg>\n");
goto command_write_done; goto command_write_done;
...@@ -1498,7 +1477,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1498,7 +1477,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
} else if (strncmp(cmd_buf, "write", 5) == 0) { } else if (strncmp(cmd_buf, "write", 5) == 0) {
u32 address, value; u32 address, value;
cnt = sscanf(&cmd_buf[5], "%x %x", &address, &value); cnt = sscanf(&cmd_buf[5], "%i %i", &address, &value);
if (cnt != 2) { if (cnt != 2) {
dev_info(&pf->pdev->dev, "write <reg> <value>\n"); dev_info(&pf->pdev->dev, "write <reg> <value>\n");
goto command_write_done; goto command_write_done;
...@@ -1516,7 +1495,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1516,7 +1495,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
address, value); address, value);
} else if (strncmp(cmd_buf, "clear_stats", 11) == 0) { } else if (strncmp(cmd_buf, "clear_stats", 11) == 0) {
if (strncmp(&cmd_buf[12], "vsi", 3) == 0) { if (strncmp(&cmd_buf[12], "vsi", 3) == 0) {
cnt = sscanf(&cmd_buf[15], "%d", &vsi_seid); cnt = sscanf(&cmd_buf[15], "%i", &vsi_seid);
if (cnt == 0) { if (cnt == 0) {
int i; int i;
for (i = 0; i < pf->hw.func_caps.num_vsis; i++) for (i = 0; i < pf->hw.func_caps.num_vsis; i++)
...@@ -1568,7 +1547,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1568,7 +1547,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
if (strncmp(cmd_buf, "add", 3) == 0) if (strncmp(cmd_buf, "add", 3) == 0)
add = true; add = true;
cnt = sscanf(&cmd_buf[13], cnt = sscanf(&cmd_buf[13],
"%hx %2hhx %2hhx %hx %2hhx %2hhx %hx %x %hd %512s", "%hx %2hhx %2hhx %hx %2hhx %2hhx %hx %x %hd %511s",
&fd_data.q_index, &fd_data.q_index,
&fd_data.flex_off, &fd_data.pctype, &fd_data.flex_off, &fd_data.pctype,
&fd_data.dest_vsi, &fd_data.dest_ctl, &fd_data.dest_vsi, &fd_data.dest_ctl,
...@@ -1592,19 +1571,15 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1592,19 +1571,15 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
packet_len = min_t(u16, packet_len = min_t(u16,
packet_len, I40E_FDIR_MAX_RAW_PACKET_LOOKUP); packet_len, I40E_FDIR_MAX_RAW_PACKET_LOOKUP);
dev_info(&pf->pdev->dev, "FD raw packet:\n");
for (i = 0; i < packet_len; i++) { for (i = 0; i < packet_len; i++) {
sscanf(&asc_packet[j], "%2hhx ", sscanf(&asc_packet[j], "%2hhx ",
&fd_data.raw_packet[i]); &fd_data.raw_packet[i]);
j += 3; j += 3;
snprintf(print_buf, 3, "%02x ", fd_data.raw_packet[i]);
print_buf += 3;
if ((i % 16) == 15) {
snprintf(print_buf, 1, "\n");
print_buf++;
}
} }
dev_info(&pf->pdev->dev, "%s\n", print_buf_start); dev_info(&pf->pdev->dev, "FD raw packet dump\n");
print_hex_dump(KERN_INFO, "FD raw packet: ",
DUMP_PREFIX_OFFSET, 16, 1,
fd_data.raw_packet, packet_len, true);
ret = i40e_program_fdir_filter(&fd_data, pf, add); ret = i40e_program_fdir_filter(&fd_data, pf, add);
if (!ret) { if (!ret) {
dev_info(&pf->pdev->dev, "Filter command send Status : Success\n"); dev_info(&pf->pdev->dev, "Filter command send Status : Success\n");
...@@ -1638,7 +1613,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1638,7 +1613,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
} else if (strncmp(&cmd_buf[5], } else if (strncmp(&cmd_buf[5],
"get local", 9) == 0) { "get local", 9) == 0) {
u16 llen, rlen; u16 llen, rlen;
int ret, i; int ret;
u8 *buff; u8 *buff;
buff = kzalloc(I40E_LLDPDU_SIZE, GFP_KERNEL); buff = kzalloc(I40E_LLDPDU_SIZE, GFP_KERNEL);
if (!buff) if (!buff)
...@@ -1656,22 +1631,15 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1656,22 +1631,15 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
buff = NULL; buff = NULL;
goto command_write_done; goto command_write_done;
} }
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev, "LLDP MIB (local)\n");
"Get LLDP MIB (local) AQ buffer written back:\n"); print_hex_dump(KERN_INFO, "LLDP MIB (local): ",
for (i = 0; i < I40E_LLDPDU_SIZE; i++) { DUMP_PREFIX_OFFSET, 16, 1,
snprintf(print_buf, 3, "%02x ", buff[i]); buff, I40E_LLDPDU_SIZE, true);
print_buf += 3;
if ((i % 16) == 15) {
snprintf(print_buf, 1, "\n");
print_buf++;
}
}
dev_info(&pf->pdev->dev, "%s\n", print_buf_start);
kfree(buff); kfree(buff);
buff = NULL; buff = NULL;
} else if (strncmp(&cmd_buf[5], "get remote", 10) == 0) { } else if (strncmp(&cmd_buf[5], "get remote", 10) == 0) {
u16 llen, rlen; u16 llen, rlen;
int ret, i; int ret;
u8 *buff; u8 *buff;
buff = kzalloc(I40E_LLDPDU_SIZE, GFP_KERNEL); buff = kzalloc(I40E_LLDPDU_SIZE, GFP_KERNEL);
if (!buff) if (!buff)
...@@ -1690,17 +1658,10 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1690,17 +1658,10 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
buff = NULL; buff = NULL;
goto command_write_done; goto command_write_done;
} }
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev, "LLDP MIB (remote)\n");
"Get LLDP MIB (remote) AQ buffer written back:\n"); print_hex_dump(KERN_INFO, "LLDP MIB (remote): ",
for (i = 0; i < I40E_LLDPDU_SIZE; i++) { DUMP_PREFIX_OFFSET, 16, 1,
snprintf(print_buf, 3, "%02x ", buff[i]); buff, I40E_LLDPDU_SIZE, true);
print_buf += 3;
if ((i % 16) == 15) {
snprintf(print_buf, 1, "\n");
print_buf++;
}
}
dev_info(&pf->pdev->dev, "%s\n", print_buf_start);
kfree(buff); kfree(buff);
buff = NULL; buff = NULL;
} else if (strncmp(&cmd_buf[5], "event on", 8) == 0) { } else if (strncmp(&cmd_buf[5], "event on", 8) == 0) {
...@@ -1725,7 +1686,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1725,7 +1686,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
} }
} }
} else if (strncmp(cmd_buf, "nvm read", 8) == 0) { } else if (strncmp(cmd_buf, "nvm read", 8) == 0) {
u16 buffer_len, i, bytes; u16 buffer_len, bytes;
u16 module; u16 module;
u32 offset; u32 offset;
u16 *buff; u16 *buff;
...@@ -1779,16 +1740,10 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1779,16 +1740,10 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
dev_info(&pf->pdev->dev, dev_info(&pf->pdev->dev,
"Read NVM module=0x%x offset=0x%x words=%d\n", "Read NVM module=0x%x offset=0x%x words=%d\n",
module, offset, buffer_len); module, offset, buffer_len);
for (i = 0; i < buffer_len; i++) { if (buffer_len)
if ((i % 16) == 0) { print_hex_dump(KERN_INFO, "NVM Dump: ",
snprintf(print_buf, 11, "\n0x%08x: ", DUMP_PREFIX_OFFSET, 16, 2,
offset + i); buff, buffer_len, true);
print_buf += 11;
}
snprintf(print_buf, 5, "%04x ", buff[i]);
print_buf += 5;
}
dev_info(&pf->pdev->dev, "%s\n", print_buf_start);
} }
kfree(buff); kfree(buff);
buff = NULL; buff = NULL;
...@@ -1832,9 +1787,6 @@ static ssize_t i40e_dbg_command_write(struct file *filp, ...@@ -1832,9 +1787,6 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
command_write_done: command_write_done:
kfree(cmd_buf); kfree(cmd_buf);
cmd_buf = NULL; cmd_buf = NULL;
kfree(print_buf_start);
print_buf = NULL;
print_buf_start = NULL;
return count; return count;
} }
......
...@@ -36,7 +36,7 @@ static const char i40e_driver_string[] = ...@@ -36,7 +36,7 @@ static const char i40e_driver_string[] =
#define DRV_VERSION_MAJOR 0 #define DRV_VERSION_MAJOR 0
#define DRV_VERSION_MINOR 3 #define DRV_VERSION_MINOR 3
#define DRV_VERSION_BUILD 13 #define DRV_VERSION_BUILD 14
#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \ #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
__stringify(DRV_VERSION_MINOR) "." \ __stringify(DRV_VERSION_MINOR) "." \
__stringify(DRV_VERSION_BUILD) DRV_KERN __stringify(DRV_VERSION_BUILD) DRV_KERN
...@@ -2489,8 +2489,8 @@ static void i40e_enable_misc_int_causes(struct i40e_hw *hw) ...@@ -2489,8 +2489,8 @@ static void i40e_enable_misc_int_causes(struct i40e_hw *hw)
wr32(hw, I40E_PFINT_ICR0_ENA, val); wr32(hw, I40E_PFINT_ICR0_ENA, val);
/* SW_ITR_IDX = 0, but don't change INTENA */ /* SW_ITR_IDX = 0, but don't change INTENA */
wr32(hw, I40E_PFINT_DYN_CTL0, I40E_PFINT_DYN_CTLN_SW_ITR_INDX_MASK | wr32(hw, I40E_PFINT_DYN_CTL0, I40E_PFINT_DYN_CTL0_SW_ITR_INDX_MASK |
I40E_PFINT_DYN_CTLN_INTENA_MSK_MASK); I40E_PFINT_DYN_CTL0_INTENA_MSK_MASK);
/* OTHER_ITR_IDX = 0 */ /* OTHER_ITR_IDX = 0 */
wr32(hw, I40E_PFINT_STAT_CTL0, 0); wr32(hw, I40E_PFINT_STAT_CTL0, 0);
......
...@@ -51,7 +51,6 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw, ...@@ -51,7 +51,6 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,
void *buff, /* can be NULL */ void *buff, /* can be NULL */
u16 buff_size, u16 buff_size,
struct i40e_asq_cmd_details *cmd_details); struct i40e_asq_cmd_details *cmd_details);
bool i40e_asq_done(struct i40e_hw *hw);
/* debug function for adminq */ /* debug function for adminq */
void i40e_debug_aq(struct i40e_hw *hw, void i40e_debug_aq(struct i40e_hw *hw,
...@@ -60,7 +59,6 @@ void i40e_debug_aq(struct i40e_hw *hw, ...@@ -60,7 +59,6 @@ void i40e_debug_aq(struct i40e_hw *hw,
void *buffer); void *buffer);
void i40e_idle_aq(struct i40e_hw *hw); void i40e_idle_aq(struct i40e_hw *hw);
void i40e_resume_aq(struct i40e_hw *hw);
u32 i40e_led_get(struct i40e_hw *hw); u32 i40e_led_get(struct i40e_hw *hw);
void i40e_led_set(struct i40e_hw *hw, u32 mode); void i40e_led_set(struct i40e_hw *hw, u32 mode);
...@@ -120,12 +118,6 @@ i40e_status i40e_aq_add_macvlan(struct i40e_hw *hw, u16 vsi_id, ...@@ -120,12 +118,6 @@ i40e_status i40e_aq_add_macvlan(struct i40e_hw *hw, u16 vsi_id,
i40e_status i40e_aq_remove_macvlan(struct i40e_hw *hw, u16 vsi_id, i40e_status i40e_aq_remove_macvlan(struct i40e_hw *hw, u16 vsi_id,
struct i40e_aqc_remove_macvlan_element_data *mv_list, struct i40e_aqc_remove_macvlan_element_data *mv_list,
u16 count, struct i40e_asq_cmd_details *cmd_details); u16 count, struct i40e_asq_cmd_details *cmd_details);
i40e_status i40e_aq_add_vlan(struct i40e_hw *hw, u16 vsi_id,
struct i40e_aqc_add_remove_vlan_element_data *v_list,
u8 count, struct i40e_asq_cmd_details *cmd_details);
i40e_status i40e_aq_remove_vlan(struct i40e_hw *hw, u16 vsi_id,
struct i40e_aqc_add_remove_vlan_element_data *v_list,
u8 count, struct i40e_asq_cmd_details *cmd_details);
i40e_status i40e_aq_send_msg_to_vf(struct i40e_hw *hw, u16 vfid, i40e_status i40e_aq_send_msg_to_vf(struct i40e_hw *hw, u16 vfid,
u32 v_opcode, u32 v_retval, u8 *msg, u16 msglen, u32 v_opcode, u32 v_retval, u8 *msg, u16 msglen,
struct i40e_asq_cmd_details *cmd_details); struct i40e_asq_cmd_details *cmd_details);
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-algo-bit.h> #include <linux/i2c-algo-bit.h>
#include <linux/pci.h>
struct igb_adapter; struct igb_adapter;
...@@ -67,6 +68,7 @@ struct igb_adapter; ...@@ -67,6 +68,7 @@ struct igb_adapter;
#define IGB_MIN_ITR_USECS 10 #define IGB_MIN_ITR_USECS 10
#define NON_Q_VECTORS 1 #define NON_Q_VECTORS 1
#define MAX_Q_VECTORS 8 #define MAX_Q_VECTORS 8
#define MAX_MSIX_ENTRIES 10
/* Transmit and receive queues */ /* Transmit and receive queues */
#define IGB_MAX_RX_QUEUES 8 #define IGB_MAX_RX_QUEUES 8
...@@ -127,9 +129,9 @@ struct vf_data_storage { ...@@ -127,9 +129,9 @@ struct vf_data_storage {
#define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8) #define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8)
#define IGB_TX_HTHRESH 1 #define IGB_TX_HTHRESH 1
#define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \ #define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \
adapter->msix_entries) ? 1 : 4) (adapter->flags & IGB_FLAG_HAS_MSIX)) ? 1 : 4)
#define IGB_TX_WTHRESH ((hw->mac.type == e1000_82576 && \ #define IGB_TX_WTHRESH ((hw->mac.type == e1000_82576 && \
adapter->msix_entries) ? 1 : 16) (adapter->flags & IGB_FLAG_HAS_MSIX)) ? 1 : 16)
/* this is the size past which hardware will drop packets when setting LPE=0 */ /* this is the size past which hardware will drop packets when setting LPE=0 */
#define MAXIMUM_ETHERNET_VLAN_SIZE 1522 #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
...@@ -357,7 +359,7 @@ struct igb_adapter { ...@@ -357,7 +359,7 @@ struct igb_adapter {
unsigned int flags; unsigned int flags;
unsigned int num_q_vectors; unsigned int num_q_vectors;
struct msix_entry *msix_entries; struct msix_entry msix_entries[MAX_MSIX_ENTRIES];
/* Interrupt Throttle Rate */ /* Interrupt Throttle Rate */
u32 rx_itr_setting; u32 rx_itr_setting;
...@@ -469,6 +471,7 @@ struct igb_adapter { ...@@ -469,6 +471,7 @@ struct igb_adapter {
#define IGB_FLAG_MEDIA_RESET (1 << 10) #define IGB_FLAG_MEDIA_RESET (1 << 10)
#define IGB_FLAG_MAS_CAPABLE (1 << 11) #define IGB_FLAG_MAS_CAPABLE (1 << 11)
#define IGB_FLAG_MAS_ENABLE (1 << 12) #define IGB_FLAG_MAS_ENABLE (1 << 12)
#define IGB_FLAG_HAS_MSIX (1 << 13)
/* Media Auto Sense */ /* Media Auto Sense */
#define IGB_MAS_ENABLE_0 0X0001 #define IGB_MAS_ENABLE_0 0X0001
......
...@@ -1386,7 +1386,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data) ...@@ -1386,7 +1386,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
*data = 0; *data = 0;
/* Hook up test interrupt handler just for this test */ /* Hook up test interrupt handler just for this test */
if (adapter->msix_entries) { if (adapter->flags & IGB_FLAG_HAS_MSIX) {
if (request_irq(adapter->msix_entries[0].vector, if (request_irq(adapter->msix_entries[0].vector,
igb_test_intr, 0, netdev->name, adapter)) { igb_test_intr, 0, netdev->name, adapter)) {
*data = 1; *data = 1;
...@@ -1519,7 +1519,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data) ...@@ -1519,7 +1519,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
msleep(10); msleep(10);
/* Unhook test interrupt handler */ /* Unhook test interrupt handler */
if (adapter->msix_entries) if (adapter->flags & IGB_FLAG_HAS_MSIX)
free_irq(adapter->msix_entries[0].vector, adapter); free_irq(adapter->msix_entries[0].vector, adapter);
else else
free_irq(irq, adapter); free_irq(irq, adapter);
...@@ -2933,7 +2933,7 @@ static void igb_get_channels(struct net_device *netdev, ...@@ -2933,7 +2933,7 @@ static void igb_get_channels(struct net_device *netdev,
ch->max_combined = igb_max_channels(adapter); ch->max_combined = igb_max_channels(adapter);
/* Report info for other vector */ /* Report info for other vector */
if (adapter->msix_entries) { if (adapter->flags & IGB_FLAG_HAS_MSIX) {
ch->max_other = NON_Q_VECTORS; ch->max_other = NON_Q_VECTORS;
ch->other_count = NON_Q_VECTORS; ch->other_count = NON_Q_VECTORS;
} }
......
...@@ -803,7 +803,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector) ...@@ -803,7 +803,7 @@ static void igb_assign_vector(struct igb_q_vector *q_vector, int msix_vector)
msixbm = E1000_EICR_RX_QUEUE0 << rx_queue; msixbm = E1000_EICR_RX_QUEUE0 << rx_queue;
if (tx_queue > IGB_N0_QUEUE) if (tx_queue > IGB_N0_QUEUE)
msixbm |= E1000_EICR_TX_QUEUE0 << tx_queue; msixbm |= E1000_EICR_TX_QUEUE0 << tx_queue;
if (!adapter->msix_entries && msix_vector == 0) if (!(adapter->flags & IGB_FLAG_HAS_MSIX) && msix_vector == 0)
msixbm |= E1000_EIMS_OTHER; msixbm |= E1000_EIMS_OTHER;
array_wr32(E1000_MSIXBM(0), msix_vector, msixbm); array_wr32(E1000_MSIXBM(0), msix_vector, msixbm);
q_vector->eims_value = msixbm; q_vector->eims_value = msixbm;
...@@ -983,43 +983,58 @@ static int igb_request_msix(struct igb_adapter *adapter) ...@@ -983,43 +983,58 @@ static int igb_request_msix(struct igb_adapter *adapter)
return err; return err;
} }
static void igb_reset_interrupt_capability(struct igb_adapter *adapter)
{
if (adapter->msix_entries) {
pci_disable_msix(adapter->pdev);
kfree(adapter->msix_entries);
adapter->msix_entries = NULL;
} else if (adapter->flags & IGB_FLAG_HAS_MSI) {
pci_disable_msi(adapter->pdev);
}
}
/** /**
* igb_free_q_vector - Free memory allocated for specific interrupt vector * igb_free_q_vector - Free memory allocated for specific interrupt vector
* @adapter: board private structure to initialize * @adapter: board private structure to initialize
* @v_idx: Index of vector to be freed * @v_idx: Index of vector to be freed
* *
* This function frees the memory allocated to the q_vector. In addition if * This function frees the memory allocated to the q_vector.
* NAPI is enabled it will delete any references to the NAPI struct prior
* to freeing the q_vector.
**/ **/
static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx) static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx)
{ {
struct igb_q_vector *q_vector = adapter->q_vector[v_idx]; struct igb_q_vector *q_vector = adapter->q_vector[v_idx];
adapter->q_vector[v_idx] = NULL;
/* igb_get_stats64() might access the rings on this vector,
* we must wait a grace period before freeing it.
*/
kfree_rcu(q_vector, rcu);
}
/**
* igb_reset_q_vector - Reset config for interrupt vector
* @adapter: board private structure to initialize
* @v_idx: Index of vector to be reset
*
* If NAPI is enabled it will delete any references to the
* NAPI struct. This is preparation for igb_free_q_vector.
**/
static void igb_reset_q_vector(struct igb_adapter *adapter, int v_idx)
{
struct igb_q_vector *q_vector = adapter->q_vector[v_idx];
if (q_vector->tx.ring) if (q_vector->tx.ring)
adapter->tx_ring[q_vector->tx.ring->queue_index] = NULL; adapter->tx_ring[q_vector->tx.ring->queue_index] = NULL;
if (q_vector->rx.ring) if (q_vector->rx.ring)
adapter->tx_ring[q_vector->rx.ring->queue_index] = NULL; adapter->tx_ring[q_vector->rx.ring->queue_index] = NULL;
adapter->q_vector[v_idx] = NULL;
netif_napi_del(&q_vector->napi); netif_napi_del(&q_vector->napi);
/* igb_get_stats64() might access the rings on this vector, }
* we must wait a grace period before freeing it.
*/ static void igb_reset_interrupt_capability(struct igb_adapter *adapter)
kfree_rcu(q_vector, rcu); {
int v_idx = adapter->num_q_vectors;
if (adapter->flags & IGB_FLAG_HAS_MSIX)
pci_disable_msix(adapter->pdev);
else if (adapter->flags & IGB_FLAG_HAS_MSI)
pci_disable_msi(adapter->pdev);
while (v_idx--)
igb_reset_q_vector(adapter, v_idx);
} }
/** /**
...@@ -1038,8 +1053,10 @@ static void igb_free_q_vectors(struct igb_adapter *adapter) ...@@ -1038,8 +1053,10 @@ static void igb_free_q_vectors(struct igb_adapter *adapter)
adapter->num_rx_queues = 0; adapter->num_rx_queues = 0;
adapter->num_q_vectors = 0; adapter->num_q_vectors = 0;
while (v_idx--) while (v_idx--) {
igb_reset_q_vector(adapter, v_idx);
igb_free_q_vector(adapter, v_idx); igb_free_q_vector(adapter, v_idx);
}
} }
/** /**
...@@ -1070,6 +1087,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix) ...@@ -1070,6 +1087,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
if (!msix) if (!msix)
goto msi_only; goto msi_only;
adapter->flags |= IGB_FLAG_HAS_MSIX;
/* Number of supported queues. */ /* Number of supported queues. */
adapter->num_rx_queues = adapter->rss_queues; adapter->num_rx_queues = adapter->rss_queues;
...@@ -1090,12 +1108,6 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix) ...@@ -1090,12 +1108,6 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
/* add 1 vector for link status interrupts */ /* add 1 vector for link status interrupts */
numvecs++; numvecs++;
adapter->msix_entries = kcalloc(numvecs, sizeof(struct msix_entry),
GFP_KERNEL);
if (!adapter->msix_entries)
goto msi_only;
for (i = 0; i < numvecs; i++) for (i = 0; i < numvecs; i++)
adapter->msix_entries[i].entry = i; adapter->msix_entries[i].entry = i;
...@@ -1172,7 +1184,9 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter, ...@@ -1172,7 +1184,9 @@ static int igb_alloc_q_vector(struct igb_adapter *adapter,
(sizeof(struct igb_ring) * ring_count); (sizeof(struct igb_ring) * ring_count);
/* allocate q_vector and rings */ /* allocate q_vector and rings */
q_vector = kzalloc(size, GFP_KERNEL); q_vector = adapter->q_vector[v_idx];
if (!q_vector)
q_vector = kzalloc(size, GFP_KERNEL);
if (!q_vector) if (!q_vector)
return -ENOMEM; return -ENOMEM;
...@@ -1370,7 +1384,7 @@ static int igb_request_irq(struct igb_adapter *adapter) ...@@ -1370,7 +1384,7 @@ static int igb_request_irq(struct igb_adapter *adapter)
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
int err = 0; int err = 0;
if (adapter->msix_entries) { if (adapter->flags & IGB_FLAG_HAS_MSIX) {
err = igb_request_msix(adapter); err = igb_request_msix(adapter);
if (!err) if (!err)
goto request_done; goto request_done;
...@@ -1414,7 +1428,7 @@ static int igb_request_irq(struct igb_adapter *adapter) ...@@ -1414,7 +1428,7 @@ static int igb_request_irq(struct igb_adapter *adapter)
static void igb_free_irq(struct igb_adapter *adapter) static void igb_free_irq(struct igb_adapter *adapter)
{ {
if (adapter->msix_entries) { if (adapter->flags & IGB_FLAG_HAS_MSIX) {
int vector = 0, i; int vector = 0, i;
free_irq(adapter->msix_entries[vector++].vector, adapter); free_irq(adapter->msix_entries[vector++].vector, adapter);
...@@ -1439,7 +1453,7 @@ static void igb_irq_disable(struct igb_adapter *adapter) ...@@ -1439,7 +1453,7 @@ static void igb_irq_disable(struct igb_adapter *adapter)
* mapped into these registers and so clearing the bits can cause * mapped into these registers and so clearing the bits can cause
* issues on the VF drivers so we only need to clear what we set * issues on the VF drivers so we only need to clear what we set
*/ */
if (adapter->msix_entries) { if (adapter->flags & IGB_FLAG_HAS_MSIX) {
u32 regval = rd32(E1000_EIAM); u32 regval = rd32(E1000_EIAM);
wr32(E1000_EIAM, regval & ~adapter->eims_enable_mask); wr32(E1000_EIAM, regval & ~adapter->eims_enable_mask);
wr32(E1000_EIMC, adapter->eims_enable_mask); wr32(E1000_EIMC, adapter->eims_enable_mask);
...@@ -1450,7 +1464,7 @@ static void igb_irq_disable(struct igb_adapter *adapter) ...@@ -1450,7 +1464,7 @@ static void igb_irq_disable(struct igb_adapter *adapter)
wr32(E1000_IAM, 0); wr32(E1000_IAM, 0);
wr32(E1000_IMC, ~0); wr32(E1000_IMC, ~0);
wrfl(); wrfl();
if (adapter->msix_entries) { if (adapter->flags & IGB_FLAG_HAS_MSIX) {
int i; int i;
for (i = 0; i < adapter->num_q_vectors; i++) for (i = 0; i < adapter->num_q_vectors; i++)
synchronize_irq(adapter->msix_entries[i].vector); synchronize_irq(adapter->msix_entries[i].vector);
...@@ -1467,7 +1481,7 @@ static void igb_irq_enable(struct igb_adapter *adapter) ...@@ -1467,7 +1481,7 @@ static void igb_irq_enable(struct igb_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
if (adapter->msix_entries) { if (adapter->flags & IGB_FLAG_HAS_MSIX) {
u32 ims = E1000_IMS_LSC | E1000_IMS_DOUTSYNC | E1000_IMS_DRSTA; u32 ims = E1000_IMS_LSC | E1000_IMS_DOUTSYNC | E1000_IMS_DRSTA;
u32 regval = rd32(E1000_EIAC); u32 regval = rd32(E1000_EIAC);
wr32(E1000_EIAC, regval | adapter->eims_enable_mask); wr32(E1000_EIAC, regval | adapter->eims_enable_mask);
...@@ -1690,7 +1704,7 @@ int igb_up(struct igb_adapter *adapter) ...@@ -1690,7 +1704,7 @@ int igb_up(struct igb_adapter *adapter)
for (i = 0; i < adapter->num_q_vectors; i++) for (i = 0; i < adapter->num_q_vectors; i++)
napi_enable(&(adapter->q_vector[i]->napi)); napi_enable(&(adapter->q_vector[i]->napi));
if (adapter->msix_entries) if (adapter->flags & IGB_FLAG_HAS_MSIX)
igb_configure_msix(adapter); igb_configure_msix(adapter);
else else
igb_assign_vector(adapter->q_vector[0], 0); igb_assign_vector(adapter->q_vector[0], 0);
...@@ -2543,7 +2557,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2543,7 +2557,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dev_info(&pdev->dev, "%s: PBA No: %s\n", netdev->name, part_str); dev_info(&pdev->dev, "%s: PBA No: %s\n", netdev->name, part_str);
dev_info(&pdev->dev, dev_info(&pdev->dev,
"Using %s interrupts. %d rx queue(s), %d tx queue(s)\n", "Using %s interrupts. %d rx queue(s), %d tx queue(s)\n",
adapter->msix_entries ? "MSI-X" : (adapter->flags & IGB_FLAG_HAS_MSIX) ? "MSI-X" :
(adapter->flags & IGB_FLAG_HAS_MSI) ? "MSI" : "legacy", (adapter->flags & IGB_FLAG_HAS_MSI) ? "MSI" : "legacy",
adapter->num_rx_queues, adapter->num_tx_queues); adapter->num_rx_queues, adapter->num_tx_queues);
switch (hw->mac.type) { switch (hw->mac.type) {
...@@ -2631,7 +2645,7 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs) ...@@ -2631,7 +2645,7 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs)
int err = 0; int err = 0;
int i; int i;
if (!adapter->msix_entries || num_vfs > 7) { if (!(adapter->flags & IGB_FLAG_HAS_MSIX) || num_vfs > 7) {
err = -EPERM; err = -EPERM;
goto out; goto out;
} }
...@@ -4251,7 +4265,7 @@ static void igb_watchdog_task(struct work_struct *work) ...@@ -4251,7 +4265,7 @@ static void igb_watchdog_task(struct work_struct *work)
} }
/* Cause software interrupt to ensure Rx ring is cleaned */ /* Cause software interrupt to ensure Rx ring is cleaned */
if (adapter->msix_entries) { if (adapter->flags & IGB_FLAG_HAS_MSIX) {
u32 eics = 0; u32 eics = 0;
for (i = 0; i < adapter->num_q_vectors; i++) for (i = 0; i < adapter->num_q_vectors; i++)
eics |= adapter->q_vector[i]->eims_value; eics |= adapter->q_vector[i]->eims_value;
...@@ -6172,7 +6186,7 @@ static void igb_ring_irq_enable(struct igb_q_vector *q_vector) ...@@ -6172,7 +6186,7 @@ static void igb_ring_irq_enable(struct igb_q_vector *q_vector)
} }
if (!test_bit(__IGB_DOWN, &adapter->state)) { if (!test_bit(__IGB_DOWN, &adapter->state)) {
if (adapter->msix_entries) if (adapter->flags & IGB_FLAG_HAS_MSIX)
wr32(E1000_EIMS, q_vector->eims_value); wr32(E1000_EIMS, q_vector->eims_value);
else else
igb_irq_enable(adapter); igb_irq_enable(adapter);
...@@ -7539,7 +7553,7 @@ static void igb_netpoll(struct net_device *netdev) ...@@ -7539,7 +7553,7 @@ static void igb_netpoll(struct net_device *netdev)
for (i = 0; i < adapter->num_q_vectors; i++) { for (i = 0; i < adapter->num_q_vectors; i++) {
q_vector = adapter->q_vector[i]; q_vector = adapter->q_vector[i];
if (adapter->msix_entries) if (adapter->flags & IGB_FLAG_HAS_MSIX)
wr32(E1000_EIMC, q_vector->eims_value); wr32(E1000_EIMC, q_vector->eims_value);
else else
igb_irq_disable(adapter); igb_irq_disable(adapter);
...@@ -8037,7 +8051,7 @@ int igb_reinit_queues(struct igb_adapter *adapter) ...@@ -8037,7 +8051,7 @@ int igb_reinit_queues(struct igb_adapter *adapter)
if (netif_running(netdev)) if (netif_running(netdev))
igb_close(netdev); igb_close(netdev);
igb_clear_interrupt_scheme(adapter); igb_reset_interrupt_capability(adapter);
if (igb_init_interrupt_scheme(adapter, true)) { if (igb_init_interrupt_scheme(adapter, true)) {
dev_err(&pdev->dev, "Unable to allocate memory for queues\n"); dev_err(&pdev->dev, "Unable to allocate memory for queues\n");
......
...@@ -552,8 +552,10 @@ struct hwmon_attr { ...@@ -552,8 +552,10 @@ struct hwmon_attr {
}; };
struct hwmon_buff { struct hwmon_buff {
struct device *device; struct attribute_group group;
struct hwmon_attr *hwmon_list; const struct attribute_group *groups[2];
struct attribute *attrs[IXGBE_MAX_SENSORS * 4 + 1];
struct hwmon_attr hwmon_list[IXGBE_MAX_SENSORS * 4];
unsigned int n_hwmon; unsigned int n_hwmon;
}; };
#endif /* CONFIG_IXGBE_HWMON */ #endif /* CONFIG_IXGBE_HWMON */
...@@ -775,7 +777,7 @@ struct ixgbe_adapter { ...@@ -775,7 +777,7 @@ struct ixgbe_adapter {
u32 vferr_refcount; u32 vferr_refcount;
struct kobject *info_kobj; struct kobject *info_kobj;
#ifdef CONFIG_IXGBE_HWMON #ifdef CONFIG_IXGBE_HWMON
struct hwmon_buff ixgbe_hwmon_buff; struct hwmon_buff *ixgbe_hwmon_buff;
#endif /* CONFIG_IXGBE_HWMON */ #endif /* CONFIG_IXGBE_HWMON */
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct dentry *ixgbe_dbg_adapter; struct dentry *ixgbe_dbg_adapter;
......
...@@ -111,29 +111,29 @@ static int ixgbe_add_hwmon_attr(struct ixgbe_adapter *adapter, ...@@ -111,29 +111,29 @@ static int ixgbe_add_hwmon_attr(struct ixgbe_adapter *adapter,
unsigned int n_attr; unsigned int n_attr;
struct hwmon_attr *ixgbe_attr; struct hwmon_attr *ixgbe_attr;
n_attr = adapter->ixgbe_hwmon_buff.n_hwmon; n_attr = adapter->ixgbe_hwmon_buff->n_hwmon;
ixgbe_attr = &adapter->ixgbe_hwmon_buff.hwmon_list[n_attr]; ixgbe_attr = &adapter->ixgbe_hwmon_buff->hwmon_list[n_attr];
switch (type) { switch (type) {
case IXGBE_HWMON_TYPE_LOC: case IXGBE_HWMON_TYPE_LOC:
ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_location; ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_location;
snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name), snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name),
"temp%u_label", offset); "temp%u_label", offset + 1);
break; break;
case IXGBE_HWMON_TYPE_TEMP: case IXGBE_HWMON_TYPE_TEMP:
ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_temp; ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_temp;
snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name), snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name),
"temp%u_input", offset); "temp%u_input", offset + 1);
break; break;
case IXGBE_HWMON_TYPE_CAUTION: case IXGBE_HWMON_TYPE_CAUTION:
ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_cautionthresh; ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_cautionthresh;
snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name), snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name),
"temp%u_max", offset); "temp%u_max", offset + 1);
break; break;
case IXGBE_HWMON_TYPE_MAX: case IXGBE_HWMON_TYPE_MAX:
ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_maxopthresh; ixgbe_attr->dev_attr.show = ixgbe_hwmon_show_maxopthresh;
snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name), snprintf(ixgbe_attr->name, sizeof(ixgbe_attr->name),
"temp%u_crit", offset); "temp%u_crit", offset + 1);
break; break;
default: default:
rc = -EPERM; rc = -EPERM;
...@@ -147,32 +147,17 @@ static int ixgbe_add_hwmon_attr(struct ixgbe_adapter *adapter, ...@@ -147,32 +147,17 @@ static int ixgbe_add_hwmon_attr(struct ixgbe_adapter *adapter,
ixgbe_attr->dev_attr.store = NULL; ixgbe_attr->dev_attr.store = NULL;
ixgbe_attr->dev_attr.attr.mode = S_IRUGO; ixgbe_attr->dev_attr.attr.mode = S_IRUGO;
ixgbe_attr->dev_attr.attr.name = ixgbe_attr->name; ixgbe_attr->dev_attr.attr.name = ixgbe_attr->name;
sysfs_attr_init(&ixgbe_attr->dev_attr.attr);
rc = device_create_file(&adapter->pdev->dev, adapter->ixgbe_hwmon_buff->attrs[n_attr] = &ixgbe_attr->dev_attr.attr;
&ixgbe_attr->dev_attr);
if (rc == 0) ++adapter->ixgbe_hwmon_buff->n_hwmon;
++adapter->ixgbe_hwmon_buff.n_hwmon;
return rc; return 0;
} }
static void ixgbe_sysfs_del_adapter(struct ixgbe_adapter *adapter) static void ixgbe_sysfs_del_adapter(struct ixgbe_adapter *adapter)
{ {
int i;
if (adapter == NULL)
return;
for (i = 0; i < adapter->ixgbe_hwmon_buff.n_hwmon; i++) {
device_remove_file(&adapter->pdev->dev,
&adapter->ixgbe_hwmon_buff.hwmon_list[i].dev_attr);
}
kfree(adapter->ixgbe_hwmon_buff.hwmon_list);
if (adapter->ixgbe_hwmon_buff.device)
hwmon_device_unregister(adapter->ixgbe_hwmon_buff.device);
} }
/* called from ixgbe_main.c */ /* called from ixgbe_main.c */
...@@ -184,9 +169,9 @@ void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter) ...@@ -184,9 +169,9 @@ void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter)
/* called from ixgbe_main.c */ /* called from ixgbe_main.c */
int ixgbe_sysfs_init(struct ixgbe_adapter *adapter) int ixgbe_sysfs_init(struct ixgbe_adapter *adapter)
{ {
struct hwmon_buff *ixgbe_hwmon = &adapter->ixgbe_hwmon_buff; struct hwmon_buff *ixgbe_hwmon;
struct device *hwmon_dev;
unsigned int i; unsigned int i;
int n_attrs;
int rc = 0; int rc = 0;
/* If this method isn't defined we don't support thermals */ /* If this method isn't defined we don't support thermals */
...@@ -198,23 +183,13 @@ int ixgbe_sysfs_init(struct ixgbe_adapter *adapter) ...@@ -198,23 +183,13 @@ int ixgbe_sysfs_init(struct ixgbe_adapter *adapter)
if (adapter->hw.mac.ops.init_thermal_sensor_thresh(&adapter->hw)) if (adapter->hw.mac.ops.init_thermal_sensor_thresh(&adapter->hw))
goto exit; goto exit;
/* ixgbe_hwmon = devm_kzalloc(&adapter->pdev->dev, sizeof(*ixgbe_hwmon),
* Allocation space for max attributs GFP_KERNEL);
* max num sensors * values (loc, temp, max, caution) if (ixgbe_hwmon == NULL) {
*/
n_attrs = IXGBE_MAX_SENSORS * 4;
ixgbe_hwmon->hwmon_list = kcalloc(n_attrs, sizeof(struct hwmon_attr),
GFP_KERNEL);
if (!ixgbe_hwmon->hwmon_list) {
rc = -ENOMEM; rc = -ENOMEM;
goto err; goto exit;
}
ixgbe_hwmon->device = hwmon_device_register(&adapter->pdev->dev);
if (IS_ERR(ixgbe_hwmon->device)) {
rc = PTR_ERR(ixgbe_hwmon->device);
goto err;
} }
adapter->ixgbe_hwmon_buff = ixgbe_hwmon;
for (i = 0; i < IXGBE_MAX_SENSORS; i++) { for (i = 0; i < IXGBE_MAX_SENSORS; i++) {
/* /*
...@@ -226,17 +201,28 @@ int ixgbe_sysfs_init(struct ixgbe_adapter *adapter) ...@@ -226,17 +201,28 @@ int ixgbe_sysfs_init(struct ixgbe_adapter *adapter)
/* Bail if any hwmon attr struct fails to initialize */ /* Bail if any hwmon attr struct fails to initialize */
rc = ixgbe_add_hwmon_attr(adapter, i, IXGBE_HWMON_TYPE_CAUTION); rc = ixgbe_add_hwmon_attr(adapter, i, IXGBE_HWMON_TYPE_CAUTION);
rc |= ixgbe_add_hwmon_attr(adapter, i, IXGBE_HWMON_TYPE_LOC);
rc |= ixgbe_add_hwmon_attr(adapter, i, IXGBE_HWMON_TYPE_TEMP);
rc |= ixgbe_add_hwmon_attr(adapter, i, IXGBE_HWMON_TYPE_MAX);
if (rc) if (rc)
goto err; goto exit;
rc = ixgbe_add_hwmon_attr(adapter, i, IXGBE_HWMON_TYPE_LOC);
if (rc)
goto exit;
rc = ixgbe_add_hwmon_attr(adapter, i, IXGBE_HWMON_TYPE_TEMP);
if (rc)
goto exit;
rc = ixgbe_add_hwmon_attr(adapter, i, IXGBE_HWMON_TYPE_MAX);
if (rc)
goto exit;
} }
goto exit; ixgbe_hwmon->groups[0] = &ixgbe_hwmon->group;
ixgbe_hwmon->group.attrs = ixgbe_hwmon->attrs;
err: hwmon_dev = devm_hwmon_device_register_with_groups(&adapter->pdev->dev,
ixgbe_sysfs_del_adapter(adapter); "ixgbe",
ixgbe_hwmon,
ixgbe_hwmon->groups);
if (IS_ERR(hwmon_dev))
rc = PTR_ERR(hwmon_dev);
exit: exit:
return rc; return rc;
} }
......
...@@ -354,6 +354,7 @@ struct ixgbevf_adapter { ...@@ -354,6 +354,7 @@ struct ixgbevf_adapter {
u32 flags; u32 flags;
#define IXGBE_FLAG_IN_WATCHDOG_TASK (u32)(1) #define IXGBE_FLAG_IN_WATCHDOG_TASK (u32)(1)
#define IXGBE_FLAG_IN_NETPOLL (u32)(1 << 1) #define IXGBE_FLAG_IN_NETPOLL (u32)(1 << 1)
#define IXGBEVF_FLAG_QUEUE_RESET_REQUESTED (u32)(1 << 2)
/* OS defined structs */ /* OS defined structs */
struct net_device *netdev; struct net_device *netdev;
......
...@@ -95,6 +95,7 @@ module_param(debug, int, 0); ...@@ -95,6 +95,7 @@ module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
/* forward decls */ /* forward decls */
static void ixgbevf_queue_reset_subtask(struct ixgbevf_adapter *adapter);
static void ixgbevf_set_itr(struct ixgbevf_q_vector *q_vector); static void ixgbevf_set_itr(struct ixgbevf_q_vector *q_vector);
static void ixgbevf_free_all_rx_resources(struct ixgbevf_adapter *adapter); static void ixgbevf_free_all_rx_resources(struct ixgbevf_adapter *adapter);
...@@ -1368,11 +1369,51 @@ static void ixgbevf_napi_disable_all(struct ixgbevf_adapter *adapter) ...@@ -1368,11 +1369,51 @@ static void ixgbevf_napi_disable_all(struct ixgbevf_adapter *adapter)
} }
} }
static int ixgbevf_configure_dcb(struct ixgbevf_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
unsigned int def_q = 0;
unsigned int num_tcs = 0;
unsigned int num_rx_queues = 1;
int err;
spin_lock_bh(&adapter->mbx_lock);
/* fetch queue configuration from the PF */
err = ixgbevf_get_queues(hw, &num_tcs, &def_q);
spin_unlock_bh(&adapter->mbx_lock);
if (err)
return err;
if (num_tcs > 1) {
/* update default Tx ring register index */
adapter->tx_ring[0].reg_idx = def_q;
/* we need as many queues as traffic classes */
num_rx_queues = num_tcs;
}
/* if we have a bad config abort request queue reset */
if (adapter->num_rx_queues != num_rx_queues) {
/* force mailbox timeout to prevent further messages */
hw->mbx.timeout = 0;
/* wait for watchdog to come around and bail us out */
adapter->flags |= IXGBEVF_FLAG_QUEUE_RESET_REQUESTED;
}
return 0;
}
static void ixgbevf_configure(struct ixgbevf_adapter *adapter) static void ixgbevf_configure(struct ixgbevf_adapter *adapter)
{ {
struct net_device *netdev = adapter->netdev; struct net_device *netdev = adapter->netdev;
int i; int i;
ixgbevf_configure_dcb(adapter);
ixgbevf_set_rx_mode(netdev); ixgbevf_set_rx_mode(netdev);
ixgbevf_restore_vlan(adapter); ixgbevf_restore_vlan(adapter);
...@@ -1551,85 +1592,10 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter) ...@@ -1551,85 +1592,10 @@ static void ixgbevf_up_complete(struct ixgbevf_adapter *adapter)
mod_timer(&adapter->watchdog_timer, jiffies); mod_timer(&adapter->watchdog_timer, jiffies);
} }
static int ixgbevf_reset_queues(struct ixgbevf_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
struct ixgbevf_ring *rx_ring;
unsigned int def_q = 0;
unsigned int num_tcs = 0;
unsigned int num_rx_queues = 1;
int err, i;
spin_lock_bh(&adapter->mbx_lock);
/* fetch queue configuration from the PF */
err = ixgbevf_get_queues(hw, &num_tcs, &def_q);
spin_unlock_bh(&adapter->mbx_lock);
if (err)
return err;
if (num_tcs > 1) {
/* update default Tx ring register index */
adapter->tx_ring[0].reg_idx = def_q;
/* we need as many queues as traffic classes */
num_rx_queues = num_tcs;
}
/* nothing to do if we have the correct number of queues */
if (adapter->num_rx_queues == num_rx_queues)
return 0;
/* allocate new rings */
rx_ring = kcalloc(num_rx_queues,
sizeof(struct ixgbevf_ring), GFP_KERNEL);
if (!rx_ring)
return -ENOMEM;
/* setup ring fields */
for (i = 0; i < num_rx_queues; i++) {
rx_ring[i].count = adapter->rx_ring_count;
rx_ring[i].queue_index = i;
rx_ring[i].reg_idx = i;
rx_ring[i].dev = &adapter->pdev->dev;
rx_ring[i].netdev = adapter->netdev;
/* allocate resources on the ring */
err = ixgbevf_setup_rx_resources(adapter, &rx_ring[i]);
if (err) {
while (i) {
i--;
ixgbevf_free_rx_resources(adapter, &rx_ring[i]);
}
kfree(rx_ring);
return err;
}
}
/* free the existing rings and queues */
ixgbevf_free_all_rx_resources(adapter);
adapter->num_rx_queues = 0;
kfree(adapter->rx_ring);
/* move new rings into position on the adapter struct */
adapter->rx_ring = rx_ring;
adapter->num_rx_queues = num_rx_queues;
/* reset ring to vector mapping */
ixgbevf_reset_q_vectors(adapter);
ixgbevf_map_rings_to_vectors(adapter);
return 0;
}
void ixgbevf_up(struct ixgbevf_adapter *adapter) void ixgbevf_up(struct ixgbevf_adapter *adapter)
{ {
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
ixgbevf_reset_queues(adapter);
ixgbevf_configure(adapter); ixgbevf_configure(adapter);
ixgbevf_up_complete(adapter); ixgbevf_up_complete(adapter);
...@@ -1875,9 +1841,28 @@ static int ixgbevf_acquire_msix_vectors(struct ixgbevf_adapter *adapter, ...@@ -1875,9 +1841,28 @@ static int ixgbevf_acquire_msix_vectors(struct ixgbevf_adapter *adapter,
**/ **/
static void ixgbevf_set_num_queues(struct ixgbevf_adapter *adapter) static void ixgbevf_set_num_queues(struct ixgbevf_adapter *adapter)
{ {
struct ixgbe_hw *hw = &adapter->hw;
unsigned int def_q = 0;
unsigned int num_tcs = 0;
int err;
/* Start with base case */ /* Start with base case */
adapter->num_rx_queues = 1; adapter->num_rx_queues = 1;
adapter->num_tx_queues = 1; adapter->num_tx_queues = 1;
spin_lock_bh(&adapter->mbx_lock);
/* fetch queue configuration from the PF */
err = ixgbevf_get_queues(hw, &num_tcs, &def_q);
spin_unlock_bh(&adapter->mbx_lock);
if (err)
return;
/* we need as many queues as traffic classes */
if (num_tcs > 1)
adapter->num_rx_queues = num_tcs;
} }
/** /**
...@@ -2326,6 +2311,8 @@ static void ixgbevf_watchdog_task(struct work_struct *work) ...@@ -2326,6 +2311,8 @@ static void ixgbevf_watchdog_task(struct work_struct *work)
bool link_up = adapter->link_up; bool link_up = adapter->link_up;
s32 need_reset; s32 need_reset;
ixgbevf_queue_reset_subtask(adapter);
adapter->flags |= IXGBE_FLAG_IN_WATCHDOG_TASK; adapter->flags |= IXGBE_FLAG_IN_WATCHDOG_TASK;
/* /*
...@@ -2595,63 +2582,6 @@ static void ixgbevf_free_all_rx_resources(struct ixgbevf_adapter *adapter) ...@@ -2595,63 +2582,6 @@ static void ixgbevf_free_all_rx_resources(struct ixgbevf_adapter *adapter)
&adapter->rx_ring[i]); &adapter->rx_ring[i]);
} }
static int ixgbevf_setup_queues(struct ixgbevf_adapter *adapter)
{
struct ixgbe_hw *hw = &adapter->hw;
struct ixgbevf_ring *rx_ring;
unsigned int def_q = 0;
unsigned int num_tcs = 0;
unsigned int num_rx_queues = 1;
int err, i;
spin_lock_bh(&adapter->mbx_lock);
/* fetch queue configuration from the PF */
err = ixgbevf_get_queues(hw, &num_tcs, &def_q);
spin_unlock_bh(&adapter->mbx_lock);
if (err)
return err;
if (num_tcs > 1) {
/* update default Tx ring register index */
adapter->tx_ring[0].reg_idx = def_q;
/* we need as many queues as traffic classes */
num_rx_queues = num_tcs;
}
/* nothing to do if we have the correct number of queues */
if (adapter->num_rx_queues == num_rx_queues)
return 0;
/* allocate new rings */
rx_ring = kcalloc(num_rx_queues,
sizeof(struct ixgbevf_ring), GFP_KERNEL);
if (!rx_ring)
return -ENOMEM;
/* setup ring fields */
for (i = 0; i < num_rx_queues; i++) {
rx_ring[i].count = adapter->rx_ring_count;
rx_ring[i].queue_index = i;
rx_ring[i].reg_idx = i;
rx_ring[i].dev = &adapter->pdev->dev;
rx_ring[i].netdev = adapter->netdev;
}
/* free the existing ring and queues */
adapter->num_rx_queues = 0;
kfree(adapter->rx_ring);
/* move new rings into position on the adapter struct */
adapter->rx_ring = rx_ring;
adapter->num_rx_queues = num_rx_queues;
return 0;
}
/** /**
* ixgbevf_open - Called when a network interface is made active * ixgbevf_open - Called when a network interface is made active
* @netdev: network interface device structure * @netdev: network interface device structure
...@@ -2695,11 +2625,6 @@ static int ixgbevf_open(struct net_device *netdev) ...@@ -2695,11 +2625,6 @@ static int ixgbevf_open(struct net_device *netdev)
} }
} }
/* setup queue reg_idx and Rx queue count */
err = ixgbevf_setup_queues(adapter);
if (err)
goto err_setup_queues;
/* allocate transmit descriptors */ /* allocate transmit descriptors */
err = ixgbevf_setup_all_tx_resources(adapter); err = ixgbevf_setup_all_tx_resources(adapter);
if (err) if (err)
...@@ -2737,7 +2662,6 @@ static int ixgbevf_open(struct net_device *netdev) ...@@ -2737,7 +2662,6 @@ static int ixgbevf_open(struct net_device *netdev)
ixgbevf_free_all_rx_resources(adapter); ixgbevf_free_all_rx_resources(adapter);
err_setup_tx: err_setup_tx:
ixgbevf_free_all_tx_resources(adapter); ixgbevf_free_all_tx_resources(adapter);
err_setup_queues:
ixgbevf_reset(adapter); ixgbevf_reset(adapter);
err_setup_reset: err_setup_reset:
...@@ -2769,6 +2693,34 @@ static int ixgbevf_close(struct net_device *netdev) ...@@ -2769,6 +2693,34 @@ static int ixgbevf_close(struct net_device *netdev)
return 0; return 0;
} }
static void ixgbevf_queue_reset_subtask(struct ixgbevf_adapter *adapter)
{
struct net_device *dev = adapter->netdev;
if (!(adapter->flags & IXGBEVF_FLAG_QUEUE_RESET_REQUESTED))
return;
adapter->flags &= ~IXGBEVF_FLAG_QUEUE_RESET_REQUESTED;
/* if interface is down do nothing */
if (test_bit(__IXGBEVF_DOWN, &adapter->state) ||
test_bit(__IXGBEVF_RESETTING, &adapter->state))
return;
/* Hardware has to reinitialize queues and interrupts to
* match packet buffer alignment. Unfortunately, the
* hardware is not flexible enough to do this dynamically.
*/
if (netif_running(dev))
ixgbevf_close(dev);
ixgbevf_clear_interrupt_scheme(adapter);
ixgbevf_init_interrupt_scheme(adapter);
if (netif_running(dev))
ixgbevf_open(dev);
}
static void ixgbevf_tx_ctxtdesc(struct ixgbevf_ring *tx_ring, static void ixgbevf_tx_ctxtdesc(struct ixgbevf_ring *tx_ring,
u32 vlan_macip_lens, u32 type_tucmd, u32 vlan_macip_lens, u32 type_tucmd,
u32 mss_l4len_idx) u32 mss_l4len_idx)
......
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