Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/120560/?format=api
https://patches.dpdk.org/api/patches/120560/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20221208075309.37852-6-beilei.xing@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": "<20221208075309.37852-6-beilei.xing@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20221208075309.37852-6-beilei.xing@intel.com", "date": "2022-12-08T07:52:59", "name": "[05/15] common/idpf: add vport init/deinit", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "0c62227e650aa12483b7127fb6c6c51c14098e2f", "submitter": { "id": 410, "url": "https://patches.dpdk.org/api/people/410/?format=api", "name": "Xing, Beilei", "email": "beilei.xing@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/20221208075309.37852-6-beilei.xing@intel.com/mbox/", "series": [ { "id": 26041, "url": "https://patches.dpdk.org/api/series/26041/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=26041", "date": "2022-12-08T07:52:54", "name": "net/idpf: refactor idpf pmd", "version": 1, "mbox": "https://patches.dpdk.org/series/26041/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/120560/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/120560/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 D3973A00C2;\n\tThu, 8 Dec 2022 08:54:01 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 5C41D42D41;\n\tThu, 8 Dec 2022 08:53:36 +0100 (CET)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n by mails.dpdk.org (Postfix) with ESMTP id 8090042D2C\n for <dev@dpdk.org>; Thu, 8 Dec 2022 08:53:33 +0100 (CET)", "from fmsmga004.fm.intel.com ([10.253.24.48])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 07 Dec 2022 23:53:33 -0800", "from dpdk-beileix-3.sh.intel.com ([10.67.110.253])\n by fmsmga004.fm.intel.com with ESMTP; 07 Dec 2022 23:53:31 -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=1670486013; x=1702022013;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=1+0/ayf0XJeht6bbQuqWOKytHwHyldV9G/1PJbOwjWk=;\n b=jeU95+12UpmBmgNjHCGel/3M1kMteseKGYechtdZd4Ll9U04yt9ho3Fi\n Pi2UxdrMjJJerR1DmbnCmpiZVkkoK4cYLLJ9ZzGB+O6MVlACROUN86Ia5\n 8aaNg90aVFmaMoNCVYH+xl8BCtAoHX+HjZt1LAT0TodFVoAjbemwKIzX1\n e83hJXtq//ABepJVF7ZxXZJY4so+5iIppk9tdL1gd3Jk8CvVi0bW0LQF6\n xyAgJq3vzMeZ3i2lt/JJLhIweeHTrc8xfi1GzbbDSJSd9zHvjdA5r8yhG\n sX4fArV6BF/r/iK3PEYp4TbrHhUdM4I4nArlKwFlI944ZzQw1deD0KbxB g==;", "X-IronPort-AV": [ "E=McAfee;i=\"6500,9779,10554\"; a=\"318244167\"", "E=Sophos;i=\"5.96,227,1665471600\"; d=\"scan'208\";a=\"318244167\"", "E=McAfee;i=\"6500,9779,10554\"; a=\"715499301\"", "E=Sophos;i=\"5.96,227,1665471600\"; d=\"scan'208\";a=\"715499301\"" ], "X-ExtLoop1": "1", "From": "beilei.xing@intel.com", "To": "jingjing.wu@intel.com,\n\tqi.z.zhang@intel.com", "Cc": "dev@dpdk.org, Beilei Xing <beilei.xing@intel.com>,\n Wenjun Wu <wenjun1.wu@intel.com>", "Subject": "[PATCH 05/15] common/idpf: add vport init/deinit", "Date": "Thu, 8 Dec 2022 07:52:59 +0000", "Message-Id": "<20221208075309.37852-6-beilei.xing@intel.com>", "X-Mailer": "git-send-email 2.26.2", "In-Reply-To": "<20221208075309.37852-1-beilei.xing@intel.com>", "References": "<20221208075309.37852-1-beilei.xing@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": "From: Beilei Xing <beilei.xing@intel.com>\n\nAdd vport init/deinit in common module.\n\nSigned-off-by: Wenjun Wu <wenjun1.wu@intel.com>\nSigned-off-by: Beilei Xing <beilei.xing@intel.com>\n---\n drivers/common/idpf/idpf_common_device.c | 128 +++++++++++++++++++\n drivers/common/idpf/idpf_common_device.h | 8 ++\n drivers/common/idpf/idpf_common_virtchnl.c | 16 +--\n drivers/common/idpf/idpf_common_virtchnl.h | 2 -\n drivers/common/idpf/version.map | 4 +-\n drivers/net/idpf/idpf_ethdev.c | 138 ++-------------------\n 6 files changed, 156 insertions(+), 140 deletions(-)", "diff": "diff --git a/drivers/common/idpf/idpf_common_device.c b/drivers/common/idpf/idpf_common_device.c\nindex b2b42443e4..2aad9bcdd3 100644\n--- a/drivers/common/idpf/idpf_common_device.c\n+++ b/drivers/common/idpf/idpf_common_device.c\n@@ -158,4 +158,132 @@ idpf_adapter_deinit(struct idpf_adapter *adapter)\n \treturn 0;\n }\n \n+int\n+idpf_vport_init(struct idpf_vport *vport,\n+\t\tstruct virtchnl2_create_vport *create_vport_info,\n+\t\tvoid *dev_data)\n+{\n+\tstruct virtchnl2_create_vport *vport_info;\n+\tint i, type, ret;\n+\n+\tvport->vport_info = rte_zmalloc(NULL, IDPF_DFLT_MBX_BUF_SIZE, 0);\n+\tif (vport->vport_info == NULL) {\n+\t\tDRV_LOG(ERR, \"Failed to allocate vport_info\");\n+\t\tret = -ENOMEM;\n+\t\tgoto err_vport_info;\n+\t}\n+\n+\tret = idpf_vc_create_vport(vport, create_vport_info);\n+\tif (ret != 0) {\n+\t\tDRV_LOG(ERR, \"Failed to create vport.\");\n+\t\tgoto err_create_vport;\n+\t}\n+\n+\tvport_info = vport->vport_info;\n+\tvport->vport_id = vport_info->vport_id;\n+\tvport->txq_model = vport_info->txq_model;\n+\tvport->rxq_model = vport_info->rxq_model;\n+\tvport->num_tx_q = vport_info->num_tx_q;\n+\tvport->num_tx_complq = vport_info->num_tx_complq;\n+\tvport->num_rx_q = vport_info->num_rx_q;\n+\tvport->num_rx_bufq = vport_info->num_rx_bufq;\n+\tvport->max_mtu = vport_info->max_mtu;\n+\trte_memcpy(vport->default_mac_addr,\n+\t\t vport_info->default_mac_addr, ETH_ALEN);\n+\tvport->rss_algorithm = vport_info->rss_algorithm;\n+\tvport->rss_key_size = RTE_MIN(IDPF_RSS_KEY_LEN,\n+\t\t\t\t vport_info->rss_key_size);\n+\tvport->rss_lut_size = vport_info->rss_lut_size;\n+\n+\tfor (i = 0; i < vport_info->chunks.num_chunks; i++) {\n+\t\ttype = vport_info->chunks.chunks[i].type;\n+\t\tswitch (type) {\n+\t\tcase VIRTCHNL2_QUEUE_TYPE_TX:\n+\t\t\tvport->chunks_info.tx_start_qid =\n+\t\t\t\tvport_info->chunks.chunks[i].start_queue_id;\n+\t\t\tvport->chunks_info.tx_qtail_start =\n+\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_start;\n+\t\t\tvport->chunks_info.tx_qtail_spacing =\n+\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_spacing;\n+\t\t\tbreak;\n+\t\tcase VIRTCHNL2_QUEUE_TYPE_RX:\n+\t\t\tvport->chunks_info.rx_start_qid =\n+\t\t\t\tvport_info->chunks.chunks[i].start_queue_id;\n+\t\t\tvport->chunks_info.rx_qtail_start =\n+\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_start;\n+\t\t\tvport->chunks_info.rx_qtail_spacing =\n+\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_spacing;\n+\t\t\tbreak;\n+\t\tcase VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION:\n+\t\t\tvport->chunks_info.tx_compl_start_qid =\n+\t\t\t\tvport_info->chunks.chunks[i].start_queue_id;\n+\t\t\tvport->chunks_info.tx_compl_qtail_start =\n+\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_start;\n+\t\t\tvport->chunks_info.tx_compl_qtail_spacing =\n+\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_spacing;\n+\t\t\tbreak;\n+\t\tcase VIRTCHNL2_QUEUE_TYPE_RX_BUFFER:\n+\t\t\tvport->chunks_info.rx_buf_start_qid =\n+\t\t\t\tvport_info->chunks.chunks[i].start_queue_id;\n+\t\t\tvport->chunks_info.rx_buf_qtail_start =\n+\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_start;\n+\t\t\tvport->chunks_info.rx_buf_qtail_spacing =\n+\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_spacing;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tDRV_LOG(ERR, \"Unsupported queue type\");\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tvport->dev_data = dev_data;\n+\n+\tvport->rss_key = rte_zmalloc(\"rss_key\",\n+\t\t\t\t vport->rss_key_size, 0);\n+\tif (vport->rss_key == NULL) {\n+\t\tDRV_LOG(ERR, \"Failed to allocate RSS key\");\n+\t\tret = -ENOMEM;\n+\t\tgoto err_rss_key;\n+\t}\n+\n+\tvport->rss_lut = rte_zmalloc(\"rss_lut\",\n+\t\t\t\t sizeof(uint32_t) * vport->rss_lut_size, 0);\n+\tif (vport->rss_lut == NULL) {\n+\t\tDRV_LOG(ERR, \"Failed to allocate RSS lut\");\n+\t\tret = -ENOMEM;\n+\t\tgoto err_rss_lut;\n+\t}\n+\n+\treturn 0;\n+\n+err_rss_lut:\n+\tvport->dev_data = NULL;\n+\trte_free(vport->rss_key);\n+\tvport->rss_key = NULL;\n+err_rss_key:\n+\tidpf_vc_destroy_vport(vport);\n+err_create_vport:\n+\trte_free(vport->vport_info);\n+\tvport->vport_info = NULL;\n+err_vport_info:\n+\treturn ret;\n+}\n+int\n+idpf_vport_deinit(struct idpf_vport *vport)\n+{\n+\trte_free(vport->rss_lut);\n+\tvport->rss_lut = NULL;\n+\n+\trte_free(vport->rss_key);\n+\tvport->rss_key = NULL;\n+\n+\tvport->dev_data = NULL;\n+\n+\trte_free(vport->vport_info);\n+\tvport->vport_info = NULL;\n+\n+\tidpf_vc_destroy_vport(vport);\n+\n+\treturn 0;\n+}\n RTE_LOG_REGISTER_SUFFIX(idpf_common_logtype, common, NOTICE);\ndiff --git a/drivers/common/idpf/idpf_common_device.h b/drivers/common/idpf/idpf_common_device.h\nindex e4344ea392..1f7483fd85 100644\n--- a/drivers/common/idpf/idpf_common_device.h\n+++ b/drivers/common/idpf/idpf_common_device.h\n@@ -9,6 +9,8 @@\n #include <base/virtchnl2.h>\n #include <idpf_common_logs.h>\n \n+#define IDPF_RSS_KEY_LEN\t52\n+\n #define IDPF_CTLQ_ID\t\t-1\n #define IDPF_CTLQ_LEN\t\t64\n #define IDPF_DFLT_MBX_BUF_SIZE\t4096\n@@ -142,5 +144,11 @@ __rte_internal\n int idpf_adapter_init(struct idpf_adapter *adapter);\n __rte_internal\n int idpf_adapter_deinit(struct idpf_adapter *adapter);\n+__rte_internal\n+int idpf_vport_init(struct idpf_vport *vport,\n+\t\t struct virtchnl2_create_vport *vport_req_info,\n+\t\t void *dev_data);\n+__rte_internal\n+int idpf_vport_deinit(struct idpf_vport *vport);\n \n #endif /* _IDPF_COMMON_DEVICE_H_ */\ndiff --git a/drivers/common/idpf/idpf_common_virtchnl.c b/drivers/common/idpf/idpf_common_virtchnl.c\nindex 2e94a95876..e7ba32c532 100644\n--- a/drivers/common/idpf/idpf_common_virtchnl.c\n+++ b/drivers/common/idpf/idpf_common_virtchnl.c\n@@ -355,7 +355,7 @@ idpf_vc_get_caps(struct idpf_adapter *adapter)\n \n int\n idpf_vc_create_vport(struct idpf_vport *vport,\n-\t\t struct virtchnl2_create_vport *vport_req_info)\n+\t\t struct virtchnl2_create_vport *create_vport_info)\n {\n \tstruct idpf_adapter *adapter = vport->adapter;\n \tstruct virtchnl2_create_vport vport_msg;\n@@ -363,13 +363,13 @@ idpf_vc_create_vport(struct idpf_vport *vport,\n \tint err = -1;\n \n \tmemset(&vport_msg, 0, sizeof(struct virtchnl2_create_vport));\n-\tvport_msg.vport_type = vport_req_info->vport_type;\n-\tvport_msg.txq_model = vport_req_info->txq_model;\n-\tvport_msg.rxq_model = vport_req_info->rxq_model;\n-\tvport_msg.num_tx_q = vport_req_info->num_tx_q;\n-\tvport_msg.num_tx_complq = vport_req_info->num_tx_complq;\n-\tvport_msg.num_rx_q = vport_req_info->num_rx_q;\n-\tvport_msg.num_rx_bufq = vport_req_info->num_rx_bufq;\n+\tvport_msg.vport_type = create_vport_info->vport_type;\n+\tvport_msg.txq_model = create_vport_info->txq_model;\n+\tvport_msg.rxq_model = create_vport_info->rxq_model;\n+\tvport_msg.num_tx_q = create_vport_info->num_tx_q;\n+\tvport_msg.num_tx_complq = create_vport_info->num_tx_complq;\n+\tvport_msg.num_rx_q = create_vport_info->num_rx_q;\n+\tvport_msg.num_rx_bufq = create_vport_info->num_rx_bufq;\n \n \tmemset(&args, 0, sizeof(args));\n \targs.ops = VIRTCHNL2_OP_CREATE_VPORT;\ndiff --git a/drivers/common/idpf/idpf_common_virtchnl.h b/drivers/common/idpf/idpf_common_virtchnl.h\nindex a1bae81372..e9e1c172eb 100644\n--- a/drivers/common/idpf/idpf_common_virtchnl.h\n+++ b/drivers/common/idpf/idpf_common_virtchnl.h\n@@ -9,10 +9,8 @@\n \n int idpf_vc_check_api_version(struct idpf_adapter *adapter);\n int idpf_vc_get_caps(struct idpf_adapter *adapter);\n-__rte_internal\n int idpf_vc_create_vport(struct idpf_vport *vport,\n \t\t\t struct virtchnl2_create_vport *vport_info);\n-__rte_internal\n int idpf_vc_destroy_vport(struct idpf_vport *vport);\n __rte_internal\n int idpf_vc_set_rss_key(struct idpf_vport *vport);\ndiff --git a/drivers/common/idpf/version.map b/drivers/common/idpf/version.map\nindex 535fa1fc24..172906fcfa 100644\n--- a/drivers/common/idpf/version.map\n+++ b/drivers/common/idpf/version.map\n@@ -7,8 +7,6 @@ INTERNAL {\n \tidpf_ctlq_recv;\n \tidpf_ctlq_send;\n \tidpf_ctlq_post_rx_buffs;\n-\tidpf_vc_create_vport;\n-\tidpf_vc_destroy_vport;\n \tidpf_vc_set_rss_key;\n \tidpf_vc_set_rss_lut;\n \tidpf_vc_set_rss_hash;\n@@ -23,6 +21,8 @@ INTERNAL {\n \tidpf_execute_vc_cmd;\n \tidpf_adapter_init;\n \tidpf_adapter_deinit;\n+\tidpf_vport_init;\n+\tidpf_vport_deinit;\n \n \tlocal: *;\n };\ndiff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c\nindex 46529cebf9..f56d1171c9 100644\n--- a/drivers/net/idpf/idpf_ethdev.c\n+++ b/drivers/net/idpf/idpf_ethdev.c\n@@ -169,73 +169,6 @@ idpf_init_vport_req_info(struct rte_eth_dev *dev,\n \treturn 0;\n }\n \n-#define IDPF_RSS_KEY_LEN 52\n-\n-static int\n-idpf_init_vport(struct idpf_vport *vport)\n-{\n-\tstruct virtchnl2_create_vport *vport_info = vport->vport_info;\n-\tint i, type;\n-\n-\tvport->vport_id = vport_info->vport_id;\n-\tvport->txq_model = vport_info->txq_model;\n-\tvport->rxq_model = vport_info->rxq_model;\n-\tvport->num_tx_q = vport_info->num_tx_q;\n-\tvport->num_tx_complq = vport_info->num_tx_complq;\n-\tvport->num_rx_q = vport_info->num_rx_q;\n-\tvport->num_rx_bufq = vport_info->num_rx_bufq;\n-\tvport->max_mtu = vport_info->max_mtu;\n-\trte_memcpy(vport->default_mac_addr,\n-\t\t vport_info->default_mac_addr, ETH_ALEN);\n-\tvport->rss_algorithm = vport_info->rss_algorithm;\n-\tvport->rss_key_size = RTE_MIN(IDPF_RSS_KEY_LEN,\n-\t\t\t\t vport_info->rss_key_size);\n-\tvport->rss_lut_size = vport_info->rss_lut_size;\n-\n-\tfor (i = 0; i < vport_info->chunks.num_chunks; i++) {\n-\t\ttype = vport_info->chunks.chunks[i].type;\n-\t\tswitch (type) {\n-\t\tcase VIRTCHNL2_QUEUE_TYPE_TX:\n-\t\t\tvport->chunks_info.tx_start_qid =\n-\t\t\t\tvport_info->chunks.chunks[i].start_queue_id;\n-\t\t\tvport->chunks_info.tx_qtail_start =\n-\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_start;\n-\t\t\tvport->chunks_info.tx_qtail_spacing =\n-\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_spacing;\n-\t\t\tbreak;\n-\t\tcase VIRTCHNL2_QUEUE_TYPE_RX:\n-\t\t\tvport->chunks_info.rx_start_qid =\n-\t\t\t\tvport_info->chunks.chunks[i].start_queue_id;\n-\t\t\tvport->chunks_info.rx_qtail_start =\n-\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_start;\n-\t\t\tvport->chunks_info.rx_qtail_spacing =\n-\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_spacing;\n-\t\t\tbreak;\n-\t\tcase VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION:\n-\t\t\tvport->chunks_info.tx_compl_start_qid =\n-\t\t\t\tvport_info->chunks.chunks[i].start_queue_id;\n-\t\t\tvport->chunks_info.tx_compl_qtail_start =\n-\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_start;\n-\t\t\tvport->chunks_info.tx_compl_qtail_spacing =\n-\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_spacing;\n-\t\t\tbreak;\n-\t\tcase VIRTCHNL2_QUEUE_TYPE_RX_BUFFER:\n-\t\t\tvport->chunks_info.rx_buf_start_qid =\n-\t\t\t\tvport_info->chunks.chunks[i].start_queue_id;\n-\t\t\tvport->chunks_info.rx_buf_qtail_start =\n-\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_start;\n-\t\t\tvport->chunks_info.rx_buf_qtail_spacing =\n-\t\t\t\tvport_info->chunks.chunks[i].qtail_reg_spacing;\n-\t\t\tbreak;\n-\t\tdefault:\n-\t\t\tPMD_INIT_LOG(ERR, \"Unsupported queue type\");\n-\t\t\tbreak;\n-\t\t}\n-\t}\n-\n-\treturn 0;\n-}\n-\n static int\n idpf_config_rss(struct idpf_vport *vport)\n {\n@@ -267,63 +200,34 @@ idpf_init_rss(struct idpf_vport *vport)\n {\n \tstruct rte_eth_rss_conf *rss_conf;\n \tstruct rte_eth_dev_data *dev_data;\n-\tuint16_t i, nb_q, lut_size;\n+\tuint16_t i, nb_q;\n \tint ret = 0;\n \n \tdev_data = vport->dev_data;\n \trss_conf = &dev_data->dev_conf.rx_adv_conf.rss_conf;\n \tnb_q = dev_data->nb_rx_queues;\n \n-\tvport->rss_key = rte_zmalloc(\"rss_key\",\n-\t\t\t\t vport->rss_key_size, 0);\n-\tif (vport->rss_key == NULL) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to allocate RSS key\");\n-\t\tret = -ENOMEM;\n-\t\tgoto err_alloc_key;\n-\t}\n-\n-\tlut_size = vport->rss_lut_size;\n-\tvport->rss_lut = rte_zmalloc(\"rss_lut\",\n-\t\t\t\t sizeof(uint32_t) * lut_size, 0);\n-\tif (vport->rss_lut == NULL) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to allocate RSS lut\");\n-\t\tret = -ENOMEM;\n-\t\tgoto err_alloc_lut;\n-\t}\n-\n \tif (rss_conf->rss_key == NULL) {\n \t\tfor (i = 0; i < vport->rss_key_size; i++)\n \t\t\tvport->rss_key[i] = (uint8_t)rte_rand();\n \t} else if (rss_conf->rss_key_len != vport->rss_key_size) {\n \t\tPMD_INIT_LOG(ERR, \"Invalid RSS key length in RSS configuration, should be %d\",\n \t\t\t vport->rss_key_size);\n-\t\tret = -EINVAL;\n-\t\tgoto err_cfg_key;\n+\t\treturn -EINVAL;\n \t} else {\n \t\trte_memcpy(vport->rss_key, rss_conf->rss_key,\n \t\t\t vport->rss_key_size);\n \t}\n \n-\tfor (i = 0; i < lut_size; i++)\n+\tfor (i = 0; i < vport->rss_lut_size; i++)\n \t\tvport->rss_lut[i] = i % nb_q;\n \n \tvport->rss_hf = IDPF_DEFAULT_RSS_HASH_EXPANDED;\n \n \tret = idpf_config_rss(vport);\n-\tif (ret != 0) {\n+\tif (ret != 0)\n \t\tPMD_INIT_LOG(ERR, \"Failed to configure RSS\");\n-\t\tgoto err_cfg_key;\n-\t}\n-\n-\treturn ret;\n \n-err_cfg_key:\n-\trte_free(vport->rss_lut);\n-\tvport->rss_lut = NULL;\n-err_alloc_lut:\n-\trte_free(vport->rss_key);\n-\tvport->rss_key = NULL;\n-err_alloc_key:\n \treturn ret;\n }\n \n@@ -597,13 +501,7 @@ idpf_dev_close(struct rte_eth_dev *dev)\n \n \tidpf_dev_stop(dev);\n \n-\tidpf_vc_destroy_vport(vport);\n-\n-\trte_free(vport->rss_lut);\n-\tvport->rss_lut = NULL;\n-\n-\trte_free(vport->rss_key);\n-\tvport->rss_key = NULL;\n+\tidpf_vport_deinit(vport);\n \n \trte_free(vport->recv_vectors);\n \tvport->recv_vectors = NULL;\n@@ -887,13 +785,6 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params)\n \tvport->sw_idx = param->idx;\n \tvport->devarg_id = param->devarg_id;\n \n-\tvport->vport_info = rte_zmalloc(NULL, IDPF_DFLT_MBX_BUF_SIZE, 0);\n-\tif (vport->vport_info == NULL) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to allocate vport_info\");\n-\t\tret = -ENOMEM;\n-\t\tgoto err;\n-\t}\n-\n \tmemset(&vport_req_info, 0, sizeof(vport_req_info));\n \tret = idpf_init_vport_req_info(dev, &vport_req_info);\n \tif (ret != 0) {\n@@ -901,19 +792,12 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params)\n \t\tgoto err;\n \t}\n \n-\tret = idpf_vc_create_vport(vport, &vport_req_info);\n-\tif (ret != 0) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to create vport.\");\n-\t\tgoto err_create_vport;\n-\t}\n-\n-\tret = idpf_init_vport(vport);\n+\tret = idpf_vport_init(vport, &vport_req_info, dev->data);\n \tif (ret != 0) {\n \t\tPMD_INIT_LOG(ERR, \"Failed to init vports.\");\n-\t\tgoto err_init_vport;\n+\t\tgoto err;\n \t}\n \n-\tvport->dev_data = dev->data;\n \tadapter->vports[param->idx] = vport;\n \tadapter->cur_vports |= RTE_BIT32(param->devarg_id);\n \tadapter->cur_vport_nb++;\n@@ -922,7 +806,7 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params)\n \tif (dev->data->mac_addrs == NULL) {\n \t\tPMD_INIT_LOG(ERR, \"Cannot allocate mac_addr memory.\");\n \t\tret = -ENOMEM;\n-\t\tgoto err_init_vport;\n+\t\tgoto err_mac_addrs;\n \t}\n \n \trte_ether_addr_copy((struct rte_ether_addr *)vport->default_mac_addr,\n@@ -930,11 +814,9 @@ idpf_dev_vport_init(struct rte_eth_dev *dev, void *init_params)\n \n \treturn 0;\n \n-err_init_vport:\n+err_mac_addrs:\n \tadapter->vports[param->idx] = NULL; /* reset */\n-\tidpf_vc_destroy_vport(vport);\n-err_create_vport:\n-\trte_free(vport->vport_info);\n+\tidpf_vport_deinit(vport);\n err:\n \treturn ret;\n }\n", "prefixes": [ "05/15" ] }{ "id": 120560, "url": "