get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 121814,
    "url": "https://patches.dpdk.org/api/patches/121814/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230111071545.504706-6-mingxia.liu@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": "<20230111071545.504706-6-mingxia.liu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230111071545.504706-6-mingxia.liu@intel.com",
    "date": "2023-01-11T07:15:44",
    "name": "[v2,5/6] common/idpf: add alarm to support handle vchnl message",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "6c165decc113c9ae3e0421b77d1b8dbb9e15e3bc",
    "submitter": {
        "id": 2514,
        "url": "https://patches.dpdk.org/api/people/2514/?format=api",
        "name": "Liu, Mingxia",
        "email": "mingxia.liu@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/20230111071545.504706-6-mingxia.liu@intel.com/mbox/",
    "series": [
        {
            "id": 26469,
            "url": "https://patches.dpdk.org/api/series/26469/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=26469",
            "date": "2023-01-11T07:15:39",
            "name": "add idpf pmd enhancement features",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/26469/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/121814/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/121814/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 1937E423AA;\n\tWed, 11 Jan 2023 09:13:31 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 492CC42D26;\n\tWed, 11 Jan 2023 09:13:10 +0100 (CET)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by mails.dpdk.org (Postfix) with ESMTP id A176242D3A\n for <dev@dpdk.org>; Wed, 11 Jan 2023 09:13:07 +0100 (CET)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 11 Jan 2023 00:13:07 -0800",
            "from dpdk-mingxial-01.sh.intel.com ([10.67.119.112])\n by orsmga005.jf.intel.com with ESMTP; 11 Jan 2023 00:13:05 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1673424787; x=1704960787;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=pYLNgYTUKESg1lF2p/yPdNSVeimTWsLSPIYnM/c0r0c=;\n b=Aa8rAM/gNkLLFp3gC0jMMIyqc4pVhN2xJwJ6xxX98HqrWbIW20/s4zNu\n Fb4jIUBMIR0PWUA6gN8sH87MmiaLpb7vz1ovfIeY62U15PAi3g4Alrdu7\n 0rEKqWPEUG6Q/vlMnSTd6qs/Pl+z/sdD+ICZbxHjPqrpu/DIAKohxYieV\n 2fJnL1+BgSD0VPuB6688JDgnl6LLmKevODCSb3WMzTcEa7Hq2elI3t9Ry\n RK4syT0lbSkUh5uUvZHTdpzczHnNAZhzPWY8X26PN4r4fxgV8mlgXGCRR\n llv3qOIELYkqHmkQJixOTy1qsaChLapnYm728MzBX6irfyC9jrp4dyfDA A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10586\"; a=\"311167498\"",
            "E=Sophos;i=\"5.96,315,1665471600\"; d=\"scan'208\";a=\"311167498\"",
            "E=McAfee;i=\"6500,9779,10586\"; a=\"831271422\"",
            "E=Sophos;i=\"5.96,315,1665471600\"; d=\"scan'208\";a=\"831271422\""
        ],
        "X-ExtLoop1": "1",
        "From": "Mingxia Liu <mingxia.liu@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "jingjing.wu@intel.com, beilei.xing@intel.com,\n Mingxia Liu <mingxia.liu@intel.com>",
        "Subject": "[PATCH v2 5/6] common/idpf: add alarm to support handle vchnl message",
        "Date": "Wed, 11 Jan 2023 07:15:44 +0000",
        "Message-Id": "<20230111071545.504706-6-mingxia.liu@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230111071545.504706-1-mingxia.liu@intel.com>",
        "References": "<20221216093706.2453812-1-mingxia.liu@intel.com>\n <20230111071545.504706-1-mingxia.liu@intel.com>",
        "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": "Handle virtual channel message.\nRefine link status update.\n\nSigned-off-by: Mingxia Liu <mingxia.liu@intel.com>\nSigned-off-by: Beilei Ling <beilei.xing@intel.com>\n---\n drivers/common/idpf/idpf_common_device.h   |   5 +\n drivers/common/idpf/idpf_common_virtchnl.c |  19 ---\n drivers/net/idpf/idpf_ethdev.c             | 165 ++++++++++++++++++++-\n drivers/net/idpf/idpf_ethdev.h             |   2 +\n 4 files changed, 171 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/drivers/common/idpf/idpf_common_device.h b/drivers/common/idpf/idpf_common_device.h\nindex d7d4cd5363..03697510bb 100644\n--- a/drivers/common/idpf/idpf_common_device.h\n+++ b/drivers/common/idpf/idpf_common_device.h\n@@ -115,6 +115,11 @@ struct idpf_vport {\n \tbool tx_use_avx512;\n \n \tstruct virtchnl2_vport_stats eth_stats_offset;\n+\n+\tvoid *dev;\n+\t/* Event from ipf */\n+\tbool link_up;\n+\tuint32_t link_speed;\n };\n \n /* Message type read in virtual channel from PF */\ndiff --git a/drivers/common/idpf/idpf_common_virtchnl.c b/drivers/common/idpf/idpf_common_virtchnl.c\nindex ae5a983836..c3e7569cc2 100644\n--- a/drivers/common/idpf/idpf_common_virtchnl.c\n+++ b/drivers/common/idpf/idpf_common_virtchnl.c\n@@ -202,25 +202,6 @@ idpf_execute_vc_cmd(struct idpf_adapter *adapter, struct idpf_cmd_info *args)\n \tswitch (args->ops) {\n \tcase VIRTCHNL_OP_VERSION:\n \tcase VIRTCHNL2_OP_GET_CAPS:\n-\tcase VIRTCHNL2_OP_CREATE_VPORT:\n-\tcase VIRTCHNL2_OP_DESTROY_VPORT:\n-\tcase VIRTCHNL2_OP_SET_RSS_KEY:\n-\tcase VIRTCHNL2_OP_SET_RSS_LUT:\n-\tcase VIRTCHNL2_OP_SET_RSS_HASH:\n-\tcase VIRTCHNL2_OP_CONFIG_RX_QUEUES:\n-\tcase VIRTCHNL2_OP_CONFIG_TX_QUEUES:\n-\tcase VIRTCHNL2_OP_ENABLE_QUEUES:\n-\tcase VIRTCHNL2_OP_DISABLE_QUEUES:\n-\tcase VIRTCHNL2_OP_ENABLE_VPORT:\n-\tcase VIRTCHNL2_OP_DISABLE_VPORT:\n-\tcase VIRTCHNL2_OP_MAP_QUEUE_VECTOR:\n-\tcase VIRTCHNL2_OP_UNMAP_QUEUE_VECTOR:\n-\tcase VIRTCHNL2_OP_ALLOC_VECTORS:\n-\tcase VIRTCHNL2_OP_DEALLOC_VECTORS:\n-\tcase VIRTCHNL2_OP_GET_STATS:\n-\tcase VIRTCHNL2_OP_GET_RSS_KEY:\n-\tcase VIRTCHNL2_OP_GET_RSS_HASH:\n-\tcase VIRTCHNL2_OP_GET_RSS_LUT:\n \t\t/* for init virtchnl ops, need to poll the response */\n \t\terr = idpf_read_one_msg(adapter, args->ops, args->out_size, args->out_buffer);\n \t\tclear_cmd(adapter);\ndiff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c\nindex 2ab31792ba..b86f63f94e 100644\n--- a/drivers/net/idpf/idpf_ethdev.c\n+++ b/drivers/net/idpf/idpf_ethdev.c\n@@ -9,6 +9,7 @@\n #include <rte_memzone.h>\n #include <rte_dev.h>\n #include <errno.h>\n+#include <rte_alarm.h>\n \n #include \"idpf_ethdev.h\"\n #include \"idpf_rxtx.h\"\n@@ -83,12 +84,49 @@ static int\n idpf_dev_link_update(struct rte_eth_dev *dev,\n \t\t     __rte_unused int wait_to_complete)\n {\n+\tstruct idpf_vport *vport = dev->data->dev_private;\n \tstruct rte_eth_link new_link;\n \n \tmemset(&new_link, 0, sizeof(new_link));\n \n-\tnew_link.link_speed = RTE_ETH_SPEED_NUM_NONE;\n+\tswitch (vport->link_speed) {\n+\tcase 10:\n+\t\tnew_link.link_speed = RTE_ETH_SPEED_NUM_10M;\n+\t\tbreak;\n+\tcase 100:\n+\t\tnew_link.link_speed = RTE_ETH_SPEED_NUM_100M;\n+\t\tbreak;\n+\tcase 1000:\n+\t\tnew_link.link_speed = RTE_ETH_SPEED_NUM_1G;\n+\t\tbreak;\n+\tcase 10000:\n+\t\tnew_link.link_speed = RTE_ETH_SPEED_NUM_10G;\n+\t\tbreak;\n+\tcase 20000:\n+\t\tnew_link.link_speed = RTE_ETH_SPEED_NUM_20G;\n+\t\tbreak;\n+\tcase 25000:\n+\t\tnew_link.link_speed = RTE_ETH_SPEED_NUM_25G;\n+\t\tbreak;\n+\tcase 40000:\n+\t\tnew_link.link_speed = RTE_ETH_SPEED_NUM_40G;\n+\t\tbreak;\n+\tcase 50000:\n+\t\tnew_link.link_speed = RTE_ETH_SPEED_NUM_50G;\n+\t\tbreak;\n+\tcase 100000:\n+\t\tnew_link.link_speed = RTE_ETH_SPEED_NUM_100G;\n+\t\tbreak;\n+\tcase 200000:\n+\t\tnew_link.link_speed = RTE_ETH_SPEED_NUM_200G;\n+\t\tbreak;\n+\tdefault:\n+\t\tnew_link.link_speed = RTE_ETH_SPEED_NUM_NONE;\n+\t}\n+\n \tnew_link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;\n+\tnew_link.link_status = vport->link_up ? RTE_ETH_LINK_UP :\n+\t\tRTE_ETH_LINK_DOWN;\n \tnew_link.link_autoneg = !(dev->data->dev_conf.link_speeds &\n \t\t\t\t  RTE_ETH_LINK_SPEED_FIXED);\n \n@@ -927,6 +965,127 @@ idpf_parse_devargs(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *adap\n \treturn ret;\n }\n \n+static struct idpf_vport *\n+idpf_find_vport(struct idpf_adapter_ext *adapter, uint32_t vport_id)\n+{\n+\tstruct idpf_vport *vport = NULL;\n+\tint i;\n+\n+\tfor (i = 0; i < adapter->cur_vport_nb; i++) {\n+\t\tvport = adapter->vports[i];\n+\t\tif (vport->vport_id != vport_id)\n+\t\t\tcontinue;\n+\t\telse\n+\t\t\treturn vport;\n+\t}\n+\n+\treturn vport;\n+}\n+\n+static void\n+idpf_handle_event_msg(struct idpf_vport *vport, uint8_t *msg, uint16_t msglen)\n+{\n+\tstruct virtchnl2_event *vc_event = (struct virtchnl2_event *)msg;\n+\tstruct rte_eth_dev *dev = (struct rte_eth_dev *)vport->dev;\n+\n+\tif (msglen < sizeof(struct virtchnl2_event)) {\n+\t\tPMD_DRV_LOG(ERR, \"Error event\");\n+\t\treturn;\n+\t}\n+\n+\tswitch (vc_event->event) {\n+\tcase VIRTCHNL2_EVENT_LINK_CHANGE:\n+\t\tPMD_DRV_LOG(DEBUG, \"VIRTCHNL2_EVENT_LINK_CHANGE\");\n+\t\tvport->link_up = vc_event->link_status;\n+\t\tvport->link_speed = vc_event->link_speed;\n+\t\tidpf_dev_link_update(dev, 0);\n+\t\tbreak;\n+\tdefault:\n+\t\tPMD_DRV_LOG(ERR, \" unknown event received %u\", vc_event->event);\n+\t\tbreak;\n+\t}\n+}\n+\n+static void\n+idpf_handle_virtchnl_msg(struct idpf_adapter_ext *adapter_ex)\n+{\n+\tstruct idpf_adapter *adapter = &adapter_ex->base;\n+\tstruct idpf_dma_mem *dma_mem = NULL;\n+\tstruct idpf_hw *hw = &adapter->hw;\n+\tstruct virtchnl2_event *vc_event;\n+\tstruct idpf_ctlq_msg ctlq_msg;\n+\tenum idpf_mbx_opc mbx_op;\n+\tstruct idpf_vport *vport;\n+\tenum virtchnl_ops vc_op;\n+\tuint16_t pending = 1;\n+\tint ret;\n+\n+\twhile (pending) {\n+\t\tret = idpf_ctlq_recv(hw->arq, &pending, &ctlq_msg);\n+\t\tif (ret) {\n+\t\t\tPMD_DRV_LOG(INFO, \"Failed to read msg from virtual channel, ret: %d\", ret);\n+\t\t\treturn;\n+\t\t}\n+\n+\t\trte_memcpy(adapter->mbx_resp, ctlq_msg.ctx.indirect.payload->va,\n+\t\t\t   IDPF_DFLT_MBX_BUF_SIZE);\n+\n+\t\tmbx_op = rte_le_to_cpu_16(ctlq_msg.opcode);\n+\t\tvc_op = rte_le_to_cpu_32(ctlq_msg.cookie.mbx.chnl_opcode);\n+\t\tadapter->cmd_retval = rte_le_to_cpu_32(ctlq_msg.cookie.mbx.chnl_retval);\n+\n+\t\tswitch (mbx_op) {\n+\t\tcase idpf_mbq_opc_send_msg_to_peer_pf:\n+\t\t\tif (vc_op == VIRTCHNL2_OP_EVENT) {\n+\t\t\t\tif (ctlq_msg.data_len < sizeof(struct virtchnl2_event)) {\n+\t\t\t\t\tPMD_DRV_LOG(ERR, \"Error event\");\n+\t\t\t\t\treturn;\n+\t\t\t\t}\n+\t\t\t\tvc_event = (struct virtchnl2_event *)adapter->mbx_resp;\n+\t\t\t\tvport = idpf_find_vport(adapter_ex, vc_event->vport_id);\n+\t\t\t\tif (!vport) {\n+\t\t\t\t\tPMD_DRV_LOG(ERR, \"Can't find vport.\");\n+\t\t\t\t\treturn;\n+\t\t\t\t}\n+\t\t\t\tidpf_handle_event_msg(vport, adapter->mbx_resp,\n+\t\t\t\t\t\t      ctlq_msg.data_len);\n+\t\t\t} else {\n+\t\t\t\tif (vc_op == adapter->pend_cmd)\n+\t\t\t\t\tnotify_cmd(adapter, adapter->cmd_retval);\n+\t\t\t\telse\n+\t\t\t\t\tPMD_DRV_LOG(ERR, \"command mismatch, expect %u, get %u\",\n+\t\t\t\t\t\t    adapter->pend_cmd, vc_op);\n+\n+\t\t\t\tPMD_DRV_LOG(DEBUG, \" Virtual channel response is received,\"\n+\t\t\t\t\t    \"opcode = %d\", vc_op);\n+\t\t\t}\n+\t\t\tgoto post_buf;\n+\t\tdefault:\n+\t\t\tPMD_DRV_LOG(DEBUG, \"Request %u is not supported yet\", mbx_op);\n+\t\t}\n+\t}\n+\n+post_buf:\n+\tif (ctlq_msg.data_len)\n+\t\tdma_mem = ctlq_msg.ctx.indirect.payload;\n+\telse\n+\t\tpending = 0;\n+\n+\tret = idpf_ctlq_post_rx_buffs(hw, hw->arq, &pending, &dma_mem);\n+\tif (ret && dma_mem)\n+\t\tidpf_free_dma_mem(hw, dma_mem);\n+}\n+\n+static void\n+idpf_dev_alarm_handler(void *param)\n+{\n+\tstruct idpf_adapter_ext *adapter = param;\n+\n+\tidpf_handle_virtchnl_msg(adapter);\n+\n+\trte_eal_alarm_set(IDPF_ALARM_INTERVAL, idpf_dev_alarm_handler, adapter);\n+}\n+\n static int\n idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *adapter)\n {\n@@ -949,6 +1108,8 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *a\n \t\tgoto err_adapter_init;\n \t}\n \n+\trte_eal_alarm_set(IDPF_ALARM_INTERVAL, idpf_dev_alarm_handler, adapter);\n+\n \tadapter->max_vport_nb = adapter->base.caps.max_vports;\n \n \tadapter->vports = rte_zmalloc(\"vports\",\n@@ -1032,6 +1193,7 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params)\n \tvport->adapter = &adapter->base;\n \tvport->sw_idx = param->idx;\n \tvport->devarg_id = param->devarg_id;\n+\tvport->dev = dev;\n \n \tmemset(&create_vport_info, 0, sizeof(create_vport_info));\n \tret = idpf_create_vport_info_init(vport, &create_vport_info);\n@@ -1101,6 +1263,7 @@ idpf_find_adapter_ext(struct rte_pci_device *pci_dev)\n static void\n idpf_adapter_ext_deinit(struct idpf_adapter_ext *adapter)\n {\n+\trte_eal_alarm_cancel(idpf_dev_alarm_handler, adapter);\n \tidpf_adapter_deinit(&adapter->base);\n \n \trte_free(adapter->vports);\ndiff --git a/drivers/net/idpf/idpf_ethdev.h b/drivers/net/idpf/idpf_ethdev.h\nindex 5bd1b441ea..f414f1113e 100644\n--- a/drivers/net/idpf/idpf_ethdev.h\n+++ b/drivers/net/idpf/idpf_ethdev.h\n@@ -55,6 +55,8 @@\n \n #define IDPF_ADAPTER_NAME_LEN\t(PCI_PRI_STR_SIZE + 1)\n \n+#define IDPF_ALARM_INTERVAL\t50000 /* us */\n+\n struct idpf_vport_param {\n \tstruct idpf_adapter_ext *adapter;\n \tuint16_t devarg_id; /* arg id from user */\n",
    "prefixes": [
        "v2",
        "5/6"
    ]
}