get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 60387,
    "url": "http://patches.dpdk.org/api/patches/60387/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20191002012335.85324-10-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-10-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20191002012335.85324-10-ajit.khaparde@broadcom.com",
    "date": "2019-10-02T01:23:29",
    "name": "[v3,09/15] net/bnxt: add code for periodic FW health monitoring",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "aff87048103d9ba6acf1baf05f4b0353bc728c4e",
    "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-10-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/60387/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/60387/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 F3B681BF10;\n\tWed,  2 Oct 2019 03:24:16 +0200 (CEST)",
            "from rnd-relay.smtp.broadcom.com (unknown [192.19.229.170])\n\tby dpdk.org (Postfix) with ESMTP id 33EA01BE81\n\tfor <dev@dpdk.org>; Wed,  2 Oct 2019 03:23:48 +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 DA9E730CC53;\n\tTue,  1 Oct 2019 18:22:31 -0700 (PDT)",
            "from localhost.localdomain (unknown [10.230.30.225])\n\tby mail-irv-17.broadcom.com (Postfix) with ESMTP id 6BBEB140069;\n\tTue,  1 Oct 2019 18:23:41 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com DA9E730CC53",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n\ts=dkimrelay; t=1569979351;\n\tbh=4J0nXGVkbXK75fVdFsTLE7sWLy6uV/fIKKfPaEF99GU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gQ9ykmfWq8L0MxgfGe71v4Qmcp8pvuTCcZg5S3KpOY4G5APHS0Zw9RrH9wIt3gCJK\n\t5YjIJjrX8hI97v75ceo3+qj6FMiBgULejixkC26cfPCtfkH3eLQ16gE/lRbgGtA1Va\n\tba/L+DehfNcpbnrAUOIS4DsFFTVQ+27H7bKHib4M=",
        "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:29 -0700",
        "Message-Id": "<20191002012335.85324-10-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-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 09/15] net/bnxt: add code for periodic FW\n\thealth monitoring",
        "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\nPeriodically poll the FW heartbeat register and FW recovery counter\nregisters to check the FW health. Polling frequency will be\nadvertised by the FW in HWRM_ERROR_RECOVERY_QCFG response.\nSchedule the task upon receiving the async event from FW.\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        |  6 +++\n drivers/net/bnxt/bnxt_cpr.c    | 10 ++++\n drivers/net/bnxt/bnxt_ethdev.c | 97 ++++++++++++++++++++++++++++++++++\n 3 files changed, 113 insertions(+)",
    "diff": "diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h\nindex ea556d0792..50b9b38565 100644\n--- a/drivers/net/bnxt/bnxt.h\n+++ b/drivers/net/bnxt/bnxt.h\n@@ -368,6 +368,9 @@ struct bnxt_error_recovery_info {\n #define BNXT_FLAG_MASTER_FUNC\t\t(1 << 2)\n #define BNXT_FLAG_RECOVERY_ENABLED\t(1 << 3)\n \tuint32_t\tflags;\n+\n+\tuint32_t        last_heart_beat;\n+\tuint32_t        last_reset_counter;\n };\n \n /* address space location of register */\n@@ -416,6 +419,7 @@ struct bnxt {\n #define BNXT_FLAG_FW_CAP_IF_CHANGE\t(1 << 17)\n #define BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE\t(1 << 18)\n #define BNXT_FLAG_FW_CAP_ERROR_RECOVERY\t\t(1 << 19)\n+#define BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED\t(1 << 20)\n #define BNXT_FLAG_EXT_STATS_SUPPORTED\t(1 << 29)\n #define BNXT_FLAG_NEW_RM\t(1 << 30)\n #define BNXT_FLAG_INIT_DONE\t(1U << 31)\n@@ -532,6 +536,8 @@ int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);\n int is_bnxt_in_error(struct bnxt *bp);\n \n int bnxt_map_fw_health_status_regs(struct bnxt *bp);\n+uint32_t bnxt_read_fw_status_reg(struct bnxt *bp, uint32_t index);\n+void bnxt_schedule_fw_health_check(struct bnxt *bp);\n \n bool is_bnxt_supported(struct rte_eth_dev *dev);\n bool bnxt_stratus_device(struct bnxt *bp);\ndiff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c\nindex 1b046bbfac..38931799eb 100644\n--- a/drivers/net/bnxt/bnxt_cpr.c\n+++ b/drivers/net/bnxt/bnxt_cpr.c\n@@ -90,6 +90,16 @@ void bnxt_handle_async_event(struct bnxt *bp,\n \t\tPMD_DRV_LOG(INFO, \"recovery enabled(%d), master function(%d)\\n\",\n \t\t\t    bnxt_is_recovery_enabled(bp),\n \t\t\t    bnxt_is_master_func(bp));\n+\n+\t\tif (bp->flags & BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED)\n+\t\t\treturn;\n+\n+\t\tinfo->last_heart_beat =\n+\t\t\tbnxt_read_fw_status_reg(bp, BNXT_FW_HEARTBEAT_CNT_REG);\n+\t\tinfo->last_reset_counter =\n+\t\t\tbnxt_read_fw_status_reg(bp, BNXT_FW_RECOVERY_CNT_REG);\n+\n+\t\tbnxt_schedule_fw_health_check(bp);\n \t\tbreak;\n \tdefault:\n \t\tPMD_DRV_LOG(INFO, \"handle_async_event id = 0x%x\\n\", event_id);\ndiff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c\nindex a23ca2b53d..d28f1bd8f9 100644\n--- a/drivers/net/bnxt/bnxt_ethdev.c\n+++ b/drivers/net/bnxt/bnxt_ethdev.c\n@@ -169,6 +169,7 @@ 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+static void bnxt_cancel_fw_health_check(struct bnxt *bp);\n \n int is_bnxt_in_error(struct bnxt *bp)\n {\n@@ -858,6 +859,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)\n \tbp->flags |= BNXT_FLAG_INIT_DONE;\n \teth_dev->data->dev_started = 1;\n \tbp->dev_stopped = 0;\n+\tbnxt_schedule_fw_health_check(bp);\n \treturn 0;\n \n error:\n@@ -910,6 +912,8 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)\n \t/* disable uio/vfio intr/eventfd mapping */\n \trte_intr_disable(intr_handle);\n \n+\tbnxt_cancel_fw_health_check(bp);\n+\n \tbp->flags &= ~BNXT_FLAG_INIT_DONE;\n \tif (bp->eth_dev->data->dev_started) {\n \t\t/* TBD: STOP HW queues DMA */\n@@ -3682,6 +3686,99 @@ void bnxt_dev_reset_and_resume(void *arg)\n \t\tPMD_DRV_LOG(ERR, \"Error setting recovery alarm\");\n }\n \n+uint32_t bnxt_read_fw_status_reg(struct bnxt *bp, uint32_t index)\n+{\n+\tstruct bnxt_error_recovery_info *info = bp->recovery_info;\n+\tuint32_t reg = info->status_regs[index];\n+\tuint32_t type, offset, val = 0;\n+\n+\ttype = BNXT_FW_STATUS_REG_TYPE(reg);\n+\toffset = BNXT_FW_STATUS_REG_OFF(reg);\n+\n+\tswitch (type) {\n+\tcase BNXT_FW_STATUS_REG_TYPE_CFG:\n+\t\trte_pci_read_config(bp->pdev, &val, sizeof(val), offset);\n+\t\tbreak;\n+\tcase BNXT_FW_STATUS_REG_TYPE_GRC:\n+\t\toffset = info->mapped_status_regs[index];\n+\t\t/* FALLTHROUGH */\n+\tcase BNXT_FW_STATUS_REG_TYPE_BAR0:\n+\t\tval = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +\n+\t\t\t\t       offset));\n+\t\tbreak;\n+\t}\n+\n+\treturn val;\n+}\n+\n+/* Driver should poll FW heartbeat, reset_counter with the frequency\n+ * advertised by FW in HWRM_ERROR_RECOVERY_QCFG.\n+ * When the driver detects heartbeat stop or change in reset_counter,\n+ * it has to trigger a reset to recover from the error condition.\n+ * A “master PF” is the function who will have the privilege to\n+ * initiate the chimp reset. The master PF will be elected by the\n+ * firmware and will be notified through async message.\n+ */\n+static void bnxt_check_fw_health(void *arg)\n+{\n+\tstruct bnxt *bp = arg;\n+\tstruct bnxt_error_recovery_info *info = bp->recovery_info;\n+\tuint32_t val = 0;\n+\n+\tif (!info || !bnxt_is_recovery_enabled(bp) ||\n+\t    is_bnxt_in_error(bp))\n+\t\treturn;\n+\n+\tval = bnxt_read_fw_status_reg(bp, BNXT_FW_HEARTBEAT_CNT_REG);\n+\tif (val == info->last_heart_beat)\n+\t\tgoto reset;\n+\n+\tinfo->last_heart_beat = val;\n+\n+\tval = bnxt_read_fw_status_reg(bp, BNXT_FW_RECOVERY_CNT_REG);\n+\tif (val != info->last_reset_counter)\n+\t\tgoto reset;\n+\n+\tinfo->last_reset_counter = val;\n+\n+\trte_eal_alarm_set(US_PER_MS * info->driver_polling_freq,\n+\t\t\t  bnxt_check_fw_health, (void *)bp);\n+\n+\treturn;\n+reset:\n+\t/* Stop DMA to/from device */\n+\tbp->flags |= BNXT_FLAG_FATAL_ERROR;\n+\tbp->flags |= BNXT_FLAG_FW_RESET;\n+\n+\tPMD_DRV_LOG(ERR, \"Detected FW dead condition\\n\");\n+}\n+\n+void bnxt_schedule_fw_health_check(struct bnxt *bp)\n+{\n+\tuint32_t polling_freq;\n+\n+\tif (!bnxt_is_recovery_enabled(bp))\n+\t\treturn;\n+\n+\tif (bp->flags & BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED)\n+\t\treturn;\n+\n+\tpolling_freq = bp->recovery_info->driver_polling_freq;\n+\n+\trte_eal_alarm_set(US_PER_MS * polling_freq,\n+\t\t\t  bnxt_check_fw_health, (void *)bp);\n+\tbp->flags |= BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED;\n+}\n+\n+static void bnxt_cancel_fw_health_check(struct bnxt *bp)\n+{\n+\tif (!bnxt_is_recovery_enabled(bp))\n+\t\treturn;\n+\n+\trte_eal_alarm_cancel(bnxt_check_fw_health, (void *)bp);\n+\tbp->flags &= ~BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED;\n+}\n+\n static bool bnxt_vf_pciid(uint16_t id)\n {\n \tif (id == BROADCOM_DEV_ID_57304_VF ||\n",
    "prefixes": [
        "v3",
        "09/15"
    ]
}