patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 18.11 1/3] net/avf: fix command after PF reset
@ 2020-12-03  9:47 Jeff Guo
  2020-12-03  9:47 ` [dpdk-stable] [PATCH 18.11 2/3] net/avf: fix flow flush " Jeff Guo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jeff Guo @ 2020-12-03  9:47 UTC (permalink / raw)
  To: ktraynor; +Cc: stable, jia.guo, Hailin Xu, Qi Zhang

[ upstream commit 1eab95fe2e36e191ad85a9aacf82a44e7c8011fc ]

If PF reset is finished but VF reset is pending, VF should no need to
send any invalid cmd to PF. That would avoid mass unexpected behaviors
affecting the robust.

Fixes: 22b123a36d07 ("net/avf: initialize PMD")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Tested-by: Hailin Xu <hailinx.xu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/avf/avf.h        | 2 +-
 drivers/net/avf/avf_ethdev.c | 3 +++
 drivers/net/avf/avf_vchnl.c  | 3 +++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/avf/avf.h b/drivers/net/avf/avf.h
index bef66a258c..112a5337a4 100644
--- a/drivers/net/avf/avf.h
+++ b/drivers/net/avf/avf.h
@@ -98,7 +98,7 @@ struct avf_info {
 	enum virtchnl_link_speed link_speed;
 
 	struct avf_vsi vsi;
-	bool vf_reset;
+	bool vf_reset;	/* true for VF reset pending, false for no VF reset */
 	uint64_t flags;
 
 	uint8_t *rss_lut;
diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index 1a1d10e79f..35a7debf64 100644
--- a/drivers/net/avf/avf_ethdev.c
+++ b/drivers/net/avf/avf_ethdev.c
@@ -1136,6 +1136,9 @@ avf_init_vf(struct rte_eth_dev *dev)
 			goto err_rss;
 		}
 	}
+
+	vf->vf_reset = false;
+
 	return 0;
 err_rss:
 	rte_free(vf->rss_key);
diff --git a/drivers/net/avf/avf_vchnl.c b/drivers/net/avf/avf_vchnl.c
index 7806014e80..29ef485184 100644
--- a/drivers/net/avf/avf_vchnl.c
+++ b/drivers/net/avf/avf_vchnl.c
@@ -76,6 +76,9 @@ avf_execute_vf_cmd(struct avf_adapter *adapter, struct avf_cmd_info *args)
 	if (_atomic_set_cmd(vf, args->ops))
 		return -1;
 
+	if (vf->vf_reset)
+		return -EIO;
+
 	ret = avf_aq_send_msg_to_pf(hw, args->ops, AVF_SUCCESS,
 				    args->in_args, args->in_args_size, NULL);
 	if (ret) {
-- 
2.20.1


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

* [dpdk-stable] [PATCH 18.11 2/3] net/avf: fix flow flush after PF reset
  2020-12-03  9:47 [dpdk-stable] [PATCH 18.11 1/3] net/avf: fix command after PF reset Jeff Guo
@ 2020-12-03  9:47 ` Jeff Guo
  2020-12-03  9:47 ` [dpdk-stable] [PATCH 18.11 3/3] net/avf: fix vector Rx Jeff Guo
  2020-12-03 16:45 ` [dpdk-stable] [PATCH 18.11 1/3] net/avf: fix command after PF reset Kevin Traynor
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Guo @ 2020-12-03  9:47 UTC (permalink / raw)
  To: ktraynor; +Cc: stable, jia.guo, Qi Zhang

[ upstream commit c02ea7410e5124ad44ad7419ab16a43e1b3af647 ]

When VF begin reset after PF reset, VF will be uninitialized at first
and then be initialized, during the time any invalid cmd such as flow
flush should not be sent to PF until the uninitialization is finished.

Fixes: 3926cfffff2c ("net/avf: fix command after PF reset")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/avf/avf_ethdev.c | 5 +++--
 drivers/net/avf/avf_vchnl.c  | 7 ++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c
index 35a7debf64..d49de4344a 100644
--- a/drivers/net/avf/avf_ethdev.c
+++ b/drivers/net/avf/avf_ethdev.c
@@ -1137,8 +1137,6 @@ avf_init_vf(struct rte_eth_dev *dev)
 		}
 	}
 
-	vf->vf_reset = false;
-
 	return 0;
 err_rss:
 	rte_free(vf->rss_key);
@@ -1269,6 +1267,7 @@ avf_dev_init(struct rte_eth_dev *eth_dev)
 static void
 avf_dev_close(struct rte_eth_dev *dev)
 {
+	struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
@@ -1282,6 +1281,8 @@ avf_dev_close(struct rte_eth_dev *dev)
 	rte_intr_callback_unregister(intr_handle,
 				     avf_dev_interrupt_handler, dev);
 	avf_disable_irq0(hw);
+
+	vf->vf_reset = false;
 }
 
 static int
diff --git a/drivers/net/avf/avf_vchnl.c b/drivers/net/avf/avf_vchnl.c
index 29ef485184..39ae0c011c 100644
--- a/drivers/net/avf/avf_vchnl.c
+++ b/drivers/net/avf/avf_vchnl.c
@@ -73,12 +73,12 @@ avf_execute_vf_cmd(struct avf_adapter *adapter, struct avf_cmd_info *args)
 	int err = 0;
 	int i = 0;
 
-	if (_atomic_set_cmd(vf, args->ops))
-		return -1;
-
 	if (vf->vf_reset)
 		return -EIO;
 
+	if (_atomic_set_cmd(vf, args->ops))
+		return -1;
+
 	ret = avf_aq_send_msg_to_pf(hw, args->ops, AVF_SUCCESS,
 				    args->in_args, args->in_args_size, NULL);
 	if (ret) {
@@ -150,6 +150,7 @@ avf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg,
 	switch (pf_msg->event) {
 	case VIRTCHNL_EVENT_RESET_IMPENDING:
 		PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event");
+		vf->vf_reset = true;
 		_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_RESET,
 					      NULL);
 		break;
-- 
2.20.1


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

* [dpdk-stable] [PATCH 18.11 3/3] net/avf: fix vector Rx
  2020-12-03  9:47 [dpdk-stable] [PATCH 18.11 1/3] net/avf: fix command after PF reset Jeff Guo
  2020-12-03  9:47 ` [dpdk-stable] [PATCH 18.11 2/3] net/avf: fix flow flush " Jeff Guo
@ 2020-12-03  9:47 ` Jeff Guo
  2020-12-03 16:45 ` [dpdk-stable] [PATCH 18.11 1/3] net/avf: fix command after PF reset Kevin Traynor
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Guo @ 2020-12-03  9:47 UTC (permalink / raw)
  To: ktraynor; +Cc: stable, jia.guo, Morten Brørup, Wei Ling, Qi Zhang

[ upstream commit 851b22ff688e759a961ed969ea620372b20581d9 ]

The limitation of burst size in vector rx was removed, since it should
retrieve as much received packets as possible. And also the scattered
receive path should use a wrapper function to achieve the goal of
burst maximizing.

Bugzilla ID: 516
Fixes: 319c421f3890 ("net/avf: enable SSE Rx Tx")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Tested-by: Wei Ling <weix.ling@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/avf/avf_rxtx_vec_sse.c | 49 ++++++++++++++++++++++--------
 1 file changed, 37 insertions(+), 12 deletions(-)

diff --git a/drivers/net/avf/avf_rxtx_vec_sse.c b/drivers/net/avf/avf_rxtx_vec_sse.c
index 13e94cebc0..4aa209f702 100644
--- a/drivers/net/avf/avf_rxtx_vec_sse.c
+++ b/drivers/net/avf/avf_rxtx_vec_sse.c
@@ -227,10 +227,12 @@ desc_to_ptype_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
 	rx_pkts[3]->packet_type = type_table[_mm_extract_epi8(ptype1, 8)];
 }
 
-/* Notice:
+/**
+ * vPMD raw receive routine, only accept(nb_pkts >= AVF_VPMD_DESCS_PER_LOOP)
+ *
+ * Notice:
  * - nb_pkts < AVF_VPMD_DESCS_PER_LOOP, just return no packet
- * - nb_pkts > AVF_VPMD_RX_MAX_BURST, only scan AVF_VPMD_RX_MAX_BURST
- *   numbers of DD bits
+ * - floor align nb_pkts to a AVF_VPMD_DESCS_PER_LOOP power-of-two
  */
 static inline uint16_t
 _recv_raw_pkts_vec(struct avf_rx_queue *rxq, struct rte_mbuf **rx_pkts,
@@ -260,9 +262,6 @@ _recv_raw_pkts_vec(struct avf_rx_queue *rxq, struct rte_mbuf **rx_pkts,
 			offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8);
 	__m128i dd_check, eop_check;
 
-	/* nb_pkts shall be less equal than AVF_VPMD_RX_MAX_BURST */
-	nb_pkts = RTE_MIN(nb_pkts, AVF_VPMD_RX_MAX_BURST);
-
 	/* nb_pkts has to be floor-aligned to AVF_VPMD_DESCS_PER_LOOP */
 	nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, AVF_VPMD_DESCS_PER_LOOP);
 
@@ -486,15 +485,15 @@ avf_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 	return _recv_raw_pkts_vec(rx_queue, rx_pkts, nb_pkts, NULL);
 }
 
-/* vPMD receive routine that reassembles scattered packets
+/**
+ * vPMD receive routine that reassembles single burst of 32 scattered packets
+ *
  * Notice:
  * - nb_pkts < AVF_VPMD_DESCS_PER_LOOP, just return no packet
- * - nb_pkts > VPMD_RX_MAX_BURST, only scan AVF_VPMD_RX_MAX_BURST
- *   numbers of DD bits
  */
-uint16_t
-avf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
-			    uint16_t nb_pkts)
+static uint16_t
+avf_recv_scattered_burst_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+			     uint16_t nb_pkts)
 {
 	struct avf_rx_queue *rxq = rx_queue;
 	uint8_t split_flags[AVF_VPMD_RX_MAX_BURST] = {0};
@@ -527,6 +526,32 @@ avf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
 		&split_flags[i]);
 }
 
+/**
+ * vPMD receive routine that reassembles scattered packets.
+ */
+uint16_t
+avf_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
+			    uint16_t nb_pkts)
+{
+	uint16_t retval = 0;
+
+	while (nb_pkts > AVF_VPMD_RX_MAX_BURST) {
+		uint16_t burst;
+
+		burst = avf_recv_scattered_burst_vec(rx_queue,
+						     rx_pkts + retval,
+						     AVF_VPMD_RX_MAX_BURST);
+		retval += burst;
+		nb_pkts -= burst;
+		if (burst < AVF_VPMD_RX_MAX_BURST)
+			return retval;
+	}
+
+	return retval + avf_recv_scattered_burst_vec(rx_queue,
+						     rx_pkts + retval,
+						     nb_pkts);
+}
+
 static inline void
 vtx1(volatile struct avf_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags)
 {
-- 
2.20.1


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

* Re: [dpdk-stable] [PATCH 18.11 1/3] net/avf: fix command after PF reset
  2020-12-03  9:47 [dpdk-stable] [PATCH 18.11 1/3] net/avf: fix command after PF reset Jeff Guo
  2020-12-03  9:47 ` [dpdk-stable] [PATCH 18.11 2/3] net/avf: fix flow flush " Jeff Guo
  2020-12-03  9:47 ` [dpdk-stable] [PATCH 18.11 3/3] net/avf: fix vector Rx Jeff Guo
@ 2020-12-03 16:45 ` Kevin Traynor
  2 siblings, 0 replies; 4+ messages in thread
From: Kevin Traynor @ 2020-12-03 16:45 UTC (permalink / raw)
  To: Jeff Guo; +Cc: stable, Hailin Xu, Qi Zhang

On 03/12/2020 09:47, Jeff Guo wrote:
> [ upstream commit 1eab95fe2e36e191ad85a9aacf82a44e7c8011fc ]
> 
> If PF reset is finished but VF reset is pending, VF should no need to
> send any invalid cmd to PF. That would avoid mass unexpected behaviors
> affecting the robust.
> 
> Fixes: 22b123a36d07 ("net/avf: initialize PMD")
> 
> Signed-off-by: Jeff Guo <jia.guo@intel.com>
> Tested-by: Hailin Xu <hailinx.xu@intel.com>
> Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied series, thanks.


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

end of thread, other threads:[~2020-12-03 16:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03  9:47 [dpdk-stable] [PATCH 18.11 1/3] net/avf: fix command after PF reset Jeff Guo
2020-12-03  9:47 ` [dpdk-stable] [PATCH 18.11 2/3] net/avf: fix flow flush " Jeff Guo
2020-12-03  9:47 ` [dpdk-stable] [PATCH 18.11 3/3] net/avf: fix vector Rx Jeff Guo
2020-12-03 16:45 ` [dpdk-stable] [PATCH 18.11 1/3] net/avf: fix command after PF reset Kevin Traynor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).