get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 57798,
    "url": "https://patches.dpdk.org/api/patches/57798/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190822055400.30119-10-ajit.khaparde@broadcom.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20190822055400.30119-10-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190822055400.30119-10-ajit.khaparde@broadcom.com",
    "date": "2019-08-22T05:53:56",
    "name": "[09/13] net/bnxt: add code for periodic FW health monitoring",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "ff6afbd96d5a760e5e5065da90bdc6716a853cb8",
    "submitter": {
        "id": 501,
        "url": "https://patches.dpdk.org/api/people/501/?format=api",
        "name": "Ajit Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20190822055400.30119-10-ajit.khaparde@broadcom.com/mbox/",
    "series": [
        {
            "id": 6099,
            "url": "https://patches.dpdk.org/api/series/6099/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=6099",
            "date": "2019-08-22T05:53:47",
            "name": "bnxt patchset to support device error recovery",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/6099/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/57798/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/57798/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 2A87A1BF58;\n\tThu, 22 Aug 2019 07:54:27 +0200 (CEST)",
            "from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com\n\t[192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 95C501BF2E\n\tfor <dev@dpdk.org>; Thu, 22 Aug 2019 07:54:09 +0200 (CEST)",
            "from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net\n\t[10.75.144.136])\n\tby rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 1DDE230C20B;\n\tWed, 21 Aug 2019 22:54:05 -0700 (PDT)",
            "from localhost.localdomain (unknown [10.230.30.225])\n\tby nis-sj1-27.broadcom.com (Postfix) with ESMTP id 066CEAC06AD;\n\tWed, 21 Aug 2019 22:54:05 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 1DDE230C20B",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n\ts=dkimrelay; t=1566453245;\n\tbh=NN6sG8zvVTQ56f/GQqxjo9Iyccp0cdfrm16O9jDD7C8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ZLllmjCsztyawNzKCJ4xlqvYY4CiGwEdyXV1bxM1dUoyXf2+NvRG/QClU9Me1DXZt\n\tY+UUcbZXJhhM21c2/+AOqwKuyWJQadZERQbtijjhcaqQQLp3zSaXL1VrgnRH64Yjf6\n\tUwXQdVrC3kNPEq7hFhS00M8KmGibHdj04uvn7l5w=",
        "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": "Wed, 21 Aug 2019 22:53:56 -0700",
        "Message-Id": "<20190822055400.30119-10-ajit.khaparde@broadcom.com>",
        "X-Mailer": "git-send-email 2.20.1 (Apple Git-117)",
        "In-Reply-To": "<20190822055400.30119-1-ajit.khaparde@broadcom.com>",
        "References": "<20190822055400.30119-1-ajit.khaparde@broadcom.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 09/13] net/bnxt: add code for periodic FW health\n\tmonitoring",
        "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        |  5 ++\n drivers/net/bnxt/bnxt_cpr.c    |  7 +++\n drivers/net/bnxt/bnxt_ethdev.c | 89 ++++++++++++++++++++++++++++++++++\n 3 files changed, 101 insertions(+)",
    "diff": "diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h\nindex f9147a9a8..a23c4a64c 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@@ -531,6 +534,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 7f5b3314e..a692fbe7c 100644\n--- a/drivers/net/bnxt/bnxt_cpr.c\n+++ b/drivers/net/bnxt/bnxt_cpr.c\n@@ -88,6 +88,13 @@ 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\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 52c460d2c..0317eb888 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@@ -880,6 +881,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@@ -3608,6 +3611,92 @@ int bnxt_dev_reset_and_resume(struct bnxt *bp)\n \treturn rc;\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 = bp->recovery_info->driver_polling_freq;\n+\n+\tif (!bnxt_is_recovery_enabled(bp))\n+\t\treturn;\n+\n+\trte_eal_alarm_set(US_PER_MS * polling_freq,\n+\t\t\t  bnxt_check_fw_health, (void *)bp);\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+}\n+\n static bool bnxt_vf_pciid(uint16_t id)\n {\n \tif (id == BROADCOM_DEV_ID_57304_VF ||\n",
    "prefixes": [
        "09/13"
    ]
}