get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 100224,
    "url": "http://patches.dpdk.org/api/patches/100224/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20211001095130.3343083-7-radu.nicolau@intel.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": "<20211001095130.3343083-7-radu.nicolau@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211001095130.3343083-7-radu.nicolau@intel.com",
    "date": "2021-10-01T09:51:30",
    "name": "[v4,6/6] net/iavf: add watchdog for VFLR",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "05339dacae707fa25ebaaa47c8f8da784f46e561",
    "submitter": {
        "id": 743,
        "url": "http://patches.dpdk.org/api/people/743/?format=api",
        "name": "Radu Nicolau",
        "email": "radu.nicolau@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "http://patches.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20211001095130.3343083-7-radu.nicolau@intel.com/mbox/",
    "series": [
        {
            "id": 19321,
            "url": "http://patches.dpdk.org/api/series/19321/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=19321",
            "date": "2021-10-01T09:51:24",
            "name": "iavf: add iAVF IPsec inline crypto support",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/19321/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/100224/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/100224/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id D9FF2A0032;\n\tFri,  1 Oct 2021 12:02:56 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D701A41178;\n\tFri,  1 Oct 2021 12:02:10 +0200 (CEST)",
            "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n by mails.dpdk.org (Postfix) with ESMTP id BE40E4118E\n for <dev@dpdk.org>; Fri,  1 Oct 2021 12:02:08 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 01 Oct 2021 03:01:52 -0700",
            "from silpixa00400884.ir.intel.com ([10.243.22.82])\n by FMSMGA003.fm.intel.com with ESMTP; 01 Oct 2021 03:01:50 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10123\"; a=\"310931331\"",
            "E=Sophos;i=\"5.85,337,1624345200\"; d=\"scan'208\";a=\"310931331\"",
            "E=Sophos;i=\"5.85,337,1624345200\"; d=\"scan'208\";a=\"556222574\""
        ],
        "X-ExtLoop1": "1",
        "From": "Radu Nicolau <radu.nicolau@intel.com>",
        "To": "Jingjing Wu <jingjing.wu@intel.com>,\n\tBeilei Xing <beilei.xing@intel.com>",
        "Cc": "dev@dpdk.org, declan.doherty@intel.com, abhijit.sinha@intel.com,\n qi.z.zhang@intel.com, bruce.richardson@intel.com,\n konstantin.ananyev@intel.com, Radu Nicolau <radu.nicolau@intel.com>",
        "Date": "Fri,  1 Oct 2021 10:51:30 +0100",
        "Message-Id": "<20211001095130.3343083-7-radu.nicolau@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211001095130.3343083-1-radu.nicolau@intel.com>",
        "References": "<20210909142428.750634-1-radu.nicolau@intel.com>\n <20211001095130.3343083-1-radu.nicolau@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v4 6/6] net/iavf: add watchdog for VFLR",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add watchdog to iAVF PMD which support monitoring the VFLR register. If\nthe device is not already in reset then if a VF reset in progress is\ndetected then notfiy user through callback and set into reset state.\nIf the device is already in reset then poll for completion of reset.\n\nSigned-off-by: Declan Doherty <declan.doherty@intel.com>\nSigned-off-by: Radu Nicolau <radu.nicolau@intel.com>\n---\n drivers/net/iavf/iavf.h        |  6 +++\n drivers/net/iavf/iavf_ethdev.c | 97 ++++++++++++++++++++++++++++++++++\n 2 files changed, 103 insertions(+)",
    "diff": "diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h\nindex d5f574b4b3..4481d2e134 100644\n--- a/drivers/net/iavf/iavf.h\n+++ b/drivers/net/iavf/iavf.h\n@@ -212,6 +212,12 @@ struct iavf_info {\n \tint cmd_retval; /* return value of the cmd response from PF */\n \tuint8_t *aq_resp; /* buffer to store the adminq response from PF */\n \n+\tstruct {\n+\t\tuint8_t enabled:1;\n+\t\tuint64_t period_us;\n+\t} watchdog;\n+\t/** iAVF watchdog configuration */\n+\n \t/* Event from pf */\n \tbool dev_closed;\n \tbool link_up;\ndiff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c\nindex aad6a28585..d02aa9c1c5 100644\n--- a/drivers/net/iavf/iavf_ethdev.c\n+++ b/drivers/net/iavf/iavf_ethdev.c\n@@ -24,6 +24,7 @@\n #include <rte_malloc.h>\n #include <rte_memzone.h>\n #include <rte_dev.h>\n+#include <rte_alarm.h>\n \n #include \"iavf.h\"\n #include \"iavf_rxtx.h\"\n@@ -239,6 +240,94 @@ iavf_tm_ops_get(struct rte_eth_dev *dev __rte_unused,\n \treturn 0;\n }\n \n+\n+static int\n+iavf_vfr_inprogress(struct iavf_hw *hw)\n+{\n+\tint inprogress = 0;\n+\n+\tif ((IAVF_READ_REG(hw, IAVF_VFGEN_RSTAT) &\n+\t\tIAVF_VFGEN_RSTAT_VFR_STATE_MASK) ==\n+\t\tVIRTCHNL_VFR_INPROGRESS)\n+\t\tinprogress = 1;\n+\n+\tif (inprogress)\n+\t\tPMD_DRV_LOG(INFO, \"Watchdog detected VFR in progress\");\n+\n+\treturn inprogress;\n+}\n+\n+static void\n+iavf_dev_watchdog(void *cb_arg)\n+{\n+\tstruct iavf_adapter *adapter = cb_arg;\n+\tstruct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);\n+\tint vfr_inprogress = 0, rc = 0;\n+\n+\t/* check if watchdog has been disabled since last call */\n+\tif (!adapter->vf.watchdog.enabled)\n+\t\treturn;\n+\n+\t/* If in reset then poll vfr_inprogress register for completion */\n+\tif (adapter->vf.vf_reset) {\n+\t\tvfr_inprogress = iavf_vfr_inprogress(hw);\n+\n+\t\tif (!vfr_inprogress) {\n+\t\t\tPMD_DRV_LOG(INFO, \"VF \\\"%s\\\" reset has completed\",\n+\t\t\t\tadapter->eth_dev->data->name);\n+\t\t\tadapter->vf.vf_reset = false;\n+\t\t}\n+\t/* If not in reset then poll vfr_inprogress register for VFLR event */\n+\t} else {\n+\t\tvfr_inprogress = iavf_vfr_inprogress(hw);\n+\n+\t\tif (vfr_inprogress) {\n+\t\t\tPMD_DRV_LOG(INFO,\n+\t\t\t\t\"VF \\\"%s\\\" reset event has been detected by watchdog\",\n+\t\t\t\tadapter->eth_dev->data->name);\n+\n+\t\t\t/* enter reset state with VFLR event */\n+\t\t\tadapter->vf.vf_reset = true;\n+\n+\t\t\trte_eth_dev_callback_process(adapter->eth_dev,\n+\t\t\t\tRTE_ETH_EVENT_INTR_RESET, NULL);\n+\t\t}\n+\t}\n+\n+\t/* re-alarm watchdog */\n+\trc = rte_eal_alarm_set(adapter->vf.watchdog.period_us,\n+\t\t\t&iavf_dev_watchdog, cb_arg);\n+\n+\tif (rc)\n+\t\tPMD_DRV_LOG(ERR, \"Failed \\\"%s\\\" to reset device watchdog alarm\",\n+\t\t\tadapter->eth_dev->data->name);\n+}\n+\n+static void\n+iavf_dev_watchdog_enable(struct iavf_adapter *adapter, uint64_t period_us)\n+{\n+\tint rc;\n+\n+\tPMD_DRV_LOG(INFO, \"Enabling device watchdog\");\n+\n+\tadapter->vf.watchdog.enabled = 1;\n+\tadapter->vf.watchdog.period_us = period_us;\n+\n+\trc = rte_eal_alarm_set(adapter->vf.watchdog.period_us,\n+\t\t\t&iavf_dev_watchdog, (void *)adapter);\n+\tif (rc)\n+\t\tPMD_DRV_LOG(ERR, \"Failed to enabled device watchdog\");\n+}\n+\n+static void\n+iavf_dev_watchdog_disable(struct iavf_adapter *adapter)\n+{\n+\tPMD_DRV_LOG(INFO, \"Disabling device watchdog\");\n+\n+\tadapter->vf.watchdog.enabled = 0;\n+\tadapter->vf.watchdog.period_us = 0;\n+}\n+\n static int\n iavf_set_mc_addr_list(struct rte_eth_dev *dev,\n \t\t\tstruct rte_ether_addr *mc_addrs,\n@@ -2448,6 +2537,11 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)\n \n \tiavf_default_rss_disable(adapter);\n \n+\n+\t/* Start device watchdog, set polling period to 500us */\n+\tiavf_dev_watchdog_enable(adapter, 500);\n+\n+\n \treturn 0;\n \n flow_init_err:\n@@ -2527,6 +2621,9 @@ iavf_dev_close(struct rte_eth_dev *dev)\n \tif (vf->vf_reset && !rte_pci_set_bus_master(pci_dev, true))\n \t\tvf->vf_reset = false;\n \n+\t/* disable watchdog */\n+\tiavf_dev_watchdog_disable(adapter);\n+\n \treturn ret;\n }\n \n",
    "prefixes": [
        "v4",
        "6/6"
    ]
}