Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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


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
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@
#include "i40e_adminq.h"
#include "i40e_prototype.h"

static void i40e_resume_aq(struct i40e_hw *hw);

/**
 *  i40e_adminq_init_regs - Initialize AdminQ registers
 *  @hw: pointer to the hardware structure
@@ -675,7 +677,7 @@ static u16 i40e_clean_asq(struct i40e_hw *hw)
 *  Returns true if the firmware has processed all descriptors on the
 *  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
	 * timing reliability than DD bit
@@ -963,7 +965,7 @@ i40e_status i40e_clean_arq_element(struct i40e_hw *hw,
	return ret_code;
}

void i40e_resume_aq(struct i40e_hw *hw)
static void i40e_resume_aq(struct i40e_hw *hw)
{
	u32 reg = 0;

+0 −80
Original line number Diff line number Diff line
@@ -1128,86 +1128,6 @@ i40e_status i40e_aq_remove_macvlan(struct i40e_hw *hw, u16 seid,
	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
 * @hw: pointer to the hardware structure
+42 −90
Original line number Diff line number Diff line
@@ -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
 * @seid: the seid the user put in
 **/
@@ -707,8 +707,13 @@ static void i40e_dbg_dump_aq_desc(struct i40e_pf *pf)
{
	struct i40e_adminq_ring *ring;
	struct i40e_hw *hw = &pf->hw;
	char hdr[32];
	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 */
	dev_info(&pf->pdev->dev, "AdminQ Tx Ring\n");
	ring = &(hw->aq.asq);
@@ -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",
			 i, d->flags, d->opcode, d->datalen, d->retval,
			 d->cookie_high, d->cookie_low);
		dev_info(&pf->pdev->dev,
			 "            %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
			 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]);
		print_hex_dump(KERN_INFO, hdr, DUMP_PREFIX_NONE,
			       16, 1, d->params.raw, 16, 0);
	}

	dev_info(&pf->pdev->dev, "AdminQ Rx Ring\n");
@@ -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",
			 i, d->flags, d->opcode, d->datalen, d->retval,
			 d->cookie_high, d->cookie_low);
		dev_info(&pf->pdev->dev,
			 "            %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
			 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]);
		print_hex_dump(KERN_INFO, hdr, DUMP_PREFIX_NONE,
			       16, 1, d->params.raw, 16, 0);
	}
}

@@ -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);
	if (!vsi) {
		dev_info(&pf->pdev->dev,
			 "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");
		dev_info(&pf->pdev->dev, "vsi %d not found\n", vsi_seid);
		return;
	}
	if (ring_id >= vsi->num_queue_pairs || ring_id < 0) {
		dev_info(&pf->pdev->dev, "ring %d not found\n", ring_id);
		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;
	}
	if (!vsi->tx_rings) {
		dev_info(&pf->pdev->dev,
			 "descriptor rings have not been allocated for vsi %d\n",
			 vsi_seid);
		return;
	}
	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,
				 desc_n, ds->read.pkt_addr, ds->read.hdr_addr,
				 ds->read.rsvd1, ds->read.rsvd2);
	} else {
		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");
		dev_info(&pf->pdev->dev, "dump desc rx/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)

	veb = i40e_dbg_find_veb(pf, seid);
	if (!veb) {
		dev_info(&pf->pdev->dev,
			 "%d: can't find veb\n", seid);
		dev_info(&pf->pdev->dev, "can't find veb %d\n", seid);
		return;
	}
	dev_info(&pf->pdev->dev,
@@ -1022,8 +1008,6 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
	char *cmd_buf, *cmd_buf_tmp;
	int bytes_not_copied;
	struct i40e_vsi *vsi;
	u8 *print_buf_start;
	u8 *print_buf;
	int vsi_seid;
	int veb_seid;
	int cnt;
@@ -1048,11 +1032,6 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
		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) {
		vsi_seid = -1;
		cnt = sscanf(&cmd_buf[7], "%i", &vsi_seid);
@@ -1479,7 +1458,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
	} else if (strncmp(cmd_buf, "read", 4) == 0) {
		u32 address;
		u32 value;
		cnt = sscanf(&cmd_buf[4], "%x", &address);
		cnt = sscanf(&cmd_buf[4], "%i", &address);
		if (cnt != 1) {
			dev_info(&pf->pdev->dev, "read <reg>\n");
			goto command_write_done;
@@ -1498,7 +1477,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,

	} else if (strncmp(cmd_buf, "write", 5) == 0) {
		u32 address, value;
		cnt = sscanf(&cmd_buf[5], "%x %x", &address, &value);
		cnt = sscanf(&cmd_buf[5], "%i %i", &address, &value);
		if (cnt != 2) {
			dev_info(&pf->pdev->dev, "write <reg> <value>\n");
			goto command_write_done;
@@ -1516,7 +1495,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
			 address, value);
	} else if (strncmp(cmd_buf, "clear_stats", 11) == 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) {
				int 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,
		if (strncmp(cmd_buf, "add", 3) == 0)
			add = true;
		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.flex_off, &fd_data.pctype,
			     &fd_data.dest_vsi, &fd_data.dest_ctl,
@@ -1592,19 +1571,15 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
		packet_len = min_t(u16,
				   packet_len, I40E_FDIR_MAX_RAW_PACKET_LOOKUP);

		dev_info(&pf->pdev->dev, "FD raw packet:\n");
		for (i = 0; i < packet_len; i++) {
			sscanf(&asc_packet[j], "%2hhx ",
			       &fd_data.raw_packet[i]);
			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);
		if (!ret) {
			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,
		} else if (strncmp(&cmd_buf[5],
			   "get local", 9) == 0) {
			u16 llen, rlen;
			int ret, i;
			int ret;
			u8 *buff;
			buff = kzalloc(I40E_LLDPDU_SIZE, GFP_KERNEL);
			if (!buff)
@@ -1656,22 +1631,15 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
				buff = NULL;
				goto command_write_done;
			}
			dev_info(&pf->pdev->dev,
				 "Get LLDP MIB (local) AQ buffer written back:\n");
			for (i = 0; i < I40E_LLDPDU_SIZE; i++) {
				snprintf(print_buf, 3, "%02x ", buff[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, "LLDP MIB (local)\n");
			print_hex_dump(KERN_INFO, "LLDP MIB (local): ",
				       DUMP_PREFIX_OFFSET, 16, 1,
				       buff, I40E_LLDPDU_SIZE, true);
			kfree(buff);
			buff = NULL;
		} else if (strncmp(&cmd_buf[5], "get remote", 10) == 0) {
			u16 llen, rlen;
			int ret, i;
			int ret;
			u8 *buff;
			buff = kzalloc(I40E_LLDPDU_SIZE, GFP_KERNEL);
			if (!buff)
@@ -1690,17 +1658,10 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
				buff = NULL;
				goto command_write_done;
			}
			dev_info(&pf->pdev->dev,
				 "Get LLDP MIB (remote) AQ buffer written back:\n");
			for (i = 0; i < I40E_LLDPDU_SIZE; i++) {
				snprintf(print_buf, 3, "%02x ", buff[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, "LLDP MIB (remote)\n");
			print_hex_dump(KERN_INFO, "LLDP MIB (remote): ",
				       DUMP_PREFIX_OFFSET, 16, 1,
				       buff, I40E_LLDPDU_SIZE, true);
			kfree(buff);
			buff = NULL;
		} else if (strncmp(&cmd_buf[5], "event on", 8) == 0) {
@@ -1725,7 +1686,7 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
			}
		}
	} else if (strncmp(cmd_buf, "nvm read", 8) == 0) {
		u16 buffer_len, i, bytes;
		u16 buffer_len, bytes;
		u16 module;
		u32 offset;
		u16 *buff;
@@ -1779,16 +1740,10 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
			dev_info(&pf->pdev->dev,
				 "Read NVM module=0x%x offset=0x%x words=%d\n",
				 module, offset, buffer_len);
			for (i = 0; i < buffer_len; i++) {
				if ((i % 16) == 0) {
					snprintf(print_buf, 11, "\n0x%08x: ",
						 offset + i);
					print_buf += 11;
				}
				snprintf(print_buf, 5, "%04x ", buff[i]);
				print_buf += 5;
			}
			dev_info(&pf->pdev->dev, "%s\n", print_buf_start);
			if (buffer_len)
				print_hex_dump(KERN_INFO, "NVM Dump: ",
					DUMP_PREFIX_OFFSET, 16, 2,
					buff, buffer_len, true);
		}
		kfree(buff);
		buff = NULL;
@@ -1832,9 +1787,6 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
command_write_done:
	kfree(cmd_buf);
	cmd_buf = NULL;
	kfree(print_buf_start);
	print_buf = NULL;
	print_buf_start = NULL;
	return count;
}

+3 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ static const char i40e_driver_string[] =

#define DRV_VERSION_MAJOR 0
#define DRV_VERSION_MINOR 3
#define DRV_VERSION_BUILD 13
#define DRV_VERSION_BUILD 14
#define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
	     __stringify(DRV_VERSION_MINOR) "." \
	     __stringify(DRV_VERSION_BUILD)    DRV_KERN
@@ -2489,8 +2489,8 @@ static void i40e_enable_misc_int_causes(struct i40e_hw *hw)
	wr32(hw, I40E_PFINT_ICR0_ENA, val);

	/* SW_ITR_IDX = 0, but don't change INTENA */
	wr32(hw, I40E_PFINT_DYN_CTL0, I40E_PFINT_DYN_CTLN_SW_ITR_INDX_MASK |
					I40E_PFINT_DYN_CTLN_INTENA_MSK_MASK);
	wr32(hw, I40E_PFINT_DYN_CTL0, I40E_PFINT_DYN_CTL0_SW_ITR_INDX_MASK |
					I40E_PFINT_DYN_CTL0_INTENA_MSK_MASK);

	/* OTHER_ITR_IDX = 0 */
	wr32(hw, I40E_PFINT_STAT_CTL0, 0);
+0 −8
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@ i40e_status i40e_asq_send_command(struct i40e_hw *hw,
				void *buff, /* can be NULL */
				u16  buff_size,
				struct i40e_asq_cmd_details *cmd_details);
bool i40e_asq_done(struct i40e_hw *hw);

/* debug function for adminq */
void i40e_debug_aq(struct i40e_hw *hw,
@@ -60,7 +59,6 @@ void i40e_debug_aq(struct i40e_hw *hw,
		   void *buffer);

void i40e_idle_aq(struct i40e_hw *hw);
void i40e_resume_aq(struct i40e_hw *hw);

u32 i40e_led_get(struct i40e_hw *hw);
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,
i40e_status i40e_aq_remove_macvlan(struct i40e_hw *hw, u16 vsi_id,
			struct i40e_aqc_remove_macvlan_element_data *mv_list,
			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,
				u32 v_opcode, u32 v_retval, u8 *msg, u16 msglen,
				struct i40e_asq_cmd_details *cmd_details);
Loading