get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 101377,
    "url": "http://patches.dpdk.org/api/patches/101377/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20211013153338.387912-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": "<20211013153338.387912-7-radu.nicolau@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211013153338.387912-7-radu.nicolau@intel.com",
    "date": "2021-10-13T15:33:38",
    "name": "[v7,6/6] net/iavf: add watchdog for VFLR",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "bee9e3f27de356c8cae3adf17e63b183bb9e1144",
    "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/20211013153338.387912-7-radu.nicolau@intel.com/mbox/",
    "series": [
        {
            "id": 19602,
            "url": "http://patches.dpdk.org/api/series/19602/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=19602",
            "date": "2021-10-13T15:33:32",
            "name": "iavf: add iAVF IPsec inline crypto support",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/19602/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/101377/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/101377/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 D012BA0C55;\n\tWed, 13 Oct 2021 17:46:16 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B10A141227;\n\tWed, 13 Oct 2021 17:45:51 +0200 (CEST)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by mails.dpdk.org (Postfix) with ESMTP id 15A1441226\n for <dev@dpdk.org>; Wed, 13 Oct 2021 17:45:49 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 13 Oct 2021 08:45:49 -0700",
            "from silpixa00400884.ir.intel.com ([10.243.22.82])\n by fmsmga005.fm.intel.com with ESMTP; 13 Oct 2021 08:45:46 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10136\"; a=\"208257849\"",
            "E=Sophos;i=\"5.85,371,1624345200\"; d=\"scan'208\";a=\"208257849\"",
            "E=Sophos;i=\"5.85,371,1624345200\"; d=\"scan'208\";a=\"717390245\""
        ],
        "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": "Wed, 13 Oct 2021 16:33:38 +0100",
        "Message-Id": "<20211013153338.387912-7-radu.nicolau@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20211013153338.387912-1-radu.nicolau@intel.com>",
        "References": "<20210909142428.750634-1-radu.nicolau@intel.com>\n <20211013153338.387912-1-radu.nicolau@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v7 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\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>\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 ec347086b4..dc1bcce3f7 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 2aeb5370a3..b94c0f6342 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->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->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(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->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@@ -2495,6 +2581,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@@ -2578,6 +2669,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": [
        "v7",
        "6/6"
    ]
}