All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice
@ 2019-02-08 20:50 Anirudh Venkataramanan
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 01/14] ice: Fix broadcast traffic in port VLAN mode Anirudh Venkataramanan
                   ` (13 more replies)
  0 siblings, 14 replies; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

Akeem G Abodunrin (5):
  ice: Fix issue with VF reset and multiple VFs support on PFs
  ice: Implement flow to reset VFs with PFR and other resets
  ice: Reset all VFs with VFLR during SR-IOV init flow
  ice: Enable MAC anti-spoof by default
  ice: Fix issue reclaiming resources back to the pool after reset

Brett Creeley (5):
  ice: remove redundant variable and if condition
  ice: use ice_for_each_vsi macro when possible
  ice: configure GLINT_ITR to always have an ITR gran of 2
  ice: Get resources per function
  ice: Determine descriptor count and ring size based on PAGE_SIZE

Bruce Allan (1):
  ice: avoid multiple unnecessary de-references in probe

Chinh T Cao (1):
  ice : Ensure only valid bits are set in ice_aq_set_phy_cfg

Henry Tieman (1):
  ice: implement ethtool set channels

Michal Swiatkowski (1):
  ice: Fix broadcast traffic in port VLAN mode

 drivers/net/ethernet/intel/ice/ice.h             |  19 ++-
 drivers/net/ethernet/intel/ice/ice_adminq_cmd.h  |   5 +-
 drivers/net/ethernet/intel/ice/ice_common.c      |  24 +++-
 drivers/net/ethernet/intel/ice/ice_ethtool.c     |  88 ++++++++++++-
 drivers/net/ethernet/intel/ice/ice_hw_autogen.h  |  10 ++
 drivers/net/ethernet/intel/ice/ice_lib.c         | 157 +++++++++++++++++++----
 drivers/net/ethernet/intel/ice/ice_lib.h         |   2 +-
 drivers/net/ethernet/intel/ice/ice_main.c        | 125 +++++++++++-------
 drivers/net/ethernet/intel/ice/ice_txrx.c        |  10 +-
 drivers/net/ethernet/intel/ice/ice_txrx.h        |   1 +
 drivers/net/ethernet/intel/ice/ice_type.h        |   1 +
 drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 100 +++++++++------
 12 files changed, 411 insertions(+), 131 deletions(-)

-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 01/14] ice: Fix broadcast traffic in port VLAN mode
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
@ 2019-02-08 20:50 ` Anirudh Venkataramanan
  2019-02-28 19:30   ` Bowers, AndrewX
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 02/14] ice: Fix issue with VF reset and multiple VFs support on PFs Anirudh Venkataramanan
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

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

Set egress (Rx) pruning enable flag for vf vsi in vsi ctxt to
enable prune action.

To avoid seeing broadcast packet in different vlan, pruning enable
flag in vsi ctxt should be set.

Write new functions (fill vsi ctx) to not repeat send ctxt code.

Signed-off-by: Michal Swiatkowski <michal.swiatkowski@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 76 ++++++++++++++----------
 1 file changed, 44 insertions(+), 32 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
index 57155b4a59dc..089881b53677 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
@@ -343,11 +343,41 @@ static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr)
 }
 
 /**
- * ice_vsi_set_pvid - Set port VLAN id for the VSI
- * @vsi: the VSI being changed
+ * ice_vsi_set_pvid_fill_ctxt - Set vsi ctxt for add pvid
+ * @ctxt: the vsi ctxt to fill
  * @vid: the VLAN id to set as a PVID
  */
-static int ice_vsi_set_pvid(struct ice_vsi *vsi, u16 vid)
+static void ice_vsi_set_pvid_fill_ctxt(struct ice_vsi_ctx *ctxt, u16 vid)
+{
+	ctxt->info.vlan_flags = (ICE_AQ_VSI_VLAN_MODE_UNTAGGED |
+				 ICE_AQ_VSI_PVLAN_INSERT_PVID |
+				 ICE_AQ_VSI_VLAN_EMOD_STR);
+	ctxt->info.pvid = cpu_to_le16(vid);
+	ctxt->info.sw_flags2 |= ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
+	ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID |
+						ICE_AQ_VSI_PROP_SW_VALID);
+}
+
+/**
+ * ice_vsi_kill_pvid_fill_ctxt - Set vsi ctx for remove pvid
+ * @ctxt: the VSI ctxt to fill
+ */
+static void ice_vsi_kill_pvid_fill_ctxt(struct ice_vsi_ctx *ctxt)
+{
+	ctxt->info.vlan_flags = ICE_AQ_VSI_VLAN_EMOD_NOTHING;
+	ctxt->info.vlan_flags |= ICE_AQ_VSI_VLAN_MODE_ALL;
+	ctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA;
+	ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID |
+						ICE_AQ_VSI_PROP_SW_VALID);
+}
+
+/**
+ * ice_vsi_manage_pvid - Enable or disable port VLAN for vsi
+ * @vsi: the vsi to update
+ * @vid: the VLAN id to set as a PVID
+ * @enable: true for enable pvid false for disable
+ */
+static int ice_vsi_manage_pvid(struct ice_vsi *vsi, u16 vid, bool enable)
 {
 	struct device *dev = &vsi->back->pdev->dev;
 	struct ice_hw *hw = &vsi->back->hw;
@@ -359,45 +389,26 @@ static int ice_vsi_set_pvid(struct ice_vsi *vsi, u16 vid)
 	if (!ctxt)
 		return -ENOMEM;
 
-	ctxt->info.vlan_flags = (ICE_AQ_VSI_VLAN_MODE_UNTAGGED |
-				 ICE_AQ_VSI_PVLAN_INSERT_PVID |
-				 ICE_AQ_VSI_VLAN_EMOD_STR);
-	ctxt->info.pvid = cpu_to_le16(vid);
-	ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);
+	ctxt->info = vsi->info;
+	if (enable)
+		ice_vsi_set_pvid_fill_ctxt(ctxt, vid);
+	else
+		ice_vsi_kill_pvid_fill_ctxt(ctxt);
 
 	status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
 	if (status) {
-		dev_info(dev, "update VSI for VLAN insert failed, err %d aq_err %d\n",
+		dev_info(dev, "update VSI for port VLAN failed, err %d aq_err %d\n",
 			 status, hw->adminq.sq_last_status);
 		ret = -EIO;
 		goto out;
 	}
 
-	vsi->info.pvid = ctxt->info.pvid;
-	vsi->info.vlan_flags = ctxt->info.vlan_flags;
+	vsi->info = ctxt->info;
 out:
 	devm_kfree(dev, ctxt);
 	return ret;
 }
 
-/**
- * ice_vsi_kill_pvid - Remove port VLAN id from the VSI
- * @vsi: the VSI being changed
- */
-static int ice_vsi_kill_pvid(struct ice_vsi *vsi)
-{
-	struct ice_pf *pf = vsi->back;
-
-	if (ice_vsi_manage_vlan_stripping(vsi, false)) {
-		dev_err(&pf->pdev->dev, "Error removing Port VLAN on VSI %i\n",
-			vsi->vsi_num);
-		return -ENODEV;
-	}
-
-	vsi->info.pvid = 0;
-	return 0;
-}
-
 /**
  * ice_vf_vsi_setup - Set up a VF VSI
  * @pf: board private structure
@@ -447,7 +458,7 @@ static int ice_alloc_vsi_res(struct ice_vf *vf)
 
 	/* Check if port VLAN exist before, and restore it accordingly */
 	if (vf->port_vlan_id)
-		ice_vsi_set_pvid(vsi, vf->port_vlan_id);
+		ice_vsi_manage_pvid(vsi, vf->port_vlan_id, true);
 
 	eth_broadcast_addr(broadcast);
 
@@ -2093,11 +2104,12 @@ ice_set_vf_port_vlan(struct net_device *netdev, int vf_id, u16 vlan_id, u8 qos,
 				  VLAN_VID_MASK));
 
 	if (vlan_id || qos) {
-		ret = ice_vsi_set_pvid(vsi, vlanprio);
+		ret = ice_vsi_manage_pvid(vsi, vlanprio, true);
 		if (ret)
 			goto error_set_pvid;
 	} else {
-		ice_vsi_kill_pvid(vsi);
+		ice_vsi_manage_pvid(vsi, 0, false);
+		vsi->info.pvid = 0;
 	}
 
 	if (vlan_id) {
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 02/14] ice: Fix issue with VF reset and multiple VFs support on PFs
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 01/14] ice: Fix broadcast traffic in port VLAN mode Anirudh Venkataramanan
@ 2019-02-08 20:50 ` Anirudh Venkataramanan
  2019-02-28 19:32   ` Bowers, AndrewX
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 03/14] ice: avoid multiple unnecessary de-references in probe Anirudh Venkataramanan
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

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

This patch fixes issues with VF queues being disabled, and VF netdev
network carrier being lost after reset. Basically, we need to check if VF
is enabled, and queue configured in reset_all_vfs flow, and disable/enable
those queues appropriately whenever the function is called after
Global/CORER/PFR reset/rebuild/replay.

Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
[Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> cleaned up commit message]
---
 drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 20 +++++++++++++-------
 1 file changed, 13 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 089881b53677..a7e1594521ec 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
@@ -775,6 +775,7 @@ static void ice_cleanup_and_realloc_vf(struct ice_vf *vf)
 bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)
 {
 	struct ice_hw *hw = &pf->hw;
+	struct ice_vf *vf;
 	int v, i;
 
 	/* If we don't have any VFs, then there is nothing to reset */
@@ -789,12 +790,17 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)
 	for (v = 0; v < pf->num_alloc_vfs; v++)
 		ice_trigger_vf_reset(&pf->vf[v], is_vflr);
 
-	/* Call Disable LAN Tx queue AQ call with VFR bit set and 0
-	 * queues to inform Firmware about VF reset.
-	 */
-	for (v = 0; v < pf->num_alloc_vfs; v++)
-		ice_dis_vsi_txq(pf->vsi[0]->port_info, 0, NULL, NULL,
-				ICE_VF_RESET, v, NULL);
+	for (v = 0; v < pf->num_alloc_vfs; v++) {
+		struct ice_vsi *vsi;
+
+		vf = &pf->vf[v];
+		vsi = pf->vsi[vf->lan_vsi_idx];
+		if (test_bit(ICE_VF_STATE_ENA, vf->vf_states)) {
+			ice_vsi_stop_lan_tx_rings(vsi, ICE_VF_RESET, vf->vf_id);
+			ice_vsi_stop_rx_rings(vsi);
+			clear_bit(ICE_VF_STATE_ENA, vf->vf_states);
+		}
+	}
 
 	/* HW requires some time to make sure it can flush the FIFO for a VF
 	 * when it resets it. Poll the VPGEN_VFRSTAT register for each VF in
@@ -807,9 +813,9 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr)
 
 		/* Check each VF in sequence */
 		while (v < pf->num_alloc_vfs) {
-			struct ice_vf *vf = &pf->vf[v];
 			u32 reg;
 
+			vf = &pf->vf[v];
 			reg = rd32(hw, VPGEN_VFRSTAT(vf->vf_id));
 			if (!(reg & VPGEN_VFRSTAT_VFRD_M))
 				break;
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 03/14] ice: avoid multiple unnecessary de-references in probe
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 01/14] ice: Fix broadcast traffic in port VLAN mode Anirudh Venkataramanan
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 02/14] ice: Fix issue with VF reset and multiple VFs support on PFs Anirudh Venkataramanan
@ 2019-02-08 20:50 ` Anirudh Venkataramanan
  2019-02-22 23:49   ` Bowers, AndrewX
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 04/14] ice: remove redundant variable and if condition Anirudh Venkataramanan
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

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

Add a local variable struct device *dev to avoid unnecessary de-references
throughout ice_probe().

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 33 ++++++++++++++-----------------
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 47cc3f905b7f..d353de4456f5 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -2075,6 +2075,7 @@ static void ice_verify_cacheline_size(struct ice_pf *pf)
 static int ice_probe(struct pci_dev *pdev,
 		     const struct pci_device_id __always_unused *ent)
 {
+	struct device *dev = &pdev->dev;
 	struct ice_pf *pf;
 	struct ice_hw *hw;
 	int err;
@@ -2086,20 +2087,20 @@ static int ice_probe(struct pci_dev *pdev,
 
 	err = pcim_iomap_regions(pdev, BIT(ICE_BAR0), pci_name(pdev));
 	if (err) {
-		dev_err(&pdev->dev, "BAR0 I/O map error %d\n", err);
+		dev_err(dev, "BAR0 I/O map error %d\n", err);
 		return err;
 	}
 
-	pf = devm_kzalloc(&pdev->dev, sizeof(*pf), GFP_KERNEL);
+	pf = devm_kzalloc(dev, sizeof(*pf), GFP_KERNEL);
 	if (!pf)
 		return -ENOMEM;
 
 	/* set up for high or low dma */
-	err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+	err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
 	if (err)
-		err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+		err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
 	if (err) {
-		dev_err(&pdev->dev, "DMA configuration failed: 0x%x\n", err);
+		dev_err(dev, "DMA configuration failed: 0x%x\n", err);
 		return err;
 	}
 
@@ -2133,12 +2134,12 @@ static int ice_probe(struct pci_dev *pdev,
 
 	err = ice_init_hw(hw);
 	if (err) {
-		dev_err(&pdev->dev, "ice_init_hw failed: %d\n", err);
+		dev_err(dev, "ice_init_hw failed: %d\n", err);
 		err = -EIO;
 		goto err_exit_unroll;
 	}
 
-	dev_info(&pdev->dev, "firmware %d.%d.%05d api %d.%d\n",
+	dev_info(dev, "firmware %d.%d.%05d api %d.%d\n",
 		 hw->fw_maj_ver, hw->fw_min_ver, hw->fw_build,
 		 hw->api_maj_ver, hw->api_min_ver);
 
@@ -2152,8 +2153,8 @@ static int ice_probe(struct pci_dev *pdev,
 		goto err_init_pf_unroll;
 	}
 
-	pf->vsi = devm_kcalloc(&pdev->dev, pf->num_alloc_vsi,
-			       sizeof(*pf->vsi), GFP_KERNEL);
+	pf->vsi = devm_kcalloc(dev, pf->num_alloc_vsi, sizeof(*pf->vsi),
+			       GFP_KERNEL);
 	if (!pf->vsi) {
 		err = -ENOMEM;
 		goto err_init_pf_unroll;
@@ -2161,8 +2162,7 @@ static int ice_probe(struct pci_dev *pdev,
 
 	err = ice_init_interrupt_scheme(pf);
 	if (err) {
-		dev_err(&pdev->dev,
-			"ice_init_interrupt_scheme failed: %d\n", err);
+		dev_err(dev, "ice_init_interrupt_scheme failed: %d\n", err);
 		err = -EIO;
 		goto err_init_interrupt_unroll;
 	}
@@ -2178,15 +2178,13 @@ static int ice_probe(struct pci_dev *pdev,
 	if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) {
 		err = ice_req_irq_msix_misc(pf);
 		if (err) {
-			dev_err(&pdev->dev,
-				"setup of misc vector failed: %d\n", err);
+			dev_err(dev, "setup of misc vector failed: %d\n", err);
 			goto err_init_interrupt_unroll;
 		}
 	}
 
 	/* create switch struct for the switch element created by FW on boot */
-	pf->first_sw = devm_kzalloc(&pdev->dev, sizeof(*pf->first_sw),
-				    GFP_KERNEL);
+	pf->first_sw = devm_kzalloc(dev, sizeof(*pf->first_sw), GFP_KERNEL);
 	if (!pf->first_sw) {
 		err = -ENOMEM;
 		goto err_msix_misc_unroll;
@@ -2204,8 +2202,7 @@ static int ice_probe(struct pci_dev *pdev,
 
 	err = ice_setup_pf_sw(pf);
 	if (err) {
-		dev_err(&pdev->dev,
-			"probe failed due to setup pf switch:%d\n", err);
+		dev_err(dev, "probe failed due to setup pf switch:%d\n", err);
 		goto err_alloc_sw_unroll;
 	}
 
@@ -2227,7 +2224,7 @@ static int ice_probe(struct pci_dev *pdev,
 	ice_free_irq_msix_misc(pf);
 err_init_interrupt_unroll:
 	ice_clear_interrupt_scheme(pf);
-	devm_kfree(&pdev->dev, pf->vsi);
+	devm_kfree(dev, pf->vsi);
 err_init_pf_unroll:
 	ice_deinit_pf(pf);
 	ice_deinit_hw(hw);
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 04/14] ice: remove redundant variable and if condition
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
                   ` (2 preceding siblings ...)
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 03/14] ice: avoid multiple unnecessary de-references in probe Anirudh Venkataramanan
@ 2019-02-08 20:50 ` Anirudh Venkataramanan
  2019-02-22 23:50   ` Bowers, AndrewX
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 05/14] ice : Ensure only valid bits are set in ice_aq_set_phy_cfg Anirudh Venkataramanan
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

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

In ice_pf_rxq_wait we are using an unnecessary local variable and also
we are checking if the timeout time was reached after the loop. Get rid
of the local variable and return 0 right when we get a successful
result. This makes it so we can return -ETIMEDOUT if we ever exit the
loop because we know the timeout time has been hit.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_lib.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index fa61203bee26..5215180d08a3 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -175,17 +175,14 @@ static int ice_pf_rxq_wait(struct ice_pf *pf, int pf_q, bool ena)
 	int i;
 
 	for (i = 0; i < ICE_Q_WAIT_MAX_RETRY; i++) {
-		u32 rx_reg = rd32(&pf->hw, QRX_CTRL(pf_q));
-
-		if (ena == !!(rx_reg & QRX_CTRL_QENA_STAT_M))
-			break;
+		if (ena == !!(rd32(&pf->hw, QRX_CTRL(pf_q)) &
+			      QRX_CTRL_QENA_STAT_M))
+			return 0;
 
 		usleep_range(20, 40);
 	}
-	if (i >= ICE_Q_WAIT_MAX_RETRY)
-		return -ETIMEDOUT;
 
-	return 0;
+	return -ETIMEDOUT;
 }
 
 /**
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 05/14] ice : Ensure only valid bits are set in ice_aq_set_phy_cfg
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
                   ` (3 preceding siblings ...)
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 04/14] ice: remove redundant variable and if condition Anirudh Venkataramanan
@ 2019-02-08 20:50 ` Anirudh Venkataramanan
  2019-02-28 19:33   ` Bowers, AndrewX
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 06/14] ice: implement ethtool set channels Anirudh Venkataramanan
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

From: Chinh T Cao <chinh.t.cao@intel.com>

In the ice_aq_set_phy_cfg AQ command, the 16.4 bit is reserved. This
patch will make sure that this bit will never be set to 1.

Signed-off-by: Chinh T Cao <chinh.t.cao@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_adminq_cmd.h |  5 +++--
 drivers/net/ethernet/intel/ice/ice_common.c     | 11 +++++++++++
 drivers/net/ethernet/intel/ice/ice_type.h       |  1 +
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
index 242c78469181..8ff438968199 100644
--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
@@ -953,8 +953,9 @@ struct ice_aqc_set_phy_cfg_data {
 	__le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
 	__le64 phy_type_high; /* Use values from ICE_PHY_TYPE_HIGH_* */
 	u8 caps;
-#define ICE_AQ_PHY_ENA_TX_PAUSE_ABILITY		BIT(0)
-#define ICE_AQ_PHY_ENA_RX_PAUSE_ABILITY		BIT(1)
+#define ICE_AQ_PHY_ENA_VALID_MASK	ICE_M(0xef, 0)
+#define ICE_AQ_PHY_ENA_TX_PAUSE_ABILITY	BIT(0)
+#define ICE_AQ_PHY_ENA_RX_PAUSE_ABILITY	BIT(1)
 #define ICE_AQ_PHY_ENA_LOW_POWER	BIT(2)
 #define ICE_AQ_PHY_ENA_LINK		BIT(3)
 #define ICE_AQ_PHY_ENA_AUTO_LINK_UPDT	BIT(5)
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index 63f003441300..2dc5c3249e12 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -1929,6 +1929,15 @@ ice_aq_set_phy_cfg(struct ice_hw *hw, u8 lport,
 	if (!cfg)
 		return ICE_ERR_PARAM;
 
+	/* Ensure that only valid bits of cfg->caps can be turned on. */
+	if (cfg->caps & ~ICE_AQ_PHY_ENA_VALID_MASK) {
+		ice_debug(hw, ICE_DBG_PHY,
+			  "Invalid bit is set in ice_aqc_set_phy_cfg_data->caps : 0x%x\n",
+			  cfg->caps);
+
+		cfg->caps &= ICE_AQ_PHY_ENA_VALID_MASK;
+	}
+
 	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_set_phy_cfg);
 	desc.params.set_phy.lport_num = lport;
 	desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
@@ -2027,8 +2036,10 @@ ice_set_fc(struct ice_port_info *pi, u8 *aq_failures, bool ena_auto_link_update)
 	/* clear the old pause settings */
 	cfg.caps = pcaps->caps & ~(ICE_AQC_PHY_EN_TX_LINK_PAUSE |
 				   ICE_AQC_PHY_EN_RX_LINK_PAUSE);
+
 	/* set the new capabilities */
 	cfg.caps |= pause_mask;
+
 	/* If the capabilities have changed, then set the new config */
 	if (cfg.caps != pcaps->caps) {
 		int retry_count, retry_max = 10;
diff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h
index 17086d5b5c33..560b0d2d46ff 100644
--- a/drivers/net/ethernet/intel/ice/ice_type.h
+++ b/drivers/net/ethernet/intel/ice/ice_type.h
@@ -24,6 +24,7 @@ static inline bool ice_is_tc_ena(u8 bitmap, u8 tc)
 /* debug masks - set these bits in hw->debug_mask to control output */
 #define ICE_DBG_INIT		BIT_ULL(1)
 #define ICE_DBG_LINK		BIT_ULL(4)
+#define ICE_DBG_PHY		BIT_ULL(5)
 #define ICE_DBG_QCTX		BIT_ULL(6)
 #define ICE_DBG_NVM		BIT_ULL(7)
 #define ICE_DBG_LAN		BIT_ULL(8)
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 06/14] ice: implement ethtool set channels
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
                   ` (4 preceding siblings ...)
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 05/14] ice : Ensure only valid bits are set in ice_aq_set_phy_cfg Anirudh Venkataramanan
@ 2019-02-08 20:50 ` Anirudh Venkataramanan
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 07/14] ice: use ice_for_each_vsi macro when possible Anirudh Venkataramanan
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

From: Henry Tieman <henry.w.tieman@intel.com>

Implement change the number of queues assigned to a VSI. This is
accessed from the 'ethtool -L' Linux command.

Signed-off-by: Henry Tieman <henry.w.tieman@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice.h         |  3 +
 drivers/net/ethernet/intel/ice/ice_ethtool.c | 85 ++++++++++++++++++++++++++++
 drivers/net/ethernet/intel/ice/ice_lib.c     | 50 ++++++++++++----
 drivers/net/ethernet/intel/ice/ice_lib.h     |  2 +-
 drivers/net/ethernet/intel/ice/ice_main.c    | 54 +++++++++++++++++-
 5 files changed, 182 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index 89440775aea1..02cbd7d92491 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -257,6 +257,8 @@ struct ice_vsi {
 	u16 num_txq;			 /* Used Tx queues */
 	u16 alloc_rxq;			 /* Allocated Rx queues */
 	u16 num_rxq;			 /* Used Rx queues */
+	u16 req_txq;			 /* User requested Tx queues */
+	u16 req_rxq;			 /* User requested Rx queues */
 	u16 num_desc;
 	struct ice_tc_cfg tc_cfg;
 } ____cacheline_internodealigned_in_smp;
@@ -381,6 +383,7 @@ static inline void ice_vsi_set_tc_cfg(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);
 int ice_up(struct ice_vsi *vsi);
 int ice_down(struct ice_vsi *vsi);
 int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index eb8d149e317c..1be757f63876 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -2079,6 +2079,89 @@ static int ice_set_rxfh(struct net_device *netdev, const u32 *indir,
 	return 0;
 }
 
+/**
+ * ice_get_max_txq - return the maximum number of Tx queues for in a PF
+ * @pf: pf structure
+ */
+static int ice_get_max_txq(struct ice_pf *pf)
+{
+	return min_t(int, num_online_cpus(),
+		     pf->hw.func_caps.common_cap.num_txq);
+}
+
+/**
+ * ice_get_max_rxq - return the maximum number of Rx queues for in a PF
+ * @pf: pf structure
+ */
+static int ice_get_max_rxq(struct ice_pf *pf)
+{
+	return min_t(int, num_online_cpus(),
+		     pf->hw.func_caps.common_cap.num_rxq);
+}
+
+/**
+ * ice_get_channels - get the current and max supported channels
+ * @dev: network interface device structure
+ * @ch: ethtool channel data structure
+ */
+static void
+ice_get_channels(struct net_device *dev, struct ethtool_channels *ch)
+{
+	struct ice_netdev_priv *np = netdev_priv(dev);
+	struct ice_vsi *vsi = np->vsi;
+	struct ice_pf *pf = vsi->back;
+
+	/* check to see if VSI is active */
+	if (test_bit(__ICE_DOWN, vsi->state))
+		return;
+
+	/* report maximum channels */
+	ch->max_rx = ice_get_max_rxq(pf);
+	ch->max_tx = ice_get_max_txq(pf);
+
+	/* report current channels */
+	ch->rx_count = vsi->num_rxq;
+	ch->tx_count = vsi->num_txq;
+}
+
+/**
+ * ice_set_channels - set the number channels
+ * @dev: network interface device structure
+ * @ch: ethtool channel data structure
+ */
+static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
+{
+	struct ice_netdev_priv *np = netdev_priv(dev);
+	struct ice_vsi *vsi = np->vsi;
+	struct ice_pf *pf = vsi->back;
+	int new_rx = 0, new_tx = 0;
+
+	/* do not support changing other_count */
+	if (ch->other_count)
+		return -EINVAL;
+
+	/* verify request for a valid number of channels */
+	if (ch->rx_count > ice_get_max_rxq(pf) ||
+	    ch->tx_count > ice_get_max_txq(pf))
+		return -EINVAL;
+
+	/* Use new Rx value only if changed */
+	if (ch->rx_count != vsi->num_rxq)
+		new_rx = ch->rx_count;
+
+	/* Use new Tx value only if changed */
+	if (ch->tx_count != vsi->num_txq)
+		new_tx = ch->tx_count;
+
+	/* verify that we have a valid request */
+	if (!new_rx && !new_tx)
+		return -EINVAL;
+
+	ice_vsi_recfg_qs(vsi, new_rx, new_tx);
+
+	return 0;
+}
+
 enum ice_container_type {
 	ICE_RX_CONTAINER,
 	ICE_TX_CONTAINER,
@@ -2360,6 +2443,8 @@ static const struct ethtool_ops ice_ethtool_ops = {
 	.get_rxfh_indir_size	= ice_get_rxfh_indir_size,
 	.get_rxfh		= ice_get_rxfh,
 	.set_rxfh		= ice_set_rxfh,
+	.get_channels		= ice_get_channels,
+	.set_channels		= ice_set_channels,
 	.get_ts_info		= ethtool_op_get_ts_info,
 	.get_per_queue_coalesce = ice_get_per_q_coalesce,
 	.set_per_queue_coalesce = ice_set_per_q_coalesce,
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 5215180d08a3..1418251b9275 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -289,6 +289,14 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi)
 	case ICE_VSI_PF:
 		vsi->alloc_txq = pf->num_lan_tx;
 		vsi->alloc_rxq = pf->num_lan_rx;
+		if (vsi->req_txq) {
+			vsi->alloc_txq = vsi->req_txq;
+			vsi->num_txq = vsi->req_txq;
+		}
+		if (vsi->req_rxq) {
+			vsi->alloc_rxq = vsi->req_rxq;
+			vsi->num_rxq = vsi->req_rxq;
+		}
 		vsi->num_desc = ALIGN(ICE_DFLT_NUM_DESC, ICE_REQ_DESC_MULTIPLE);
 		vsi->num_q_vectors = max_t(int, pf->num_lan_rx, pf->num_lan_tx);
 		break;
@@ -818,6 +826,9 @@ static void ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
 				max_rss = ICE_MAX_SMALL_RSS_QS;
 			qcount_rx = min_t(int, rx_numq_tc, max_rss);
 			qcount_rx = min_t(int, qcount_rx, vsi->rss_size);
+			if (!vsi->req_rxq)
+				qcount_rx = min_t(int, qcount_rx,
+						  vsi->rss_size);
 		}
 	}
 
@@ -905,11 +916,12 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)
 /**
  * ice_vsi_init - Create and initialize a VSI
  * @vsi: the VSI being configured
+ * @init_vsi: is this call creating a VSI
  *
  * This initializes a VSI context depending on the VSI type to be added and
  * passes it down to the add_vsi aq command to create a new VSI.
  */
-static int ice_vsi_init(struct ice_vsi *vsi)
+static int ice_vsi_init(struct ice_vsi *vsi, bool init_vsi)
 {
 	struct ice_pf *pf = vsi->back;
 	struct ice_hw *hw = &pf->hw;
@@ -930,7 +942,8 @@ static int ice_vsi_init(struct ice_vsi *vsi)
 		ctxt->vf_num = vsi->vf_id + hw->func_caps.vf_base_id;
 		break;
 	default:
-		return -ENODEV;
+		ret = -ENODEV;
+		goto out;
 	}
 
 	ice_set_dflt_vsi_ctx(ctxt);
@@ -945,11 +958,22 @@ static int ice_vsi_init(struct ice_vsi *vsi)
 	ctxt->info.sw_id = vsi->port_info->sw_id;
 	ice_vsi_setup_q_map(vsi, ctxt);
 
-	ret = ice_add_vsi(hw, vsi->idx, ctxt, NULL);
-	if (ret) {
-		dev_err(&pf->pdev->dev,
-			"Add VSI failed, err %d\n", ret);
-		return -EIO;
+	if (init_vsi) {
+		ret = ice_add_vsi(hw, vsi->idx, ctxt, NULL);
+		if (ret) {
+			dev_err(&pf->pdev->dev,
+				"Add VSI failed, err %d\n", ret);
+			ret = -EIO;
+			goto out;
+		}
+	} else {
+		ret = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
+		if (ret) {
+			dev_err(&pf->pdev->dev,
+				"Update VSI failed, err %d\n", ret);
+			ret = -EIO;
+			goto out;
+		}
 	}
 
 	/* keep context for update VSI operations */
@@ -958,6 +982,7 @@ static int ice_vsi_init(struct ice_vsi *vsi)
 	/* record VSI number returned */
 	vsi->vsi_num = ctxt->vsi_num;
 
+out:
 	devm_kfree(&pf->pdev->dev, ctxt);
 	return ret;
 }
@@ -2133,7 +2158,7 @@ ice_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi,
 	ice_vsi_set_tc_cfg(vsi);
 
 	/* create the VSI */
-	ret = ice_vsi_init(vsi);
+	ret = ice_vsi_init(vsi, true);
 	if (ret)
 		goto unroll_get_qs;
 
@@ -2587,10 +2612,11 @@ int ice_vsi_release(struct ice_vsi *vsi)
 /**
  * ice_vsi_rebuild - Rebuild VSI after reset
  * @vsi: VSI to be rebuild
+ * @init_vsi: is this an initialization or a reconfigure of the VSI
  *
  * Returns 0 on success and negative value on failure
  */
-int ice_vsi_rebuild(struct ice_vsi *vsi)
+int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)
 {
 	u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
 	struct ice_pf *pf;
@@ -2609,11 +2635,15 @@ int ice_vsi_rebuild(struct ice_vsi *vsi)
 	ice_vsi_clear_rings(vsi);
 	ice_vsi_free_arrays(vsi, false);
 	ice_dev_onetime_setup(&vsi->back->hw);
+	if (vsi->req_txq || vsi->req_rxq)
+		ice_vsi_put_qs(vsi);
 	ice_vsi_set_num_qs(vsi);
+	if (vsi->req_txq || vsi->req_rxq)
+		ice_vsi_get_qs(vsi);
 	ice_vsi_set_tc_cfg(vsi);
 
 	/* Initialize VSI struct elements and create VSI in FW */
-	ret = ice_vsi_init(vsi);
+	ret = ice_vsi_init(vsi, init_vsi);
 	if (ret < 0)
 		goto err_vsi;
 
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h
index 7988a53729a9..7f8b08863dad 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.h
+++ b/drivers/net/ethernet/intel/ice/ice_lib.h
@@ -54,7 +54,7 @@ int ice_free_res(struct ice_res_tracker *res, u16 index, u16 id);
 int
 ice_get_res(struct ice_pf *pf, struct ice_res_tracker *res, u16 needed, u16 id);
 
-int ice_vsi_rebuild(struct ice_vsi *vsi);
+int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi);
 
 bool ice_is_reset_in_progress(unsigned long *state);
 
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index d353de4456f5..ad1bd3fe1f34 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -3382,7 +3382,7 @@ static int ice_vsi_rebuild_all(struct ice_pf *pf)
 		if (pf->vsi[i]->type == ICE_VSI_VF)
 			continue;
 
-		err = ice_vsi_rebuild(pf->vsi[i]);
+		err = ice_vsi_rebuild(pf->vsi[i], true);
 		if (err) {
 			dev_err(&pf->pdev->dev,
 				"VSI at index %d rebuild failed\n",
@@ -3552,6 +3552,58 @@ static void ice_rebuild(struct ice_pf *pf)
 	dev_err(dev, "Rebuild failed, unload and reload driver\n");
 }
 
+/**
+ * ice_vsi_recfg_qs - Change the number of queues on a VSI
+ * @vsi: VSI being changed
+ * @new_rx: new number of Rx queues
+ * @new_tx: new number of Tx queues
+ *
+ * Only change the number of queues if new_tx, or new_rx is non-0.
+ *
+ * Returns 0 on success.
+ */
+int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx)
+{
+	struct ice_pf *pf = vsi->back;
+	int err = 0, timeout = 50;
+
+	if (!new_rx && !new_tx)
+		return -EINVAL;
+
+	while (test_and_set_bit(__ICE_CFG_BUSY, pf->state)) {
+		timeout--;
+		if (!timeout)
+			return -EBUSY;
+		usleep_range(1000, 2000);
+	}
+
+	/* set for the next time the netdev is started */
+	if (!netif_running(vsi->netdev)) {
+		if (new_tx)
+			vsi->req_txq = new_tx;
+		if (new_rx)
+			vsi->req_rxq = new_rx;
+
+		dev_dbg(&pf->pdev->dev, "Link is down, queue count change happens when link is brought up\n");
+		goto done;
+	}
+
+	ice_vsi_close(vsi);
+
+	if (new_tx)
+		vsi->req_txq = new_tx;
+
+	if (new_rx)
+		vsi->req_rxq = new_rx;
+
+	ice_vsi_rebuild(vsi, false);
+
+	ice_vsi_open(vsi);
+done:
+	clear_bit(__ICE_CFG_BUSY, pf->state);
+	return err;
+}
+
 /**
  * ice_change_mtu - NDO callback to change the MTU
  * @netdev: network interface device structure
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 07/14] ice: use ice_for_each_vsi macro when possible
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
                   ` (5 preceding siblings ...)
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 06/14] ice: implement ethtool set channels Anirudh Venkataramanan
@ 2019-02-08 20:50 ` Anirudh Venkataramanan
  2019-02-22 23:51   ` Bowers, AndrewX
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 08/14] ice: configure GLINT_ITR to always have an ITR gran of 2 Anirudh Venkataramanan
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

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

Replace all instances of:
	for (i = 0; i < pf->num_alloc_vsi; i++)

with the following macro:
	ice_for_each_vsi(pf, i)

This will allow the code to be consistent since there are currently
cases of using both.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_ethtool.c     |  3 +--
 drivers/net/ethernet/intel/ice/ice_main.c        | 12 ++++++------
 drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c |  2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index 1be757f63876..b906c7d15d46 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -1400,13 +1400,12 @@ ice_set_link_ksettings(struct net_device *netdev,
 		return -EOPNOTSUPP;
 
 	/* Check if this is lan vsi */
-	for (idx = 0 ; idx <  pf->num_alloc_vsi ; idx++) {
+	ice_for_each_vsi(pf, idx)
 		if (pf->vsi[idx]->type == ICE_VSI_PF) {
 			if (np->vsi != pf->vsi[idx])
 				return -EOPNOTSUPP;
 			break;
 		}
-	}
 
 	if (p->phy.media_type != ICE_MEDIA_BASET &&
 	    p->phy.media_type != ICE_MEDIA_FIBER &&
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index ad1bd3fe1f34..f5ade04cb9de 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -322,7 +322,7 @@ static void ice_sync_fltr_subtask(struct ice_pf *pf)
 
 	clear_bit(ICE_FLAG_FLTR_SYNC, pf->flags);
 
-	for (v = 0; v < pf->num_alloc_vsi; v++)
+	ice_for_each_vsi(pf, v)
 		if (pf->vsi[v] && ice_vsi_fltr_changed(pf->vsi[v]) &&
 		    ice_vsi_sync_fltr(pf->vsi[v])) {
 			/* come back and try again later */
@@ -642,7 +642,7 @@ static void ice_watchdog_subtask(struct ice_pf *pf)
 	 * can look at updated numbers whenever it cares to
 	 */
 	ice_update_pf_stats(pf);
-	for (i = 0; i < pf->num_alloc_vsi; i++)
+	ice_for_each_vsi(pf, i)
 		if (pf->vsi[i] && pf->vsi[i]->netdev)
 			ice_update_vsi_stats(pf->vsi[i]);
 }
@@ -3273,7 +3273,7 @@ static void ice_vsi_release_all(struct ice_pf *pf)
 	if (!pf->vsi)
 		return;
 
-	for (i = 0; i < pf->num_alloc_vsi; i++) {
+	ice_for_each_vsi(pf, i) {
 		if (!pf->vsi[i])
 			continue;
 
@@ -3372,7 +3372,7 @@ static int ice_vsi_rebuild_all(struct ice_pf *pf)
 	int i;
 
 	/* loop through pf->vsi array and reinit the VSI if found */
-	for (i = 0; i < pf->num_alloc_vsi; i++) {
+	ice_for_each_vsi(pf, i) {
 		int err;
 
 		if (!pf->vsi[i])
@@ -3409,7 +3409,7 @@ static int ice_vsi_replay_all(struct ice_pf *pf)
 	int i;
 
 	/* loop through pf->vsi array and replay the VSI if found */
-	for (i = 0; i < pf->num_alloc_vsi; i++) {
+	ice_for_each_vsi(pf, i) {
 		if (!pf->vsi[i])
 			continue;
 
@@ -3520,7 +3520,7 @@ static void ice_rebuild(struct ice_pf *pf)
 
 	ice_reset_all_vfs(pf, true);
 
-	for (i = 0; i < pf->num_alloc_vsi; i++) {
+	ice_for_each_vsi(pf, i) {
 		bool link_up;
 
 		if (!pf->vsi[i] || pf->vsi[i]->type != ICE_VSI_PF)
diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
index a7e1594521ec..99c8cddb2162 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
@@ -1385,7 +1385,7 @@ static struct ice_vsi *ice_find_vsi_from_id(struct ice_pf *pf, u16 id)
 {
 	int i;
 
-	for (i = 0; i < pf->num_alloc_vsi; i++)
+	ice_for_each_vsi(pf, i)
 		if (pf->vsi[i] && pf->vsi[i]->vsi_num == id)
 			return pf->vsi[i];
 
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 08/14] ice: configure GLINT_ITR to always have an ITR gran of 2
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
                   ` (6 preceding siblings ...)
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 07/14] ice: use ice_for_each_vsi macro when possible Anirudh Venkataramanan
@ 2019-02-08 20:50 ` Anirudh Venkataramanan
  2019-02-22 23:52   ` Bowers, AndrewX
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 09/14] ice: Implement flow to reset VFs with PFR and other resets Anirudh Venkataramanan
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

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

Instead of hoping that our ITR granularity will be 2 usec program the
GLINT_CTL register to make sure the ITR granularity is always 2 usecs.

Now that we know what the ITR granularity will be get rid of the check
in ice_probe() to verify our previous assumption.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_hw_autogen.h | 10 ++++++++
 drivers/net/ethernet/intel/ice/ice_lib.c        | 33 +++++++++++++++++++++++++
 drivers/net/ethernet/intel/ice/ice_main.c       | 18 --------------
 drivers/net/ethernet/intel/ice/ice_txrx.h       |  1 +
 4 files changed, 44 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
index 6bf5cc064270..24255ff64ab0 100644
--- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
+++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
@@ -106,6 +106,16 @@
 #define VPGEN_VFRTRIG_VFSWR_M			BIT(0)
 #define PFHMC_ERRORDATA				0x00520500
 #define PFHMC_ERRORINFO				0x00520400
+#define GLINT_CTL				0x0016CC54
+#define GLINT_CTL_DIS_AUTOMASK_M		BIT(0)
+#define GLINT_CTL_ITR_GRAN_200_S		16
+#define GLINT_CTL_ITR_GRAN_200_M		ICE_M(0xF, 16)
+#define GLINT_CTL_ITR_GRAN_100_S		20
+#define GLINT_CTL_ITR_GRAN_100_M		ICE_M(0xF, 20)
+#define GLINT_CTL_ITR_GRAN_50_S			24
+#define GLINT_CTL_ITR_GRAN_50_M			ICE_M(0xF, 24)
+#define GLINT_CTL_ITR_GRAN_25_S			28
+#define GLINT_CTL_ITR_GRAN_25_M			ICE_M(0xF, 28)
 #define GLINT_DYN_CTL(_INT)			(0x00160000 + ((_INT) * 4))
 #define GLINT_DYN_CTL_INTENA_M			BIT(0)
 #define GLINT_DYN_CTL_CLEARPBA_M		BIT(1)
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 1418251b9275..40e9df15777b 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -1738,6 +1738,37 @@ static u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran)
 	return 0;
 }
 
+/**
+ * ice_cfg_itr_gran - set the ITR granularity to 2 usecs if not already set
+ * @hw: board specific structure
+ */
+static void ice_cfg_itr_gran(struct ice_hw *hw)
+{
+	u32 regval = rd32(hw, GLINT_CTL);
+
+	/* no need to update global register if ITR gran is already set */
+	if (!(regval & GLINT_CTL_DIS_AUTOMASK_M) &&
+	    (((regval & GLINT_CTL_ITR_GRAN_200_M) >>
+	     GLINT_CTL_ITR_GRAN_200_S) == ICE_ITR_GRAN_US) &&
+	    (((regval & GLINT_CTL_ITR_GRAN_100_M) >>
+	     GLINT_CTL_ITR_GRAN_100_S) == ICE_ITR_GRAN_US) &&
+	    (((regval & GLINT_CTL_ITR_GRAN_50_M) >>
+	     GLINT_CTL_ITR_GRAN_50_S) == ICE_ITR_GRAN_US) &&
+	    (((regval & GLINT_CTL_ITR_GRAN_25_M) >>
+	      GLINT_CTL_ITR_GRAN_25_S) == ICE_ITR_GRAN_US))
+		return;
+
+	regval = ((ICE_ITR_GRAN_US << GLINT_CTL_ITR_GRAN_200_S) &
+		  GLINT_CTL_ITR_GRAN_200_M) |
+		 ((ICE_ITR_GRAN_US << GLINT_CTL_ITR_GRAN_100_S) &
+		  GLINT_CTL_ITR_GRAN_100_M) |
+		 ((ICE_ITR_GRAN_US << GLINT_CTL_ITR_GRAN_50_S) &
+		  GLINT_CTL_ITR_GRAN_50_M) |
+		 ((ICE_ITR_GRAN_US << GLINT_CTL_ITR_GRAN_25_S) &
+		  GLINT_CTL_ITR_GRAN_25_M);
+	wr32(hw, GLINT_CTL, regval);
+}
+
 /**
  * ice_cfg_itr - configure the initial interrupt throttle values
  * @hw: pointer to the HW structure
@@ -1750,6 +1781,8 @@ static u32 ice_intrl_usec_to_reg(u8 intrl, u8 gran)
 static void
 ice_cfg_itr(struct ice_hw *hw, struct ice_q_vector *q_vector, u16 vector)
 {
+	ice_cfg_itr_gran(hw);
+
 	if (q_vector->num_ring_rx) {
 		struct ice_ring_container *rc = &q_vector->rx;
 
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index f5ade04cb9de..23db0cda6655 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -2032,23 +2032,6 @@ static int ice_init_interrupt_scheme(struct ice_pf *pf)
 	return 0;
 }
 
-/**
- * ice_verify_itr_gran - verify driver's assumption of ITR granularity
- * @pf: pointer to the PF structure
- *
- * There is no error returned here because the driver will be able to handle a
- * different ITR granularity, but interrupt moderation will not be accurate if
- * the driver's assumptions are not verified. This assumption is made so we can
- * use constants in the hot path instead of accessing structure members.
- */
-static void ice_verify_itr_gran(struct ice_pf *pf)
-{
-	if (pf->hw.itr_gran != (ICE_ITR_GRAN_S << 1))
-		dev_warn(&pf->pdev->dev,
-			 "%d ITR granularity assumption is invalid, actual ITR granularity is %d. Interrupt moderation will be inaccurate!\n",
-			 (ICE_ITR_GRAN_S << 1), pf->hw.itr_gran);
-}
-
 /**
  * ice_verify_cacheline_size - verify driver's assumption of 64 Byte cache lines
  * @pf: pointer to the PF structure
@@ -2212,7 +2195,6 @@ static int ice_probe(struct pci_dev *pdev,
 	mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period));
 
 	ice_verify_cacheline_size(pf);
-	ice_verify_itr_gran(pf);
 
 	return 0;
 
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.h b/drivers/net/ethernet/intel/ice/ice_txrx.h
index fc358ea81816..b7ff0ff82517 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.h
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.h
@@ -125,6 +125,7 @@ enum ice_rx_dtype {
 #define ITR_IS_DYNAMIC(setting) (!!((setting) & ICE_ITR_DYNAMIC))
 #define ITR_TO_REG(setting)	((setting) & ~ICE_ITR_DYNAMIC)
 #define ICE_ITR_GRAN_S		1	/* Assume ITR granularity is 2us */
+#define ICE_ITR_GRAN_US		BIT(ICE_ITR_GRAN_S)
 #define ICE_ITR_MASK		0x1FFE	/* ITR register value alignment mask */
 #define ITR_REG_ALIGN(setting)	__ALIGN_MASK(setting, ~ICE_ITR_MASK)
 
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 09/14] ice: Implement flow to reset VFs with PFR and other resets
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
                   ` (7 preceding siblings ...)
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 08/14] ice: configure GLINT_ITR to always have an ITR gran of 2 Anirudh Venkataramanan
@ 2019-02-08 20:50 ` Anirudh Venkataramanan
  2019-02-28 19:34   ` Bowers, AndrewX
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 10/14] ice: Get resources per function Anirudh Venkataramanan
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

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

All VF VSIs need to be reset and rebuild with the main VSIs before
replaying all VSIs, so that all existing switch filters, scheduler tree
and other configuration could be replayed at once. This fixes issues when
doing PFR and CORER reset.

Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
[Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> cleaned up commit message]
---
 drivers/net/ethernet/intel/ice/ice_main.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 23db0cda6655..dcb5a9fab87d 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -394,6 +394,7 @@ static void ice_do_reset(struct ice_pf *pf, enum ice_reset_req reset_type)
 		ice_rebuild(pf);
 		clear_bit(__ICE_PREPARED_FOR_RESET, pf->state);
 		clear_bit(__ICE_PFR_REQ, pf->state);
+		ice_reset_all_vfs(pf, true);
 	}
 }
 
@@ -436,6 +437,7 @@ static void ice_reset_subtask(struct ice_pf *pf)
 			clear_bit(__ICE_PFR_REQ, pf->state);
 			clear_bit(__ICE_CORER_REQ, pf->state);
 			clear_bit(__ICE_GLOBR_REQ, pf->state);
+			ice_reset_all_vfs(pf, true);
 		}
 
 		return;
@@ -3360,10 +3362,6 @@ static int ice_vsi_rebuild_all(struct ice_pf *pf)
 		if (!pf->vsi[i])
 			continue;
 
-		/* VF VSI rebuild isn't supported yet */
-		if (pf->vsi[i]->type == ICE_VSI_VF)
-			continue;
-
 		err = ice_vsi_rebuild(pf->vsi[i], true);
 		if (err) {
 			dev_err(&pf->pdev->dev,
@@ -3500,8 +3498,6 @@ static void ice_rebuild(struct ice_pf *pf)
 		goto err_vsi_rebuild;
 	}
 
-	ice_reset_all_vfs(pf, true);
-
 	ice_for_each_vsi(pf, i) {
 		bool link_up;
 
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 10/14] ice: Get resources per function
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
                   ` (8 preceding siblings ...)
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 09/14] ice: Implement flow to reset VFs with PFR and other resets Anirudh Venkataramanan
@ 2019-02-08 20:50 ` Anirudh Venkataramanan
  2019-02-28 19:34   ` Bowers, AndrewX
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 11/14] ice: Reset all VFs with VFLR during SR-IOV init flow Anirudh Venkataramanan
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

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

ice_get_guar_num_vsi currently calculates the number of VSIs per PF.
Rework this into a general function ice_get_num_per_func, that can
calculate per PF allocations for not just VSIs but across multiple
resource types.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
[Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> rewrote commit message]
---
 drivers/net/ethernet/intel/ice/ice_common.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index 2dc5c3249e12..d2e1e6f440b8 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -1415,13 +1415,15 @@ void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res)
 }
 
 /**
- * ice_get_guar_num_vsi - determine number of guar VSI for a PF
+ * ice_get_num_per_func - determine number of resources per PF
  * @hw: pointer to the hw structure
+ * @max: value to be evenly split between each PF
  *
  * Determine the number of valid functions by going through the bitmap returned
- * from parsing capabilities and use this to calculate the number of VSI per PF.
+ * from parsing capabilities and use this to calculate the number of resources
+ * per PF based on the max value passed in.
  */
-static u32 ice_get_guar_num_vsi(struct ice_hw *hw)
+static u32 ice_get_num_per_func(struct ice_hw *hw, u32 max)
 {
 	u8 funcs;
 
@@ -1432,7 +1434,7 @@ static u32 ice_get_guar_num_vsi(struct ice_hw *hw)
 	if (!funcs)
 		return 0;
 
-	return ICE_MAX_VSI / funcs;
+	return max / funcs;
 }
 
 /**
@@ -1512,7 +1514,8 @@ ice_parse_caps(struct ice_hw *hw, void *buf, u32 cap_count,
 					  "HW caps: Dev.VSI cnt = %d\n",
 					  dev_p->num_vsi_allocd_to_host);
 			} else if (func_p) {
-				func_p->guar_num_vsi = ice_get_guar_num_vsi(hw);
+				func_p->guar_num_vsi =
+					ice_get_num_per_func(hw, ICE_MAX_VSI);
 				ice_debug(hw, ICE_DBG_INIT,
 					  "HW caps: Func.VSI cnt = %d\n",
 					  number);
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 11/14] ice: Reset all VFs with VFLR during SR-IOV init flow
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
                   ` (9 preceding siblings ...)
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 10/14] ice: Get resources per function Anirudh Venkataramanan
@ 2019-02-08 20:50 ` Anirudh Venkataramanan
  2019-02-28 19:34   ` Bowers, AndrewX
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 12/14] ice: Determine descriptor count and ring size based on PAGE_SIZE Anirudh Venkataramanan
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

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

During SR-IOV initialization, we allocate and setup VFs with reset, and
since we were going to inform Firmware about our intention to do VFLR by
disabling LAN TX Queue, then we really have to complete VF reset flow with
VFLR using appropriate registers - Otherwise, reset status bit for VF in
the Guest OS might returns DEADBEEF.
This resolves issue to properly initialize VFs in the Guest OS via PCI
passthrough.

Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
index 99c8cddb2162..a93db0a7ac1c 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
@@ -1029,7 +1029,7 @@ static int ice_alloc_vfs(struct ice_pf *pf, u16 num_alloc_vfs)
 	pf->num_alloc_vfs = num_alloc_vfs;
 
 	/* VF resources get allocated during reset */
-	if (!ice_reset_all_vfs(pf, false))
+	if (!ice_reset_all_vfs(pf, true))
 		goto err_unroll_sriov;
 
 	goto err_unroll_intr;
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 12/14] ice: Determine descriptor count and ring size based on PAGE_SIZE
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
                   ` (10 preceding siblings ...)
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 11/14] ice: Reset all VFs with VFLR during SR-IOV init flow Anirudh Venkataramanan
@ 2019-02-08 20:50 ` Anirudh Venkataramanan
  2019-02-28 19:35   ` Bowers, AndrewX
  2019-02-08 20:51 ` [Intel-wired-lan] [PATCH S12 13/14] ice: Enable MAC anti-spoof by default Anirudh Venkataramanan
  2019-02-08 20:51 ` [Intel-wired-lan] [PATCH S12 14/14] ice: Fix issue reclaiming resources back to the pool after reset Anirudh Venkataramanan
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:50 UTC (permalink / raw)
  To: intel-wired-lan

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

Currently we set the default number of Tx and Rx descriptors to 128 by
default. For Rx this amounts to a full page (assuming 4K pages) because
each Rx descriptor is 32 Bytes, but for Tx it only amounts to a half
page because each Tx descriptor is 16 Bytes (assuming 4K pages).
Instead of assuming 4K pages, determine the ring size and the number of
descriptors for Tx and Rx based on a calculation using the PAGE_SIZE,
ICE_MAX_NUM_DESC, and ICE_REQ_DESC_MULTIPLE. This change is being made
to improve the performance of the driver when using the default
settings.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice.h      | 16 ++++++++++++++--
 drivers/net/ethernet/intel/ice/ice_lib.c  | 28 ++++++++++++++++++++++++----
 drivers/net/ethernet/intel/ice/ice_txrx.c | 10 +++++-----
 3 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
index 02cbd7d92491..652dbfb5ab4e 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -42,10 +42,21 @@
 
 extern const char ice_drv_ver[];
 #define ICE_BAR0		0
-#define ICE_DFLT_NUM_DESC	128
 #define ICE_REQ_DESC_MULTIPLE	32
 #define ICE_MIN_NUM_DESC	ICE_REQ_DESC_MULTIPLE
 #define ICE_MAX_NUM_DESC	8160
+/* set default number of Rx/Tx descriptors to the minimum between
+ * ICE_MAX_NUM_DESC and the number of descriptors to fill up an entire page
+ */
+#define ICE_DFLT_NUM_RX_DESC	min_t(u16, ICE_MAX_NUM_DESC, \
+				      ALIGN(PAGE_SIZE / \
+					    sizeof(union ice_32byte_rx_desc), \
+					    ICE_REQ_DESC_MULTIPLE))
+#define ICE_DFLT_NUM_TX_DESC	min_t(u16, ICE_MAX_NUM_DESC, \
+				      ALIGN(PAGE_SIZE / \
+					    sizeof(struct ice_tx_desc), \
+					    ICE_REQ_DESC_MULTIPLE))
+
 #define ICE_DFLT_TRAFFIC_CLASS	BIT(0)
 #define ICE_INT_NAME_STR_LEN	(IFNAMSIZ + 16)
 #define ICE_ETHTOOL_FWVER_LEN	32
@@ -259,7 +270,8 @@ struct ice_vsi {
 	u16 num_rxq;			 /* Used Rx queues */
 	u16 req_txq;			 /* User requested Tx queues */
 	u16 req_rxq;			 /* User requested Rx queues */
-	u16 num_desc;
+	u16 num_rx_desc;
+	u16 num_tx_desc;
 	struct ice_tc_cfg tc_cfg;
 } ____cacheline_internodealigned_in_smp;
 
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 40e9df15777b..864007bc945e 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -276,7 +276,26 @@ static int ice_vsi_alloc_arrays(struct ice_vsi *vsi, bool alloc_qvectors)
 }
 
 /**
- * ice_vsi_set_num_qs - Set num queues, descriptors and vectors for a VSI
+ * ice_vsi_set_num_desc - Set number of descriptors for queues on this VSI
+ * @vsi: the VSI being configured
+ */
+static void ice_vsi_set_num_desc(struct ice_vsi *vsi)
+{
+	switch (vsi->type) {
+	case ICE_VSI_PF:
+		vsi->num_rx_desc = ICE_DFLT_NUM_RX_DESC;
+		vsi->num_tx_desc = ICE_DFLT_NUM_TX_DESC;
+		break;
+	default:
+		dev_dbg(&vsi->back->pdev->dev,
+			"Not setting number of Tx/Rx descriptors for VSI type %d\n",
+			vsi->type);
+		break;
+	}
+}
+
+/**
+ * ice_vsi_set_num_qs - Set number of queues, descriptors and vectors for a VSI
  * @vsi: the VSI being configured
  *
  * Return 0 on success and a negative value on error
@@ -297,7 +316,6 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi)
 			vsi->alloc_rxq = vsi->req_rxq;
 			vsi->num_rxq = vsi->req_rxq;
 		}
-		vsi->num_desc = ALIGN(ICE_DFLT_NUM_DESC, ICE_REQ_DESC_MULTIPLE);
 		vsi->num_q_vectors = max_t(int, pf->num_lan_rx, pf->num_lan_tx);
 		break;
 	case ICE_VSI_VF:
@@ -315,6 +333,8 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi)
 			 vsi->type);
 		break;
 	}
+
+	ice_vsi_set_num_desc(vsi);
 }
 
 /**
@@ -1237,7 +1257,7 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi)
 		ring->ring_active = false;
 		ring->vsi = vsi;
 		ring->dev = &pf->pdev->dev;
-		ring->count = vsi->num_desc;
+		ring->count = vsi->num_tx_desc;
 		vsi->tx_rings[i] = ring;
 	}
 
@@ -1256,7 +1276,7 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi)
 		ring->vsi = vsi;
 		ring->netdev = vsi->netdev;
 		ring->dev = &pf->pdev->dev;
-		ring->count = vsi->num_desc;
+		ring->count = vsi->num_rx_desc;
 		vsi->rx_rings[i] = ring;
 	}
 
diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c
index c289d97f477d..fad308c936b2 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
@@ -236,9 +236,9 @@ int ice_setup_tx_ring(struct ice_ring *tx_ring)
 	if (!tx_ring->tx_buf)
 		return -ENOMEM;
 
-	/* round up to nearest 4K */
+	/* round up to nearest page */
 	tx_ring->size = ALIGN(tx_ring->count * sizeof(struct ice_tx_desc),
-			      4096);
+			      PAGE_SIZE);
 	tx_ring->desc = dmam_alloc_coherent(dev, tx_ring->size, &tx_ring->dma,
 					    GFP_KERNEL);
 	if (!tx_ring->desc) {
@@ -339,9 +339,9 @@ int ice_setup_rx_ring(struct ice_ring *rx_ring)
 	if (!rx_ring->rx_buf)
 		return -ENOMEM;
 
-	/* round up to nearest 4K */
-	rx_ring->size = rx_ring->count * sizeof(union ice_32byte_rx_desc);
-	rx_ring->size = ALIGN(rx_ring->size, 4096);
+	/* round up to nearest page */
+	rx_ring->size = ALIGN(rx_ring->count * sizeof(union ice_32byte_rx_desc),
+			      PAGE_SIZE);
 	rx_ring->desc = dmam_alloc_coherent(dev, rx_ring->size, &rx_ring->dma,
 					    GFP_KERNEL);
 	if (!rx_ring->desc) {
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 13/14] ice: Enable MAC anti-spoof by default
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
                   ` (11 preceding siblings ...)
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 12/14] ice: Determine descriptor count and ring size based on PAGE_SIZE Anirudh Venkataramanan
@ 2019-02-08 20:51 ` Anirudh Venkataramanan
  2019-02-28 19:36   ` Bowers, AndrewX
  2019-02-08 20:51 ` [Intel-wired-lan] [PATCH S12 14/14] ice: Fix issue reclaiming resources back to the pool after reset Anirudh Venkataramanan
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:51 UTC (permalink / raw)
  To: intel-wired-lan

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

This patch enables MAC anti-spoof by default, with creation of VF VSIs or
when the VF VSIs are being re-initialized.

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

diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 864007bc945e..d528640fc5b1 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -952,6 +952,7 @@ static int ice_vsi_init(struct ice_vsi *vsi, bool init_vsi)
 	if (!ctxt)
 		return -ENOMEM;
 
+	ctxt->info = vsi->info;
 	switch (vsi->type) {
 	case ICE_VSI_PF:
 		ctxt->flags = ICE_AQ_VSI_TYPE_PF;
@@ -978,6 +979,14 @@ static int ice_vsi_init(struct ice_vsi *vsi, bool init_vsi)
 	ctxt->info.sw_id = vsi->port_info->sw_id;
 	ice_vsi_setup_q_map(vsi, ctxt);
 
+	/* Enable MAC Antispoof with new VSI being initialized or updated */
+	if (vsi->type == ICE_VSI_VF && pf->vf[vsi->vf_id].spoofchk) {
+		ctxt->info.valid_sections |=
+			cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID);
+		ctxt->info.sec_flags |=
+			ICE_AQ_VSI_SEC_FLAG_ENA_MAC_ANTI_SPOOF;
+	}
+
 	if (init_vsi) {
 		ret = ice_add_vsi(hw, vsi->idx, ctxt, NULL);
 		if (ret) {
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 14/14] ice: Fix issue reclaiming resources back to the pool after reset
  2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
                   ` (12 preceding siblings ...)
  2019-02-08 20:51 ` [Intel-wired-lan] [PATCH S12 13/14] ice: Enable MAC anti-spoof by default Anirudh Venkataramanan
@ 2019-02-08 20:51 ` Anirudh Venkataramanan
  2019-02-28 19:36   ` Bowers, AndrewX
  13 siblings, 1 reply; 28+ messages in thread
From: Anirudh Venkataramanan @ 2019-02-08 20:51 UTC (permalink / raw)
  To: intel-wired-lan

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

This patch fixes issue reclaiming VF resources back to the pool after
reset - Since we only allocate HW vector for all VFs and track together
with resources allocation for PF with ice_search_res, we need to free VFs
resources separately, using first VF vector index to traverse the list.
Otherwise tracker starts from the last assigned vectors list and causes
maximum supported number of HW vectors, 1024 to be exhausted, depending on
the number of VFs enabled, which causes a lot of unwanted issues, and
failed to reassign vectors for VFs.

Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_lib.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index d528640fc5b1..af72bb4f8f6f 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -2681,6 +2681,7 @@ int ice_vsi_release(struct ice_vsi *vsi)
 int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)
 {
 	u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
+	struct ice_vf *vf = NULL;
 	struct ice_pf *pf;
 	int ret, i;
 
@@ -2688,12 +2689,31 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)
 		return -EINVAL;
 
 	pf = vsi->back;
+	if (vsi->type == ICE_VSI_VF)
+		vf = &pf->vf[vsi->vf_id];
+
 	ice_rm_vsi_lan_cfg(vsi->port_info, vsi->idx);
 	ice_vsi_free_q_vectors(vsi);
-	ice_free_res(vsi->back->sw_irq_tracker, vsi->sw_base_vector, vsi->idx);
-	ice_free_res(vsi->back->hw_irq_tracker, vsi->hw_base_vector, vsi->idx);
-	vsi->sw_base_vector = 0;
+
+	if (vsi->type != ICE_VSI_VF) {
+		/* reclaim SW interrupts back to the common pool */
+		ice_free_res(pf->sw_irq_tracker, vsi->sw_base_vector, vsi->idx);
+		pf->num_avail_sw_msix += vsi->num_q_vectors;
+		vsi->sw_base_vector = 0;
+		/* reclaim HW interrupts back to the common pool */
+		ice_free_res(pf->hw_irq_tracker, vsi->hw_base_vector,
+			     vsi->idx);
+		pf->num_avail_hw_msix += vsi->num_q_vectors;
+	} else {
+		/* Reclaim VF resources back to the common pool for reset and
+		 * and rebuild, with vector reassignment
+		 */
+		ice_free_res(pf->hw_irq_tracker, vf->first_vector_idx,
+			     vsi->idx);
+		pf->num_avail_hw_msix += pf->num_vf_msix;
+	}
 	vsi->hw_base_vector = 0;
+
 	ice_vsi_clear_rings(vsi);
 	ice_vsi_free_arrays(vsi, false);
 	ice_dev_onetime_setup(&vsi->back->hw);
-- 
2.14.5


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

* [Intel-wired-lan] [PATCH S12 03/14] ice: avoid multiple unnecessary de-references in probe
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 03/14] ice: avoid multiple unnecessary de-references in probe Anirudh Venkataramanan
@ 2019-02-22 23:49   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-22 23:49 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 03/14] ice: avoid multiple unnecessary
> de-references in probe
> 
> From: Bruce Allan <bruce.w.allan@intel.com>
> 
> Add a local variable struct device *dev to avoid unnecessary de-references
> throughout ice_probe().
> 
> Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 33 ++++++++++++++-------------
> ----
>  1 file changed, 15 insertions(+), 18 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S12 04/14] ice: remove redundant variable and if condition
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 04/14] ice: remove redundant variable and if condition Anirudh Venkataramanan
@ 2019-02-22 23:50   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-22 23:50 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 04/14] ice: remove redundant variable
> and if condition
> 
> From: Brett Creeley <brett.creeley@intel.com>
> 
> In ice_pf_rxq_wait we are using an unnecessary local variable and also we
> are checking if the timeout time was reached after the loop. Get rid of the
> local variable and return 0 right when we get a successful result. This makes it
> so we can return -ETIMEDOUT if we ever exit the loop because we know the
> timeout time has been hit.
> 
> Signed-off-by: Brett Creeley <brett.creeley@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_lib.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S12 07/14] ice: use ice_for_each_vsi macro when possible
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 07/14] ice: use ice_for_each_vsi macro when possible Anirudh Venkataramanan
@ 2019-02-22 23:51   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-22 23:51 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 07/14] ice: use ice_for_each_vsi macro
> when possible
> 
> From: Brett Creeley <brett.creeley@intel.com>
> 
> Replace all instances of:
> 	for (i = 0; i < pf->num_alloc_vsi; i++)
> 
> with the following macro:
> 	ice_for_each_vsi(pf, i)
> 
> This will allow the code to be consistent since there are currently cases of
> using both.
> 
> Signed-off-by: Brett Creeley <brett.creeley@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_ethtool.c     |  3 +--
>  drivers/net/ethernet/intel/ice/ice_main.c        | 12 ++++++------
>  drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c |  2 +-
>  3 files changed, 8 insertions(+), 9 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S12 08/14] ice: configure GLINT_ITR to always have an ITR gran of 2
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 08/14] ice: configure GLINT_ITR to always have an ITR gran of 2 Anirudh Venkataramanan
@ 2019-02-22 23:52   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-22 23:52 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 08/14] ice: configure GLINT_ITR to
> always have an ITR gran of 2
> 
> From: Brett Creeley <brett.creeley@intel.com>
> 
> Instead of hoping that our ITR granularity will be 2 usec program the
> GLINT_CTL register to make sure the ITR granularity is always 2 usecs.
> 
> Now that we know what the ITR granularity will be get rid of the check in
> ice_probe() to verify our previous assumption.
> 
> Signed-off-by: Brett Creeley <brett.creeley@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_hw_autogen.h | 10 ++++++++
>  drivers/net/ethernet/intel/ice/ice_lib.c        | 33
> +++++++++++++++++++++++++
>  drivers/net/ethernet/intel/ice/ice_main.c       | 18 --------------
>  drivers/net/ethernet/intel/ice/ice_txrx.h       |  1 +
>  4 files changed, 44 insertions(+), 18 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S12 01/14] ice: Fix broadcast traffic in port VLAN mode
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 01/14] ice: Fix broadcast traffic in port VLAN mode Anirudh Venkataramanan
@ 2019-02-28 19:30   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-28 19:30 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 01/14] ice: Fix broadcast traffic in port
> VLAN mode
> 
> From: Michal Swiatkowski <michal.swiatkowski@intel.com>
> 
> Set egress (Rx) pruning enable flag for vf vsi in vsi ctxt to enable prune action.
> 
> To avoid seeing broadcast packet in different vlan, pruning enable flag in vsi
> ctxt should be set.
> 
> Write new functions (fill vsi ctx) to not repeat send ctxt code.
> 
> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 76 ++++++++++++++------
> ----
>  1 file changed, 44 insertions(+), 32 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S12 02/14] ice: Fix issue with VF reset and multiple VFs support on PFs
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 02/14] ice: Fix issue with VF reset and multiple VFs support on PFs Anirudh Venkataramanan
@ 2019-02-28 19:32   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-28 19:32 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 02/14] ice: Fix issue with VF reset and
> multiple VFs support on PFs
> 
> From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> 
> This patch fixes issues with VF queues being disabled, and VF netdev
> network carrier being lost after reset. Basically, we need to check if VF is
> enabled, and queue configured in reset_all_vfs flow, and disable/enable
> those queues appropriately whenever the function is called after
> Global/CORER/PFR reset/rebuild/replay.
> 
> Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
> [Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> cleaned
> up commit message]
> ---
>  drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S12 05/14] ice : Ensure only valid bits are set in ice_aq_set_phy_cfg
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 05/14] ice : Ensure only valid bits are set in ice_aq_set_phy_cfg Anirudh Venkataramanan
@ 2019-02-28 19:33   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-28 19:33 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 05/14] ice : Ensure only valid bits are
> set in ice_aq_set_phy_cfg
> 
> From: Chinh T Cao <chinh.t.cao@intel.com>
> 
> In the ice_aq_set_phy_cfg AQ command, the 16.4 bit is reserved. This patch
> will make sure that this bit will never be set to 1.
> 
> Signed-off-by: Chinh T Cao <chinh.t.cao@intel.com>
> Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_adminq_cmd.h |  5 +++--
>  drivers/net/ethernet/intel/ice/ice_common.c     | 11 +++++++++++
>  drivers/net/ethernet/intel/ice/ice_type.h       |  1 +
>  3 files changed, 15 insertions(+), 2 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S12 09/14] ice: Implement flow to reset VFs with PFR and other resets
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 09/14] ice: Implement flow to reset VFs with PFR and other resets Anirudh Venkataramanan
@ 2019-02-28 19:34   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-28 19:34 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 09/14] ice: Implement flow to reset VFs
> with PFR and other resets
> 
> From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> 
> All VF VSIs need to be reset and rebuild with the main VSIs before replaying
> all VSIs, so that all existing switch filters, scheduler tree and other
> configuration could be replayed at once. This fixes issues when doing PFR
> and CORER reset.
> 
> Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
> [Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> cleaned
> up commit message]
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S12 10/14] ice: Get resources per function
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 10/14] ice: Get resources per function Anirudh Venkataramanan
@ 2019-02-28 19:34   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-28 19:34 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 10/14] ice: Get resources per function
> 
> From: Brett Creeley <brett.creeley@intel.com>
> 
> ice_get_guar_num_vsi currently calculates the number of VSIs per PF.
> Rework this into a general function ice_get_num_per_func, that can
> calculate per PF allocations for not just VSIs but across multiple resource
> types.
> 
> Signed-off-by: Brett Creeley <brett.creeley@intel.com>
> Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
> [Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> rewrote
> commit message]
> ---
>  drivers/net/ethernet/intel/ice/ice_common.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S12 11/14] ice: Reset all VFs with VFLR during SR-IOV init flow
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 11/14] ice: Reset all VFs with VFLR during SR-IOV init flow Anirudh Venkataramanan
@ 2019-02-28 19:34   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-28 19:34 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 11/14] ice: Reset all VFs with VFLR
> during SR-IOV init flow
> 
> From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> 
> During SR-IOV initialization, we allocate and setup VFs with reset, and since
> we were going to inform Firmware about our intention to do VFLR by
> disabling LAN TX Queue, then we really have to complete VF reset flow with
> VFLR using appropriate registers - Otherwise, reset status bit for VF in the
> Guest OS might returns DEADBEEF.
> This resolves issue to properly initialize VFs in the Guest OS via PCI
> passthrough.
> 
> Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

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



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

* [Intel-wired-lan] [PATCH S12 12/14] ice: Determine descriptor count and ring size based on PAGE_SIZE
  2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 12/14] ice: Determine descriptor count and ring size based on PAGE_SIZE Anirudh Venkataramanan
@ 2019-02-28 19:35   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-28 19:35 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 12/14] ice: Determine descriptor count
> and ring size based on PAGE_SIZE
> 
> From: Brett Creeley <brett.creeley@intel.com>
> 
> Currently we set the default number of Tx and Rx descriptors to 128 by
> default. For Rx this amounts to a full page (assuming 4K pages) because each
> Rx descriptor is 32 Bytes, but for Tx it only amounts to a half page because
> each Tx descriptor is 16 Bytes (assuming 4K pages).
> Instead of assuming 4K pages, determine the ring size and the number of
> descriptors for Tx and Rx based on a calculation using the PAGE_SIZE,
> ICE_MAX_NUM_DESC, and ICE_REQ_DESC_MULTIPLE. This change is being
> made to improve the performance of the driver when using the default
> settings.
> 
> Signed-off-by: Brett Creeley <brett.creeley@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice.h      | 16 ++++++++++++++--
>  drivers/net/ethernet/intel/ice/ice_lib.c  | 28
> ++++++++++++++++++++++++----  drivers/net/ethernet/intel/ice/ice_txrx.c
> | 10 +++++-----
>  3 files changed, 43 insertions(+), 11 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S12 13/14] ice: Enable MAC anti-spoof by default
  2019-02-08 20:51 ` [Intel-wired-lan] [PATCH S12 13/14] ice: Enable MAC anti-spoof by default Anirudh Venkataramanan
@ 2019-02-28 19:36   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-28 19:36 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 13/14] ice: Enable MAC anti-spoof by
> default
> 
> From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> 
> This patch enables MAC anti-spoof by default, with creation of VF VSIs or
> when the VF VSIs are being re-initialized.
> 
> Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_lib.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

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



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

* [Intel-wired-lan] [PATCH S12 14/14] ice: Fix issue reclaiming resources back to the pool after reset
  2019-02-08 20:51 ` [Intel-wired-lan] [PATCH S12 14/14] ice: Fix issue reclaiming resources back to the pool after reset Anirudh Venkataramanan
@ 2019-02-28 19:36   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2019-02-28 19:36 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Anirudh Venkataramanan
> Sent: Friday, February 8, 2019 12:51 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S12 14/14] ice: Fix issue reclaiming
> resources back to the pool after reset
> 
> From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> 
> This patch fixes issue reclaiming VF resources back to the pool after reset -
> Since we only allocate HW vector for all VFs and track together with
> resources allocation for PF with ice_search_res, we need to free VFs
> resources separately, using first VF vector index to traverse the list.
> Otherwise tracker starts from the last assigned vectors list and causes
> maximum supported number of HW vectors, 1024 to be exhausted,
> depending on the number of VFs enabled, which causes a lot of unwanted
> issues, and failed to reassign vectors for VFs.
> 
> Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_lib.c | 26 +++++++++++++++++++++++--
> -
>  1 file changed, 23 insertions(+), 3 deletions(-)

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



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

end of thread, other threads:[~2019-02-28 19:36 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-08 20:50 [Intel-wired-lan] [PATCH S12 00/14] Bug fixes and minor feature updates for ice Anirudh Venkataramanan
2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 01/14] ice: Fix broadcast traffic in port VLAN mode Anirudh Venkataramanan
2019-02-28 19:30   ` Bowers, AndrewX
2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 02/14] ice: Fix issue with VF reset and multiple VFs support on PFs Anirudh Venkataramanan
2019-02-28 19:32   ` Bowers, AndrewX
2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 03/14] ice: avoid multiple unnecessary de-references in probe Anirudh Venkataramanan
2019-02-22 23:49   ` Bowers, AndrewX
2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 04/14] ice: remove redundant variable and if condition Anirudh Venkataramanan
2019-02-22 23:50   ` Bowers, AndrewX
2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 05/14] ice : Ensure only valid bits are set in ice_aq_set_phy_cfg Anirudh Venkataramanan
2019-02-28 19:33   ` Bowers, AndrewX
2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 06/14] ice: implement ethtool set channels Anirudh Venkataramanan
2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 07/14] ice: use ice_for_each_vsi macro when possible Anirudh Venkataramanan
2019-02-22 23:51   ` Bowers, AndrewX
2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 08/14] ice: configure GLINT_ITR to always have an ITR gran of 2 Anirudh Venkataramanan
2019-02-22 23:52   ` Bowers, AndrewX
2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 09/14] ice: Implement flow to reset VFs with PFR and other resets Anirudh Venkataramanan
2019-02-28 19:34   ` Bowers, AndrewX
2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 10/14] ice: Get resources per function Anirudh Venkataramanan
2019-02-28 19:34   ` Bowers, AndrewX
2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 11/14] ice: Reset all VFs with VFLR during SR-IOV init flow Anirudh Venkataramanan
2019-02-28 19:34   ` Bowers, AndrewX
2019-02-08 20:50 ` [Intel-wired-lan] [PATCH S12 12/14] ice: Determine descriptor count and ring size based on PAGE_SIZE Anirudh Venkataramanan
2019-02-28 19:35   ` Bowers, AndrewX
2019-02-08 20:51 ` [Intel-wired-lan] [PATCH S12 13/14] ice: Enable MAC anti-spoof by default Anirudh Venkataramanan
2019-02-28 19:36   ` Bowers, AndrewX
2019-02-08 20:51 ` [Intel-wired-lan] [PATCH S12 14/14] ice: Fix issue reclaiming resources back to the pool after reset Anirudh Venkataramanan
2019-02-28 19:36   ` 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.