get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/60377/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 60377,
    "url": "http://patches.dpdk.org/api/patches/60377/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191002012335.85324-4-ajit.khaparde@broadcom.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20191002012335.85324-4-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191002012335.85324-4-ajit.khaparde@broadcom.com",
    "date": "2019-10-02T01:23:23",
    "name": "[v3,03/15] net/bnxt: handle reset notify async event from FW",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "bd05d29447a791001cd805ab73c6c67323adba11",
    "submitter": {
        "id": 501,
        "url": "http://patches.dpdk.org/api/people/501/?format=api",
        "name": "Ajit Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20191002012335.85324-4-ajit.khaparde@broadcom.com/mbox/",
    "series": [
        {
            "id": 6660,
            "url": "http://patches.dpdk.org/api/series/6660/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6660",
            "date": "2019-10-02T01:23:24",
            "name": "bnxt patchset to support device error recovery",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/6660/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/60377/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/60377/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 61A481BEA6;\n\tWed,  2 Oct 2019 03:23:55 +0200 (CEST)",
            "from rnd-relay.smtp.broadcom.com (unknown [192.19.229.170])\n\tby dpdk.org (Postfix) with ESMTP id AEC8C44C3\n\tfor <dev@dpdk.org>; Wed,  2 Oct 2019 03:23:46 +0200 (CEST)",
            "from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net\n\t[10.75.242.48])\n\tby rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 5AA3430CC4C;\n\tTue,  1 Oct 2019 18:22:30 -0700 (PDT)",
            "from localhost.localdomain (unknown [10.230.30.225])\n\tby mail-irv-17.broadcom.com (Postfix) with ESMTP id E97BD140069;\n\tTue,  1 Oct 2019 18:23:39 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 5AA3430CC4C",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n\ts=dkimrelay; t=1569979350;\n\tbh=QZkDnJCMt5/Q/cfy0T611LJAFvcVUvTVLtIA/YE5NYs=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=KD5hI7Aa/Yu7XS6ztNVwepzc/A+8tH8Cbo7GdYSfbnGn1aPSP2410rTMyH0Tj+Yzb\n\tyPNulKx+iCGuq+AxCZj2nd/21Qrd8s/nvgmUWd8svBYFEzRkcZ4nm8dbne3dyjNglA\n\tXy70681yCfpu0sGLBEpH11885nTy2am1zg9CFdsM=",
        "From": "Ajit Khaparde <ajit.khaparde@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "ferruh.yigit@intel.com, Kalesh AP <kalesh-anakkur.purayil@broadcom.com>, \n\tSomnath Kotur <somnath.kotur@broadcom.com>",
        "Date": "Tue,  1 Oct 2019 18:23:23 -0700",
        "Message-Id": "<20191002012335.85324-4-ajit.khaparde@broadcom.com>",
        "X-Mailer": "git-send-email 2.20.1 (Apple Git-117)",
        "In-Reply-To": "<20191002012335.85324-1-ajit.khaparde@broadcom.com>",
        "References": "<7c08999f-13f3-5fb6-39a2-557a0884bfde@intel.com>\n\t<20191002012335.85324-1-ajit.khaparde@broadcom.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 03/15] net/bnxt: handle reset notify async\n\tevent from FW",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>\n\nWhen the FW upgrade is initiated the current instance\nof FW issues a HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY\nasync notification to the driver. On receiving this notification,\nthe PMD shall quiesce itself and poll on the HWRM_VER_GET FW\ncommand at regular intervals.\n\nOnce the VER_GET command succeeds, the driver should go through\nthe rediscovery process and re-initialize the device.\n\nAlso register with FW for the reset notify async event.\n\nSigned-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>\nReviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\nReviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>\n---\n drivers/net/bnxt/bnxt.h                |  13 +++\n drivers/net/bnxt/bnxt_cpr.c            |  16 +++\n drivers/net/bnxt/bnxt_cpr.h            |   1 +\n drivers/net/bnxt/bnxt_ethdev.c         | 147 ++++++++++++++++++++++---\n drivers/net/bnxt/bnxt_hwrm.c           |  47 +++++++-\n drivers/net/bnxt/bnxt_hwrm.h           |   2 +\n drivers/net/bnxt/hsi_struct_def_dpdk.h |  11 ++\n 7 files changed, 215 insertions(+), 22 deletions(-)",
    "diff": "diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h\nindex 37b4c717d6..8797b032ee 100644\n--- a/drivers/net/bnxt/bnxt.h\n+++ b/drivers/net/bnxt/bnxt.h\n@@ -333,6 +333,16 @@ struct bnxt_ctx_mem_info {\n \tstruct bnxt_ctx_pg_info *tqm_mem[BNXT_MAX_TC_Q];\n };\n \n+/* Maximum Firmware Reset bail out value in milliseconds */\n+#define BNXT_MAX_FW_RESET_TIMEOUT\t6000\n+/* Minimum time required for the firmware readiness in milliseconds */\n+#define BNXT_MIN_FW_READY_TIMEOUT\t2000\n+/* Frequency for the firmware readiness check in milliseconds */\n+#define BNXT_FW_READY_WAIT_INTERVAL\t100\n+\n+#define US_PER_MS\t\t\t1000\n+#define NS_PER_US\t\t\t1000\n+\n #define BNXT_HWRM_SHORT_REQ_LEN\t\tsizeof(struct hwrm_short_input)\n struct bnxt {\n \tvoid\t\t\t\t*bar0;\n@@ -463,6 +473,9 @@ struct bnxt {\n \tstruct bnxt_ptp_cfg     *ptp_cfg;\n \tuint16_t\t\tvf_resv_strategy;\n \tstruct bnxt_ctx_mem_info        *ctx;\n+\n+\tuint16_t\t\tfw_reset_min_msecs;\n+\tuint16_t\t\tfw_reset_max_msecs;\n };\n \n int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete);\ndiff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c\nindex bbcdb42f10..1a23649b05 100644\n--- a/drivers/net/bnxt/bnxt_cpr.c\n+++ b/drivers/net/bnxt/bnxt_cpr.c\n@@ -4,6 +4,7 @@\n  */\n \n #include <rte_malloc.h>\n+#include <rte_alarm.h>\n \n #include \"bnxt.h\"\n #include \"bnxt_cpr.h\"\n@@ -40,6 +41,21 @@ void bnxt_handle_async_event(struct bnxt *bp,\n \tcase HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED:\n \t\tPMD_DRV_LOG(INFO, \"Port conn async event\\n\");\n \t\tbreak;\n+\tcase HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY:\n+\t\t/* timestamp_lo/hi values are in units of 100ms */\n+\t\tbp->fw_reset_max_msecs = async_cmp->timestamp_hi ?\n+\t\t\trte_le_to_cpu_16(async_cmp->timestamp_hi) * 100 :\n+\t\t\tBNXT_MAX_FW_RESET_TIMEOUT;\n+\t\tbp->fw_reset_min_msecs = async_cmp->timestamp_lo ?\n+\t\t\tasync_cmp->timestamp_lo * 100 :\n+\t\t\tBNXT_MIN_FW_READY_TIMEOUT;\n+\t\tPMD_DRV_LOG(INFO,\n+\t\t\t    \"Firmware non-fatal reset event received\\n\");\n+\n+\t\tbp->flags |= BNXT_FLAG_FW_RESET;\n+\t\trte_eal_alarm_set(US_PER_MS, bnxt_dev_reset_and_resume,\n+\t\t\t\t  (void *)bp);\n+\t\tbreak;\n \tdefault:\n \t\tPMD_DRV_LOG(INFO, \"handle_async_event id = 0x%x\\n\", event_id);\n \t\tbreak;\ndiff --git a/drivers/net/bnxt/bnxt_cpr.h b/drivers/net/bnxt/bnxt_cpr.h\nindex 8c6a34b611..f48293b963 100644\n--- a/drivers/net/bnxt/bnxt_cpr.h\n+++ b/drivers/net/bnxt/bnxt_cpr.h\n@@ -106,5 +106,6 @@ struct bnxt;\n void bnxt_handle_async_event(struct bnxt *bp, struct cmpl_base *cmp);\n void bnxt_handle_fwd_req(struct bnxt *bp, struct cmpl_base *cmp);\n int bnxt_event_hwrm_resp_handler(struct bnxt *bp, struct cmpl_base *cmp);\n+void bnxt_dev_reset_and_resume(void *arg);\n \n #endif\ndiff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c\nindex d90a6e4202..6bc006a719 100644\n--- a/drivers/net/bnxt/bnxt_ethdev.c\n+++ b/drivers/net/bnxt/bnxt_ethdev.c\n@@ -11,6 +11,7 @@\n #include <rte_ethdev_pci.h>\n #include <rte_malloc.h>\n #include <rte_cycles.h>\n+#include <rte_alarm.h>\n \n #include \"bnxt.h\"\n #include \"bnxt_cpr.h\"\n@@ -166,6 +167,8 @@ static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);\n static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);\n static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu);\n static int bnxt_dev_uninit(struct rte_eth_dev *eth_dev);\n+static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev);\n+static int bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev);\n \n int is_bnxt_in_error(struct bnxt *bp)\n {\n@@ -201,19 +204,25 @@ static uint16_t  bnxt_rss_hash_tbl_size(const struct bnxt *bp)\n \treturn bnxt_rss_ctxts(bp) * BNXT_RSS_ENTRIES_PER_CTX_THOR;\n }\n \n-static void bnxt_free_mem(struct bnxt *bp)\n+static void bnxt_free_mem(struct bnxt *bp, bool reconfig)\n {\n \tbnxt_free_filter_mem(bp);\n \tbnxt_free_vnic_attributes(bp);\n \tbnxt_free_vnic_mem(bp);\n \n-\tbnxt_free_stats(bp);\n-\tbnxt_free_tx_rings(bp);\n-\tbnxt_free_rx_rings(bp);\n+\t/* tx/rx rings are configured as part of *_queue_setup callbacks.\n+\t * If the number of rings change across fw update,\n+\t * we don't have much choice except to warn the user.\n+\t */\n+\tif (!reconfig) {\n+\t\tbnxt_free_stats(bp);\n+\t\tbnxt_free_tx_rings(bp);\n+\t\tbnxt_free_rx_rings(bp);\n+\t}\n \tbnxt_free_async_cp_ring(bp);\n }\n \n-static int bnxt_alloc_mem(struct bnxt *bp)\n+static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig)\n {\n \tint rc;\n \n@@ -244,7 +253,7 @@ static int bnxt_alloc_mem(struct bnxt *bp)\n \treturn 0;\n \n alloc_mem_err:\n-\tbnxt_free_mem(bp);\n+\tbnxt_free_mem(bp, reconfig);\n \treturn rc;\n }\n \n@@ -3523,6 +3532,89 @@ static const struct eth_dev_ops bnxt_dev_ops = {\n \t.timesync_read_tx_timestamp = bnxt_timesync_read_tx_timestamp,\n };\n \n+static void bnxt_dev_cleanup(struct bnxt *bp)\n+{\n+\tbnxt_set_hwrm_link_config(bp, false);\n+\tbp->link_info.link_up = 0;\n+\tif (bp->dev_stopped == 0)\n+\t\tbnxt_dev_stop_op(bp->eth_dev);\n+\n+\tbnxt_uninit_resources(bp, true);\n+}\n+\n+static int bnxt_restore_filters(struct bnxt *bp)\n+{\n+\tstruct rte_eth_dev *dev = bp->eth_dev;\n+\tint ret = 0;\n+\n+\tif (dev->data->all_multicast)\n+\t\tret = bnxt_allmulticast_enable_op(dev);\n+\tif (dev->data->promiscuous)\n+\t\tret = bnxt_promiscuous_enable_op(dev);\n+\n+\t/* TODO restore other filters as well */\n+\treturn ret;\n+}\n+\n+static void bnxt_dev_recover(void *arg)\n+{\n+\tstruct bnxt *bp = arg;\n+\tint timeout = bp->fw_reset_max_msecs;\n+\tint rc = 0;\n+\n+\tdo {\n+\t\trc = bnxt_hwrm_ver_get(bp);\n+\t\tif (rc == 0)\n+\t\t\tbreak;\n+\t\trte_delay_ms(BNXT_FW_READY_WAIT_INTERVAL);\n+\t\ttimeout -= BNXT_FW_READY_WAIT_INTERVAL;\n+\t} while (rc && timeout);\n+\n+\tif (rc) {\n+\t\tPMD_DRV_LOG(ERR, \"FW is not Ready after reset\\n\");\n+\t\tgoto err;\n+\t}\n+\n+\trc = bnxt_init_resources(bp, true);\n+\tif (rc) {\n+\t\tPMD_DRV_LOG(ERR,\n+\t\t\t    \"Failed to initialize resources after reset\\n\");\n+\t\tgoto err;\n+\t}\n+\t/* clear reset flag as the device is initialized now */\n+\tbp->flags &= ~BNXT_FLAG_FW_RESET;\n+\n+\trc = bnxt_dev_start_op(bp->eth_dev);\n+\tif (rc) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to start port after reset\\n\");\n+\t\tgoto err;\n+\t}\n+\n+\trc = bnxt_restore_filters(bp);\n+\tif (rc)\n+\t\tgoto err;\n+\n+\tPMD_DRV_LOG(INFO, \"Recovered from FW reset\\n\");\n+\treturn;\n+err:\n+\tbp->flags |= BNXT_FLAG_FATAL_ERROR;\n+\tbnxt_uninit_resources(bp, false);\n+\tPMD_DRV_LOG(ERR, \"Failed to recover from FW reset\\n\");\n+}\n+\n+void bnxt_dev_reset_and_resume(void *arg)\n+{\n+\tstruct bnxt *bp = arg;\n+\tint rc;\n+\n+\tbnxt_dev_cleanup(bp);\n+\n+\trc = rte_eal_alarm_set(US_PER_MS * bp->fw_reset_min_msecs,\n+\t\t\t       bnxt_dev_recover, (void *)bp);\n+\tif (rc)\n+\t\tPMD_DRV_LOG(ERR, \"Error setting recovery alarm\");\n+}\n+\n static bool bnxt_vf_pciid(uint16_t id)\n {\n \tif (id == BROADCOM_DEV_ID_57304_VF ||\n@@ -3965,6 +4057,22 @@ static int bnxt_setup_mac_addr(struct rte_eth_dev *eth_dev)\n \treturn rc;\n }\n \n+static int bnxt_restore_dflt_mac(struct bnxt *bp)\n+{\n+\tint rc = 0;\n+\n+\t/* MAC is already configured in FW */\n+\tif (!bnxt_check_zero_bytes(bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN))\n+\t\treturn 0;\n+\n+\t/* Restore the old MAC configured */\n+\trc = bnxt_hwrm_set_mac(bp);\n+\tif (rc)\n+\t\tPMD_DRV_LOG(ERR, \"Failed to restore MAC address\\n\");\n+\n+\treturn rc;\n+}\n+\n static void bnxt_config_vf_req_fwd(struct bnxt *bp)\n {\n \tif (!BNXT_PF(bp))\n@@ -4038,7 +4146,7 @@ static int bnxt_init_fw(struct bnxt *bp)\n \treturn 0;\n }\n \n-static int bnxt_init_resources(struct bnxt *bp)\n+static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev)\n {\n \tint rc;\n \n@@ -4046,9 +4154,15 @@ static int bnxt_init_resources(struct bnxt *bp)\n \tif (rc)\n \t\treturn rc;\n \n-\trc = bnxt_setup_mac_addr(bp->eth_dev);\n-\tif (rc)\n-\t\treturn rc;\n+\tif (!reconfig_dev) {\n+\t\trc = bnxt_setup_mac_addr(bp->eth_dev);\n+\t\tif (rc)\n+\t\t\treturn rc;\n+\t} else {\n+\t\trc = bnxt_restore_dflt_mac(bp);\n+\t\tif (rc)\n+\t\t\treturn rc;\n+\t}\n \n \tbnxt_config_vf_req_fwd(bp);\n \n@@ -4075,7 +4189,7 @@ static int bnxt_init_resources(struct bnxt *bp)\n \t\t}\n \t}\n \n-\trc = bnxt_alloc_mem(bp);\n+\trc = bnxt_alloc_mem(bp, reconfig_dev);\n \tif (rc)\n \t\treturn rc;\n \n@@ -4149,7 +4263,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)\n \t\t\t    \"Failed to allocate hwrm resource rc: %x\\n\", rc);\n \t\tgoto error_free;\n \t}\n-\trc = bnxt_init_resources(bp);\n+\trc = bnxt_init_resources(bp, false);\n \tif (rc)\n \t\tgoto error_free;\n \n@@ -4170,18 +4284,19 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)\n }\n \n static int\n-bnxt_uninit_resources(struct bnxt *bp)\n+bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)\n {\n \tint rc;\n \n \tbnxt_disable_int(bp);\n \tbnxt_free_int(bp);\n-\tbnxt_free_mem(bp);\n+\tbnxt_free_mem(bp, reconfig_dev);\n \tbnxt_hwrm_func_buf_unrgtr(bp);\n \trc = bnxt_hwrm_func_driver_unregister(bp, 0);\n \tbp->flags &= ~BNXT_FLAG_REGISTERED;\n \tbnxt_free_ctx_mem(bp);\n-\tbnxt_free_hwrm_resources(bp);\n+\tif (!reconfig_dev)\n+\t\tbnxt_free_hwrm_resources(bp);\n \n \treturn rc;\n }\n@@ -4197,7 +4312,7 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev)\n \n \tPMD_DRV_LOG(DEBUG, \"Calling Device uninit\\n\");\n \n-\trc = bnxt_uninit_resources(bp);\n+\trc = bnxt_uninit_resources(bp, false);\n \n \tif (bp->grp_info != NULL) {\n \t\trte_free(bp->grp_info);\ndiff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c\nindex 24a5a09147..abbad0152c 100644\n--- a/drivers/net/bnxt/bnxt_hwrm.c\n+++ b/drivers/net/bnxt/bnxt_hwrm.c\n@@ -27,6 +27,7 @@\n #include <rte_io.h>\n \n #define HWRM_CMD_TIMEOUT\t\t6000000\n+#define HWRM_SHORT_CMD_TIMEOUT\t\t50000\n #define HWRM_SPEC_CODE_1_8_3\t\t0x10803\n #define HWRM_VERSION_1_9_1\t\t0x10901\n #define HWRM_VERSION_1_9_2\t\t0x10903\n@@ -97,6 +98,17 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,\n \t\tGRCPF_REG_KONG_CHANNEL_OFFSET : GRCPF_REG_CHIMP_CHANNEL_OFFSET;\n \tuint16_t mb_trigger_offset = use_kong_mb ?\n \t\tGRCPF_REG_KONG_COMM_TRIGGER : GRCPF_REG_CHIMP_COMM_TRIGGER;\n+\tuint32_t timeout;\n+\n+\t/* Do not send HWRM commands to firmware in error state */\n+\tif (bp->flags & BNXT_FLAG_FATAL_ERROR)\n+\t\treturn 0;\n+\n+\t/* For VER_GET command, set timeout as 50ms */\n+\tif (rte_cpu_to_le_16(req->req_type) == HWRM_VER_GET)\n+\t\ttimeout = HWRM_SHORT_CMD_TIMEOUT;\n+\telse\n+\t\ttimeout = HWRM_CMD_TIMEOUT;\n \n \tif (bp->flags & BNXT_FLAG_SHORT_CMD ||\n \t    msg_len > bp->max_req_len) {\n@@ -139,7 +151,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,\n \trte_write32(1, bar);\n \n \t/* Poll for the valid bit */\n-\tfor (i = 0; i < HWRM_CMD_TIMEOUT; i++) {\n+\tfor (i = 0; i < timeout; i++) {\n \t\t/* Sanity check on the resp->resp_len */\n \t\trte_rmb();\n \t\tif (resp->resp_len && resp->resp_len <= bp->max_resp_len) {\n@@ -151,7 +163,12 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,\n \t\trte_delay_us(1);\n \t}\n \n-\tif (i >= HWRM_CMD_TIMEOUT) {\n+\tif (i >= timeout) {\n+\t\t/* Suppress VER_GET timeout messages during reset recovery */\n+\t\tif (bp->flags & BNXT_FLAG_FW_RESET &&\n+\t\t    rte_cpu_to_le_16(req->req_type) == HWRM_VER_GET)\n+\t\t\treturn -ETIMEDOUT;\n+\n \t\tPMD_DRV_LOG(ERR, \"Error(timeout) sending msg 0x%04x\\n\",\n \t\t\t    req->req_type);\n \t\treturn -ETIMEDOUT;\n@@ -657,12 +674,21 @@ int bnxt_hwrm_func_reset(struct bnxt *bp)\n int bnxt_hwrm_func_driver_register(struct bnxt *bp)\n {\n \tint rc;\n+\tuint32_t flags = 0;\n \tstruct hwrm_func_drv_rgtr_input req = {.req_type = 0 };\n \tstruct hwrm_func_drv_rgtr_output *resp = bp->hwrm_cmd_resp_addr;\n \n \tif (bp->flags & BNXT_FLAG_REGISTERED)\n \t\treturn 0;\n \n+\tflags = HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_HOT_RESET_SUPPORT;\n+\n+\t/* PFs and trusted VFs should indicate the support of the\n+\t * Master capability on non Stingray platform\n+\t */\n+\tif ((BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp)) && !BNXT_STINGRAY(bp))\n+\t\tflags |= HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_MASTER_SUPPORT;\n+\n \tHWRM_PREP(req, FUNC_DRV_RGTR, BNXT_USE_CHIMP_MB);\n \treq.enables = rte_cpu_to_le_32(HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VER |\n \t\t\tHWRM_FUNC_DRV_RGTR_INPUT_ENABLES_ASYNC_EVENT_FWD);\n@@ -683,14 +709,16 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)\n \t\t * this HWRM sniffer list in FW because DPDK PF driver does\n \t\t * not support this.\n \t\t */\n-\t\treq.flags =\n-\t\trte_cpu_to_le_32(HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE);\n+\t\tflags |= HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE;\n \t}\n \n+\treq.flags = rte_cpu_to_le_32(flags);\n+\n \treq.async_event_fwd[0] |=\n \t\trte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_LINK_STATUS_CHANGE |\n \t\t\t\t ASYNC_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED |\n-\t\t\t\t ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE);\n+\t\t\t\t ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE |\n+\t\t\t\t ASYNC_CMPL_EVENT_ID_RESET_NOTIFY);\n \treq.async_event_fwd[1] |=\n \t\trte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_PF_DRVR_UNLOAD |\n \t\t\t\t ASYNC_CMPL_EVENT_ID_VF_CFG_CHANGE);\n@@ -837,7 +865,10 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)\n \n \trc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);\n \n-\tHWRM_CHECK_RESULT();\n+\tif (bp->flags & BNXT_FLAG_FW_RESET)\n+\t\tHWRM_CHECK_RESULT_SILENT();\n+\telse\n+\t\tHWRM_CHECK_RESULT();\n \n \tPMD_DRV_LOG(INFO, \"%d.%d.%d:%d.%d.%d\\n\",\n \t\tresp->hwrm_intf_maj_8b, resp->hwrm_intf_min_8b,\n@@ -2685,6 +2716,10 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu)\n \tif (BNXT_VF(bp) && (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_TRUSTED_VF)) {\n \t\tbp->flags |= BNXT_FLAG_TRUSTED_VF_EN;\n \t\tPMD_DRV_LOG(INFO, \"Trusted VF cap enabled\\n\");\n+\t} else if (BNXT_VF(bp) &&\n+\t\t   !(flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_TRUSTED_VF)) {\n+\t\tbp->flags &= ~BNXT_FLAG_TRUSTED_VF_EN;\n+\t\tPMD_DRV_LOG(INFO, \"Trusted VF cap disabled\\n\");\n \t}\n \n \tif (mtu)\ndiff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h\nindex c882fc2a15..a036205329 100644\n--- a/drivers/net/bnxt/bnxt_hwrm.h\n+++ b/drivers/net/bnxt/bnxt_hwrm.h\n@@ -21,6 +21,8 @@ struct bnxt_cp_ring_info;\n \t(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED)\n #define ASYNC_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE\t\\\n \t(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_CHANGE)\n+#define ASYNC_CMPL_EVENT_ID_RESET_NOTIFY \\\n+\t(1 << HWRM_ASYNC_EVENT_CMPL_EVENT_ID_RESET_NOTIFY)\n #define ASYNC_CMPL_EVENT_ID_PF_DRVR_UNLOAD\t\\\n \t(1 << (HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD - 32))\n #define ASYNC_CMPL_EVENT_ID_VF_CFG_CHANGE\t\\\ndiff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h\nindex 0095717254..809ea48736 100644\n--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h\n+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h\n@@ -8918,6 +8918,17 @@ struct hwrm_func_drv_rgtr_input {\n \t */\n \t#define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_ERROR_RECOVERY_SUPPORT \\\n \t\tUINT32_C(0x20)\n+\t/*\n+\t * When this bit is 1, the function is indicating the support of the\n+\t * Master capability. The Firmware will use this capability to select\n+\t * the Master function. The master function will be used to initiate\n+\t * designated functionality like error recovery etc. If none of the\n+\t * registered PFs or trusted VFs indicate this support, then\n+\t * firmware will select the 1st registered PF as Master capable\n+\t * instance.\n+\t */\n+\t#define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_MASTER_SUPPORT \\\n+\t\tUINT32_C(0x40)\n \tuint32_t\tenables;\n \t/*\n \t * This bit must be '1' for the os_type field to be\n",
    "prefixes": [
        "v3",
        "03/15"
    ]
}