DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/liquidio: add support for device reset in driver
@ 2017-11-08 12:04 Shijith Thotton
  2017-11-08 20:32 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Shijith Thotton @ 2017-11-08 12:04 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit, Thomas Monjalon, stable

Reset device during init and close if bound to igb_uio.

Fixes: 369db3ae8e91 ("igb_uio: remove device reset in release")
Cc: stable@dpdk.org

Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com>
---
Hi Thomas/Ferruh,

Please consider this patch for 17.11 as removing reset from igb_uio breaks
LiquidIO PMD[1]. Here I have added support for reset within driver if the kernel
driver in use is igb_uio.

1. http://dpdk.org/ml/archives/dev/2017-October/079483.html

Thanks,
Shijith
---
 drivers/net/liquidio/base/lio_23xx_vf.c | 19 +++++++++++++++++++
 drivers/net/liquidio/base/lio_23xx_vf.h |  2 ++
 drivers/net/liquidio/base/lio_hw_defs.h |  3 +++
 drivers/net/liquidio/base/lio_mbox.h    |  1 +
 drivers/net/liquidio/lio_ethdev.c       | 12 ++++++++++++
 5 files changed, 37 insertions(+)

diff --git a/drivers/net/liquidio/base/lio_23xx_vf.c b/drivers/net/liquidio/base/lio_23xx_vf.c
index 9978017..e30c20d 100644
--- a/drivers/net/liquidio/base/lio_23xx_vf.c
+++ b/drivers/net/liquidio/base/lio_23xx_vf.c
@@ -379,6 +379,25 @@
 	cn23xx_vf_reset_io_queues(lio_dev, num_queues);
 }
 
+void
+cn23xx_vf_ask_pf_to_do_flr(struct lio_device *lio_dev)
+{
+	struct lio_mbox_cmd mbox_cmd;
+
+	memset(&mbox_cmd, 0, sizeof(struct lio_mbox_cmd));
+	mbox_cmd.msg.s.type = LIO_MBOX_REQUEST;
+	mbox_cmd.msg.s.resp_needed = 0;
+	mbox_cmd.msg.s.cmd = LIO_VF_FLR_REQUEST;
+	mbox_cmd.msg.s.len = 1;
+	mbox_cmd.q_no = 0;
+	mbox_cmd.recv_len = 0;
+	mbox_cmd.recv_status = 0;
+	mbox_cmd.fn = NULL;
+	mbox_cmd.fn_arg = 0;
+
+	lio_mbox_write(lio_dev, &mbox_cmd);
+}
+
 static void
 cn23xx_pfvf_hs_callback(struct lio_device *lio_dev,
 			struct lio_mbox_cmd *cmd, void *arg)
diff --git a/drivers/net/liquidio/base/lio_23xx_vf.h b/drivers/net/liquidio/base/lio_23xx_vf.h
index 83dc053..ad8db0d 100644
--- a/drivers/net/liquidio/base/lio_23xx_vf.h
+++ b/drivers/net/liquidio/base/lio_23xx_vf.h
@@ -87,6 +87,8 @@
 
 #define CN23XX_VF_BUSY_READING_REG_LOOP_COUNT	100000
 
+void cn23xx_vf_ask_pf_to_do_flr(struct lio_device *lio_dev);
+
 int cn23xx_pfvf_handshake(struct lio_device *lio_dev);
 
 int cn23xx_vf_setup_device(struct lio_device  *lio_dev);
diff --git a/drivers/net/liquidio/base/lio_hw_defs.h b/drivers/net/liquidio/base/lio_hw_defs.h
index d4cd23c..fe5c3bb 100644
--- a/drivers/net/liquidio/base/lio_hw_defs.h
+++ b/drivers/net/liquidio/base/lio_hw_defs.h
@@ -80,6 +80,9 @@
 /* Max IOQs per LIO Link */
 #define LIO_MAX_IOQS_PER_IF			64
 
+/* Wait time in milliseconds for FLR */
+#define LIO_PCI_FLR_WAIT			100
+
 enum lio_card_type {
 	LIO_23XX /* 23xx */
 };
diff --git a/drivers/net/liquidio/base/lio_mbox.h b/drivers/net/liquidio/base/lio_mbox.h
index f1c5b8e..b0875d6 100644
--- a/drivers/net/liquidio/base/lio_mbox.h
+++ b/drivers/net/liquidio/base/lio_mbox.h
@@ -43,6 +43,7 @@
 #define LIO_MBOX_DATA_MAX			32
 
 #define LIO_VF_ACTIVE				0x1
+#define LIO_VF_FLR_REQUEST			0x2
 #define LIO_CORES_CRASHED			0x3
 
 /* Macro for Read acknowledgment */
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 4b18966..84b8a32 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -1636,6 +1636,11 @@ struct rte_lio_xstats_name_off {
 		rte_write32(pkt_count, droq->pkts_sent_reg);
 	}
 
+	if (lio_dev->pci_dev->kdrv == RTE_KDRV_IGB_UIO) {
+		cn23xx_vf_ask_pf_to_do_flr(lio_dev);
+		rte_delay_ms(LIO_PCI_FLR_WAIT);
+	}
+
 	/* lio_free_mbox */
 	lio_dev->fn_list.free_mbox(lio_dev);
 
@@ -2009,6 +2014,13 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev)
 	if (cn23xx_pfvf_handshake(lio_dev))
 		goto error;
 
+	/* Request and wait for device reset. */
+	if (pdev->kdrv == RTE_KDRV_IGB_UIO) {
+		cn23xx_vf_ask_pf_to_do_flr(lio_dev);
+		/* FLR wait time doubled as a precaution. */
+		rte_delay_ms(LIO_PCI_FLR_WAIT * 2);
+	}
+
 	if (cn23xx_vf_set_io_queues_off(lio_dev)) {
 		lio_dev_err(lio_dev, "Setting io queues off failed\n");
 		goto error;
-- 
1.8.3.1

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

* Re: [dpdk-dev] [PATCH] net/liquidio: add support for device reset in driver
  2017-11-08 12:04 [dpdk-dev] [PATCH] net/liquidio: add support for device reset in driver Shijith Thotton
@ 2017-11-08 20:32 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2017-11-08 20:32 UTC (permalink / raw)
  To: Shijith Thotton; +Cc: dev, Ferruh Yigit, stable

08/11/2017 13:04, Shijith Thotton:
> Reset device during init and close if bound to igb_uio.
> 
> Fixes: 369db3ae8e91 ("igb_uio: remove device reset in release")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com>
> ---
> Hi Thomas/Ferruh,
> 
> Please consider this patch for 17.11 as removing reset from igb_uio breaks
> LiquidIO PMD[1]. Here I have added support for reset within driver if the kernel
> driver in use is igb_uio.
> 
> 1. http://dpdk.org/ml/archives/dev/2017-October/079483.html

Applied, thanks

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

end of thread, other threads:[~2017-11-08 20:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 12:04 [dpdk-dev] [PATCH] net/liquidio: add support for device reset in driver Shijith Thotton
2017-11-08 20:32 ` Thomas Monjalon

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).