get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 104563,
    "url": "http://patchwork.dpdk.org/api/patches/104563/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20211122092913.262886-1-dapengx.yu@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20211122092913.262886-1-dapengx.yu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20211122092913.262886-1-dapengx.yu@intel.com",
    "date": "2021-11-22T09:29:13",
    "name": "net/ice: track the DCF state of PF",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a8c49cc67109e248f8d1ae2ec844a48817ff3c84",
    "submitter": {
        "id": 2042,
        "url": "http://patchwork.dpdk.org/api/people/2042/?format=api",
        "name": "Yu, DapengX",
        "email": "dapengx.yu@intel.com"
    },
    "delegate": {
        "id": 1540,
        "url": "http://patchwork.dpdk.org/api/users/1540/?format=api",
        "username": "qzhan15",
        "first_name": "Qi",
        "last_name": "Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20211122092913.262886-1-dapengx.yu@intel.com/mbox/",
    "series": [
        {
            "id": 20679,
            "url": "http://patchwork.dpdk.org/api/series/20679/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=20679",
            "date": "2021-11-22T09:29:13",
            "name": "net/ice: track the DCF state of PF",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/20679/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/104563/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/104563/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 28C59A0C52;\n\tMon, 22 Nov 2021 10:30:10 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id C2584410E4;\n\tMon, 22 Nov 2021 10:30:09 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by mails.dpdk.org (Postfix) with ESMTP id CDA6140395;\n Mon, 22 Nov 2021 10:30:07 +0100 (CET)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 22 Nov 2021 01:30:06 -0800",
            "from unknown (HELO localhost.localdomain) ([10.240.183.93])\n by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 22 Nov 2021 01:30:04 -0800"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10175\"; a=\"258573315\"",
            "E=Sophos;i=\"5.87,254,1631602800\"; d=\"scan'208\";a=\"258573315\"",
            "E=Sophos;i=\"5.87,254,1631602800\"; d=\"scan'208\";a=\"496793875\""
        ],
        "From": "dapengx.yu@intel.com",
        "To": "Qiming Yang <qiming.yang@intel.com>,\n\tQi Zhang <qi.z.zhang@intel.com>",
        "Cc": "dev@dpdk.org,\n\tDapeng Yu <dapengx.yu@intel.com>,\n\tstable@dpdk.org",
        "Subject": "[PATCH] net/ice: track the DCF state of PF",
        "Date": "Mon, 22 Nov 2021 17:29:13 +0800",
        "Message-Id": "<20211122092913.262886-1-dapengx.yu@intel.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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"
    },
    "content": "From: Dapeng Yu <dapengx.yu@intel.com>\n\nWhen VF is reset, PF will change DCF state from ON to other state, if\nflow creation, destroy, or redirect command is sent to DCF at this\ntime, it will fail.\n\nThis patch tracks DCF state and returns try-again error to caller when\nDCF state is not ON.\n\nCc: stable@dpdk.org\n\nSigned-off-by: Dapeng Yu <dapengx.yu@intel.com>\n---\n drivers/net/ice/base/ice_common.c   | 14 +++++++++++---\n drivers/net/ice/ice_dcf.c           | 23 +++++++++++++++++------\n drivers/net/ice/ice_dcf.h           |  3 +++\n drivers/net/ice/ice_dcf_parent.c    |  1 +\n drivers/net/ice/ice_generic_flow.c  |  4 +++-\n drivers/net/ice/ice_switch_filter.c | 22 ++++++++++++++++++----\n 6 files changed, 53 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c\nindex ae55bebaa2..1626db263c 100644\n--- a/drivers/net/ice/base/ice_common.c\n+++ b/drivers/net/ice/base/ice_common.c\n@@ -1764,12 +1764,14 @@ ice_aq_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf,\n \t\tu16 buf_size, struct ice_sq_cd *cd)\n {\n \tif (hw->aq_send_cmd_fn) {\n-\t\tenum ice_status status = ICE_ERR_NOT_READY;\n+\t\tenum ice_status status;\n \t\tu16 retval = ICE_AQ_RC_OK;\n \n \t\tice_acquire_lock(&hw->adminq.sq_lock);\n-\t\tif (!hw->aq_send_cmd_fn(hw->aq_send_cmd_param, desc,\n-\t\t\t\t\tbuf, buf_size)) {\n+\t\tstatus = hw->aq_send_cmd_fn(hw->aq_send_cmd_param, desc, buf,\n+\t\t\t\t\t    buf_size);\n+\t\tswitch (status) {\n+\t\tcase ICE_SUCCESS:\n \t\t\tretval = LE16_TO_CPU(desc->retval);\n \t\t\t/* strip off FW internal code */\n \t\t\tif (retval)\n@@ -1778,6 +1780,12 @@ ice_aq_send_cmd(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf,\n \t\t\t\tstatus = ICE_SUCCESS;\n \t\t\telse\n \t\t\t\tstatus = ICE_ERR_AQ_ERROR;\n+\t\t\tbreak;\n+\t\tcase ICE_ERR_NOT_READY:\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tstatus = ICE_ERR_AQ_ERROR;\n+\t\t\tbreak;\n \t\t}\n \n \t\thw->adminq.sq_last_status = (enum ice_aq_err)retval;\ndiff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c\nindex cca1d7bf46..63c2e547ff 100644\n--- a/drivers/net/ice/ice_dcf.c\n+++ b/drivers/net/ice/ice_dcf.c\n@@ -269,6 +269,8 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)\n \thw->vsi_id = hw->vsi_res->vsi_id;\n \tPMD_DRV_LOG(DEBUG, \"VSI ID is %u\", hw->vsi_id);\n \n+\t__atomic_store_n(&hw->state_on, true, __ATOMIC_RELAXED);\n+\n \treturn 0;\n }\n \n@@ -476,9 +478,12 @@ ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,\n \tint err = 0;\n \tint i = 0;\n \n+\tif (!__atomic_load_n(&hw->state_on, __ATOMIC_RELAXED))\n+\t\treturn ICE_ERR_NOT_READY;\n+\n \tif ((buf && !buf_size) || (!buf && buf_size) ||\n \t    buf_size > ICE_DCF_AQ_BUF_SZ)\n-\t\treturn -EINVAL;\n+\t\treturn ICE_ERR_PARAM;\n \n \tdesc_cmd.v_op = VIRTCHNL_OP_DCF_CMD_DESC;\n \tdesc_cmd.req_msglen = sizeof(*desc);\n@@ -503,7 +508,7 @@ ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,\n \n \tif (ice_dcf_vc_cmd_send(hw, &desc_cmd) ||\n \t    ice_dcf_vc_cmd_send(hw, &buff_cmd)) {\n-\t\terr = -1;\n+\t\terr = ICE_ERR_AQ_ERROR;\n \t\tPMD_DRV_LOG(ERR, \"fail to send OP_DCF_CMD_DESC/BUFF\");\n \t\tgoto ret;\n \t}\n@@ -516,10 +521,15 @@ ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,\n \t} while (i++ < ICE_DCF_ARQ_MAX_RETRIES);\n \n \tif (desc_cmd.v_ret != IAVF_SUCCESS || buff_cmd.v_ret != IAVF_SUCCESS) {\n-\t\terr = -1;\n-\t\tPMD_DRV_LOG(ERR,\n-\t\t\t    \"No response (%d times) or return failure (desc: %d / buff: %d)\",\n-\t\t\t    i, desc_cmd.v_ret, buff_cmd.v_ret);\n+\t\tif (!__atomic_load_n(&hw->state_on, __ATOMIC_RELAXED)) {\n+\t\t\terr = ICE_ERR_NOT_READY;\n+\t\t\tPMD_DRV_LOG(ERR, \"DCF is not on temporarily\");\n+\t\t} else {\n+\t\t\terr = ICE_ERR_AQ_ERROR;\n+\t\t\tPMD_DRV_LOG(ERR,\n+\t\t\t\t    \"No response (%d times) or return failure (desc: %d / buff: %d)\",\n+\t\t\t\t    i, desc_cmd.v_ret, buff_cmd.v_ret);\n+\t\t}\n \t}\n \n ret:\n@@ -594,6 +604,7 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)\n \tint ret, size;\n \n \thw->resetting = false;\n+\t__atomic_store_n(&hw->state_on, false, __ATOMIC_RELAXED);\n \n \thw->avf.hw_addr = pci_dev->mem_resource[0].addr;\n \thw->avf.back = hw;\ndiff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h\nindex 6ec766ebda..c3a2bb2b03 100644\n--- a/drivers/net/ice/ice_dcf.h\n+++ b/drivers/net/ice/ice_dcf.h\n@@ -113,6 +113,9 @@ struct ice_dcf_hw {\n \tuint32_t link_speed;\n \n \tbool resetting;\n+\n+\t/* True if DCF state of the associated PF is on */\n+\tbool state_on;\n };\n \n int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,\ndiff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c\nindex 1ff2c47172..84c170e79b 100644\n--- a/drivers/net/ice/ice_dcf_parent.c\n+++ b/drivers/net/ice/ice_dcf_parent.c\n@@ -258,6 +258,7 @@ ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw,\n \t\tPMD_DRV_LOG(DEBUG, \"VIRTCHNL_EVENT_DCF_VSI_MAP_UPDATE event : VF%u with VSI num %u\",\n \t\t\t    pf_msg->event_data.vf_vsi_map.vf_id,\n \t\t\t    pf_msg->event_data.vf_vsi_map.vsi_id);\n+\t\t__atomic_store_n(&dcf_hw->state_on, false, __ATOMIC_RELAXED);\n \t\tstart_vsi_reset_thread(dcf_hw, true,\n \t\t\t\t       pf_msg->event_data.vf_vsi_map.vf_id);\n \t\tbreak;\ndiff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c\nindex c673feb7a6..406a0a953f 100644\n--- a/drivers/net/ice/ice_generic_flow.c\n+++ b/drivers/net/ice/ice_generic_flow.c\n@@ -2515,7 +2515,9 @@ ice_flow_flush(struct rte_eth_dev *dev,\n \t\tret = ice_flow_destroy(dev, p_flow, error);\n \t\tif (ret) {\n \t\t\tPMD_DRV_LOG(ERR, \"Failed to flush flows\");\n-\t\t\treturn -EINVAL;\n+\t\t\tif (ret != -EAGAIN)\n+\t\t\t\tret = -EINVAL;\n+\t\t\treturn ret;\n \t\t}\n \t}\n \ndiff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c\nindex ed29c00d77..9e35c2d1ea 100644\n--- a/drivers/net/ice/ice_switch_filter.c\n+++ b/drivers/net/ice/ice_switch_filter.c\n@@ -423,7 +423,11 @@ ice_switch_create(struct ice_adapter *ad,\n \n \t\tflow->rule = filter_conf_ptr;\n \t} else {\n-\t\trte_flow_error_set(error, EINVAL,\n+\t\tif (ret == ICE_ERR_NOT_READY)\n+\t\t\tret = -EAGAIN;\n+\t\telse\n+\t\t\tret = -EINVAL;\n+\t\trte_flow_error_set(error, -ret,\n \t\t\tRTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n \t\t\t\"switch filter create flow fail\");\n \t\tgoto error;\n@@ -477,7 +481,11 @@ ice_switch_destroy(struct ice_adapter *ad,\n \n \tret = ice_rem_adv_rule_by_id(hw, &filter_conf_ptr->sw_query_data);\n \tif (ret) {\n-\t\trte_flow_error_set(error, EINVAL,\n+\t\tif (ret == ICE_ERR_NOT_READY)\n+\t\t\tret = -EAGAIN;\n+\t\telse\n+\t\t\tret = -EINVAL;\n+\t\trte_flow_error_set(error, -ret,\n \t\t\tRTE_FLOW_ERROR_TYPE_HANDLE, NULL,\n \t\t\t\"fail to destroy switch filter rule\");\n \t\treturn -rte_errno;\n@@ -2023,7 +2031,10 @@ ice_switch_redirect(struct ice_adapter *ad,\n \t\t\t    rdata->rule_id);\n \t\tfilter_conf_ptr->fltr_status =\n \t\t\tICE_SW_FLTR_RMV_FAILED_ON_RIDRECT;\n-\t\tret = -EINVAL;\n+\t\tif (ret == ICE_ERR_NOT_READY)\n+\t\t\tret = -EAGAIN;\n+\t\telse\n+\t\t\tret = -EINVAL;\n \t\tgoto out;\n \t}\n \n@@ -2038,7 +2049,10 @@ ice_switch_redirect(struct ice_adapter *ad,\n \t\tPMD_DRV_LOG(ERR, \"Failed to replay the rule\");\n \t\tfilter_conf_ptr->fltr_status =\n \t\t\tICE_SW_FLTR_ADD_FAILED_ON_RIDRECT;\n-\t\tret = -EINVAL;\n+\t\tif (ret == ICE_ERR_NOT_READY)\n+\t\t\tret = -EAGAIN;\n+\t\telse\n+\t\t\tret = -EINVAL;\n \t} else {\n \t\tfilter_conf_ptr->sw_query_data = added_rdata;\n \t\t/* Save VSI number for failure recover */\n",
    "prefixes": []
}