]> git.droids-corp.org - dpdk.git/commitdiff
net/liquidio: support device reset in driver
authorShijith Thotton <shijith.thotton@caviumnetworks.com>
Wed, 8 Nov 2017 12:04:07 +0000 (17:34 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 8 Nov 2017 20:30:14 +0000 (21:30 +0100)
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>
drivers/net/liquidio/base/lio_23xx_vf.c
drivers/net/liquidio/base/lio_23xx_vf.h
drivers/net/liquidio/base/lio_hw_defs.h
drivers/net/liquidio/base/lio_mbox.h
drivers/net/liquidio/lio_ethdev.c

index 99780178eaa9eaf73bff25207af4ae5bf3a8cf67..e30c20dce2e0b349588cddf1ccec634c95e0a251 100644 (file)
@@ -379,6 +379,25 @@ cn23xx_vf_disable_io_queues(struct lio_device *lio_dev)
        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)
index 83dc053aa31282c5cb3dc9ec177599b833f662ca..ad8db0dff3458f3a0558d06fc2403d30c04c82a1 100644 (file)
@@ -87,6 +87,8 @@ int cn23xx_vf_set_io_queues_off(struct lio_device *lio_dev);
 
 #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);
index d4cd23ce83cee92a92e9e6644d7292940c4740fc..fe5c3bbbae305dbafa9dda603089e0041f634d30 100644 (file)
@@ -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 */
 };
index f1c5b8ec41f8e520a481ec49ed424e12d5814141..b0875d646d1f503defffdc45169427d39f50087c 100644 (file)
@@ -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 */
index 4b1896619a37175c0a29471b77dbda29b14d536b..84b8a3288d12a7df9813fa5e1c9fbe2da8897b04 100644 (file)
@@ -1636,6 +1636,11 @@ lio_dev_close(struct rte_eth_dev *eth_dev)
                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 @@ lio_first_time_init(struct lio_device *lio_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;