All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set
@ 2020-05-16  0:42 Tony Nguyen
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 02/14] ice: Handle critical FW error during admin queue initialization Tony Nguyen
                   ` (13 more replies)
  0 siblings, 14 replies; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

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

Currently, if the PVID is set in the VLAN handling section of the VSI
context the driver still allows VLAN stripping to be enabled/disabled.
VLAN stripping should only be modifiable when the PVID is not set. Fix
this by preventing VLAN stripping modification when PVID is set.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_lib.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 86a3a15c21c8..70b770083ee8 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -1847,6 +1847,12 @@ int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)
 	enum ice_status status;
 	int ret = 0;
 
+	/* do not allow modifying VLAN stripping when a port VLAN is configured
+	 * on this VSI
+	 */
+	if (vsi->info.pvid)
+		return 0;
+
 	ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
 	if (!ctxt)
 		return -ENOMEM;
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 02/14] ice: Handle critical FW error during admin queue initialization
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:22   ` Bowers, AndrewX
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 03/14] ice: Change number of XDP TxQ to 0 when destroying rings Tony Nguyen
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

From: Evan Swanson <evan.swanson@intel.com>

A race condition between FW and SW can occur between admin queue setup and
the first command sent. A link event may occur and FW attempts to notify a
non-existent queue. FW will set the critical error bit and disable the
queue. When this happens retry queue setup.

Signed-off-by: Evan Swanson <evan.swanson@intel.com>
Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_controlq.c | 126 ++++++++++--------
 drivers/net/ethernet/intel/ice/ice_controlq.h |   3 +
 .../net/ethernet/intel/ice/ice_hw_autogen.h   |   2 +
 drivers/net/ethernet/intel/ice/ice_main.c     |   2 +
 drivers/net/ethernet/intel/ice/ice_status.h   |   1 +
 5 files changed, 80 insertions(+), 54 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.c b/drivers/net/ethernet/intel/ice/ice_controlq.c
index 62c2c1e621d2..479a74efc536 100644
--- a/drivers/net/ethernet/intel/ice/ice_controlq.c
+++ b/drivers/net/ethernet/intel/ice/ice_controlq.c
@@ -12,6 +12,7 @@ do {								\
 	(qinfo)->sq.bal = prefix##_ATQBAL;			\
 	(qinfo)->sq.len_mask = prefix##_ATQLEN_ATQLEN_M;	\
 	(qinfo)->sq.len_ena_mask = prefix##_ATQLEN_ATQENABLE_M;	\
+	(qinfo)->sq.len_crit_mask = prefix##_ATQLEN_ATQCRIT_M;	\
 	(qinfo)->sq.head_mask = prefix##_ATQH_ATQH_M;		\
 	(qinfo)->rq.head = prefix##_ARQH;			\
 	(qinfo)->rq.tail = prefix##_ARQT;			\
@@ -20,6 +21,7 @@ do {								\
 	(qinfo)->rq.bal = prefix##_ARQBAL;			\
 	(qinfo)->rq.len_mask = prefix##_ARQLEN_ARQLEN_M;	\
 	(qinfo)->rq.len_ena_mask = prefix##_ARQLEN_ARQENABLE_M;	\
+	(qinfo)->rq.len_crit_mask = prefix##_ARQLEN_ARQCRIT_M;	\
 	(qinfo)->rq.head_mask = prefix##_ARQH_ARQH_M;		\
 } while (0)
 
@@ -641,6 +643,50 @@ static enum ice_status ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)
 	return ret_code;
 }
 
+/**
+ * ice_shutdown_ctrlq - shutdown routine for any control queue
+ * @hw: pointer to the hardware structure
+ * @q_type: specific Control queue type
+ *
+ * NOTE: this function does not destroy the control queue locks.
+ */
+static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)
+{
+	struct ice_ctl_q_info *cq;
+
+	switch (q_type) {
+	case ICE_CTL_Q_ADMIN:
+		cq = &hw->adminq;
+		if (ice_check_sq_alive(hw, cq))
+			ice_aq_q_shutdown(hw, true);
+		break;
+	case ICE_CTL_Q_MAILBOX:
+		cq = &hw->mailboxq;
+		break;
+	default:
+		return;
+	}
+
+	ice_shutdown_sq(hw, cq);
+	ice_shutdown_rq(hw, cq);
+}
+
+/**
+ * ice_shutdown_all_ctrlq - shutdown routine for all control queues
+ * @hw: pointer to the hardware structure
+ *
+ * NOTE: this function does not destroy the control queue locks. The driver
+ * may call this at runtime to shutdown and later restart control queues, such
+ * as in response to a reset event.
+ */
+void ice_shutdown_all_ctrlq(struct ice_hw *hw)
+{
+	/* Shutdown FW admin queue */
+	ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN);
+	/* Shutdown PF-VF Mailbox */
+	ice_shutdown_ctrlq(hw, ICE_CTL_Q_MAILBOX);
+}
+
 /**
  * ice_init_all_ctrlq - main initialization routine for all control queues
  * @hw: pointer to the hardware structure
@@ -656,17 +702,27 @@ static enum ice_status ice_init_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)
  */
 enum ice_status ice_init_all_ctrlq(struct ice_hw *hw)
 {
-	enum ice_status ret_code;
+	enum ice_status status;
+	u32 retry = 0;
 
 	/* Init FW admin queue */
-	ret_code = ice_init_ctrlq(hw, ICE_CTL_Q_ADMIN);
-	if (ret_code)
-		return ret_code;
+	do {
+		status = ice_init_ctrlq(hw, ICE_CTL_Q_ADMIN);
+		if (status)
+			return status;
 
-	ret_code = ice_init_check_adminq(hw);
-	if (ret_code)
-		return ret_code;
+		status = ice_init_check_adminq(hw);
+		if (status != ICE_ERR_AQ_FW_CRITICAL)
+			break;
 
+		ice_debug(hw, ICE_DBG_AQ_MSG,
+			  "Retry Admin Queue init due to FW critical error\n");
+		ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN);
+		msleep(ICE_CTL_Q_ADMIN_INIT_MSEC);
+	} while (retry++ < ICE_CTL_Q_ADMIN_INIT_TIMEOUT);
+
+	if (status)
+		return status;
 	/* Init Mailbox queue */
 	return ice_init_ctrlq(hw, ICE_CTL_Q_MAILBOX);
 }
@@ -707,50 +763,6 @@ enum ice_status ice_create_all_ctrlq(struct ice_hw *hw)
 	return ice_init_all_ctrlq(hw);
 }
 
-/**
- * ice_shutdown_ctrlq - shutdown routine for any control queue
- * @hw: pointer to the hardware structure
- * @q_type: specific Control queue type
- *
- * NOTE: this function does not destroy the control queue locks.
- */
-static void ice_shutdown_ctrlq(struct ice_hw *hw, enum ice_ctl_q q_type)
-{
-	struct ice_ctl_q_info *cq;
-
-	switch (q_type) {
-	case ICE_CTL_Q_ADMIN:
-		cq = &hw->adminq;
-		if (ice_check_sq_alive(hw, cq))
-			ice_aq_q_shutdown(hw, true);
-		break;
-	case ICE_CTL_Q_MAILBOX:
-		cq = &hw->mailboxq;
-		break;
-	default:
-		return;
-	}
-
-	ice_shutdown_sq(hw, cq);
-	ice_shutdown_rq(hw, cq);
-}
-
-/**
- * ice_shutdown_all_ctrlq - shutdown routine for all control queues
- * @hw: pointer to the hardware structure
- *
- * NOTE: this function does not destroy the control queue locks. The driver
- * may call this at runtime to shutdown and later restart control queues, such
- * as in response to a reset event.
- */
-void ice_shutdown_all_ctrlq(struct ice_hw *hw)
-{
-	/* Shutdown FW admin queue */
-	ice_shutdown_ctrlq(hw, ICE_CTL_Q_ADMIN);
-	/* Shutdown PF-VF Mailbox */
-	ice_shutdown_ctrlq(hw, ICE_CTL_Q_MAILBOX);
-}
-
 /**
  * ice_destroy_ctrlq_locks - Destroy locks for a control queue
  * @cq: pointer to the control queue
@@ -1049,9 +1061,15 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 
 	/* update the error if time out occurred */
 	if (!cmd_completed) {
-		ice_debug(hw, ICE_DBG_AQ_MSG,
-			  "Control Send Queue Writeback timeout.\n");
-		status = ICE_ERR_AQ_TIMEOUT;
+		if (rd32(hw, cq->rq.len) & cq->rq.len_crit_mask ||
+		    rd32(hw, cq->sq.len) & cq->sq.len_crit_mask) {
+			ice_debug(hw, ICE_DBG_AQ_MSG, "Critical FW error.\n");
+			status = ICE_ERR_AQ_FW_CRITICAL;
+		} else {
+			ice_debug(hw, ICE_DBG_AQ_MSG,
+				  "Control Send Queue Writeback timeout.\n");
+			status = ICE_ERR_AQ_TIMEOUT;
+		}
 	}
 
 sq_send_command_error:
diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.h b/drivers/net/ethernet/intel/ice/ice_controlq.h
index bf0ebe6149e8..faaa08e8171b 100644
--- a/drivers/net/ethernet/intel/ice/ice_controlq.h
+++ b/drivers/net/ethernet/intel/ice/ice_controlq.h
@@ -34,6 +34,8 @@ enum ice_ctl_q {
 /* Control Queue timeout settings - max delay 250ms */
 #define ICE_CTL_Q_SQ_CMD_TIMEOUT	2500  /* Count 2500 times */
 #define ICE_CTL_Q_SQ_CMD_USEC		100   /* Check every 100usec */
+#define ICE_CTL_Q_ADMIN_INIT_TIMEOUT	10    /* Count 10 times */
+#define ICE_CTL_Q_ADMIN_INIT_MSEC	100   /* Check every 100msec */
 
 struct ice_ctl_q_ring {
 	void *dma_head;			/* Virtual address to DMA head */
@@ -59,6 +61,7 @@ struct ice_ctl_q_ring {
 	u32 bal;
 	u32 len_mask;
 	u32 len_ena_mask;
+	u32 len_crit_mask;
 	u32 head_mask;
 };
 
diff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
index 5803bacef129..91b658e224ad 100644
--- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
+++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h
@@ -39,6 +39,7 @@
 #define PF_MBX_ARQH_ARQH_M			ICE_M(0x3FF, 0)
 #define PF_MBX_ARQLEN				0x0022E480
 #define PF_MBX_ARQLEN_ARQLEN_M			ICE_M(0x3FF, 0)
+#define PF_MBX_ARQLEN_ARQCRIT_M			BIT(30)
 #define PF_MBX_ARQLEN_ARQENABLE_M		BIT(31)
 #define PF_MBX_ARQT				0x0022E580
 #define PF_MBX_ATQBAH				0x0022E180
@@ -47,6 +48,7 @@
 #define PF_MBX_ATQH_ATQH_M			ICE_M(0x3FF, 0)
 #define PF_MBX_ATQLEN				0x0022E200
 #define PF_MBX_ATQLEN_ATQLEN_M			ICE_M(0x3FF, 0)
+#define PF_MBX_ATQLEN_ATQCRIT_M			BIT(30)
 #define PF_MBX_ATQLEN_ATQENABLE_M		BIT(31)
 #define PF_MBX_ATQT				0x0022E300
 #define PRTDCB_GENC				0x00083000
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 589bafb601ae..644784e86177 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -5292,6 +5292,8 @@ const char *ice_stat_str(enum ice_status stat_err)
 		return "ICE_ERR_AQ_NO_WORK";
 	case ICE_ERR_AQ_EMPTY:
 		return "ICE_ERR_AQ_EMPTY";
+	case ICE_ERR_AQ_FW_CRITICAL:
+		return "ICE_ERR_AQ_FW_CRITICAL";
 	}
 
 	return "ICE_ERR_UNKNOWN";
diff --git a/drivers/net/ethernet/intel/ice/ice_status.h b/drivers/net/ethernet/intel/ice/ice_status.h
index 546a02856d09..4028c6365172 100644
--- a/drivers/net/ethernet/intel/ice/ice_status.h
+++ b/drivers/net/ethernet/intel/ice/ice_status.h
@@ -37,6 +37,7 @@ enum ice_status {
 	ICE_ERR_AQ_FULL				= -102,
 	ICE_ERR_AQ_NO_WORK			= -103,
 	ICE_ERR_AQ_EMPTY			= -104,
+	ICE_ERR_AQ_FW_CRITICAL			= -105,
 };
 
 #endif /* _ICE_STATUS_H_ */
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 03/14] ice: Change number of XDP TxQ to 0 when destroying rings
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 02/14] ice: Handle critical FW error during admin queue initialization Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:23   ` Bowers, AndrewX
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 04/14] ice: Add XDP Tx to VSI ring stats Tony Nguyen
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

From: Marta Plantykow <marta.a.plantykow@intel.com>

When XDP Tx rings are destroyed the number of XDP Tx queues
is not changing. This patch is changing this number to 0.

Signed-off-by: Marta Plantykow <marta.a.plantykow@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 644784e86177..61c7d0b57f02 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -1906,6 +1906,9 @@ int ice_destroy_xdp_rings(struct ice_vsi *vsi)
 	for (i = 0; i < vsi->tc_cfg.numtc; i++)
 		max_txqs[i] = vsi->num_txq;
 
+	/* change number of XDP Tx queues to 0 */
+	vsi->num_xdp_txq = 0;
+
 	return ice_cfg_vsi_lan(vsi->port_info, vsi->idx, vsi->tc_cfg.ena_tc,
 			       max_txqs);
 }
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 04/14] ice: Add XDP Tx to VSI ring stats
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 02/14] ice: Handle critical FW error during admin queue initialization Tony Nguyen
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 03/14] ice: Change number of XDP TxQ to 0 when destroying rings Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:23   ` Bowers, AndrewX
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 05/14] ice: Change number of XDP Tx queues to match number of Rx queues Tony Nguyen
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

From: Marta Plantykow <marta.a.plantykow@intel.com>

When XDP Tx program is loaded and packets are sent from
interface, VSI statistics are not updated. This patch adds
packets sent on Tx XDP ring to VSI ring stats.

Signed-off-by: Marta Plantykow <marta.a.plantykow@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 42 ++++++++++++++++++-----
 1 file changed, 33 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 61c7d0b57f02..a74b2ce6956a 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -4281,6 +4281,33 @@ ice_fetch_u64_stats_per_ring(struct ice_ring *ring, u64 *pkts, u64 *bytes)
 	} while (u64_stats_fetch_retry_irq(&ring->syncp, start));
 }
 
+/**
+ * ice_update_vsi_tx_ring_stats - Update VSI Tx ring stats counters
+ * @vsi: the VSI to be updated
+ * @rings: rings to work on
+ * @count: number of rings
+ */
+static void
+ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi, struct ice_ring **rings,
+			     u16 count)
+{
+	struct rtnl_link_stats64 *vsi_stats = &vsi->net_stats;
+	u16 i;
+
+	for (i = 0; i < count; i++) {
+		struct ice_ring *ring;
+		u64 pkts, bytes;
+
+		ring = READ_ONCE(rings[i]);
+		ice_fetch_u64_stats_per_ring(ring, &pkts, &bytes);
+		vsi_stats->tx_packets += pkts;
+		vsi_stats->tx_bytes += bytes;
+		vsi->tx_restart += ring->tx_stats.restart_q;
+		vsi->tx_busy += ring->tx_stats.tx_busy;
+		vsi->tx_linearize += ring->tx_stats.tx_linearize;
+	}
+}
+
 /**
  * ice_update_vsi_ring_stats - Update VSI stats counters
  * @vsi: the VSI to be updated
@@ -4308,15 +4335,7 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)
 	rcu_read_lock();
 
 	/* update Tx rings counters */
-	ice_for_each_txq(vsi, i) {
-		ring = READ_ONCE(vsi->tx_rings[i]);
-		ice_fetch_u64_stats_per_ring(ring, &pkts, &bytes);
-		vsi_stats->tx_packets += pkts;
-		vsi_stats->tx_bytes += bytes;
-		vsi->tx_restart += ring->tx_stats.restart_q;
-		vsi->tx_busy += ring->tx_stats.tx_busy;
-		vsi->tx_linearize += ring->tx_stats.tx_linearize;
-	}
+	ice_update_vsi_tx_ring_stats(vsi, vsi->tx_rings, vsi->num_txq);
 
 	/* update Rx rings counters */
 	ice_for_each_rxq(vsi, i) {
@@ -4328,6 +4347,11 @@ static void ice_update_vsi_ring_stats(struct ice_vsi *vsi)
 		vsi->rx_page_failed += ring->rx_stats.alloc_page_failed;
 	}
 
+	/* update XDP Tx rings counters */
+	if (ice_is_xdp_ena_vsi(vsi))
+		ice_update_vsi_tx_ring_stats(vsi, vsi->xdp_rings,
+					     vsi->num_xdp_txq);
+
 	rcu_read_unlock();
 }
 
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 05/14] ice: Change number of XDP Tx queues to match number of Rx queues
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
                   ` (2 preceding siblings ...)
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 04/14] ice: Add XDP Tx to VSI ring stats Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:24   ` Bowers, AndrewX
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 06/14] ice: avoid undefined behavior Tony Nguyen
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

From: Marta Plantykow <marta.a.plantykow@intel.com>

In current implementation number of XDP Tx queues is the same as
the number of transmit queues, which is not always true. This
patch changes this number to match the number of receive queues.
XDP programs are running on Rx rings, so what we actually need to
provide is the XDP Tx ring per each Rx ring so that the whole XDP
ecosystem is functional, e.g. if the result of XDP prog is XDP_TX
then you have the need to access the XDP Tx ring.

Signed-off-by: Marta Plantykow <marta.a.plantykow@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_lib.c  | 2 +-
 drivers/net/ethernet/intel/ice/ice_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 70b770083ee8..51a20958e0d0 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -2835,7 +2835,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)
 
 		ice_vsi_map_rings_to_vectors(vsi);
 		if (ice_is_xdp_ena_vsi(vsi)) {
-			vsi->num_xdp_txq = vsi->alloc_txq;
+			vsi->num_xdp_txq = vsi->alloc_rxq;
 			ret = ice_prepare_xdp_rings(vsi, vsi->xdp_prog);
 			if (ret)
 				goto err_vectors;
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index a74b2ce6956a..fcd5c53202d9 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -1942,7 +1942,7 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,
 	}
 
 	if (!ice_is_xdp_ena_vsi(vsi) && prog) {
-		vsi->num_xdp_txq = vsi->alloc_txq;
+		vsi->num_xdp_txq = vsi->alloc_rxq;
 		xdp_ring_err = ice_prepare_xdp_rings(vsi, prog);
 		if (xdp_ring_err)
 			NL_SET_ERR_MSG_MOD(extack, "Setting up XDP Tx resources failed");
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 06/14] ice: avoid undefined behavior
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
                   ` (3 preceding siblings ...)
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 05/14] ice: Change number of XDP Tx queues to match number of Rx queues Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:24   ` Bowers, AndrewX
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 07/14] ice: Refactor Rx checksum checks Tony Nguyen
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

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

When writing the driver's struct ice_tlan_ctx structure, do not write the
8-bit element int_q_state with the associated internal-to-hardware field
which is 122-bits, otherwise the helper function ice_write_byte() will use
undefined behavior when setting the mask used for that write.  This should
not cause any functional change and will avoid use of undefined behavior.
Also, update a comment to highlight this structure element is not written.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_base.c      |  5 +++--
 drivers/net/ethernet/intel/ice/ice_common.c    | 12 ++++++++++--
 drivers/net/ethernet/intel/ice/ice_common.h    |  3 ++-
 drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h |  2 +-
 4 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
index ff6a5cf8e06f..a964f5055f37 100644
--- a/drivers/net/ethernet/intel/ice/ice_base.c
+++ b/drivers/net/ethernet/intel/ice/ice_base.c
@@ -638,6 +638,7 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,
 	struct ice_aqc_add_txqs_perq *txq;
 	struct ice_pf *pf = vsi->back;
 	u8 buf_len = sizeof(*qg_buf);
+	struct ice_hw *hw = &pf->hw;
 	enum ice_status status;
 	u16 pf_q;
 	u8 tc;
@@ -646,13 +647,13 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_ring *ring,
 	ice_setup_tx_ctx(ring, &tlan_ctx, pf_q);
 	/* copy context contents into the qg_buf */
 	qg_buf->txqs[0].txq_id = cpu_to_le16(pf_q);
-	ice_set_ctx((u8 *)&tlan_ctx, qg_buf->txqs[0].txq_ctx,
+	ice_set_ctx(hw, (u8 *)&tlan_ctx, qg_buf->txqs[0].txq_ctx,
 		    ice_tlan_ctx_info);
 
 	/* init queue specific tail reg. It is referred as
 	 * transmit comm scheduler queue doorbell.
 	 */
-	ring->tail = pf->hw.hw_addr + QTX_COMM_DBELL(pf_q);
+	ring->tail = hw->hw_addr + QTX_COMM_DBELL(pf_q);
 
 	if (IS_ENABLED(CONFIG_DCB))
 		tc = ring->dcb_tc;
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index b0bbba8e6f6c..8eccec1fa9e7 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -1099,7 +1099,7 @@ ice_write_rxq_ctx(struct ice_hw *hw, struct ice_rlan_ctx *rlan_ctx,
 
 	rlan_ctx->prefena = 1;
 
-	ice_set_ctx((u8 *)rlan_ctx, ctx_buf, ice_rlan_ctx_info);
+	ice_set_ctx(hw, (u8 *)rlan_ctx, ctx_buf, ice_rlan_ctx_info);
 	return ice_copy_rxq_ctx_to_hw(hw, ctx_buf, rxq_index);
 }
 
@@ -3268,12 +3268,14 @@ ice_write_qword(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 
 /**
  * ice_set_ctx - set context bits in packed structure
+ * @hw: pointer to the hardware structure
  * @src_ctx:  pointer to a generic non-packed context structure
  * @dest_ctx: pointer to memory for the packed structure
  * @ce_info:  a description of the structure to be transformed
  */
 enum ice_status
-ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
+ice_set_ctx(struct ice_hw *hw, u8 *src_ctx, u8 *dest_ctx,
+	    const struct ice_ctx_ele *ce_info)
 {
 	int f;
 
@@ -3282,6 +3284,12 @@ ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info)
 		 * using the correct size so that we are correct regardless
 		 * of the endianness of the machine.
 		 */
+		if (ce_info[f].width > (ce_info[f].size_of * BITS_PER_BYTE)) {
+			ice_debug(hw, ICE_DBG_QCTX,
+				  "Field %d width of %d bits larger than size of %d byte(s) ... skipping write\n",
+				  f, ce_info[f].width, ce_info[f].size_of);
+			continue;
+		}
 		switch (ce_info[f].size_of) {
 		case sizeof(u8):
 			ice_write_byte(src_ctx, dest_ctx, &ce_info[f]);
diff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h
index 9bac3e46da33..2cfd684061e5 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.h
+++ b/drivers/net/ethernet/intel/ice/ice_common.h
@@ -70,7 +70,8 @@ enum ice_status ice_aq_q_shutdown(struct ice_hw *hw, bool unloading);
 void ice_fill_dflt_direct_cmd_desc(struct ice_aq_desc *desc, u16 opcode);
 extern const struct ice_ctx_ele ice_tlan_ctx_info[];
 enum ice_status
-ice_set_ctx(u8 *src_ctx, u8 *dest_ctx, const struct ice_ctx_ele *ce_info);
+ice_set_ctx(struct ice_hw *hw, u8 *src_ctx, u8 *dest_ctx,
+	    const struct ice_ctx_ele *ce_info);
 
 extern struct mutex ice_global_cfg_lock_sw;
 
diff --git a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h
index bd2cd3435768..14dfbbc1b2cf 100644
--- a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h
+++ b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h
@@ -581,7 +581,7 @@ struct ice_tlan_ctx {
 	u8 drop_ena;
 	u8 cache_prof_idx;
 	u8 pkt_shaper_prof_idx;
-	u8 int_q_state;	/* width not needed - internal do not write */
+	u8 int_q_state;	/* width not needed - internal - DO NOT WRITE!!! */
 };
 
 /* macro to make the table lines short */
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 07/14] ice: Refactor Rx checksum checks
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
                   ` (4 preceding siblings ...)
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 06/14] ice: avoid undefined behavior Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:24   ` Bowers, AndrewX
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 08/14] ice: Check UMEM FQ size when allocating bufs Tony Nguyen
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

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

We don't need both rx_status and rx_error parameters, as the latter is
a subset of the former. Remove rx_error completely and check the right bit
in rx_status.

Rename rx_status to rx_status0, and rx_status_err1 to
rx_status1. This naming more closely reflects the specification.

Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 27 ++++++++-----------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
index 1ba97172d8d0..ab2031b1c635 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c
@@ -84,17 +84,12 @@ ice_rx_csum(struct ice_ring *ring, struct sk_buff *skb,
 	    union ice_32b_rx_flex_desc *rx_desc, u8 ptype)
 {
 	struct ice_rx_ptype_decoded decoded;
-	u16 rx_error, rx_status;
-	u16 rx_stat_err1;
+	u16 rx_status0, rx_status1;
 	bool ipv4, ipv6;
 
-	rx_status = le16_to_cpu(rx_desc->wb.status_error0);
-	rx_error = rx_status & (BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_IPE_S) |
-				BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_L4E_S) |
-				BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S) |
-				BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S));
+	rx_status0 = le16_to_cpu(rx_desc->wb.status_error0);
+	rx_status1 = le16_to_cpu(rx_desc->wb.status_error1);
 
-	rx_stat_err1 = le16_to_cpu(rx_desc->wb.status_error1);
 	decoded = ice_decode_rx_desc_ptype(ptype);
 
 	/* Start with CHECKSUM_NONE and by default csum_level = 0 */
@@ -106,7 +101,7 @@ ice_rx_csum(struct ice_ring *ring, struct sk_buff *skb,
 		return;
 
 	/* check if HW has decoded the packet and checksum */
-	if (!(rx_status & BIT(ICE_RX_FLEX_DESC_STATUS0_L3L4P_S)))
+	if (!(rx_status0 & BIT(ICE_RX_FLEX_DESC_STATUS0_L3L4P_S)))
 		return;
 
 	if (!(decoded.known && decoded.outer_ip))
@@ -117,22 +112,22 @@ ice_rx_csum(struct ice_ring *ring, struct sk_buff *skb,
 	ipv6 = (decoded.outer_ip == ICE_RX_PTYPE_OUTER_IP) &&
 	       (decoded.outer_ip_ver == ICE_RX_PTYPE_OUTER_IPV6);
 
-	if (ipv4 && (rx_error & (BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_IPE_S) |
-				 BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S))))
+	if (ipv4 && (rx_status0 & (BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_IPE_S) |
+				   BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_EIPE_S))))
 		goto checksum_fail;
-	else if (ipv6 && (rx_status &
-		 (BIT(ICE_RX_FLEX_DESC_STATUS0_IPV6EXADD_S))))
+
+	if (ipv6 && (rx_status0 & (BIT(ICE_RX_FLEX_DESC_STATUS0_IPV6EXADD_S))))
 		goto checksum_fail;
 
 	/* check for L4 errors and handle packets that were not able to be
 	 * checksummed due to arrival speed
 	 */
-	if (rx_error & BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_L4E_S))
+	if (rx_status0 & BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_L4E_S))
 		goto checksum_fail;
 
 	/* check for outer UDP checksum error in tunneled packets */
-	if ((rx_stat_err1 & BIT(ICE_RX_FLEX_DESC_STATUS1_NAT_S)) &&
-	    (rx_error & BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S)))
+	if ((rx_status1 & BIT(ICE_RX_FLEX_DESC_STATUS1_NAT_S)) &&
+	    (rx_status0 & BIT(ICE_RX_FLEX_DESC_STATUS0_XSUM_EUDPE_S)))
 		goto checksum_fail;
 
 	/* If there is an outer header present that might contain a checksum
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 08/14] ice: Check UMEM FQ size when allocating bufs
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
                   ` (5 preceding siblings ...)
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 07/14] ice: Refactor Rx checksum checks Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:25   ` Bowers, AndrewX
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 09/14] ice: Refactor ice_setup_rx_ctx Tony Nguyen
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

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

If a UMEM is present on a queue when an interface/queue pair is being
enabled, the driver will try to prepare the Rx buffers in advance to
improve performance. However, if fill queue is shorter than HW Rx ring,
the driver will report failure after getting the last address from the
fill queue.

This still lets the driver process the packets correctly during the NAPI
poll, but leads to a constant NAPI rescheduling. Not allocating the
buffers in advance would result in a potential performance decrease.

Commit d57d76428ae9 ("xsk: Add API to check for available entries in FQ")
provides an API that lets drivers check the number of addresses that the
fill queue holds.

Notify the user if fill queue is not long enough to prepare all buffers
before packet processing starts, and allocate the buffers during the
NAPI poll. If the fill queue size is sufficient, prepare Rx buffers in
advance.

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

diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
index a964f5055f37..74fdd4296937 100644
--- a/drivers/net/ethernet/intel/ice/ice_base.c
+++ b/drivers/net/ethernet/intel/ice/ice_base.c
@@ -280,7 +280,9 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q)
  */
 int ice_setup_rx_ctx(struct ice_ring *ring)
 {
+	struct device *dev = ice_pf_to_dev(ring->vsi->back);
 	int chain_len = ICE_MAX_CHAINED_RX_BUFS;
+	u16 num_bufs = ICE_DESC_UNUSED(ring);
 	struct ice_vsi *vsi = ring->vsi;
 	u32 rxdid = ICE_RXDID_FLEX_NIC;
 	struct ice_rlan_ctx rlan_ctx;
@@ -323,7 +325,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
 			if (err)
 				return err;
 
-			dev_info(ice_pf_to_dev(vsi->back), "Registered XDP mem model MEM_TYPE_ZERO_COPY on Rx ring %d\n",
+			dev_info(dev, "Registered XDP mem model MEM_TYPE_ZERO_COPY on Rx ring %d\n",
 				 ring->q_index);
 		} else {
 			ring->zca.free = NULL;
@@ -408,7 +410,7 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
 	/* Absolute queue number out of 2K needs to be passed */
 	err = ice_write_rxq_ctx(hw, &rlan_ctx, pf_q);
 	if (err) {
-		dev_err(ice_pf_to_dev(vsi->back), "Failed to set LAN Rx queue context for absolute Rx queue %d error: %d\n",
+		dev_err(dev, "Failed to set LAN Rx queue context for absolute Rx queue %d error: %d\n",
 			pf_q, err);
 		return -EIO;
 	}
@@ -426,13 +428,23 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
 	ring->tail = hw->hw_addr + QRX_TAIL(pf_q);
 	writel(0, ring->tail);
 
-	err = ring->xsk_umem ?
-	      ice_alloc_rx_bufs_slow_zc(ring, ICE_DESC_UNUSED(ring)) :
-	      ice_alloc_rx_bufs(ring, ICE_DESC_UNUSED(ring));
-	if (err)
-		dev_info(ice_pf_to_dev(vsi->back), "Failed allocate some buffers on %sRx ring %d (pf_q %d)\n",
-			 ring->xsk_umem ? "UMEM enabled " : "",
-			 ring->q_index, pf_q);
+	if (ring->xsk_umem) {
+		if (!xsk_umem_has_addrs_rq(ring->xsk_umem, num_bufs)) {
+			dev_warn(dev, "UMEM does not provide enough addresses to fill %d buffers on Rx ring %d\n",
+				 num_bufs, ring->q_index);
+			dev_warn(dev, "Change Rx ring/fill queue size to avoid performance issues\n");
+
+			return 0;
+		}
+
+		err = ice_alloc_rx_bufs_slow_zc(ring, num_bufs);
+		if (err)
+			dev_info(dev, "Failed to allocate some buffers on UMEM enabled Rx ring %d (pf_q %d)\n",
+				 ring->q_index, pf_q);
+		return 0;
+	}
+
+	ice_alloc_rx_bufs(ring, num_bufs);
 
 	return 0;
 }
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 09/14] ice: Refactor ice_setup_rx_ctx
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
                   ` (6 preceding siblings ...)
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 08/14] ice: Check UMEM FQ size when allocating bufs Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:25   ` Bowers, AndrewX
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 10/14] ice: Poll for reset completion when DDP load fails Tony Nguyen
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

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

Move AF_XDP logic and buffer allocation out of ice_setup_rx_ctx() to a
new function ice_vsi_cfg_rxq(), so the function actually sets up the Rx
context.

Signed-off-by: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_base.c | 123 +++++++++++++---------
 drivers/net/ethernet/intel/ice/ice_base.h |   2 +-
 drivers/net/ethernet/intel/ice/ice_lib.c  |  10 +-
 drivers/net/ethernet/intel/ice/ice_xsk.c  |   2 +-
 4 files changed, 80 insertions(+), 57 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c
index 74fdd4296937..798b173e81e0 100644
--- a/drivers/net/ethernet/intel/ice/ice_base.c
+++ b/drivers/net/ethernet/intel/ice/ice_base.c
@@ -278,11 +278,9 @@ ice_setup_tx_ctx(struct ice_ring *ring, struct ice_tlan_ctx *tlan_ctx, u16 pf_q)
  *
  * Configure the Rx descriptor ring in RLAN context.
  */
-int ice_setup_rx_ctx(struct ice_ring *ring)
+static int ice_setup_rx_ctx(struct ice_ring *ring)
 {
-	struct device *dev = ice_pf_to_dev(ring->vsi->back);
 	int chain_len = ICE_MAX_CHAINED_RX_BUFS;
-	u16 num_bufs = ICE_DESC_UNUSED(ring);
 	struct ice_vsi *vsi = ring->vsi;
 	u32 rxdid = ICE_RXDID_FLEX_NIC;
 	struct ice_rlan_ctx rlan_ctx;
@@ -299,49 +297,6 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
 	/* clear the context structure first */
 	memset(&rlan_ctx, 0, sizeof(rlan_ctx));
 
-	ring->rx_buf_len = vsi->rx_buf_len;
-
-	if (ring->vsi->type == ICE_VSI_PF) {
-		if (!xdp_rxq_info_is_reg(&ring->xdp_rxq))
-			/* coverity[check_return] */
-			xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
-					 ring->q_index);
-
-		ring->xsk_umem = ice_xsk_umem(ring);
-		if (ring->xsk_umem) {
-			xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq);
-
-			ring->rx_buf_len = ring->xsk_umem->chunk_size_nohr -
-					   XDP_PACKET_HEADROOM;
-			/* For AF_XDP ZC, we disallow packets to span on
-			 * multiple buffers, thus letting us skip that
-			 * handling in the fast-path.
-			 */
-			chain_len = 1;
-			ring->zca.free = ice_zca_free;
-			err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,
-							 MEM_TYPE_ZERO_COPY,
-							 &ring->zca);
-			if (err)
-				return err;
-
-			dev_info(dev, "Registered XDP mem model MEM_TYPE_ZERO_COPY on Rx ring %d\n",
-				 ring->q_index);
-		} else {
-			ring->zca.free = NULL;
-			if (!xdp_rxq_info_is_reg(&ring->xdp_rxq))
-				/* coverity[check_return] */
-				xdp_rxq_info_reg(&ring->xdp_rxq,
-						 ring->netdev,
-						 ring->q_index);
-
-			err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,
-							 MEM_TYPE_PAGE_SHARED,
-							 NULL);
-			if (err)
-				return err;
-		}
-	}
 	/* Receive Queue Base Address.
 	 * Indicates the starting address of the descriptor queue defined in
 	 * 128 Byte units.
@@ -376,6 +331,12 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
 	 */
 	rlan_ctx.showiv = 0;
 
+	/* For AF_XDP ZC, we disallow packets to span on
+	 * multiple buffers, thus letting us skip that
+	 * handling in the fast-path.
+	 */
+	if (ring->xsk_umem)
+		chain_len = 1;
 	/* Max packet size for this queue - must not be set to a larger value
 	 * than 5 x DBUF
 	 */
@@ -410,7 +371,8 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
 	/* Absolute queue number out of 2K needs to be passed */
 	err = ice_write_rxq_ctx(hw, &rlan_ctx, pf_q);
 	if (err) {
-		dev_err(dev, "Failed to set LAN Rx queue context for absolute Rx queue %d error: %d\n",
+		dev_err(ice_pf_to_dev(vsi->back),
+			"Failed to set LAN Rx queue context for absolute Rx queue %d error: %d\n",
 			pf_q, err);
 		return -EIO;
 	}
@@ -428,6 +390,67 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
 	ring->tail = hw->hw_addr + QRX_TAIL(pf_q);
 	writel(0, ring->tail);
 
+	return 0;
+}
+
+/**
+ * ice_vsi_cfg_rxq - Configure an Rx queue
+ * @ring: the ring being configured
+ *
+ * Return 0 on success and a negative value on error.
+ */
+int ice_vsi_cfg_rxq(struct ice_ring *ring)
+{
+	struct device *dev = ice_pf_to_dev(ring->vsi->back);
+	u16 num_bufs = ICE_DESC_UNUSED(ring);
+	int err;
+
+	ring->rx_buf_len = ring->vsi->rx_buf_len;
+
+	if (ring->vsi->type == ICE_VSI_PF) {
+		if (!xdp_rxq_info_is_reg(&ring->xdp_rxq))
+			/* coverity[check_return] */
+			xdp_rxq_info_reg(&ring->xdp_rxq, ring->netdev,
+					 ring->q_index);
+
+		ring->xsk_umem = ice_xsk_umem(ring);
+		if (ring->xsk_umem) {
+			xdp_rxq_info_unreg_mem_model(&ring->xdp_rxq);
+
+			ring->rx_buf_len = ring->xsk_umem->chunk_size_nohr -
+					   XDP_PACKET_HEADROOM;
+			ring->zca.free = ice_zca_free;
+			err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,
+							 MEM_TYPE_ZERO_COPY,
+							 &ring->zca);
+			if (err)
+				return err;
+
+			dev_info(dev, "Registered XDP mem model MEM_TYPE_ZERO_COPY on Rx ring %d\n",
+				 ring->q_index);
+		} else {
+			ring->zca.free = NULL;
+			if (!xdp_rxq_info_is_reg(&ring->xdp_rxq))
+				/* coverity[check_return] */
+				xdp_rxq_info_reg(&ring->xdp_rxq,
+						 ring->netdev,
+						 ring->q_index);
+
+			err = xdp_rxq_info_reg_mem_model(&ring->xdp_rxq,
+							 MEM_TYPE_PAGE_SHARED,
+							 NULL);
+			if (err)
+				return err;
+		}
+	}
+
+	err = ice_setup_rx_ctx(ring);
+	if (err) {
+		dev_err(dev, "ice_setup_rx_ctx failed for RxQ %d, err %d\n",
+			ring->q_index, err);
+		return err;
+	}
+
 	if (ring->xsk_umem) {
 		if (!xsk_umem_has_addrs_rq(ring->xsk_umem, num_bufs)) {
 			dev_warn(dev, "UMEM does not provide enough addresses to fill %d buffers on Rx ring %d\n",
@@ -438,9 +461,13 @@ int ice_setup_rx_ctx(struct ice_ring *ring)
 		}
 
 		err = ice_alloc_rx_bufs_slow_zc(ring, num_bufs);
-		if (err)
+		if (err) {
+			u16 pf_q = ring->vsi->rxq_map[ring->q_index];
+
 			dev_info(dev, "Failed to allocate some buffers on UMEM enabled Rx ring %d (pf_q %d)\n",
 				 ring->q_index, pf_q);
+		}
+
 		return 0;
 	}
 
diff --git a/drivers/net/ethernet/intel/ice/ice_base.h b/drivers/net/ethernet/intel/ice/ice_base.h
index 44efdb627043..20e1c29aa68a 100644
--- a/drivers/net/ethernet/intel/ice/ice_base.h
+++ b/drivers/net/ethernet/intel/ice/ice_base.h
@@ -6,7 +6,7 @@
 
 #include "ice.h"
 
-int ice_setup_rx_ctx(struct ice_ring *ring);
+int ice_vsi_cfg_rxq(struct ice_ring *ring);
 int __ice_vsi_get_qs(struct ice_qs_cfg *qs_cfg);
 int
 ice_vsi_ctrl_one_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx, bool wait);
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 51a20958e0d0..9bee0d947651 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -1648,15 +1648,11 @@ int ice_vsi_cfg_rxqs(struct ice_vsi *vsi)
 	ice_vsi_cfg_frame_size(vsi);
 setup_rings:
 	/* set up individual rings */
-	for (i = 0; i < vsi->num_rxq; i++) {
-		int err;
+	ice_for_each_rxq(vsi, i) {
+		int err = ice_vsi_cfg_rxq(vsi->rx_rings[i]);
 
-		err = ice_setup_rx_ctx(vsi->rx_rings[i]);
-		if (err) {
-			dev_err(ice_pf_to_dev(vsi->back), "ice_setup_rx_ctx failed for RxQ %d, err %d\n",
-				i, err);
+		if (err)
 			return err;
-		}
 	}
 
 	return 0;
diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
index 1e9cc550ec98..5f556faef405 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -237,7 +237,7 @@ static int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx)
 		xdp_ring->xsk_umem = ice_xsk_umem(xdp_ring);
 	}
 
-	err = ice_setup_rx_ctx(rx_ring);
+	err = ice_vsi_cfg_rxq(rx_ring);
 	if (err)
 		goto free_buf;
 
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 10/14] ice: Poll for reset completion when DDP load fails
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
                   ` (7 preceding siblings ...)
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 09/14] ice: Refactor ice_setup_rx_ctx Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:25   ` Bowers, AndrewX
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 11/14] ice: cleanup VSI context initialization Tony Nguyen
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

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

There are certain cases where the DDP load fails and the FW issues a
core reset. For these cases, wait for reset to complete before
proceeding with reset of the driver init.

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

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index fcd5c53202d9..1853dca3f364 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -3111,6 +3111,9 @@ ice_log_pkg_init(struct ice_hw *hw, enum ice_status *status)
 		case ICE_AQ_RC_EBADMAN:
 		case ICE_AQ_RC_EBADBUF:
 			dev_err(dev, "An error occurred on the device while loading the DDP package.  The device will be reset.\n");
+			/* poll for reset to complete */
+			if (ice_check_reset(hw))
+				dev_err(dev, "Error resetting device. Please reload the driver\n");
 			return;
 		default:
 			break;
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 11/14] ice: cleanup VSI context initialization
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
                   ` (8 preceding siblings ...)
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 10/14] ice: Poll for reset completion when DDP load fails Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:26   ` Bowers, AndrewX
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 12/14] ice: fix potential double free in probe unrolling Tony Nguyen
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

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

Remove an unnecessary copy of vsi->info into ctxt->info in ice_vsi_init.
This line is essentially a no-op because ice_set_dflt_vsi_ctx performs
a memset to clear the info from the context structure.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_lib.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 9bee0d947651..7ab7408b3a05 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -949,7 +949,6 @@ 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_CTRL:
 	case ICE_VSI_LB:
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 12/14] ice: fix potential double free in probe unrolling
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
                   ` (9 preceding siblings ...)
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 11/14] ice: cleanup VSI context initialization Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:26   ` Bowers, AndrewX
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 13/14] ice: fix kernel BUG if register_netdev fails Tony Nguyen
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

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

If ice_init_interrupt_scheme fails, ice_probe will jump to clearing up
the interrupts. This can lead to some static analysis tools such as the
compiler sanitizers complaining about double free problems.

Since ice_init_interrupt_scheme already unrolls internally on failure,
there is no need to call ice_clear_interrupt_scheme when it fails. Add
a new unroll label and use that instead.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 1853dca3f364..943fde5abdb7 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -3443,7 +3443,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
 	if (err) {
 		dev_err(dev, "ice_init_interrupt_scheme failed: %d\n", err);
 		err = -EIO;
-		goto err_init_interrupt_unroll;
+		goto err_init_vsi_unroll;
 	}
 
 	/* In case of MSIX we are going to setup the misc vector right here
@@ -3564,6 +3564,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
 	ice_free_irq_msix_misc(pf);
 err_init_interrupt_unroll:
 	ice_clear_interrupt_scheme(pf);
+err_init_vsi_unroll:
 	devm_kfree(dev, pf->vsi);
 err_init_pf_unroll:
 	ice_deinit_pf(pf);
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 13/14] ice: fix kernel BUG if register_netdev fails
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
                   ` (10 preceding siblings ...)
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 12/14] ice: fix potential double free in probe unrolling Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:26   ` Bowers, AndrewX
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 14/14] ice: Declare functions static Tony Nguyen
  2020-05-26 20:22 ` [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Bowers, AndrewX
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

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

If register_netdev() fails, the driver will attempt to cleanup the
q_vectors and inadvertently trigger a kernel BUG due to a NULL pointer
dereference.

This occurs because cleaning up q_vectors attempts to call
netif_napi_del on napi_structs which were never initialized.

Resolve this by releasing the netdev in ice_cfg_netdev and setting
vsi->netdev to NULL. This ensures that after ice_cfg_netdev fails the
state is rewound to match as if ice_cfg_netdev was never called.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 943fde5abdb7..14aa02b000cc 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -2435,7 +2435,7 @@ static int ice_cfg_netdev(struct ice_vsi *vsi)
 
 	err = register_netdev(vsi->netdev);
 	if (err)
-		goto err_destroy_devlink_port;
+		goto err_free_netdev;
 
 	devlink_port_type_eth_set(&pf->devlink_port, vsi->netdev);
 
@@ -2446,9 +2446,11 @@ static int ice_cfg_netdev(struct ice_vsi *vsi)
 
 	return 0;
 
+err_free_netdev:
+	free_netdev(vsi->netdev);
+	vsi->netdev = NULL;
 err_destroy_devlink_port:
 	ice_devlink_destroy_port(pf);
-
 	return err;
 }
 
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 14/14] ice: Declare functions static
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
                   ` (11 preceding siblings ...)
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 13/14] ice: fix kernel BUG if register_netdev fails Tony Nguyen
@ 2020-05-16  0:42 ` Tony Nguyen
  2020-05-26 20:26   ` Bowers, AndrewX
  2020-05-26 20:22 ` [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Bowers, AndrewX
  13 siblings, 1 reply; 28+ messages in thread
From: Tony Nguyen @ 2020-05-16  0:42 UTC (permalink / raw)
  To: intel-wired-lan

ice_get_pfa_module_tlv() and ice_read_sr_word() are not being called
outside of their file. Declare them as static.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_nvm.c | 5 +++--
 drivers/net/ethernet/intel/ice/ice_nvm.h | 4 ----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_nvm.c b/drivers/net/ethernet/intel/ice/ice_nvm.c
index 7c2a06892bbb..b049c1c30c88 100644
--- a/drivers/net/ethernet/intel/ice/ice_nvm.c
+++ b/drivers/net/ethernet/intel/ice/ice_nvm.c
@@ -172,7 +172,8 @@ void ice_release_nvm(struct ice_hw *hw)
  *
  * Reads one 16 bit word from the Shadow RAM using the ice_read_sr_word_aq.
  */
-enum ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data)
+static enum ice_status
+ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data)
 {
 	enum ice_status status;
 
@@ -196,7 +197,7 @@ enum ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data)
  * Area (PFA) and returns the TLV pointer and length. The caller can
  * use these to read the variable length TLV value.
  */
-enum ice_status
+static enum ice_status
 ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,
 		       u16 module_type)
 {
diff --git a/drivers/net/ethernet/intel/ice/ice_nvm.h b/drivers/net/ethernet/intel/ice/ice_nvm.h
index 999f273ba6ad..165eda07b93d 100644
--- a/drivers/net/ethernet/intel/ice/ice_nvm.h
+++ b/drivers/net/ethernet/intel/ice/ice_nvm.h
@@ -11,10 +11,6 @@ enum ice_status
 ice_read_flat_nvm(struct ice_hw *hw, u32 offset, u32 *length, u8 *data,
 		  bool read_shadow_ram);
 enum ice_status
-ice_get_pfa_module_tlv(struct ice_hw *hw, u16 *module_tlv, u16 *module_tlv_len,
-		       u16 module_type);
-enum ice_status
 ice_read_pba_string(struct ice_hw *hw, u8 *pba_num, u32 pba_num_size);
 enum ice_status ice_init_nvm(struct ice_hw *hw);
-enum ice_status ice_read_sr_word(struct ice_hw *hw, u16 offset, u16 *data);
 #endif /* _ICE_NVM_H_ */
-- 
2.20.1


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

* [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set
  2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
                   ` (12 preceding siblings ...)
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 14/14] ice: Declare functions static Tony Nguyen
@ 2020-05-26 20:22 ` Bowers, AndrewX
  13 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:22 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping
> change when pvid set
> 
> From: Brett Creeley <brett.creeley@intel.com>
> 
> Currently, if the PVID is set in the VLAN handling section of the VSI context
> the driver still allows VLAN stripping to be enabled/disabled.
> VLAN stripping should only be modifiable when the PVID is not set. Fix this by
> preventing VLAN stripping modification when PVID is set.
> 
> Signed-off-by: Brett Creeley <brett.creeley@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_lib.c | 6 ++++++
>  1 file changed, 6 insertions(+)

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



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

* [Intel-wired-lan] [PATCH S44 02/14] ice: Handle critical FW error during admin queue initialization
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 02/14] ice: Handle critical FW error during admin queue initialization Tony Nguyen
@ 2020-05-26 20:22   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:22 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 02/14] ice: Handle critical FW error
> during admin queue initialization
> 
> From: Evan Swanson <evan.swanson@intel.com>
> 
> A race condition between FW and SW can occur between admin queue setup
> and the first command sent. A link event may occur and FW attempts to
> notify a non-existent queue. FW will set the critical error bit and disable the
> queue. When this happens retry queue setup.
> 
> Signed-off-by: Evan Swanson <evan.swanson@intel.com>
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_controlq.c | 126 ++++++++++--------
>  drivers/net/ethernet/intel/ice/ice_controlq.h |   3 +
>  .../net/ethernet/intel/ice/ice_hw_autogen.h   |   2 +
>  drivers/net/ethernet/intel/ice/ice_main.c     |   2 +
>  drivers/net/ethernet/intel/ice/ice_status.h   |   1 +
>  5 files changed, 80 insertions(+), 54 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S44 03/14] ice: Change number of XDP TxQ to 0 when destroying rings
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 03/14] ice: Change number of XDP TxQ to 0 when destroying rings Tony Nguyen
@ 2020-05-26 20:23   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:23 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 03/14] ice: Change number of XDP TxQ
> to 0 when destroying rings
> 
> From: Marta Plantykow <marta.a.plantykow@intel.com>
> 
> When XDP Tx rings are destroyed the number of XDP Tx queues is not
> changing. This patch is changing this number to 0.
> 
> Signed-off-by: Marta Plantykow <marta.a.plantykow@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 3 +++
>  1 file changed, 3 insertions(+)

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



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

* [Intel-wired-lan] [PATCH S44 04/14] ice: Add XDP Tx to VSI ring stats
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 04/14] ice: Add XDP Tx to VSI ring stats Tony Nguyen
@ 2020-05-26 20:23   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:23 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 04/14] ice: Add XDP Tx to VSI ring stats
> 
> From: Marta Plantykow <marta.a.plantykow@intel.com>
> 
> When XDP Tx program is loaded and packets are sent from interface, VSI
> statistics are not updated. This patch adds packets sent on Tx XDP ring to VSI
> ring stats.
> 
> Signed-off-by: Marta Plantykow <marta.a.plantykow@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 42 ++++++++++++++++++-----
>  1 file changed, 33 insertions(+), 9 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S44 05/14] ice: Change number of XDP Tx queues to match number of Rx queues
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 05/14] ice: Change number of XDP Tx queues to match number of Rx queues Tony Nguyen
@ 2020-05-26 20:24   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:24 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 05/14] ice: Change number of XDP Tx
> queues to match number of Rx queues
> 
> From: Marta Plantykow <marta.a.plantykow@intel.com>
> 
> In current implementation number of XDP Tx queues is the same as the
> number of transmit queues, which is not always true. This patch changes this
> number to match the number of receive queues.
> XDP programs are running on Rx rings, so what we actually need to provide is
> the XDP Tx ring per each Rx ring so that the whole XDP ecosystem is
> functional, e.g. if the result of XDP prog is XDP_TX then you have the need to
> access the XDP Tx ring.
> 
> Signed-off-by: Marta Plantykow <marta.a.plantykow@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_lib.c  | 2 +-
> drivers/net/ethernet/intel/ice/ice_main.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S44 06/14] ice: avoid undefined behavior
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 06/14] ice: avoid undefined behavior Tony Nguyen
@ 2020-05-26 20:24   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:24 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 06/14] ice: avoid undefined behavior
> 
> From: Bruce Allan <bruce.w.allan@intel.com>
> 
> When writing the driver's struct ice_tlan_ctx structure, do not write the 8-bit
> element int_q_state with the associated internal-to-hardware field which is
> 122-bits, otherwise the helper function ice_write_byte() will use undefined
> behavior when setting the mask used for that write.  This should not cause
> any functional change and will avoid use of undefined behavior.
> Also, update a comment to highlight this structure element is not written.
> 
> Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_base.c      |  5 +++--
>  drivers/net/ethernet/intel/ice/ice_common.c    | 12 ++++++++++--
>  drivers/net/ethernet/intel/ice/ice_common.h    |  3 ++-
>  drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h |  2 +-
>  4 files changed, 16 insertions(+), 6 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S44 07/14] ice: Refactor Rx checksum checks
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 07/14] ice: Refactor Rx checksum checks Tony Nguyen
@ 2020-05-26 20:24   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:24 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 07/14] ice: Refactor Rx checksum
> checks
> 
> From: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
> 
> We don't need both rx_status and rx_error parameters, as the latter is a
> subset of the former. Remove rx_error completely and check the right bit in
> rx_status.
> 
> Rename rx_status to rx_status0, and rx_status_err1 to rx_status1. This
> naming more closely reflects the specification.
> 
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 27 ++++++++-----------
>  1 file changed, 11 insertions(+), 16 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S44 08/14] ice: Check UMEM FQ size when allocating bufs
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 08/14] ice: Check UMEM FQ size when allocating bufs Tony Nguyen
@ 2020-05-26 20:25   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:25 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 08/14] ice: Check UMEM FQ size when
> allocating bufs
> 
> From: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
> 
> If a UMEM is present on a queue when an interface/queue pair is being
> enabled, the driver will try to prepare the Rx buffers in advance to improve
> performance. However, if fill queue is shorter than HW Rx ring, the driver will
> report failure after getting the last address from the fill queue.
> 
> This still lets the driver process the packets correctly during the NAPI poll, but
> leads to a constant NAPI rescheduling. Not allocating the buffers in advance
> would result in a potential performance decrease.
> 
> Commit d57d76428ae9 ("xsk: Add API to check for available entries in FQ")
> provides an API that lets drivers check the number of addresses that the fill
> queue holds.
> 
> Notify the user if fill queue is not long enough to prepare all buffers before
> packet processing starts, and allocate the buffers during the NAPI poll. If the
> fill queue size is sufficient, prepare Rx buffers in advance.
> 
> Signed-off-by: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_base.c | 30 ++++++++++++++++-------
>  1 file changed, 21 insertions(+), 9 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S44 09/14] ice: Refactor ice_setup_rx_ctx
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 09/14] ice: Refactor ice_setup_rx_ctx Tony Nguyen
@ 2020-05-26 20:25   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:25 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 09/14] ice: Refactor ice_setup_rx_ctx
> 
> From: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
> 
> Move AF_XDP logic and buffer allocation out of ice_setup_rx_ctx() to a new
> function ice_vsi_cfg_rxq(), so the function actually sets up the Rx context.
> 
> Signed-off-by: Krzysztof Kazimierczak <krzysztof.kazimierczak@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_base.c | 123 +++++++++++++---------
>  drivers/net/ethernet/intel/ice/ice_base.h |   2 +-
>  drivers/net/ethernet/intel/ice/ice_lib.c  |  10 +-
>  drivers/net/ethernet/intel/ice/ice_xsk.c  |   2 +-
>  4 files changed, 80 insertions(+), 57 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S44 10/14] ice: Poll for reset completion when DDP load fails
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 10/14] ice: Poll for reset completion when DDP load fails Tony Nguyen
@ 2020-05-26 20:25   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:25 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 10/14] ice: Poll for reset completion
> when DDP load fails
> 
> From: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
> 
> There are certain cases where the DDP load fails and the FW issues a core
> reset. For these cases, wait for reset to complete before proceeding with
> reset of the driver init.
> 
> Signed-off-by: Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 3 +++
>  1 file changed, 3 insertions(+)

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



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

* [Intel-wired-lan] [PATCH S44 11/14] ice: cleanup VSI context initialization
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 11/14] ice: cleanup VSI context initialization Tony Nguyen
@ 2020-05-26 20:26   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:26 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 11/14] ice: cleanup VSI context
> initialization
> 
> From: Jacob Keller <jacob.e.keller@intel.com>
> 
> Remove an unnecessary copy of vsi->info into ctxt->info in ice_vsi_init.
> This line is essentially a no-op because ice_set_dflt_vsi_ctx performs a
> memset to clear the info from the context structure.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_lib.c | 1 -
>  1 file changed, 1 deletion(-)

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



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

* [Intel-wired-lan] [PATCH S44 12/14] ice: fix potential double free in probe unrolling
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 12/14] ice: fix potential double free in probe unrolling Tony Nguyen
@ 2020-05-26 20:26   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:26 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 12/14] ice: fix potential double free in
> probe unrolling
> 
> From: Jacob Keller <jacob.e.keller@intel.com>
> 
> If ice_init_interrupt_scheme fails, ice_probe will jump to clearing up the
> interrupts. This can lead to some static analysis tools such as the compiler
> sanitizers complaining about double free problems.
> 
> Since ice_init_interrupt_scheme already unrolls internally on failure, there is
> no need to call ice_clear_interrupt_scheme when it fails. Add a new unroll
> label and use that instead.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

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



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

* [Intel-wired-lan] [PATCH S44 13/14] ice: fix kernel BUG if register_netdev fails
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 13/14] ice: fix kernel BUG if register_netdev fails Tony Nguyen
@ 2020-05-26 20:26   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:26 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 13/14] ice: fix kernel BUG if
> register_netdev fails
> 
> From: Jacob Keller <jacob.e.keller@intel.com>
> 
> If register_netdev() fails, the driver will attempt to cleanup the q_vectors
> and inadvertently trigger a kernel BUG due to a NULL pointer dereference.
> 
> This occurs because cleaning up q_vectors attempts to call netif_napi_del on
> napi_structs which were never initialized.
> 
> Resolve this by releasing the netdev in ice_cfg_netdev and setting
> vsi->netdev to NULL. This ensures that after ice_cfg_netdev fails the
> state is rewound to match as if ice_cfg_netdev was never called.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

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



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

* [Intel-wired-lan] [PATCH S44 14/14] ice: Declare functions static
  2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 14/14] ice: Declare functions static Tony Nguyen
@ 2020-05-26 20:26   ` Bowers, AndrewX
  0 siblings, 0 replies; 28+ messages in thread
From: Bowers, AndrewX @ 2020-05-26 20:26 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Tony Nguyen
> Sent: Friday, May 15, 2020 5:42 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH S44 14/14] ice: Declare functions static
> 
> ice_get_pfa_module_tlv() and ice_read_sr_word() are not being called
> outside of their file. Declare them as static.
> 
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_nvm.c | 5 +++--
> drivers/net/ethernet/intel/ice/ice_nvm.h | 4 ----
>  2 files changed, 3 insertions(+), 6 deletions(-)

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



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

end of thread, other threads:[~2020-05-26 20:26 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-16  0:42 [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set Tony Nguyen
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 02/14] ice: Handle critical FW error during admin queue initialization Tony Nguyen
2020-05-26 20:22   ` Bowers, AndrewX
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 03/14] ice: Change number of XDP TxQ to 0 when destroying rings Tony Nguyen
2020-05-26 20:23   ` Bowers, AndrewX
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 04/14] ice: Add XDP Tx to VSI ring stats Tony Nguyen
2020-05-26 20:23   ` Bowers, AndrewX
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 05/14] ice: Change number of XDP Tx queues to match number of Rx queues Tony Nguyen
2020-05-26 20:24   ` Bowers, AndrewX
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 06/14] ice: avoid undefined behavior Tony Nguyen
2020-05-26 20:24   ` Bowers, AndrewX
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 07/14] ice: Refactor Rx checksum checks Tony Nguyen
2020-05-26 20:24   ` Bowers, AndrewX
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 08/14] ice: Check UMEM FQ size when allocating bufs Tony Nguyen
2020-05-26 20:25   ` Bowers, AndrewX
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 09/14] ice: Refactor ice_setup_rx_ctx Tony Nguyen
2020-05-26 20:25   ` Bowers, AndrewX
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 10/14] ice: Poll for reset completion when DDP load fails Tony Nguyen
2020-05-26 20:25   ` Bowers, AndrewX
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 11/14] ice: cleanup VSI context initialization Tony Nguyen
2020-05-26 20:26   ` Bowers, AndrewX
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 12/14] ice: fix potential double free in probe unrolling Tony Nguyen
2020-05-26 20:26   ` Bowers, AndrewX
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 13/14] ice: fix kernel BUG if register_netdev fails Tony Nguyen
2020-05-26 20:26   ` Bowers, AndrewX
2020-05-16  0:42 ` [Intel-wired-lan] [PATCH S44 14/14] ice: Declare functions static Tony Nguyen
2020-05-26 20:26   ` Bowers, AndrewX
2020-05-26 20:22 ` [Intel-wired-lan] [PATCH S44 01/14] ice: Don't allow VLAN stripping change when pvid set 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.