get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 101968,
    "url": "https://patches.dpdk.org/api/patches/101968/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20211018101019.957804-7-radu.nicolau@intel.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": "<20211018101019.957804-7-radu.nicolau@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211018101019.957804-7-radu.nicolau@intel.com",
    "date": "2021-10-18T10:10:18",
    "name": "[v9,6/7] net/iavf: add watchdog for VFLR",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a81db74e5bffec472c47f1f448862ec8d4a7d3a5",
    "submitter": {
        "id": 743,
        "url": "https://patches.dpdk.org/api/people/743/?format=api",
        "name": "Radu Nicolau",
        "email": "radu.nicolau@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "https://patches.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20211018101019.957804-7-radu.nicolau@intel.com/mbox/",
    "series": [
        {
            "id": 19731,
            "url": "https://patches.dpdk.org/api/series/19731/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=19731",
            "date": "2021-10-18T10:10:12",
            "name": "iavf: add iAVF IPsec inline crypto support",
            "version": 9,
            "mbox": "https://patches.dpdk.org/series/19731/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/101968/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/101968/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 C19A5A0C43;\n\tMon, 18 Oct 2021 12:23:38 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9E9EB41125;\n\tMon, 18 Oct 2021 12:23:14 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id F1C35410EA\n for <dev@dpdk.org>; Mon, 18 Oct 2021 12:23:11 +0200 (CEST)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 18 Oct 2021 03:23:11 -0700",
            "from silpixa00400884.ir.intel.com ([10.243.22.82])\n by orsmga004.jf.intel.com with ESMTP; 18 Oct 2021 03:23:09 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10140\"; a=\"251675776\"",
            "E=Sophos;i=\"5.85,381,1624345200\"; d=\"scan'208\";a=\"251675776\"",
            "E=Sophos;i=\"5.85,381,1624345200\"; d=\"scan'208\";a=\"593759813\""
        ],
        "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": "Mon, 18 Oct 2021 11:10:18 +0100",
        "Message-Id": "<20211018101019.957804-7-radu.nicolau@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211018101019.957804-1-radu.nicolau@intel.com>",
        "References": "<20210909142428.750634-1-radu.nicolau@intel.com>\n <20211018101019.957804-1-radu.nicolau@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v9 6/7] 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\nThe watchdog is disabled by default, to enable it set\nIAVF_DEV_WATCHDOG_PERIOD to a non zero value (microseconds)\n\nSigned-off-by: Declan Doherty <declan.doherty@intel.com>\nSigned-off-by: Radu Nicolau <radu.nicolau@intel.com>\nAcked-by: Jingjing Wu <jingjing.wu@intel.com>\n---\n drivers/net/iavf/iavf.h        |  5 ++\n drivers/net/iavf/iavf_ethdev.c | 94 ++++++++++++++++++++++++++++++++++\n 2 files changed, 99 insertions(+)",
    "diff": "diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h\nindex 90a7344bd5..f06979b4da 100644\n--- a/drivers/net/iavf/iavf.h\n+++ b/drivers/net/iavf/iavf.h\n@@ -31,6 +31,8 @@\n \n #define IAVF_NUM_MACADDR_MAX      64\n \n+#define IAVF_DEV_WATCHDOG_PERIOD     0\n+\n #define IAVF_DEFAULT_RX_PTHRESH      8\n #define IAVF_DEFAULT_RX_HTHRESH      8\n #define IAVF_DEFAULT_RX_WTHRESH      0\n@@ -216,6 +218,9 @@ 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+\t/** iAVF watchdog enable */\n+\tbool watchdog_enabled;\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 41d859ed57..4e9f592cdc 100644\n--- a/drivers/net/iavf/iavf_ethdev.c\n+++ b/drivers/net/iavf/iavf_ethdev.c\n@@ -25,6 +25,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@@ -240,6 +241,91 @@ iavf_tm_ops_get(struct rte_eth_dev *dev __rte_unused,\n \treturn 0;\n }\n \n+__rte_unused\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+__rte_unused\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->vf.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 detected by watchdog\",\n+\t\t\t\tadapter->vf.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->vf.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(IAVF_DEV_WATCHDOG_PERIOD,\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->vf.eth_dev->data->name);\n+}\n+\n+static void\n+iavf_dev_watchdog_enable(struct iavf_adapter *adapter __rte_unused)\n+{\n+#if (IAVF_DEV_WATCHDOG_PERIOD > 0)\n+\tPMD_DRV_LOG(INFO, \"Enabling device watchdog\");\n+\tadapter->vf.watchdog_enabled = true;\n+\tif (rte_eal_alarm_set(IAVF_DEV_WATCHDOG_PERIOD,\n+\t\t\t&iavf_dev_watchdog, (void *)adapter))\n+\t\tPMD_DRV_LOG(ERR, \"Failed to enabled device watchdog\");\n+#endif\n+}\n+\n+static void\n+iavf_dev_watchdog_disable(struct iavf_adapter *adapter __rte_unused)\n+{\n+#if (IAVF_DEV_WATCHDOG_PERIOD > 0)\n+\tPMD_DRV_LOG(INFO, \"Disabling device watchdog\");\n+\tadapter->vf.watchdog_enabled = false;\n+#endif\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@@ -2496,6 +2582,11 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)\n \n \tiavf_default_rss_disable(adapter);\n \n+\n+\t/* Start device watchdog */\n+\tiavf_dev_watchdog_enable(adapter);\n+\n+\n \treturn 0;\n \n flow_init_err:\n@@ -2579,6 +2670,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": [
        "v9",
        "6/7"
    ]
}