From: Shijith Thotton Date: Sat, 25 Mar 2017 06:24:23 +0000 (+0530) Subject: net/liquidio: add API for VF FLR X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=cdb166963caed5dc4da8d9cca49e62ffafefca17;p=dpdk.git net/liquidio: add API for VF FLR VF sends Function Level Reset request to PF using mbox and PF does the reset. Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S Signed-off-by: Mallesham Jatharakonda --- diff --git a/drivers/net/liquidio/base/lio_23xx_vf.c b/drivers/net/liquidio/base/lio_23xx_vf.c index 6270af55ce..ed5b8302a3 100644 --- a/drivers/net/liquidio/base/lio_23xx_vf.c +++ b/drivers/net/liquidio/base/lio_23xx_vf.c @@ -255,6 +255,25 @@ cn23xx_vf_setup_mbox(struct lio_device *lio_dev) return 0; } +void +cn23xx_vf_ask_pf_to_do_flr(struct lio_device *lio_dev) +{ + struct lio_mbox_cmd mbox_cmd; + + mbox_cmd.msg.mbox_msg64 = 0; + 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 83dc053aa3..ad8db0dff3 100644 --- a/drivers/net/liquidio/base/lio_23xx_vf.h +++ b/drivers/net/liquidio/base/lio_23xx_vf.h @@ -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); diff --git a/drivers/net/liquidio/base/lio_mbox.h b/drivers/net/liquidio/base/lio_mbox.h index f1c5b8ec41..b0875d646d 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 bebe0e8bff..5aae105177 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -112,6 +112,11 @@ lio_first_time_init(struct lio_device *lio_dev, if (cn23xx_pfvf_handshake(lio_dev)) goto error; + /* Initial reset */ + cn23xx_vf_ask_pf_to_do_flr(lio_dev); + /* Wait for FLR for 100ms per SRIOV specification */ + rte_delay_ms(100); + if (cn23xx_vf_set_io_queues_off(lio_dev)) { lio_dev_err(lio_dev, "Setting io queues off failed\n"); goto error;