All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand
@ 2019-07-25  9:53 Tony Nguyen
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 02/12] ice: Fix issues updating VSI MAC filters Tony Nguyen
                   ` (12 more replies)
  0 siblings, 13 replies; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:53 UTC (permalink / raw)
  To: intel-wired-lan

From: Bruce Allan <bruce.w.allan@intel.com>

Users expect ethtool statistics to be updated on-demand when invoking
'ethtool -S <iface>' instead of providing a snapshot of statistics taken
once a second (the frequency of the watchdog task where stats are currently
updated).  Update stats every time 'ethtool -S <iface>' is run.

Also, fix an indentation style issue and an unnecessary local variable
initialization in ice_get_ethtool_stats() discovered while investigating
the subject issue.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice.h         | 2 ++
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 +++++--
 drivers/net/ethernet/intel/ice/ice_main.c    | 6 ++----
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index 0e233b7c40bc..2165366e9250 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -450,6 +450,8 @@ int ice_vsi_setup_tx_rings(struct ice_vsi *vsi);
 int ice_vsi_setup_rx_rings(struct ice_vsi *vsi);
 void ice_set_ethtool_ops(struct net_device *netdev);
 int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx);
+void ice_update_vsi_stats(struct ice_vsi *vsi);
+void ice_update_pf_stats(struct ice_pf *pf);
 int ice_up(struct ice_vsi *vsi);
 int ice_down(struct ice_vsi *vsi);
 int ice_vsi_cfg(struct ice_vsi *vsi);
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index b60bcbcf9bf2..4b2494e7fa78 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -1319,14 +1319,17 @@ ice_get_ethtool_stats(struct net_device *netdev,
 	struct ice_vsi *vsi = np->vsi;
 	struct ice_pf *pf = vsi->back;
 	struct ice_ring *ring;
-	unsigned int j = 0;
+	unsigned int j;
 	int i = 0;
 	char *p;
 
+	ice_update_pf_stats(pf);
+	ice_update_vsi_stats(vsi);
+
 	for (j = 0; j < ICE_VSI_STATS_LEN; j++) {
 		p = (char *)vsi + ice_gstrings_vsi_stats[j].stat_offset;
 		data[i++] = (ice_gstrings_vsi_stats[j].sizeof_stat ==
-			    sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
+			     sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
 	}
 
 	/* populate per queue stats */
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 833f0efc93f9..17358a10866d 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -34,8 +34,6 @@ static const struct net_device_ops ice_netdev_ops;
 static void ice_rebuild(struct ice_pf *pf);
 
 static void ice_vsi_release_all(struct ice_pf *pf);
-static void ice_update_vsi_stats(struct ice_vsi *vsi);
-static void ice_update_pf_stats(struct ice_pf *pf);
 
 /**
  * ice_get_tx_pending - returns number of Tx descriptors not processed
@@ -3290,7 +3288,7 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)
  * ice_update_vsi_stats - Update VSI stats counters
  * @vsi: the VSI to be updated
  */
-static void ice_update_vsi_stats(struct ice_vsi *vsi)
+void ice_update_vsi_stats(struct ice_vsi *vsi)
 {
 	struct rtnl_link_stats64 *cur_ns = &vsi->net_stats;
 	struct ice_eth_stats *cur_es = &vsi->eth_stats;
@@ -3326,7 +3324,7 @@ static void ice_update_vsi_stats(struct ice_vsi *vsi)
  * ice_update_pf_stats - Update PF port stats counters
  * @pf: PF whose stats needs to be updated
  */
-static void ice_update_pf_stats(struct ice_pf *pf)
+void ice_update_pf_stats(struct ice_pf *pf)
 {
 	struct ice_hw_port_stats *prev_ps, *cur_ps;
 	struct ice_hw *hw = &pf->hw;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 02/12] ice: Fix issues updating VSI MAC filters
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
@ 2019-07-25  9:53 ` Tony Nguyen
  2019-07-31 18:10   ` Bowers, AndrewX
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 03/12] ice: Don't allow VSI to remove unassociated ucast filter Tony Nguyen
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:53 UTC (permalink / raw)
  To: intel-wired-lan

From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>

VSI, especially VF could request to add or remove filter for another VSI,
driver should really guide such request and disallow it.
However, instead of returning error for such malicious request, driver
can simply return success.

In addition, we are not tracking number of MAC filters configured per
VF correctly - and this leads to issue updating VF MAC filters whenever
they were removed and re-configured via bringing VF interface down and
up. Also, since VF could send request to update multiple MAC filters at
once, driver should program those filters individually in the switch, in
order to determine which action resulted to error, and communicate
accordingly to the VF.

So, with this changes, we now track number of filters added right from
when VF resources allocation is done, and could properly add filters for
both trusted and non_trusted VFs, without MAC filters mis-match issue in
the switch...

Also refactor code, so that driver can use new function to add or remove
MAC filters.

Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_lib.c      | 30 +++++++++
 drivers/net/ethernet/intel/ice/ice_lib.h      |  4 ++
 drivers/net/ethernet/intel/ice/ice_main.c     | 64 +++++--------------
 .../net/ethernet/intel/ice/ice_virtchnl_pf.c  | 42 ++++++------
 4 files changed, 73 insertions(+), 67 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index aff65333c302..df28597f2e52 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -3211,3 +3211,33 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc)
 	return ret;
 }
 #endif /* CONFIG_DCB */
+
+/**
+ * ice_vsi_cfg_mac_fltr - Add or remove a MAC address filter for a VSI
+ * @vsi: the VSI being configured MAC filter
+ * @macaddr: the MAC address to be added.
+ * @set: Add or delete a MAC filter
+ *
+ * Adds or removes MAC address filter entry for VF VSI
+ */
+enum ice_status
+ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set)
+{
+	LIST_HEAD(tmp_add_list);
+	enum ice_status status;
+
+	 /* Update MAC filter list to be added or removed for a VSI */
+	if (ice_add_mac_to_list(vsi, &tmp_add_list, macaddr)) {
+		status = ICE_ERR_NO_MEMORY;
+		goto cfg_mac_fltr_exit;
+	}
+
+	if (set)
+		status = ice_add_mac(&vsi->back->hw, &tmp_add_list);
+	else
+		status = ice_remove_mac(&vsi->back->hw, &tmp_add_list);
+
+cfg_mac_fltr_exit:
+	ice_free_fltr_list(&vsi->back->pdev->dev, &tmp_add_list);
+	return status;
+}
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h
index 7409a69f631d..0ed111edb7bb 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.h
+++ b/drivers/net/ethernet/intel/ice/ice_lib.h
@@ -95,4 +95,8 @@ void ice_vsi_free_tx_rings(struct ice_vsi *vsi);
 int ice_vsi_manage_rss_lut(struct ice_vsi *vsi, bool ena);
 
 u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran);
+
+enum ice_status
+ice_vsi_cfg_mac_fltr(struct ice_vsi *vsi, const u8 *macaddr, bool set);
+
 #endif /* !_ICE_LIB_H_ */
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 17358a10866d..072771543582 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -116,10 +116,9 @@ static void ice_check_for_hang_subtask(struct ice_pf *pf)
  */
 static int ice_init_mac_fltr(struct ice_pf *pf)
 {
-	LIST_HEAD(tmp_add_list);
+	enum ice_status status;
 	u8 broadcast[ETH_ALEN];
 	struct ice_vsi *vsi;
-	int status;
 
 	vsi = ice_find_vsi_by_type(pf, ICE_VSI_PF);
 	if (!vsi)
@@ -130,8 +129,7 @@ static int ice_init_mac_fltr(struct ice_pf *pf)
 	 */
 
 	 /* Add a unicast MAC filter so the VSI can get its packets */
-	status = ice_add_mac_to_list(vsi, &tmp_add_list,
-				     vsi->port_info->mac.perm_addr);
+	status = ice_vsi_cfg_mac_fltr(vsi, vsi->port_info->mac.perm_addr, true);
 	if (status)
 		goto unregister;
 
@@ -139,18 +137,11 @@ static int ice_init_mac_fltr(struct ice_pf *pf)
 	 * MAC address to the list as well.
 	 */
 	eth_broadcast_addr(broadcast);
-	status = ice_add_mac_to_list(vsi, &tmp_add_list, broadcast);
-	if (status)
-		goto free_mac_list;
-
-	/* Program MAC filters for entries in tmp_add_list */
-	status = ice_add_mac(&pf->hw, &tmp_add_list);
+	status = ice_vsi_cfg_mac_fltr(vsi, broadcast, true);
 	if (status)
-		status = -ENOMEM;
-
-free_mac_list:
-	ice_free_fltr_list(&pf->pdev->dev, &tmp_add_list);
+		goto unregister;
 
+	return 0;
 unregister:
 	/* We aren't useful with no MAC filters, so unregister if we
 	 * had an error
@@ -164,7 +155,7 @@ static int ice_init_mac_fltr(struct ice_pf *pf)
 		vsi->netdev = NULL;
 	}
 
-	return status;
+	return -EIO;
 }
 
 /**
@@ -2870,10 +2861,8 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
 	struct ice_hw *hw = &pf->hw;
 	struct sockaddr *addr = pi;
 	enum ice_status status;
-	LIST_HEAD(a_mac_list);
-	LIST_HEAD(r_mac_list);
 	u8 flags = 0;
-	int err;
+	int err = 0;
 	u8 *mac;
 
 	mac = (u8 *)addr->sa_data;
@@ -2896,42 +2885,23 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
 	/* When we change the MAC address we also have to change the MAC address
 	 * based filter rules that were created previously for the old MAC
 	 * address. So first, we remove the old filter rule using ice_remove_mac
-	 * and then create a new filter rule using ice_add_mac. Note that for
-	 * both these operations, we first need to form a "list" of MAC
-	 * addresses (even though in this case, we have only 1 MAC address to be
-	 * added/removed) and this done using ice_add_mac_to_list. Depending on
-	 * the ensuing operation this "list" of MAC addresses is either to be
-	 * added or removed from the filter.
+	 * and then create a new filter rule using ice_add_mac via
+	 * ice_vsi_cfg_mac_fltr function call for both add and/or remove
+	 * filters.
 	 */
-	err = ice_add_mac_to_list(vsi, &r_mac_list, netdev->dev_addr);
-	if (err) {
-		err = -EADDRNOTAVAIL;
-		goto free_lists;
-	}
-
-	status = ice_remove_mac(hw, &r_mac_list);
+	status = ice_vsi_cfg_mac_fltr(vsi, netdev->dev_addr, false);
 	if (status) {
 		err = -EADDRNOTAVAIL;
-		goto free_lists;
-	}
-
-	err = ice_add_mac_to_list(vsi, &a_mac_list, mac);
-	if (err) {
-		err = -EADDRNOTAVAIL;
-		goto free_lists;
+		goto err_update_filters;
 	}
 
-	status = ice_add_mac(hw, &a_mac_list);
+	status = ice_vsi_cfg_mac_fltr(vsi, mac, true);
 	if (status) {
 		err = -EADDRNOTAVAIL;
-		goto free_lists;
+		goto err_update_filters;
 	}
 
-free_lists:
-	/* free list entries */
-	ice_free_fltr_list(&pf->pdev->dev, &r_mac_list);
-	ice_free_fltr_list(&pf->pdev->dev, &a_mac_list);
-
+err_update_filters:
 	if (err) {
 		netdev_err(netdev, "can't set MAC %pM. filter update failed\n",
 			   mac);
@@ -2947,8 +2917,8 @@ static int ice_set_mac_address(struct net_device *netdev, void *pi)
 	flags = ICE_AQC_MAN_MAC_UPDATE_LAA_WOL;
 	status = ice_aq_manage_mac_write(hw, mac, flags, NULL);
 	if (status) {
-		netdev_err(netdev, "can't set MAC %pM. write to firmware failed.\n",
-			   mac);
+		netdev_err(netdev, "can't set MAC %pM. write to firmware failed error %d\n",
+			   mac, status);
 	}
 	return 0;
 }
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
index f86c26d0e426..377e6d495c14 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
@@ -540,7 +540,10 @@ static int ice_alloc_vsi_res(struct ice_vf *vf)
 
 	status = ice_add_mac(&pf->hw, &tmp_add_list);
 	if (status)
-		dev_err(&pf->pdev->dev, "could not add mac filters\n");
+		dev_err(&pf->pdev->dev,
+			"could not add mac filters error %d\n", status);
+	else
+		vf->num_mac = 1;
 
 	/* Clear this bit after VF initialization since we shouldn't reclaim
 	 * and reassign interrupts for synchronous or asynchronous VFR events.
@@ -2209,7 +2212,7 @@ ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set)
 	    (struct virtchnl_ether_addr_list *)msg;
 	struct ice_pf *pf = vf->pf;
 	enum virtchnl_ops vc_op;
-	LIST_HEAD(mac_list);
+	enum ice_status status;
 	struct ice_vsi *vsi;
 	int mac_count = 0;
 	int i;
@@ -2283,33 +2286,32 @@ ice_vc_handle_mac_addr_msg(struct ice_vf *vf, u8 *msg, bool set)
 			goto handle_mac_exit;
 		}
 
-		/* get here if maddr is multicast or if VF can change MAC */
-		if (ice_add_mac_to_list(vsi, &mac_list, al->list[i].addr)) {
-			v_ret = VIRTCHNL_STATUS_ERR_NO_MEMORY;
+		/* program the updated filter list */
+		status = ice_vsi_cfg_mac_fltr(vsi, maddr, set);
+		if (status == ICE_ERR_DOES_NOT_EXIST ||
+		    status == ICE_ERR_ALREADY_EXISTS) {
+			dev_info(&pf->pdev->dev,
+				 "can't %s MAC filters %pM for VF %d, error %d\n",
+				 set ? "add" : "remove", maddr, vf->vf_id,
+				 status);
+		} else if (status) {
+			dev_err(&pf->pdev->dev,
+				"can't %s MAC filters for VF %d, error %d\n",
+				set ? "add" : "remove", vf->vf_id, status);
+			v_ret = ice_err_to_virt_err(status);
 			goto handle_mac_exit;
 		}
+
 		mac_count++;
 	}
 
-	/* program the updated filter list */
+	/* Track number of MAC filters programmed for the VF VSI */
 	if (set)
-		v_ret = ice_err_to_virt_err(ice_add_mac(&pf->hw, &mac_list));
+		vf->num_mac += mac_count;
 	else
-		v_ret = ice_err_to_virt_err(ice_remove_mac(&pf->hw, &mac_list));
-
-	if (v_ret) {
-		dev_err(&pf->pdev->dev,
-			"can't %s MAC filters for VF %d, error %d\n",
-			set ? "add" : "remove", vf->vf_id, v_ret);
-	} else {
-		if (set)
-			vf->num_mac += mac_count;
-		else
-			vf->num_mac -= mac_count;
-	}
+		vf->num_mac -= mac_count;
 
 handle_mac_exit:
-	ice_free_fltr_list(&pf->pdev->dev, &mac_list);
 	/* send the response to the VF */
 	return ice_vc_send_msg_to_vf(vf, vc_op, v_ret, NULL, 0);
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 03/12] ice: Don't allow VSI to remove unassociated ucast filter
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 02/12] ice: Fix issues updating VSI MAC filters Tony Nguyen
@ 2019-07-25  9:53 ` Tony Nguyen
  2019-07-31 18:11   ` Bowers, AndrewX
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 04/12] ice: Fix ethtool port and PFC stats for 4x25G cards Tony Nguyen
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:53 UTC (permalink / raw)
  To: intel-wired-lan

From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>

If a VSI is not using a unicast filter or did not configure that
particular unicast filter, driver should not allow it to be removed
by the rogue VSI.

Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_switch.c | 56 +++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 6b68ff8dae18..2e6ea062fa2a 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -2136,6 +2136,38 @@ ice_cfg_dflt_vsi(struct ice_hw *hw, u16 vsi_handle, bool set, u8 direction)
 	return status;
 }
 
+/**
+ * ice_find_ucast_rule_entry - Search for a unicast MAC filter rule entry
+ * @hw: pointer to the hardware structure
+ * @recp_id: lookup type for which the specified rule needs to be searched
+ * @f_info: rule information
+ *
+ * Helper function to search for a unicast rule entry - this is to be used
+ * to remove unicast MAC filter that is not shared with other VSIs on the
+ * PF switch.
+ *
+ * Returns pointer to entry storing the rule if found
+ */
+static struct ice_fltr_mgmt_list_entry *
+ice_find_ucast_rule_entry(struct ice_hw *hw, u8 recp_id,
+			  struct ice_fltr_info *f_info)
+{
+	struct ice_switch_info *sw = hw->switch_info;
+	struct ice_fltr_mgmt_list_entry *list_itr;
+	struct list_head *list_head;
+
+	list_head = &sw->recp_list[recp_id].filt_rules;
+	list_for_each_entry(list_itr, list_head, list_entry) {
+		if (!memcmp(&f_info->l_data, &list_itr->fltr_info.l_data,
+			    sizeof(f_info->l_data)) &&
+		    f_info->fwd_id.hw_vsi_id ==
+		    list_itr->fltr_info.fwd_id.hw_vsi_id &&
+		    f_info->flag == list_itr->fltr_info.flag)
+			return list_itr;
+	}
+	return NULL;
+}
+
 /**
  * ice_remove_mac - remove a MAC address based filter rule
  * @hw: pointer to the hardware structure
@@ -2153,15 +2185,39 @@ enum ice_status
 ice_remove_mac(struct ice_hw *hw, struct list_head *m_list)
 {
 	struct ice_fltr_list_entry *list_itr, *tmp;
+	struct mutex *rule_lock; /* Lock to protect filter rule list */
 
 	if (!m_list)
 		return ICE_ERR_PARAM;
 
+	rule_lock = &hw->switch_info->recp_list[ICE_SW_LKUP_MAC].filt_rule_lock;
 	list_for_each_entry_safe(list_itr, tmp, m_list, list_entry) {
 		enum ice_sw_lkup_type l_type = list_itr->fltr_info.lkup_type;
+		u8 *add = &list_itr->fltr_info.l_data.mac.mac_addr[0];
+		u16 vsi_handle;
 
 		if (l_type != ICE_SW_LKUP_MAC)
 			return ICE_ERR_PARAM;
+
+		vsi_handle = list_itr->fltr_info.vsi_handle;
+		if (!ice_is_vsi_valid(hw, vsi_handle))
+			return ICE_ERR_PARAM;
+
+		list_itr->fltr_info.fwd_id.hw_vsi_id =
+					ice_get_hw_vsi_num(hw, vsi_handle);
+		if (is_unicast_ether_addr(add) && !hw->ucast_shared) {
+			/* Don't remove the unicast address that belongs to
+			 * another VSI on the switch, since it is not being
+			 * shared...
+			 */
+			mutex_lock(rule_lock);
+			if (!ice_find_ucast_rule_entry(hw, ICE_SW_LKUP_MAC,
+						       &list_itr->fltr_info)) {
+				mutex_unlock(rule_lock);
+				return ICE_ERR_DOES_NOT_EXIST;
+			}
+			mutex_unlock(rule_lock);
+		}
 		list_itr->status = ice_remove_rule_internal(hw,
 							    ICE_SW_LKUP_MAC,
 							    list_itr);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 04/12] ice: Fix ethtool port and PFC stats for 4x25G cards
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 02/12] ice: Fix issues updating VSI MAC filters Tony Nguyen
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 03/12] ice: Don't allow VSI to remove unassociated ucast filter Tony Nguyen
@ 2019-07-25  9:53 ` Tony Nguyen
  2019-07-31 18:11   ` Bowers, AndrewX
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 05/12] ice: added sibling head to parse nodes Tony Nguyen
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:53 UTC (permalink / raw)
  To: intel-wired-lan

From: Usha Ketineni <usha.k.ketineni@intel.com>

This patch fixes the issue where port and PFC statistics counters are
incrementing at the wrong port with 4x25G cards.
Read the GLPRT port registers using lport parameter instead of pf_id to
update the statistics otherwise the pf_ids are flipped for ports 2 and 3
when read from the HW register PF_FUNC_RID and this is expected as per
hardware specification.

Signed-off-by: Usha Ketineni <usha.k.ketineni@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 13 ++--
 drivers/net/ethernet/intel/ice/ice_main.c    | 76 ++++++++++----------
 2 files changed, 45 insertions(+), 44 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
index 21405958aa63..34c9d1e01529 100644
--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c
@@ -505,30 +505,31 @@ void ice_update_dcb_stats(struct ice_pf *pf)
 {
 	struct ice_hw_port_stats *prev_ps, *cur_ps;
 	struct ice_hw *hw = &pf->hw;
-	u8 pf_id = hw->pf_id;
+	u8 port;
 	int i;
 
+	port = hw->port_info->lport;
 	prev_ps = &pf->stats_prev;
 	cur_ps = &pf->stats;
 
 	for (i = 0; i < 8; i++) {
-		ice_stat_update32(hw, GLPRT_PXOFFRXC(pf_id, i),
+		ice_stat_update32(hw, GLPRT_PXOFFRXC(port, i),
 				  pf->stat_prev_loaded,
 				  &prev_ps->priority_xoff_rx[i],
 				  &cur_ps->priority_xoff_rx[i]);
-		ice_stat_update32(hw, GLPRT_PXONRXC(pf_id, i),
+		ice_stat_update32(hw, GLPRT_PXONRXC(port, i),
 				  pf->stat_prev_loaded,
 				  &prev_ps->priority_xon_rx[i],
 				  &cur_ps->priority_xon_rx[i]);
-		ice_stat_update32(hw, GLPRT_PXONTXC(pf_id, i),
+		ice_stat_update32(hw, GLPRT_PXONTXC(port, i),
 				  pf->stat_prev_loaded,
 				  &prev_ps->priority_xon_tx[i],
 				  &cur_ps->priority_xon_tx[i]);
-		ice_stat_update32(hw, GLPRT_PXOFFTXC(pf_id, i),
+		ice_stat_update32(hw, GLPRT_PXOFFTXC(port, i),
 				  pf->stat_prev_loaded,
 				  &prev_ps->priority_xoff_tx[i],
 				  &cur_ps->priority_xoff_tx[i]);
-		ice_stat_update32(hw, GLPRT_RXON2OFFCNT(pf_id, i),
+		ice_stat_update32(hw, GLPRT_RXON2OFFCNT(port, i),
 				  pf->stat_prev_loaded,
 				  &prev_ps->priority_xon_2_xoff[i],
 				  &cur_ps->priority_xon_2_xoff[i]);
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 072771543582..920122443c0f 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -3298,25 +3298,25 @@ void ice_update_pf_stats(struct ice_pf *pf)
 {
 	struct ice_hw_port_stats *prev_ps, *cur_ps;
 	struct ice_hw *hw = &pf->hw;
-	u8 pf_id;
+	u8 port;
 
+	port = hw->port_info->lport;
 	prev_ps = &pf->stats_prev;
 	cur_ps = &pf->stats;
-	pf_id = hw->pf_id;
 
-	ice_stat_update40(hw, GLPRT_GORCL(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_GORCL(port), pf->stat_prev_loaded,
 			  &prev_ps->eth.rx_bytes,
 			  &cur_ps->eth.rx_bytes);
 
-	ice_stat_update40(hw, GLPRT_UPRCL(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_UPRCL(port), pf->stat_prev_loaded,
 			  &prev_ps->eth.rx_unicast,
 			  &cur_ps->eth.rx_unicast);
 
-	ice_stat_update40(hw, GLPRT_MPRCL(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_MPRCL(port), pf->stat_prev_loaded,
 			  &prev_ps->eth.rx_multicast,
 			  &cur_ps->eth.rx_multicast);
 
-	ice_stat_update40(hw, GLPRT_BPRCL(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_BPRCL(port), pf->stat_prev_loaded,
 			  &prev_ps->eth.rx_broadcast,
 			  &cur_ps->eth.rx_broadcast);
 
@@ -3324,109 +3324,109 @@ void ice_update_pf_stats(struct ice_pf *pf)
 			  &prev_ps->eth.rx_discards,
 			  &cur_ps->eth.rx_discards);
 
-	ice_stat_update40(hw, GLPRT_GOTCL(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_GOTCL(port), pf->stat_prev_loaded,
 			  &prev_ps->eth.tx_bytes,
 			  &cur_ps->eth.tx_bytes);
 
-	ice_stat_update40(hw, GLPRT_UPTCL(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_UPTCL(port), pf->stat_prev_loaded,
 			  &prev_ps->eth.tx_unicast,
 			  &cur_ps->eth.tx_unicast);
 
-	ice_stat_update40(hw, GLPRT_MPTCL(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_MPTCL(port), pf->stat_prev_loaded,
 			  &prev_ps->eth.tx_multicast,
 			  &cur_ps->eth.tx_multicast);
 
-	ice_stat_update40(hw, GLPRT_BPTCL(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_BPTCL(port), pf->stat_prev_loaded,
 			  &prev_ps->eth.tx_broadcast,
 			  &cur_ps->eth.tx_broadcast);
 
-	ice_stat_update32(hw, GLPRT_TDOLD(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_TDOLD(port), pf->stat_prev_loaded,
 			  &prev_ps->tx_dropped_link_down,
 			  &cur_ps->tx_dropped_link_down);
 
-	ice_stat_update40(hw, GLPRT_PRC64L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PRC64L(port), pf->stat_prev_loaded,
 			  &prev_ps->rx_size_64, &cur_ps->rx_size_64);
 
-	ice_stat_update40(hw, GLPRT_PRC127L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PRC127L(port), pf->stat_prev_loaded,
 			  &prev_ps->rx_size_127, &cur_ps->rx_size_127);
 
-	ice_stat_update40(hw, GLPRT_PRC255L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PRC255L(port), pf->stat_prev_loaded,
 			  &prev_ps->rx_size_255, &cur_ps->rx_size_255);
 
-	ice_stat_update40(hw, GLPRT_PRC511L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PRC511L(port), pf->stat_prev_loaded,
 			  &prev_ps->rx_size_511, &cur_ps->rx_size_511);
 
-	ice_stat_update40(hw, GLPRT_PRC1023L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PRC1023L(port), pf->stat_prev_loaded,
 			  &prev_ps->rx_size_1023, &cur_ps->rx_size_1023);
 
-	ice_stat_update40(hw, GLPRT_PRC1522L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PRC1522L(port), pf->stat_prev_loaded,
 			  &prev_ps->rx_size_1522, &cur_ps->rx_size_1522);
 
-	ice_stat_update40(hw, GLPRT_PRC9522L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PRC9522L(port), pf->stat_prev_loaded,
 			  &prev_ps->rx_size_big, &cur_ps->rx_size_big);
 
-	ice_stat_update40(hw, GLPRT_PTC64L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PTC64L(port), pf->stat_prev_loaded,
 			  &prev_ps->tx_size_64, &cur_ps->tx_size_64);
 
-	ice_stat_update40(hw, GLPRT_PTC127L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PTC127L(port), pf->stat_prev_loaded,
 			  &prev_ps->tx_size_127, &cur_ps->tx_size_127);
 
-	ice_stat_update40(hw, GLPRT_PTC255L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PTC255L(port), pf->stat_prev_loaded,
 			  &prev_ps->tx_size_255, &cur_ps->tx_size_255);
 
-	ice_stat_update40(hw, GLPRT_PTC511L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PTC511L(port), pf->stat_prev_loaded,
 			  &prev_ps->tx_size_511, &cur_ps->tx_size_511);
 
-	ice_stat_update40(hw, GLPRT_PTC1023L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PTC1023L(port), pf->stat_prev_loaded,
 			  &prev_ps->tx_size_1023, &cur_ps->tx_size_1023);
 
-	ice_stat_update40(hw, GLPRT_PTC1522L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PTC1522L(port), pf->stat_prev_loaded,
 			  &prev_ps->tx_size_1522, &cur_ps->tx_size_1522);
 
-	ice_stat_update40(hw, GLPRT_PTC9522L(pf_id), pf->stat_prev_loaded,
+	ice_stat_update40(hw, GLPRT_PTC9522L(port), pf->stat_prev_loaded,
 			  &prev_ps->tx_size_big, &cur_ps->tx_size_big);
 
-	ice_stat_update32(hw, GLPRT_LXONRXC(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_LXONRXC(port), pf->stat_prev_loaded,
 			  &prev_ps->link_xon_rx, &cur_ps->link_xon_rx);
 
-	ice_stat_update32(hw, GLPRT_LXOFFRXC(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_LXOFFRXC(port), pf->stat_prev_loaded,
 			  &prev_ps->link_xoff_rx, &cur_ps->link_xoff_rx);
 
-	ice_stat_update32(hw, GLPRT_LXONTXC(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_LXONTXC(port), pf->stat_prev_loaded,
 			  &prev_ps->link_xon_tx, &cur_ps->link_xon_tx);
 
-	ice_stat_update32(hw, GLPRT_LXOFFTXC(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_LXOFFTXC(port), pf->stat_prev_loaded,
 			  &prev_ps->link_xoff_tx, &cur_ps->link_xoff_tx);
 
 	ice_update_dcb_stats(pf);
 
-	ice_stat_update32(hw, GLPRT_CRCERRS(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_CRCERRS(port), pf->stat_prev_loaded,
 			  &prev_ps->crc_errors, &cur_ps->crc_errors);
 
-	ice_stat_update32(hw, GLPRT_ILLERRC(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_ILLERRC(port), pf->stat_prev_loaded,
 			  &prev_ps->illegal_bytes, &cur_ps->illegal_bytes);
 
-	ice_stat_update32(hw, GLPRT_MLFC(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_MLFC(port), pf->stat_prev_loaded,
 			  &prev_ps->mac_local_faults,
 			  &cur_ps->mac_local_faults);
 
-	ice_stat_update32(hw, GLPRT_MRFC(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_MRFC(port), pf->stat_prev_loaded,
 			  &prev_ps->mac_remote_faults,
 			  &cur_ps->mac_remote_faults);
 
-	ice_stat_update32(hw, GLPRT_RLEC(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_RLEC(port), pf->stat_prev_loaded,
 			  &prev_ps->rx_len_errors, &cur_ps->rx_len_errors);
 
-	ice_stat_update32(hw, GLPRT_RUC(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_RUC(port), pf->stat_prev_loaded,
 			  &prev_ps->rx_undersize, &cur_ps->rx_undersize);
 
-	ice_stat_update32(hw, GLPRT_RFC(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_RFC(port), pf->stat_prev_loaded,
 			  &prev_ps->rx_fragments, &cur_ps->rx_fragments);
 
-	ice_stat_update32(hw, GLPRT_ROC(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_ROC(port), pf->stat_prev_loaded,
 			  &prev_ps->rx_oversize, &cur_ps->rx_oversize);
 
-	ice_stat_update32(hw, GLPRT_RJC(pf_id), pf->stat_prev_loaded,
+	ice_stat_update32(hw, GLPRT_RJC(port), pf->stat_prev_loaded,
 			  &prev_ps->rx_jabber, &cur_ps->rx_jabber);
 
 	pf->stat_prev_loaded = true;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 05/12] ice: added sibling head to parse nodes
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
                   ` (2 preceding siblings ...)
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 04/12] ice: Fix ethtool port and PFC stats for 4x25G cards Tony Nguyen
@ 2019-07-25  9:53 ` Tony Nguyen
  2019-07-31 18:11   ` Bowers, AndrewX
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 06/12] ice: Sanitize ice_ena_vsi and ice_dis_vsi Tony Nguyen
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:53 UTC (permalink / raw)
  To: intel-wired-lan

From: Victor Raj <victor.raj@intel.com>

There was a bug in the previous code which never traverses all the
children to get the first node of the requested layer. Add a sibling
head pointer to point the first node of each layer per TC. This helps
traverse easier and quicker and also removes the recursion.

Signed-off-by: Victor Raj <victor.raj@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_sched.c | 57 ++++++++--------------
 drivers/net/ethernet/intel/ice/ice_type.h  |  2 +
 2 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c
index 2a232504379d..79d64f9ed609 100644
--- a/drivers/net/ethernet/intel/ice/ice_sched.c
+++ b/drivers/net/ethernet/intel/ice/ice_sched.c
@@ -260,33 +260,17 @@ ice_sched_remove_elems(struct ice_hw *hw, struct ice_sched_node *parent,
 
 /**
  * ice_sched_get_first_node - get the first node of the given layer
- * @hw: pointer to the HW struct
+ * @pi: port information structure
  * @parent: pointer the base node of the subtree
  * @layer: layer number
  *
  * This function retrieves the first node of the given layer from the subtree
  */
 static struct ice_sched_node *
-ice_sched_get_first_node(struct ice_hw *hw, struct ice_sched_node *parent,
-			 u8 layer)
+ice_sched_get_first_node(struct ice_port_info *pi,
+			 struct ice_sched_node *parent, u8 layer)
 {
-	u8 i;
-
-	if (layer < hw->sw_entry_point_layer)
-		return NULL;
-	for (i = 0; i < parent->num_children; i++) {
-		struct ice_sched_node *node = parent->children[i];
-
-		if (node) {
-			if (node->tx_sched_layer == layer)
-				return node;
-			/* this recursion is intentional, and wouldn't
-			 * go more than 9 calls
-			 */
-			return ice_sched_get_first_node(hw, node, layer);
-		}
-	}
-	return NULL;
+	return pi->sib_head[parent->tc_num][layer];
 }
 
 /**
@@ -342,7 +326,7 @@ void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node)
 	parent = node->parent;
 	/* root has no parent */
 	if (parent) {
-		struct ice_sched_node *p, *tc_node;
+		struct ice_sched_node *p;
 
 		/* update the parent */
 		for (i = 0; i < parent->num_children; i++)
@@ -354,16 +338,7 @@ void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node)
 				break;
 			}
 
-		/* search for previous sibling that points to this node and
-		 * remove the reference
-		 */
-		tc_node = ice_sched_get_tc_node(pi, node->tc_num);
-		if (!tc_node) {
-			ice_debug(hw, ICE_DBG_SCHED,
-				  "Invalid TC number %d\n", node->tc_num);
-			goto err_exit;
-		}
-		p = ice_sched_get_first_node(hw, tc_node, node->tx_sched_layer);
+		p = ice_sched_get_first_node(pi, node, node->tx_sched_layer);
 		while (p) {
 			if (p->sibling == node) {
 				p->sibling = node->sibling;
@@ -371,8 +346,13 @@ void ice_free_sched_node(struct ice_port_info *pi, struct ice_sched_node *node)
 			}
 			p = p->sibling;
 		}
+
+		/* update the sibling head if head is getting removed */
+		if (pi->sib_head[node->tc_num][node->tx_sched_layer] == node)
+			pi->sib_head[node->tc_num][node->tx_sched_layer] =
+				node->sibling;
 	}
-err_exit:
+
 	/* leaf nodes have no children */
 	if (node->children)
 		devm_kfree(ice_hw_to_dev(hw), node->children);
@@ -743,13 +723,17 @@ ice_sched_add_elems(struct ice_port_info *pi, struct ice_sched_node *tc_node,
 
 		/* add it to previous node sibling pointer */
 		/* Note: siblings are not linked across branches */
-		prev = ice_sched_get_first_node(hw, tc_node, layer);
+		prev = ice_sched_get_first_node(pi, tc_node, layer);
 		if (prev && prev != new_node) {
 			while (prev->sibling)
 				prev = prev->sibling;
 			prev->sibling = new_node;
 		}
 
+		/* initialize the sibling head */
+		if (!pi->sib_head[tc_node->tc_num][layer])
+			pi->sib_head[tc_node->tc_num][layer] = new_node;
+
 		if (i == 0)
 			*first_node_teid = teid;
 	}
@@ -1160,7 +1144,7 @@ ice_sched_get_free_qparent(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
 		goto lan_q_exit;
 
 	/* get the first queue group node from VSI sub-tree */
-	qgrp_node = ice_sched_get_first_node(pi->hw, vsi_node, qgrp_layer);
+	qgrp_node = ice_sched_get_first_node(pi, vsi_node, qgrp_layer);
 	while (qgrp_node) {
 		/* make sure the qgroup node is part of the VSI subtree */
 		if (ice_sched_find_node_in_subtree(pi->hw, vsi_node, qgrp_node))
@@ -1191,7 +1175,7 @@ ice_sched_get_vsi_node(struct ice_hw *hw, struct ice_sched_node *tc_node,
 	u8 vsi_layer;
 
 	vsi_layer = ice_sched_get_vsi_layer(hw);
-	node = ice_sched_get_first_node(hw, tc_node, vsi_layer);
+	node = ice_sched_get_first_node(hw->port_info, tc_node, vsi_layer);
 
 	/* Check whether it already exists */
 	while (node) {
@@ -1316,7 +1300,8 @@ ice_sched_calc_vsi_support_nodes(struct ice_hw *hw,
 			/* If intermediate nodes are reached max children
 			 * then add a new one.
 			 */
-			node = ice_sched_get_first_node(hw, tc_node, (u8)i);
+			node = ice_sched_get_first_node(hw->port_info, tc_node,
+							(u8)i);
 			/* scan all the siblings */
 			while (node) {
 				if (node->num_children < hw->max_children[i])
diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h
index 24bbef8bbe69..d76e0cb7ef46 100644
--- a/drivers/net/ethernet/intel/ice/ice_type.h
+++ b/drivers/net/ethernet/intel/ice/ice_type.h
@@ -347,6 +347,8 @@ struct ice_port_info {
 	struct ice_mac_info mac;
 	struct ice_phy_info phy;
 	struct mutex sched_lock;	/* protect access to TXSched tree */
+	struct ice_sched_node *
+		sib_head[ICE_MAX_TRAFFIC_CLASS][ICE_AQC_TOPO_MAX_LEVEL_NUM];
 	struct ice_dcbx_cfg local_dcbx_cfg;	/* Oper/Local Cfg */
 	/* DCBX info */
 	struct ice_dcbx_cfg remote_dcbx_cfg;	/* Peer Cfg */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 06/12] ice: Sanitize ice_ena_vsi and ice_dis_vsi
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
                   ` (3 preceding siblings ...)
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 05/12] ice: added sibling head to parse nodes Tony Nguyen
@ 2019-07-25  9:53 ` Tony Nguyen
  2019-07-31 18:12   ` Bowers, AndrewX
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 07/12] ice: shorten local and add debug prints Tony Nguyen
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:53 UTC (permalink / raw)
  To: intel-wired-lan

From: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>

1. ndo_open and ndo_stop are implemented by ice_open and ice_stop
   respectively. When enabling/disabling VSIs, just call
   ice_open/ice_stop instead of ndo_open/ndo_stop.

2. Rework logic around rtnl_lock/rtnl_unlock

3. In ice_ena_vsi, remove an unnecessary stack variable and return
   0 instead of err when __ICE_NEEDS_RESTART is not set.

Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 24 +++++++++++------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 920122443c0f..1abbea7a69e1 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -436,13 +436,13 @@ static void ice_dis_vsi(struct ice_vsi *vsi, bool locked)
 
 	if (vsi->type == ICE_VSI_PF && vsi->netdev) {
 		if (netif_running(vsi->netdev)) {
-			if (!locked) {
+			if (!locked)
 				rtnl_lock();
-				vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
+
+			ice_stop(vsi->netdev);
+
+			if (!locked)
 				rtnl_unlock();
-			} else {
-				vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
-			}
 		} else {
 			ice_vsi_close(vsi);
 		}
@@ -3690,21 +3690,19 @@ static int ice_ena_vsi(struct ice_vsi *vsi, bool locked)
 	int err = 0;
 
 	if (!test_bit(__ICE_NEEDS_RESTART, vsi->state))
-		return err;
+		return 0;
 
 	clear_bit(__ICE_NEEDS_RESTART, vsi->state);
 
 	if (vsi->netdev && vsi->type == ICE_VSI_PF) {
-		struct net_device *netd = vsi->netdev;
-
 		if (netif_running(vsi->netdev)) {
-			if (locked) {
-				err = netd->netdev_ops->ndo_open(netd);
-			} else {
+			if (!locked)
 				rtnl_lock();
-				err = netd->netdev_ops->ndo_open(netd);
+
+			err = ice_open(vsi->netdev);
+
+			if (!locked)
 				rtnl_unlock();
-			}
 		}
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 07/12] ice: shorten local and add debug prints
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
                   ` (4 preceding siblings ...)
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 06/12] ice: Sanitize ice_ena_vsi and ice_dis_vsi Tony Nguyen
@ 2019-07-25  9:53 ` Tony Nguyen
  2019-07-31 18:12   ` Bowers, AndrewX
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 08/12] ice: Introduce a local variable for a VSI in the rebuild path Tony Nguyen
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:53 UTC (permalink / raw)
  To: intel-wired-lan

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

Add some verbose debugging for dyndbg to help us when
we are having issues with link and/or PHY.

While there, shorten some strings used by locals that
were causing long line wrapping.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_common.c | 63 ++++++++++++++-------
 1 file changed, 44 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index 4b43e6de847b..302ad981129c 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -263,21 +263,23 @@ enum ice_status
 ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
 		     struct ice_link_status *link, struct ice_sq_cd *cd)
 {
-	struct ice_link_status *hw_link_info_old, *hw_link_info;
 	struct ice_aqc_get_link_status_data link_data = { 0 };
 	struct ice_aqc_get_link_status *resp;
+	struct ice_link_status *li_old, *li;
 	enum ice_media_type *hw_media_type;
 	struct ice_fc_info *hw_fc_info;
 	bool tx_pause, rx_pause;
 	struct ice_aq_desc desc;
 	enum ice_status status;
+	struct ice_hw *hw;
 	u16 cmd_flags;
 
 	if (!pi)
 		return ICE_ERR_PARAM;
-	hw_link_info_old = &pi->phy.link_info_old;
+	hw = pi->hw;
+	li_old = &pi->phy.link_info_old;
 	hw_media_type = &pi->phy.media_type;
-	hw_link_info = &pi->phy.link_info;
+	li = &pi->phy.link_info;
 	hw_fc_info = &pi->fc;
 
 	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_get_link_status);
@@ -286,27 +288,27 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
 	resp->cmd_flags = cpu_to_le16(cmd_flags);
 	resp->lport_num = pi->lport;
 
-	status = ice_aq_send_cmd(pi->hw, &desc, &link_data, sizeof(link_data),
-				 cd);
+	status = ice_aq_send_cmd(hw, &desc, &link_data, sizeof(link_data), cd);
 
 	if (status)
 		return status;
 
 	/* save off old link status information */
-	*hw_link_info_old = *hw_link_info;
+	*li_old = *li;
 
 	/* update current link status information */
-	hw_link_info->link_speed = le16_to_cpu(link_data.link_speed);
-	hw_link_info->phy_type_low = le64_to_cpu(link_data.phy_type_low);
-	hw_link_info->phy_type_high = le64_to_cpu(link_data.phy_type_high);
+	li->link_speed = le16_to_cpu(link_data.link_speed);
+	li->phy_type_low = le64_to_cpu(link_data.phy_type_low);
+	li->phy_type_high = le64_to_cpu(link_data.phy_type_high);
 	*hw_media_type = ice_get_media_type(pi);
-	hw_link_info->link_info = link_data.link_info;
-	hw_link_info->an_info = link_data.an_info;
-	hw_link_info->ext_info = link_data.ext_info;
-	hw_link_info->max_frame_size = le16_to_cpu(link_data.max_frame_size);
-	hw_link_info->fec_info = link_data.cfg & ICE_AQ_FEC_MASK;
-	hw_link_info->topo_media_conflict = link_data.topo_media_conflict;
-	hw_link_info->pacing = link_data.cfg & ICE_AQ_CFG_PACING_M;
+	li->link_info = link_data.link_info;
+	li->an_info = link_data.an_info;
+	li->ext_info = link_data.ext_info;
+	li->max_frame_size = le16_to_cpu(link_data.max_frame_size);
+	li->fec_info = link_data.cfg & ICE_AQ_FEC_MASK;
+	li->topo_media_conflict = link_data.topo_media_conflict;
+	li->pacing = link_data.cfg & (ICE_AQ_CFG_PACING_M |
+				      ICE_AQ_CFG_PACING_TYPE_M);
 
 	/* update fc info */
 	tx_pause = !!(link_data.an_info & ICE_AQ_LINK_PAUSE_TX);
@@ -320,12 +322,24 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
 	else
 		hw_fc_info->current_mode = ICE_FC_NONE;
 
-	hw_link_info->lse_ena =
-		!!(resp->cmd_flags & cpu_to_le16(ICE_AQ_LSE_IS_ENABLED));
+	li->lse_ena = !!(resp->cmd_flags & cpu_to_le16(ICE_AQ_LSE_IS_ENABLED));
+
+	ice_debug(hw, ICE_DBG_LINK, "link_speed = 0x%x\n", li->link_speed);
+	ice_debug(hw, ICE_DBG_LINK, "phy_type_low = 0x%llx\n",
+		  (unsigned long long)li->phy_type_low);
+	ice_debug(hw, ICE_DBG_LINK, "phy_type_high = 0x%llx\n",
+		  (unsigned long long)li->phy_type_high);
+	ice_debug(hw, ICE_DBG_LINK, "media_type = 0x%x\n", *hw_media_type);
+	ice_debug(hw, ICE_DBG_LINK, "link_info = 0x%x\n", li->link_info);
+	ice_debug(hw, ICE_DBG_LINK, "an_info = 0x%x\n", li->an_info);
+	ice_debug(hw, ICE_DBG_LINK, "ext_info = 0x%x\n", li->ext_info);
+	ice_debug(hw, ICE_DBG_LINK, "lse_ena = 0x%x\n", li->lse_ena);
+	ice_debug(hw, ICE_DBG_LINK, "max_frame = 0x%x\n", li->max_frame_size);
+	ice_debug(hw, ICE_DBG_LINK, "pacing = 0x%x\n", li->pacing);
 
 	/* save link status information */
 	if (link)
-		*link = *hw_link_info;
+		*link = *li;
 
 	/* flag cleared so calling functions don't call AQ again */
 	pi->phy.get_link_info = false;
@@ -2000,6 +2014,17 @@ ice_aq_set_phy_cfg(struct ice_hw *hw, u8 lport,
 	desc.params.set_phy.lport_num = lport;
 	desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
 
+	ice_debug(hw, ICE_DBG_LINK, "phy_type_low = 0x%llx\n",
+		  (unsigned long long)le64_to_cpu(cfg->phy_type_low));
+	ice_debug(hw, ICE_DBG_LINK, "phy_type_high = 0x%llx\n",
+		  (unsigned long long)le64_to_cpu(cfg->phy_type_high));
+	ice_debug(hw, ICE_DBG_LINK, "caps = 0x%x\n", cfg->caps);
+	ice_debug(hw, ICE_DBG_LINK, "low_power_ctrl = 0x%x\n",
+		  cfg->low_power_ctrl);
+	ice_debug(hw, ICE_DBG_LINK, "eee_cap = 0x%x\n", cfg->eee_cap);
+	ice_debug(hw, ICE_DBG_LINK, "eeer_value = 0x%x\n", cfg->eeer_value);
+	ice_debug(hw, ICE_DBG_LINK, "link_fec_opt = 0x%x\n", cfg->link_fec_opt);
+
 	return ice_aq_send_cmd(hw, &desc, cfg, sizeof(*cfg), cd);
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 08/12] ice: Introduce a local variable for a VSI in the rebuild path
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
                   ` (5 preceding siblings ...)
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 07/12] ice: shorten local and add debug prints Tony Nguyen
@ 2019-07-25  9:53 ` Tony Nguyen
  2019-07-31 18:13   ` Bowers, AndrewX
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 09/12] ice: Don't clog kernel debug log with VF MDD events errors Tony Nguyen
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:53 UTC (permalink / raw)
  To: intel-wired-lan

From: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>

When a VSI is accessed inside the ice_for_each_vsi macro in the rebuild
path (ice_vsi_rebuild_all() and ice_vsi_replay_all()), it is referred to
as pf->vsi[i]. Introduce local variables to improve readability.

Signed-off-by: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 1abbea7a69e1..f8746609f065 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -3740,22 +3740,23 @@ static int ice_vsi_rebuild_all(struct ice_pf *pf)
 
 	/* loop through pf->vsi array and reinit the VSI if found */
 	ice_for_each_vsi(pf, i) {
+		struct ice_vsi *vsi = pf->vsi[i];
 		int err;
 
-		if (!pf->vsi[i])
+		if (!vsi)
 			continue;
 
-		err = ice_vsi_rebuild(pf->vsi[i], true);
+		err = ice_vsi_rebuild(vsi, true);
 		if (err) {
 			dev_err(&pf->pdev->dev,
 				"VSI at index %d rebuild failed\n",
-				pf->vsi[i]->idx);
+				vsi->idx);
 			return err;
 		}
 
 		dev_info(&pf->pdev->dev,
 			 "VSI at index %d rebuilt. vsi_num = 0x%x\n",
-			 pf->vsi[i]->idx, pf->vsi[i]->vsi_num);
+			 vsi->idx, vsi->vsi_num);
 	}
 
 	return 0;
@@ -3773,25 +3774,27 @@ static int ice_vsi_replay_all(struct ice_pf *pf)
 
 	/* loop through pf->vsi array and replay the VSI if found */
 	ice_for_each_vsi(pf, i) {
-		if (!pf->vsi[i])
+		struct ice_vsi *vsi = pf->vsi[i];
+
+		if (!vsi)
 			continue;
 
-		ret = ice_replay_vsi(hw, pf->vsi[i]->idx);
+		ret = ice_replay_vsi(hw, vsi->idx);
 		if (ret) {
 			dev_err(&pf->pdev->dev,
 				"VSI at index %d replay failed %d\n",
-				pf->vsi[i]->idx, ret);
+				vsi->idx, ret);
 			return -EIO;
 		}
 
 		/* Re-map HW VSI number, using VSI handle that has been
 		 * previously validated in ice_replay_vsi() call above
 		 */
-		pf->vsi[i]->vsi_num = ice_get_hw_vsi_num(hw, pf->vsi[i]->idx);
+		vsi->vsi_num = ice_get_hw_vsi_num(hw, vsi->idx);
 
 		dev_info(&pf->pdev->dev,
 			 "VSI at index %d filter replayed successfully - vsi_num %i\n",
-			 pf->vsi[i]->idx, pf->vsi[i]->vsi_num);
+			 vsi->idx, vsi->vsi_num);
 	}
 
 	/* Clean up replay filter after successful re-configuration */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 09/12] ice: Don't clog kernel debug log with VF MDD events errors
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
                   ` (6 preceding siblings ...)
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 08/12] ice: Introduce a local variable for a VSI in the rebuild path Tony Nguyen
@ 2019-07-25  9:53 ` Tony Nguyen
  2019-07-31 18:13   ` Bowers, AndrewX
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 10/12] ice: add validation in OP_CONFIG_VSI_QUEUES VF message Tony Nguyen
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:53 UTC (permalink / raw)
  To: intel-wired-lan

From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>

In case of MDD events on VF, don't clog kernel log with unlimited VF mdd
events message "VF 0 has had 1018 MDD events since last boot" - limit
events log message to 30, based on the observation in some experimenation
with sending malicious packet once, and number of events reported before
device stopped observing MDD events.

Also removed defunct macro "ICE_DFLT_NUM_MDD_EVENTS_ALLOWED" for tracking
number of MDD events allowed before disabling the interface...

Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c        | 6 ++++--
 drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index f8746609f065..60b48ab177ea 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -1315,8 +1315,10 @@ static void ice_handle_mdd_event(struct ice_pf *pf)
 
 		if (vf_mdd_detected) {
 			vf->num_mdd_events++;
-			if (vf->num_mdd_events > 1)
-				dev_info(&pf->pdev->dev, "VF %d has had %llu MDD events since last boot\n",
+			if (vf->num_mdd_events &&
+			    vf->num_mdd_events <= ICE_MDD_EVENTS_THRESHOLD)
+				dev_info(&pf->pdev->dev,
+					 "VF %d has had %llu MDD events since last boot, Admin might need to reload AVF driver with this number of events\n",
 					 i, vf->num_mdd_events);
 		}
 	}
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h
index 4d94853f119a..13f45f37d75e 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h
@@ -15,8 +15,8 @@
 #define ICE_MAX_MACADDR_PER_VF		12
 
 /* Malicious Driver Detection */
-#define ICE_DFLT_NUM_MDD_EVENTS_ALLOWED		3
 #define ICE_DFLT_NUM_INVAL_MSGS_ALLOWED		10
+#define ICE_MDD_EVENTS_THRESHOLD		30
 
 /* Static VF transaction/status register def */
 #define VF_DEVICE_STATUS		0xAA
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 10/12] ice: add validation in OP_CONFIG_VSI_QUEUES VF message
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
                   ` (7 preceding siblings ...)
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 09/12] ice: Don't clog kernel debug log with VF MDD events errors Tony Nguyen
@ 2019-07-25  9:53 ` Tony Nguyen
  2019-07-31 18:14   ` Bowers, AndrewX
  2019-07-25  9:54 ` [Intel-wired-lan] [PATCH S25 11/12] ice: Remove ice_dev_onetime_setup() Tony Nguyen
                   ` (3 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:53 UTC (permalink / raw)
  To: intel-wired-lan

From: Michal Swiatkowski <michal.swiatkowski@intel.com>

Check num_queue_pairs to avoid access to unallocated field of
vsi->tx_rings/vsi->rx_rings. Without this validation we can set
vsi->alloc_txq/vsi->alloc_rxq to value smaller than ICE_MAX_BASE_QS_PER_VF
and send this command with num_queue_pairs greater than
vsi->alloc_txq/vsi->alloc_rxq. This lead to access to unallocated memory.

In VF vsi alloc_txq and alloc_rxq should be the same. Get minimum
because looks more readable.

Also add validation for ring_len param. It should be greater than 32 and
be multiple of 32. Incorrect value leads to hang traffic on PF.

Signed-off-by: Michal Swiatkowski <michal.swiatkowski@intel.com>
---
 .../net/ethernet/intel/ice/ice_virtchnl_pf.c  | 31 ++++++++++++++-----
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
index 377e6d495c14..cd8662ac133d 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
@@ -1713,6 +1713,19 @@ static bool ice_vc_isvalid_q_id(struct ice_vf *vf, u16 vsi_id, u8 qid)
 	return (vsi && (qid < vsi->alloc_txq));
 }
 
+/**
+ * ice_vc_isvalid_ring_len
+ * @ring_len: length of ring
+ *
+ * check for the valid ring count, should be multiple of ICE_REQ_DESC_MULTIPLE
+ */
+static bool ice_vc_isvalid_ring_len(u16 ring_len)
+{
+	return (ring_len >= ICE_MIN_NUM_DESC &&
+		ring_len <= ICE_MAX_NUM_DESC &&
+		!(ring_len % ICE_REQ_DESC_MULTIPLE));
+}
+
 /**
  * ice_vc_config_rss_key
  * @vf: pointer to the VF info
@@ -2108,16 +2121,17 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
 		goto error_param;
 	}
 
-	if (qci->num_queue_pairs > ICE_MAX_BASE_QS_PER_VF) {
-		dev_err(&pf->pdev->dev,
-			"VF-%d requesting more than supported number of queues: %d\n",
-			vf->vf_id, qci->num_queue_pairs);
+	vsi = pf->vsi[vf->lan_vsi_idx];
+	if (!vsi) {
 		v_ret = VIRTCHNL_STATUS_ERR_PARAM;
 		goto error_param;
 	}
 
-	vsi = pf->vsi[vf->lan_vsi_idx];
-	if (!vsi) {
+	if (qci->num_queue_pairs > ICE_MAX_BASE_QS_PER_VF ||
+	    qci->num_queue_pairs > min_t(u16, vsi->alloc_txq, vsi->alloc_rxq)) {
+		dev_err(&pf->pdev->dev,
+			"VF-%d requesting more than supported number of queues: %d\n",
+			vf->vf_id, min_t(u16, vsi->alloc_txq, vsi->alloc_rxq));
 		v_ret = VIRTCHNL_STATUS_ERR_PARAM;
 		goto error_param;
 	}
@@ -2128,6 +2142,8 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
 		    qpi->rxq.vsi_id != qci->vsi_id ||
 		    qpi->rxq.queue_id != qpi->txq.queue_id ||
 		    qpi->txq.headwb_enabled ||
+		    !ice_vc_isvalid_ring_len(qpi->txq.ring_len) ||
+		    !ice_vc_isvalid_ring_len(qpi->rxq.ring_len) ||
 		    !ice_vc_isvalid_q_id(vf, qci->vsi_id, qpi->txq.queue_id)) {
 			v_ret = VIRTCHNL_STATUS_ERR_PARAM;
 			goto error_param;
@@ -2138,7 +2154,8 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg)
 		/* copy Rx queue info from VF into VSI */
 		vsi->rx_rings[i]->dma = qpi->rxq.dma_ring_addr;
 		vsi->rx_rings[i]->count = qpi->rxq.ring_len;
-		if (qpi->rxq.databuffer_size > ((16 * 1024) - 128)) {
+		if (qpi->rxq.databuffer_size > ((16 * 1024) - 128) ||
+		    qpi->rxq.databuffer_size < 1024) {
 			v_ret = VIRTCHNL_STATUS_ERR_PARAM;
 			goto error_param;
 		}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 11/12] ice: Remove ice_dev_onetime_setup()
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
                   ` (8 preceding siblings ...)
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 10/12] ice: add validation in OP_CONFIG_VSI_QUEUES VF message Tony Nguyen
@ 2019-07-25  9:54 ` Tony Nguyen
  2019-07-31 18:14   ` Bowers, AndrewX
  2019-07-25  9:54 ` [Intel-wired-lan] [PATCH S25 12/12] ice: fix ice_is_tc_ena Tony Nguyen
                   ` (2 subsequent siblings)
  12 siblings, 1 reply; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:54 UTC (permalink / raw)
  To: intel-wired-lan

From: Brett Creeley <brett.creeley@intel.com>

ice_dev_onetime_setup contains driver workarounds needed for
firmware limitations. These issues have now been resolved in newer
NVMs so remove the function.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_common.c | 16 ----------------
 drivers/net/ethernet/intel/ice/ice_common.h |  2 --
 drivers/net/ethernet/intel/ice/ice_lib.c    |  1 -
 3 files changed, 19 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index 302ad981129c..847ddd9a7449 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -42,20 +42,6 @@ static enum ice_status ice_set_mac_type(struct ice_hw *hw)
 	return 0;
 }
 
-/**
- * ice_dev_onetime_setup - Temporary HW/FW workarounds
- * @hw: pointer to the HW structure
- *
- * This function provides temporary workarounds for certain issues
- * that are expected to be fixed in the HW/FW.
- */
-void ice_dev_onetime_setup(struct ice_hw *hw)
-{
-#define MBX_PF_VT_PFALLOC	0x00231E80
-	/* set VFs per PF */
-	wr32(hw, MBX_PF_VT_PFALLOC, rd32(hw, PF_VT_PFALLOC_HIF));
-}
-
 /**
  * ice_clear_pf_cfg - Clear PF configuration
  * @hw: pointer to the hardware structure
@@ -837,8 +823,6 @@ enum ice_status ice_init_hw(struct ice_hw *hw)
 	if (status)
 		goto err_unroll_sched;
 
-	ice_dev_onetime_setup(hw);
-
 	/* Get MAC information */
 	/* A single port can report up to two (LAN and WoL) addresses */
 	mac_buf = devm_kcalloc(ice_hw_to_dev(hw), 2,
diff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h
index e376d1eadba4..89b5125ad64c 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.h
+++ b/drivers/net/ethernet/intel/ice/ice_common.h
@@ -41,8 +41,6 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 void ice_clear_pxe_mode(struct ice_hw *hw);
 enum ice_status ice_get_caps(struct ice_hw *hw);
 
-void ice_dev_onetime_setup(struct ice_hw *hw);
-
 enum ice_status
 ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
 		  u32 rxq_index);
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index df28597f2e52..751f9f1f6367 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -2978,7 +2978,6 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)
 
 	ice_vsi_clear_rings(vsi);
 	ice_vsi_free_arrays(vsi);
-	ice_dev_onetime_setup(&pf->hw);
 	if (vsi->req_txq || vsi->req_rxq)
 		ice_vsi_put_qs(vsi);
 	if (vsi->type == ICE_VSI_VF)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 12/12] ice: fix ice_is_tc_ena
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
                   ` (9 preceding siblings ...)
  2019-07-25  9:54 ` [Intel-wired-lan] [PATCH S25 11/12] ice: Remove ice_dev_onetime_setup() Tony Nguyen
@ 2019-07-25  9:54 ` Tony Nguyen
  2019-07-31 18:14   ` Bowers, AndrewX
  2019-07-26 15:11 ` [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Allan, Bruce W
  2019-07-31 18:10 ` Bowers, AndrewX
  12 siblings, 1 reply; 25+ messages in thread
From: Tony Nguyen @ 2019-07-25  9:54 UTC (permalink / raw)
  To: intel-wired-lan

From: Jacob Keller <jacob.e.keller@intel.com>

ice_is_tc_ena is used to check whether a given traffic class is
enabled. Because there are only 8 traffic classes, the function took
a u8 bitmap. This causes problems because it is cast to an unsigned
long causing a static analysis warning regarding Out-of-bounds read.

Fix this by simply updating ice_is_tc_ena to take an unsigned long.
Passing a u8 to this function should implicitly convert the value.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_type.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h
index d76e0cb7ef46..b538d0b9eb80 100644
--- a/drivers/net/ethernet/intel/ice/ice_type.h
+++ b/drivers/net/ethernet/intel/ice/ice_type.h
@@ -13,9 +13,9 @@
 #define ICE_BYTES_PER_WORD	2
 #define ICE_BYTES_PER_DWORD	4
 
-static inline bool ice_is_tc_ena(u8 bitmap, u8 tc)
+static inline bool ice_is_tc_ena(unsigned long bitmap, u8 tc)
 {
-	return test_bit(tc, (unsigned long *)&bitmap);
+	return test_bit(tc, &bitmap);
 }
 
 /* Driver always calls main vsi_handle first */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
                   ` (10 preceding siblings ...)
  2019-07-25  9:54 ` [Intel-wired-lan] [PATCH S25 12/12] ice: fix ice_is_tc_ena Tony Nguyen
@ 2019-07-26 15:11 ` Allan, Bruce W
  2019-07-31 18:10 ` Bowers, AndrewX
  12 siblings, 0 replies; 25+ messages in thread
From: Allan, Bruce W @ 2019-07-26 15:11 UTC (permalink / raw)
  To: intel-wired-lan

ACK

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On Behalf
> Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-
> demand
> 
> From: Bruce Allan <bruce.w.allan@intel.com>
> 
> Users expect ethtool statistics to be updated on-demand when invoking
> 'ethtool -S <iface>' instead of providing a snapshot of statistics taken
> once a second (the frequency of the watchdog task where stats are currently
> updated).  Update stats every time 'ethtool -S <iface>' is run.
> 
> Also, fix an indentation style issue and an unnecessary local variable
> initialization in ice_get_ethtool_stats() discovered while investigating
> the subject issue.
> 
> Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice.h         | 2 ++
>  drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 +++++--
>  drivers/net/ethernet/intel/ice/ice_main.c    | 6 ++----
>  3 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice.h
> b/drivers/net/ethernet/intel/ice/ice.h
> index 0e233b7c40bc..2165366e9250 100644
> --- a/drivers/net/ethernet/intel/ice/ice.h
> +++ b/drivers/net/ethernet/intel/ice/ice.h
> @@ -450,6 +450,8 @@ int ice_vsi_setup_tx_rings(struct ice_vsi *vsi);
>  int ice_vsi_setup_rx_rings(struct ice_vsi *vsi);
>  void ice_set_ethtool_ops(struct net_device *netdev);
>  int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx);
> +void ice_update_vsi_stats(struct ice_vsi *vsi);
> +void ice_update_pf_stats(struct ice_pf *pf);
>  int ice_up(struct ice_vsi *vsi);
>  int ice_down(struct ice_vsi *vsi);
>  int ice_vsi_cfg(struct ice_vsi *vsi);
> diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c
> b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> index b60bcbcf9bf2..4b2494e7fa78 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> @@ -1319,14 +1319,17 @@ ice_get_ethtool_stats(struct net_device *netdev,
>  	struct ice_vsi *vsi = np->vsi;
>  	struct ice_pf *pf = vsi->back;
>  	struct ice_ring *ring;
> -	unsigned int j = 0;
> +	unsigned int j;
>  	int i = 0;
>  	char *p;
> 
> +	ice_update_pf_stats(pf);
> +	ice_update_vsi_stats(vsi);
> +
>  	for (j = 0; j < ICE_VSI_STATS_LEN; j++) {
>  		p = (char *)vsi + ice_gstrings_vsi_stats[j].stat_offset;
>  		data[i++] = (ice_gstrings_vsi_stats[j].sizeof_stat ==
> -			    sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
> +			     sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
>  	}
> 
>  	/* populate per queue stats */
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> b/drivers/net/ethernet/intel/ice/ice_main.c
> index 833f0efc93f9..17358a10866d 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -34,8 +34,6 @@ static const struct net_device_ops ice_netdev_ops;
>  static void ice_rebuild(struct ice_pf *pf);
> 
>  static void ice_vsi_release_all(struct ice_pf *pf);
> -static void ice_update_vsi_stats(struct ice_vsi *vsi);
> -static void ice_update_pf_stats(struct ice_pf *pf);
> 
>  /**
>   * ice_get_tx_pending - returns number of Tx descriptors not processed
> @@ -3290,7 +3288,7 @@ static void ice_update_vsi_ring_stats(struct ice_vsi
> *vsi)
>   * ice_update_vsi_stats - Update VSI stats counters
>   * @vsi: the VSI to be updated
>   */
> -static void ice_update_vsi_stats(struct ice_vsi *vsi)
> +void ice_update_vsi_stats(struct ice_vsi *vsi)
>  {
>  	struct rtnl_link_stats64 *cur_ns = &vsi->net_stats;
>  	struct ice_eth_stats *cur_es = &vsi->eth_stats;
> @@ -3326,7 +3324,7 @@ static void ice_update_vsi_stats(struct ice_vsi *vsi)
>   * ice_update_pf_stats - Update PF port stats counters
>   * @pf: PF whose stats needs to be updated
>   */
> -static void ice_update_pf_stats(struct ice_pf *pf)
> +void ice_update_pf_stats(struct ice_pf *pf)
>  {
>  	struct ice_hw_port_stats *prev_ps, *cur_ps;
>  	struct ice_hw *hw = &pf->hw;
> --
> 2.20.1
> 
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan at osuosl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand
  2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
                   ` (11 preceding siblings ...)
  2019-07-26 15:11 ` [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Allan, Bruce W
@ 2019-07-31 18:10 ` Bowers, AndrewX
  12 siblings, 0 replies; 25+ messages in thread
From: Bowers, AndrewX @ 2019-07-31 18:10 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-
> demand
> 
> From: Bruce Allan <bruce.w.allan@intel.com>
> 
> Users expect ethtool statistics to be updated on-demand when invoking
> 'ethtool -S <iface>' instead of providing a snapshot of statistics taken once a
> second (the frequency of the watchdog task where stats are currently
> updated).  Update stats every time 'ethtool -S <iface>' is run.
> 
> Also, fix an indentation style issue and an unnecessary local variable
> initialization in ice_get_ethtool_stats() discovered while investigating the
> subject issue.
> 
> Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice.h         | 2 ++
>  drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 +++++--
>  drivers/net/ethernet/intel/ice/ice_main.c    | 6 ++----
>  3 files changed, 9 insertions(+), 6 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 02/12] ice: Fix issues updating VSI MAC filters
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 02/12] ice: Fix issues updating VSI MAC filters Tony Nguyen
@ 2019-07-31 18:10   ` Bowers, AndrewX
  0 siblings, 0 replies; 25+ messages in thread
From: Bowers, AndrewX @ 2019-07-31 18:10 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 02/12] ice: Fix issues updating VSI MAC
> filters
> 
> From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> 
> VSI, especially VF could request to add or remove filter for another VSI,
> driver should really guide such request and disallow it.
> However, instead of returning error for such malicious request, driver can
> simply return success.
> 
> In addition, we are not tracking number of MAC filters configured per VF
> correctly - and this leads to issue updating VF MAC filters whenever they
> were removed and re-configured via bringing VF interface down and up.
> Also, since VF could send request to update multiple MAC filters at once,
> driver should program those filters individually in the switch, in order to
> determine which action resulted to error, and communicate accordingly to
> the VF.
> 
> So, with this changes, we now track number of filters added right from when
> VF resources allocation is done, and could properly add filters for both
> trusted and non_trusted VFs, without MAC filters mis-match issue in the
> switch...
> 
> Also refactor code, so that driver can use new function to add or remove
> MAC filters.
> 
> Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_lib.c      | 30 +++++++++
>  drivers/net/ethernet/intel/ice/ice_lib.h      |  4 ++
>  drivers/net/ethernet/intel/ice/ice_main.c     | 64 +++++--------------
>  .../net/ethernet/intel/ice/ice_virtchnl_pf.c  | 42 ++++++------
>  4 files changed, 73 insertions(+), 67 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 03/12] ice: Don't allow VSI to remove unassociated ucast filter
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 03/12] ice: Don't allow VSI to remove unassociated ucast filter Tony Nguyen
@ 2019-07-31 18:11   ` Bowers, AndrewX
  0 siblings, 0 replies; 25+ messages in thread
From: Bowers, AndrewX @ 2019-07-31 18:11 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 03/12] ice: Don't allow VSI to remove
> unassociated ucast filter
> 
> From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> 
> If a VSI is not using a unicast filter or did not configure that particular unicast
> filter, driver should not allow it to be removed by the rogue VSI.
> 
> Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_switch.c | 56 +++++++++++++++++++++
>  1 file changed, 56 insertions(+)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 04/12] ice: Fix ethtool port and PFC stats for 4x25G cards
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 04/12] ice: Fix ethtool port and PFC stats for 4x25G cards Tony Nguyen
@ 2019-07-31 18:11   ` Bowers, AndrewX
  0 siblings, 0 replies; 25+ messages in thread
From: Bowers, AndrewX @ 2019-07-31 18:11 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 04/12] ice: Fix ethtool port and PFC
> stats for 4x25G cards
> 
> From: Usha Ketineni <usha.k.ketineni@intel.com>
> 
> This patch fixes the issue where port and PFC statistics counters are
> incrementing at the wrong port with 4x25G cards.
> Read the GLPRT port registers using lport parameter instead of pf_id to
> update the statistics otherwise the pf_ids are flipped for ports 2 and 3 when
> read from the HW register PF_FUNC_RID and this is expected as per
> hardware specification.
> 
> Signed-off-by: Usha Ketineni <usha.k.ketineni@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 13 ++--
>  drivers/net/ethernet/intel/ice/ice_main.c    | 76 ++++++++++----------
>  2 files changed, 45 insertions(+), 44 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 05/12] ice: added sibling head to parse nodes
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 05/12] ice: added sibling head to parse nodes Tony Nguyen
@ 2019-07-31 18:11   ` Bowers, AndrewX
  0 siblings, 0 replies; 25+ messages in thread
From: Bowers, AndrewX @ 2019-07-31 18:11 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 05/12] ice: added sibling head to parse
> nodes
> 
> From: Victor Raj <victor.raj@intel.com>
> 
> There was a bug in the previous code which never traverses all the children
> to get the first node of the requested layer. Add a sibling head pointer to
> point the first node of each layer per TC. This helps traverse easier and
> quicker and also removes the recursion.
> 
> Signed-off-by: Victor Raj <victor.raj@intel.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_sched.c | 57 ++++++++--------------
> drivers/net/ethernet/intel/ice/ice_type.h  |  2 +
>  2 files changed, 23 insertions(+), 36 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 06/12] ice: Sanitize ice_ena_vsi and ice_dis_vsi
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 06/12] ice: Sanitize ice_ena_vsi and ice_dis_vsi Tony Nguyen
@ 2019-07-31 18:12   ` Bowers, AndrewX
  0 siblings, 0 replies; 25+ messages in thread
From: Bowers, AndrewX @ 2019-07-31 18:12 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 06/12] ice: Sanitize ice_ena_vsi and
> ice_dis_vsi
> 
> From: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
> 
> 1. ndo_open and ndo_stop are implemented by ice_open and ice_stop
>    respectively. When enabling/disabling VSIs, just call
>    ice_open/ice_stop instead of ndo_open/ndo_stop.
> 
> 2. Rework logic around rtnl_lock/rtnl_unlock
> 
> 3. In ice_ena_vsi, remove an unnecessary stack variable and return
>    0 instead of err when __ICE_NEEDS_RESTART is not set.
> 
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 24 +++++++++++------------
>  1 file changed, 11 insertions(+), 13 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 07/12] ice: shorten local and add debug prints
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 07/12] ice: shorten local and add debug prints Tony Nguyen
@ 2019-07-31 18:12   ` Bowers, AndrewX
  0 siblings, 0 replies; 25+ messages in thread
From: Bowers, AndrewX @ 2019-07-31 18:12 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 07/12] ice: shorten local and add debug
> prints
> 
> From: Jesse Brandeburg <jesse.brandeburg@intel.com>
> 
> Add some verbose debugging for dyndbg to help us when we are having
> issues with link and/or PHY.
> 
> While there, shorten some strings used by locals that were causing long line
> wrapping.
> 
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_common.c | 63 ++++++++++++++-------
>  1 file changed, 44 insertions(+), 19 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 08/12] ice: Introduce a local variable for a VSI in the rebuild path
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 08/12] ice: Introduce a local variable for a VSI in the rebuild path Tony Nguyen
@ 2019-07-31 18:13   ` Bowers, AndrewX
  0 siblings, 0 replies; 25+ messages in thread
From: Bowers, AndrewX @ 2019-07-31 18:13 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 08/12] ice: Introduce a local variable for
> a VSI in the rebuild path
> 
> From: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
> 
> When a VSI is accessed inside the ice_for_each_vsi macro in the rebuild path
> (ice_vsi_rebuild_all() and ice_vsi_replay_all()), it is referred to as pf->vsi[i].
> Introduce local variables to improve readability.
> 
> Signed-off-by: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 09/12] ice: Don't clog kernel debug log with VF MDD events errors
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 09/12] ice: Don't clog kernel debug log with VF MDD events errors Tony Nguyen
@ 2019-07-31 18:13   ` Bowers, AndrewX
  0 siblings, 0 replies; 25+ messages in thread
From: Bowers, AndrewX @ 2019-07-31 18:13 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 09/12] ice: Don't clog kernel debug log
> with VF MDD events errors
> 
> From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> 
> In case of MDD events on VF, don't clog kernel log with unlimited VF mdd
> events message "VF 0 has had 1018 MDD events since last boot" - limit
> events log message to 30, based on the observation in some experimenation
> with sending malicious packet once, and number of events reported before
> device stopped observing MDD events.
> 
> Also removed defunct macro "ICE_DFLT_NUM_MDD_EVENTS_ALLOWED"
> for tracking number of MDD events allowed before disabling the interface...
> 
> Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c        | 6 ++++--
>  drivers/net/ethernet/intel/ice/ice_virtchnl_pf.h | 2 +-
>  2 files changed, 5 insertions(+), 3 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 10/12] ice: add validation in OP_CONFIG_VSI_QUEUES VF message
  2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 10/12] ice: add validation in OP_CONFIG_VSI_QUEUES VF message Tony Nguyen
@ 2019-07-31 18:14   ` Bowers, AndrewX
  0 siblings, 0 replies; 25+ messages in thread
From: Bowers, AndrewX @ 2019-07-31 18:14 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 10/12] ice: add validation in
> OP_CONFIG_VSI_QUEUES VF message
> 
> From: Michal Swiatkowski <michal.swiatkowski@intel.com>
> 
> Check num_queue_pairs to avoid access to unallocated field of
> vsi->tx_rings/vsi->rx_rings. Without this validation we can set
> vsi->alloc_txq/vsi->alloc_rxq to value smaller than
> vsi->ICE_MAX_BASE_QS_PER_VF
> and send this command with num_queue_pairs greater than
> vsi->alloc_txq/vsi->alloc_rxq. This lead to access to unallocated memory.
> 
> In VF vsi alloc_txq and alloc_rxq should be the same. Get minimum because
> looks more readable.
> 
> Also add validation for ring_len param. It should be greater than 32 and be
> multiple of 32. Incorrect value leads to hang traffic on PF.
> 
> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@intel.com>
> ---
>  .../net/ethernet/intel/ice/ice_virtchnl_pf.c  | 31 ++++++++++++++-----
>  1 file changed, 24 insertions(+), 7 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 11/12] ice: Remove ice_dev_onetime_setup()
  2019-07-25  9:54 ` [Intel-wired-lan] [PATCH S25 11/12] ice: Remove ice_dev_onetime_setup() Tony Nguyen
@ 2019-07-31 18:14   ` Bowers, AndrewX
  0 siblings, 0 replies; 25+ messages in thread
From: Bowers, AndrewX @ 2019-07-31 18:14 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 11/12] ice: Remove
> ice_dev_onetime_setup()
> 
> From: Brett Creeley <brett.creeley@intel.com>
> 
> ice_dev_onetime_setup contains driver workarounds needed for firmware
> limitations. These issues have now been resolved in newer NVMs so remove
> the function.
> 
> Signed-off-by: Brett Creeley <brett.creeley@intel.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_common.c | 16 ----------------
> drivers/net/ethernet/intel/ice/ice_common.h |  2 --
>  drivers/net/ethernet/intel/ice/ice_lib.c    |  1 -
>  3 files changed, 19 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Intel-wired-lan] [PATCH S25 12/12] ice: fix ice_is_tc_ena
  2019-07-25  9:54 ` [Intel-wired-lan] [PATCH S25 12/12] ice: fix ice_is_tc_ena Tony Nguyen
@ 2019-07-31 18:14   ` Bowers, AndrewX
  0 siblings, 0 replies; 25+ messages in thread
From: Bowers, AndrewX @ 2019-07-31 18:14 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Tony Nguyen
> Sent: Thursday, July 25, 2019 2:54 AM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S25 12/12] ice: fix ice_is_tc_ena
> 
> From: Jacob Keller <jacob.e.keller@intel.com>
> 
> ice_is_tc_ena is used to check whether a given traffic class is enabled.
> Because there are only 8 traffic classes, the function took a u8 bitmap. This
> causes problems because it is cast to an unsigned long causing a static
> analysis warning regarding Out-of-bounds read.
> 
> Fix this by simply updating ice_is_tc_ena to take an unsigned long.
> Passing a u8 to this function should implicitly convert the value.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_type.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2019-07-31 18:14 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25  9:53 [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Tony Nguyen
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 02/12] ice: Fix issues updating VSI MAC filters Tony Nguyen
2019-07-31 18:10   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 03/12] ice: Don't allow VSI to remove unassociated ucast filter Tony Nguyen
2019-07-31 18:11   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 04/12] ice: Fix ethtool port and PFC stats for 4x25G cards Tony Nguyen
2019-07-31 18:11   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 05/12] ice: added sibling head to parse nodes Tony Nguyen
2019-07-31 18:11   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 06/12] ice: Sanitize ice_ena_vsi and ice_dis_vsi Tony Nguyen
2019-07-31 18:12   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 07/12] ice: shorten local and add debug prints Tony Nguyen
2019-07-31 18:12   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 08/12] ice: Introduce a local variable for a VSI in the rebuild path Tony Nguyen
2019-07-31 18:13   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 09/12] ice: Don't clog kernel debug log with VF MDD events errors Tony Nguyen
2019-07-31 18:13   ` Bowers, AndrewX
2019-07-25  9:53 ` [Intel-wired-lan] [PATCH S25 10/12] ice: add validation in OP_CONFIG_VSI_QUEUES VF message Tony Nguyen
2019-07-31 18:14   ` Bowers, AndrewX
2019-07-25  9:54 ` [Intel-wired-lan] [PATCH S25 11/12] ice: Remove ice_dev_onetime_setup() Tony Nguyen
2019-07-31 18:14   ` Bowers, AndrewX
2019-07-25  9:54 ` [Intel-wired-lan] [PATCH S25 12/12] ice: fix ice_is_tc_ena Tony Nguyen
2019-07-31 18:14   ` Bowers, AndrewX
2019-07-26 15:11 ` [Intel-wired-lan] [PATCH S25 01/12] ice: update ethtool stats on-demand Allan, Bruce W
2019-07-31 18:10 ` Bowers, AndrewX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.