get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 81723,
    "url": "https://patches.dpdk.org/api/patches/81723/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20201022064902.40143-2-ting.xu@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": "<20201022064902.40143-2-ting.xu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201022064902.40143-2-ting.xu@intel.com",
    "date": "2020-10-22T06:48:57",
    "name": "[v8,1/6] net/iavf: handle virtchnl event message without interrupt",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "7d44a5e0955e1297bab964d9dc17ca7481a7e4f8",
    "submitter": {
        "id": 1363,
        "url": "https://patches.dpdk.org/api/people/1363/?format=api",
        "name": "Xu, Ting",
        "email": "ting.xu@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/20201022064902.40143-2-ting.xu@intel.com/mbox/",
    "series": [
        {
            "id": 13188,
            "url": "https://patches.dpdk.org/api/series/13188/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=13188",
            "date": "2020-10-22T06:48:56",
            "name": "enable large VF configuration",
            "version": 8,
            "mbox": "https://patches.dpdk.org/series/13188/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/81723/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/81723/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 0838CA04DD;\n\tThu, 22 Oct 2020 08:46:09 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id ADFE972F9;\n\tThu, 22 Oct 2020 08:45:53 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by dpdk.org (Postfix) with ESMTP id 7A98272F8\n for <dev@dpdk.org>; Thu, 22 Oct 2020 08:45:51 +0200 (CEST)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 21 Oct 2020 23:45:51 -0700",
            "from dpdk-xuting-second.sh.intel.com ([10.67.116.154])\n by orsmga005.jf.intel.com with ESMTP; 21 Oct 2020 23:45:47 -0700"
        ],
        "IronPort-SDR": [
            "\n w133Y3hQK0bN3KCtTcri+bP1tQJ9jfgumV7qoTJ+3thS0v24Aw51XiyfbMixo1ES9y844BjfZN\n w0WhJg7G93OA==",
            "\n sGdCcLs2EImtg+XMsd8lz5z1KvtPnLtIe2sdh7q3qrFe+wJbYDgXrmCE0yIMTSZwxlfi2dK/B7\n j3duyixG1ipA=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9781\"; a=\"185158488\"",
            "E=Sophos;i=\"5.77,403,1596524400\"; d=\"scan'208\";a=\"185158488\"",
            "E=Sophos;i=\"5.77,403,1596524400\"; d=\"scan'208\";a=\"533829171\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "From": "Ting Xu <ting.xu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "qi.z.zhang@intel.com, beilei.xing@intel.com, jingjing.wu@intel.com,\n Ting Xu <ting.xu@intel.com>",
        "Date": "Thu, 22 Oct 2020 14:48:57 +0800",
        "Message-Id": "<20201022064902.40143-2-ting.xu@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20201022064902.40143-1-ting.xu@intel.com>",
        "References": "<20200909072028.16726-1-ting.xu@intel.com>\n <20201022064902.40143-1-ting.xu@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v8 1/6] net/iavf: handle virtchnl event message\n\twithout interrupt",
        "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 <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": "Currently, VF can only handle virtchnl event message by calling interrupt.\nIt is not available in two cases:\n1. If the event message comes during VF initialization before interrupt\nis enabled, this message will not be handled correctly.\n2. Some virtchnl commands need to receive the event message and handle\nit with interrupt disabled.\nTo solve this issue, we add the virtchnl event message handling in the\nprocess of reading vitchnl messages in adminq from PF.\n\nSigned-off-by: Ting Xu <ting.xu@intel.com>\n---\n drivers/net/iavf/iavf.h       |   8 ++\n drivers/net/iavf/iavf_vchnl.c | 138 ++++++++++++++++++++++------------\n 2 files changed, 97 insertions(+), 49 deletions(-)",
    "diff": "diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h\nindex 3198d85b3..9c16324c1 100644\n--- a/drivers/net/iavf/iavf.h\n+++ b/drivers/net/iavf/iavf.h\n@@ -107,6 +107,14 @@ struct iavf_fdir_info {\n /* TODO: is that correct to assume the max number to be 16 ?*/\n #define IAVF_MAX_MSIX_VECTORS   16\n \n+/* Message type read in admin queue from PF */\n+enum iavf_aq_result {\n+\tIAVF_MSG_ERR = -1, /* Meet error when accessing admin queue */\n+\tIAVF_MSG_NON,      /* Read nothing from admin queue */\n+\tIAVF_MSG_SYS,      /* Read system msg from admin queue */\n+\tIAVF_MSG_CMD,      /* Read async command result */\n+};\n+\n /* Structure to store private data specific for VF instance. */\n struct iavf_info {\n \tuint16_t num_queue_pairs;\ndiff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c\nindex a2295f879..b62c8683c 100644\n--- a/drivers/net/iavf/iavf_vchnl.c\n+++ b/drivers/net/iavf/iavf_vchnl.c\n@@ -25,14 +25,54 @@\n #define MAX_TRY_TIMES 200\n #define ASQ_DELAY_MS  10\n \n+static uint32_t\n+iavf_convert_link_speed(enum virtchnl_link_speed virt_link_speed)\n+{\n+\tuint32_t speed;\n+\n+\tswitch (virt_link_speed) {\n+\tcase VIRTCHNL_LINK_SPEED_100MB:\n+\t\tspeed = 100;\n+\t\tbreak;\n+\tcase VIRTCHNL_LINK_SPEED_1GB:\n+\t\tspeed = 1000;\n+\t\tbreak;\n+\tcase VIRTCHNL_LINK_SPEED_10GB:\n+\t\tspeed = 10000;\n+\t\tbreak;\n+\tcase VIRTCHNL_LINK_SPEED_40GB:\n+\t\tspeed = 40000;\n+\t\tbreak;\n+\tcase VIRTCHNL_LINK_SPEED_20GB:\n+\t\tspeed = 20000;\n+\t\tbreak;\n+\tcase VIRTCHNL_LINK_SPEED_25GB:\n+\t\tspeed = 25000;\n+\t\tbreak;\n+\tcase VIRTCHNL_LINK_SPEED_2_5GB:\n+\t\tspeed = 2500;\n+\t\tbreak;\n+\tcase VIRTCHNL_LINK_SPEED_5GB:\n+\t\tspeed = 5000;\n+\t\tbreak;\n+\tdefault:\n+\t\tspeed = 0;\n+\t\tbreak;\n+\t}\n+\n+\treturn speed;\n+}\n+\n /* Read data in admin queue to get msg from pf driver */\n-static enum iavf_status\n+static enum iavf_aq_result\n iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len,\n \t\t     uint8_t *buf)\n {\n \tstruct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);\n \tstruct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);\n+\tstruct rte_eth_dev *dev = adapter->eth_dev;\n \tstruct iavf_arq_event_info event;\n+\tenum iavf_aq_result result = IAVF_MSG_NON;\n \tenum virtchnl_ops opcode;\n \tint ret;\n \n@@ -42,7 +82,9 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len,\n \t/* Can't read any msg from adminQ */\n \tif (ret) {\n \t\tPMD_DRV_LOG(DEBUG, \"Can't read msg from AQ\");\n-\t\treturn ret;\n+\t\tif (ret != IAVF_ERR_ADMIN_QUEUE_NO_WORK)\n+\t\t\tresult = IAVF_MSG_ERR;\n+\t\treturn result;\n \t}\n \n \topcode = (enum virtchnl_ops)rte_le_to_cpu_32(event.desc.cookie_high);\n@@ -52,16 +94,51 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len,\n \tPMD_DRV_LOG(DEBUG, \"AQ from pf carries opcode %u, retval %d\",\n \t\t    opcode, vf->cmd_retval);\n \n-\tif (opcode != vf->pend_cmd) {\n-\t\tif (opcode != VIRTCHNL_OP_EVENT) {\n-\t\t\tPMD_DRV_LOG(WARNING,\n-\t\t\t\t    \"command mismatch, expect %u, get %u\",\n-\t\t\t\t    vf->pend_cmd, opcode);\n+\tif (opcode == VIRTCHNL_OP_EVENT) {\n+\t\tstruct virtchnl_pf_event *vpe =\n+\t\t\t(struct virtchnl_pf_event *)event.msg_buf;\n+\n+\t\tresult = IAVF_MSG_SYS;\n+\t\tswitch (vpe->event) {\n+\t\tcase VIRTCHNL_EVENT_LINK_CHANGE:\n+\t\t\tvf->link_up =\n+\t\t\t\tvpe->event_data.link_event.link_status;\n+\t\t\tif (vf->vf_res->vf_cap_flags &\n+\t\t\t\tVIRTCHNL_VF_CAP_ADV_LINK_SPEED) {\n+\t\t\t\tvf->link_speed =\n+\t\t\t\t    vpe->event_data.link_event_adv.link_speed;\n+\t\t\t} else {\n+\t\t\t\tenum virtchnl_link_speed speed;\n+\t\t\t\tspeed = vpe->event_data.link_event.link_speed;\n+\t\t\t\tvf->link_speed = iavf_convert_link_speed(speed);\n+\t\t\t}\n+\t\t\tiavf_dev_link_update(dev, 0);\n+\t\t\tPMD_DRV_LOG(INFO, \"Link status update:%s\",\n+\t\t\t\t\tvf->link_up ? \"up\" : \"down\");\n+\t\t\tbreak;\n+\t\tcase VIRTCHNL_EVENT_RESET_IMPENDING:\n+\t\t\tvf->vf_reset = true;\n+\t\t\tPMD_DRV_LOG(INFO, \"VF is resetting\");\n+\t\t\tbreak;\n+\t\tcase VIRTCHNL_EVENT_PF_DRIVER_CLOSE:\n+\t\t\tvf->dev_closed = true;\n+\t\t\tPMD_DRV_LOG(INFO, \"PF driver closed\");\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tPMD_DRV_LOG(ERR, \"%s: Unknown event %d from pf\",\n+\t\t\t\t\t__func__, vpe->event);\n+\t\t}\n+\t}  else {\n+\t\t/* async reply msg on command issued by vf previously */\n+\t\tresult = IAVF_MSG_CMD;\n+\t\tif (opcode != vf->pend_cmd) {\n+\t\t\tPMD_DRV_LOG(WARNING, \"command mismatch, expect %u, get %u\",\n+\t\t\t\t\tvf->pend_cmd, opcode);\n+\t\t\tresult = IAVF_MSG_ERR;\n \t\t}\n-\t\treturn IAVF_ERR_OPCODE_MISMATCH;\n \t}\n \n-\treturn IAVF_SUCCESS;\n+\treturn result;\n }\n \n static int\n@@ -69,6 +146,7 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args)\n {\n \tstruct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);\n \tstruct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);\n+\tenum iavf_aq_result result;\n \tenum iavf_status ret;\n \tint err = 0;\n \tint i = 0;\n@@ -97,9 +175,9 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args)\n \tcase VIRTCHNL_OP_GET_SUPPORTED_RXDIDS:\n \t\t/* for init virtchnl ops, need to poll the response */\n \t\tdo {\n-\t\t\tret = iavf_read_msg_from_pf(adapter, args->out_size,\n+\t\t\tresult = iavf_read_msg_from_pf(adapter, args->out_size,\n \t\t\t\t\t\t   args->out_buffer);\n-\t\t\tif (ret == IAVF_SUCCESS)\n+\t\t\tif (result == IAVF_MSG_CMD)\n \t\t\t\tbreak;\n \t\t\trte_delay_ms(ASQ_DELAY_MS);\n \t\t} while (i++ < MAX_TRY_TIMES);\n@@ -136,44 +214,6 @@ iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args)\n \treturn err;\n }\n \n-static uint32_t\n-iavf_convert_link_speed(enum virtchnl_link_speed virt_link_speed)\n-{\n-\tuint32_t speed;\n-\n-\tswitch (virt_link_speed) {\n-\tcase VIRTCHNL_LINK_SPEED_100MB:\n-\t\tspeed = 100;\n-\t\tbreak;\n-\tcase VIRTCHNL_LINK_SPEED_1GB:\n-\t\tspeed = 1000;\n-\t\tbreak;\n-\tcase VIRTCHNL_LINK_SPEED_10GB:\n-\t\tspeed = 10000;\n-\t\tbreak;\n-\tcase VIRTCHNL_LINK_SPEED_40GB:\n-\t\tspeed = 40000;\n-\t\tbreak;\n-\tcase VIRTCHNL_LINK_SPEED_20GB:\n-\t\tspeed = 20000;\n-\t\tbreak;\n-\tcase VIRTCHNL_LINK_SPEED_25GB:\n-\t\tspeed = 25000;\n-\t\tbreak;\n-\tcase VIRTCHNL_LINK_SPEED_2_5GB:\n-\t\tspeed = 2500;\n-\t\tbreak;\n-\tcase VIRTCHNL_LINK_SPEED_5GB:\n-\t\tspeed = 5000;\n-\t\tbreak;\n-\tdefault:\n-\t\tspeed = 0;\n-\t\tbreak;\n-\t}\n-\n-\treturn speed;\n-}\n-\n static void\n iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg,\n \t\t\tuint16_t msglen)\n",
    "prefixes": [
        "v8",
        "1/6"
    ]
}