Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/60193/?format=api
http://patches.dpdk.org/api/patches/60193/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/9e7e0a9b186e756ac3099fd0c21dd33cc8a2ff02.1569850827.git.cloud.wangxiaoyun@huawei.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": "<9e7e0a9b186e756ac3099fd0c21dd33cc8a2ff02.1569850827.git.cloud.wangxiaoyun@huawei.com>", "list_archive_url": "https://inbox.dpdk.org/dev/9e7e0a9b186e756ac3099fd0c21dd33cc8a2ff02.1569850827.git.cloud.wangxiaoyun@huawei.com", "date": "2019-09-30T14:00:44", "name": "[v3,06/19] net/hinic: add unicast and multicast MAC set", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "cd9db434cd7ae5272bef07b4cf76d4874a06d593", "submitter": { "id": 1446, "url": "http://patches.dpdk.org/api/people/1446/?format=api", "name": "Wangxiaoyun (Cloud)", "email": "cloud.wangxiaoyun@huawei.com" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/9e7e0a9b186e756ac3099fd0c21dd33cc8a2ff02.1569850827.git.cloud.wangxiaoyun@huawei.com/mbox/", "series": [ { "id": 6622, "url": "http://patches.dpdk.org/api/series/6622/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=6622", "date": "2019-09-30T14:00:38", "name": "Add advanced features for Huawei hinic pmd", "version": 3, "mbox": "http://patches.dpdk.org/series/6622/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/60193/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/60193/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 367524CE4;\n\tMon, 30 Sep 2019 15:48:21 +0200 (CEST)", "from huawei.com (szxga06-in.huawei.com [45.249.212.32])\n\tby dpdk.org (Postfix) with ESMTP id 897644CA6\n\tfor <dev@dpdk.org>; Mon, 30 Sep 2019 15:48:19 +0200 (CEST)", "from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58])\n\tby Forcepoint Email with ESMTP id D2C02B618AD21A1095FA\n\tfor <dev@dpdk.org>; Mon, 30 Sep 2019 21:48:17 +0800 (CST)", "from tester.localdomain (10.175.119.39) by\n\tDGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP\n\tServer id 14.3.439.0; Mon, 30 Sep 2019 21:48:07 +0800" ], "From": "Xiaoyun wang <cloud.wangxiaoyun@huawei.com>", "To": "<ferruh.yigit@intel.com>", "CC": "<dev@dpdk.org>, <xuanziyang2@huawei.com>, <shahar.belkar@huawei.com>,\n\t<luoxianjun@huawei.com>, <tanya.brokhman@huawei.com>,\n\t<zhouguoyang@huawei.com>, <wulike1@huawei.com>, Xiaoyun wang\n\t<cloud.wangxiaoyun@huawei.com>", "Date": "Mon, 30 Sep 2019 22:00:44 +0800", "Message-ID": "<9e7e0a9b186e756ac3099fd0c21dd33cc8a2ff02.1569850827.git.cloud.wangxiaoyun@huawei.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<cover.1569850826.git.cloud.wangxiaoyun@huawei.com>", "References": "<cover.1569850826.git.cloud.wangxiaoyun@huawei.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Originating-IP": "[10.175.119.39]", "X-CFilter-Loop": "Reflected", "Subject": "[dpdk-dev] [PATCH v3 06/19] net/hinic: add unicast and multicast\n\tMAC set", "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This patch adds unicast and multicast set interfaces.\nApplication can add or remove unicast MAC address, also can set\nmulticast MAC address, tha maximum multicast list size is 2048.\n\nSigned-off-by: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>\n---\n doc/guides/nics/hinic.rst | 2 +\n drivers/net/hinic/base/hinic_pmd_niccfg.c | 55 +++++++\n drivers/net/hinic/hinic_pmd_ethdev.c | 260 +++++++++++++++++++++++++++---\n drivers/net/hinic/hinic_pmd_ethdev.h | 2 +\n 4 files changed, 298 insertions(+), 21 deletions(-)", "diff": "diff --git a/doc/guides/nics/hinic.rst b/doc/guides/nics/hinic.rst\nindex 681519c..4df5f16 100644\n--- a/doc/guides/nics/hinic.rst\n+++ b/doc/guides/nics/hinic.rst\n@@ -28,6 +28,8 @@ Features\n - VLAN filter and VLAN offload\n - Allmulticast mode\n - MTU update\n+- Unicast MAC filter\n+- Multicast MAC filter\n \n Prerequisites\n -------------\ndiff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.c b/drivers/net/hinic/base/hinic_pmd_niccfg.c\nindex 8bd7ed6..054925c 100644\n--- a/drivers/net/hinic/base/hinic_pmd_niccfg.c\n+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.c\n@@ -250,6 +250,61 @@ int hinic_get_default_mac(void *hwdev, u8 *mac_addr)\n }\n \n /**\n+* hinic_update_mac - Update mac address to hardware.\n+*\n+* @param hwdev\n+* The hardware interface of a nic device.\n+* @param old_mac\n+* Old mac address.\n+* @param new_mac\n+* New mac address.\n+* @param vlan_id\n+* Set 0 for mac_vlan table initialization.\n+* @param func_id\n+* Global function id of NIC.\n+*\n+* @return\n+* 0 on success.\n+* negative error value otherwise.\n+*/\n+int hinic_update_mac(void *hwdev, u8 *old_mac, u8 *new_mac, u16 vlan_id,\n+\t\t u16 func_id)\n+{\n+\tstruct hinic_port_mac_update mac_info;\n+\tu16 out_size = sizeof(mac_info);\n+\tint err;\n+\n+\tif (!hwdev || !old_mac || !new_mac) {\n+\t\tPMD_DRV_LOG(ERR, \"Hwdev, old_mac or new_mac is NULL\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tmemset(&mac_info, 0, sizeof(mac_info));\n+\tmac_info.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;\n+\tmac_info.func_id = func_id;\n+\tmac_info.vlan_id = vlan_id;\n+\tmemcpy(mac_info.old_mac, old_mac, ETH_ALEN);\n+\tmemcpy(mac_info.new_mac, new_mac, ETH_ALEN);\n+\n+\terr = l2nic_msg_to_mgmt_sync(hwdev, HINIC_PORT_CMD_UPDATE_MAC,\n+\t\t\t\t &mac_info, sizeof(mac_info),\n+\t\t\t\t &mac_info, &out_size);\n+\tif (err || !out_size ||\n+\t (mac_info.mgmt_msg_head.status &&\n+\t mac_info.mgmt_msg_head.status != HINIC_PF_SET_VF_ALREADY)) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to update MAC, err: %d, status: 0x%x, out size: 0x%x\\n\",\n+\t\t\t err, mac_info.mgmt_msg_head.status, out_size);\n+\t\treturn -EINVAL;\n+\t}\n+\tif (mac_info.mgmt_msg_head.status == HINIC_PF_SET_VF_ALREADY) {\n+\t\tPMD_DRV_LOG(WARNING, \"PF has already set vf mac, Ignore update operation.\\n\");\n+\t\treturn HINIC_PF_SET_VF_ALREADY;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/**\n * hinic_set_port_mtu - Set MTU to port.\n *\n * @param hwdev\ndiff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c\nindex 96967a3..91b4f98 100644\n--- a/drivers/net/hinic/hinic_pmd_ethdev.c\n+++ b/drivers/net/hinic/hinic_pmd_ethdev.c\n@@ -51,8 +51,8 @@\n #define NR_MAX_COS\t\t\t8\n \n #define HINIC_MIN_RX_BUF_SIZE\t\t1024\n-#define HINIC_MAX_MAC_ADDRS\t\t1\n-\n+#define HINIC_MAX_UC_MAC_ADDRS\t\t128\n+#define HINIC_MAX_MC_MAC_ADDRS\t\t2048\n /*\n * vlan_id is a 12 bit number.\n * The VFTA array is actually a 4096 bit array, 128 of 32bit elements.\n@@ -716,7 +716,7 @@ static void hinic_get_speed_capa(struct rte_eth_dev *dev, uint32_t *speed_capa)\n \tinfo->max_tx_queues = nic_dev->nic_cap.max_sqs;\n \tinfo->min_rx_bufsize = HINIC_MIN_RX_BUF_SIZE;\n \tinfo->max_rx_pktlen = HINIC_MAX_JUMBO_FRAME_SIZE;\n-\tinfo->max_mac_addrs = HINIC_MAX_MAC_ADDRS;\n+\tinfo->max_mac_addrs = HINIC_MAX_UC_MAC_ADDRS;\n \tinfo->min_mtu = HINIC_MIN_MTU_SIZE;\n \tinfo->max_mtu = HINIC_MAX_MTU_SIZE;\n \n@@ -1342,21 +1342,41 @@ static int hinic_init_mac_addr(struct rte_eth_dev *eth_dev)\n \tif (rc)\n \t\treturn rc;\n \n-\tmemmove(eth_dev->data->mac_addrs->addr_bytes,\n-\t\taddr_bytes, RTE_ETHER_ADDR_LEN);\n-\n-\tif (rte_is_zero_ether_addr(eth_dev->data->mac_addrs))\n-\t\thinic_gen_random_mac_addr(eth_dev->data->mac_addrs);\n+\trte_ether_addr_copy((struct rte_ether_addr *)addr_bytes,\n+\t\tð_dev->data->mac_addrs[0]);\n+\tif (rte_is_zero_ether_addr(ð_dev->data->mac_addrs[0]))\n+\t\thinic_gen_random_mac_addr(ð_dev->data->mac_addrs[0]);\n \n \tfunc_id = hinic_global_func_id(nic_dev->hwdev);\n-\trc = hinic_set_mac(nic_dev->hwdev, eth_dev->data->mac_addrs->addr_bytes,\n-\t\t\t 0, func_id);\n+\trc = hinic_set_mac(nic_dev->hwdev,\n+\t\t\teth_dev->data->mac_addrs[0].addr_bytes,\n+\t\t\t0, func_id);\n \tif (rc && rc != HINIC_PF_SET_VF_ALREADY)\n \t\treturn rc;\n \n+\trte_ether_addr_copy(ð_dev->data->mac_addrs[0],\n+\t\t\t&nic_dev->default_addr);\n+\n \treturn 0;\n }\n \n+static void hinic_delete_mc_addr_list(struct hinic_nic_dev *nic_dev)\n+{\n+\tu16 func_id;\n+\tu32 i;\n+\n+\tfunc_id = hinic_global_func_id(nic_dev->hwdev);\n+\n+\tfor (i = 0; i < HINIC_MAX_MC_MAC_ADDRS; i++) {\n+\t\tif (rte_is_zero_ether_addr(&nic_dev->mc_list[i]))\n+\t\t\tbreak;\n+\n+\t\thinic_del_mac(nic_dev->hwdev, nic_dev->mc_list[i].addr_bytes,\n+\t\t\t 0, func_id);\n+\t\tmemset(&nic_dev->mc_list[i], 0, sizeof(struct rte_ether_addr));\n+\t}\n+}\n+\n /**\n * Deinit mac_vlan table in NIC.\n *\n@@ -1371,19 +1391,29 @@ static void hinic_deinit_mac_addr(struct rte_eth_dev *eth_dev)\n {\n \tstruct hinic_nic_dev *nic_dev =\n \t\t\t\tHINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(eth_dev);\n-\tint rc;\n \tu16 func_id = 0;\n-\n-\tif (rte_is_zero_ether_addr(eth_dev->data->mac_addrs))\n-\t\treturn;\n+\tint rc;\n+\tint i;\n \n \tfunc_id = hinic_global_func_id(nic_dev->hwdev);\n-\trc = hinic_del_mac(nic_dev->hwdev,\n-\t\t\t eth_dev->data->mac_addrs->addr_bytes,\n-\t\t\t 0, func_id);\n-\tif (rc && rc != HINIC_PF_SET_VF_ALREADY)\n-\t\tPMD_DRV_LOG(ERR, \"Delete mac table failed, dev_name: %s\",\n-\t\t\t eth_dev->data->name);\n+\n+\tfor (i = 0; i < HINIC_MAX_UC_MAC_ADDRS; i++) {\n+\t\tif (rte_is_zero_ether_addr(ð_dev->data->mac_addrs[i]))\n+\t\t\tcontinue;\n+\n+\t\trc = hinic_del_mac(nic_dev->hwdev,\n+\t\t\t\t eth_dev->data->mac_addrs[i].addr_bytes,\n+\t\t\t\t 0, func_id);\n+\t\tif (rc && rc != HINIC_PF_SET_VF_ALREADY)\n+\t\t\tPMD_DRV_LOG(ERR, \"Delete mac table failed, dev_name: %s\",\n+\t\t\t\t eth_dev->data->name);\n+\n+\t\tmemset(ð_dev->data->mac_addrs[i], 0,\n+\t\t sizeof(struct rte_ether_addr));\n+\t}\n+\n+\t/* delete multicast mac addrs */\n+\thinic_delete_mc_addr_list(nic_dev);\n }\n \n static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)\n@@ -2091,6 +2121,169 @@ static int hinic_dev_xstats_get_names(struct rte_eth_dev *dev,\n \n \treturn count;\n }\n+/**\n+ * DPDK callback to set mac address\n+ *\n+ * @param dev\n+ * Pointer to Ethernet device structure.\n+ * @param addr\n+ * Pointer to mac address\n+ * @return\n+ * 0 on success, negative error value otherwise.\n+ */\n+static int hinic_set_mac_addr(struct rte_eth_dev *dev,\n+\t\t\t struct rte_ether_addr *addr)\n+{\n+\tstruct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n+\tu16 func_id;\n+\tint err;\n+\n+\tfunc_id = hinic_global_func_id(nic_dev->hwdev);\n+\terr = hinic_update_mac(nic_dev->hwdev, nic_dev->default_addr.addr_bytes,\n+\t\t\t addr->addr_bytes, 0, func_id);\n+\tif (err)\n+\t\treturn err;\n+\n+\trte_ether_addr_copy(addr, &nic_dev->default_addr);\n+\n+\tPMD_DRV_LOG(INFO, \"Set new mac address %02x:%02x:%02x:%02x:%02x:%02x\\n\",\n+\t\t addr->addr_bytes[0], addr->addr_bytes[1],\n+\t\t addr->addr_bytes[2], addr->addr_bytes[3],\n+\t\t addr->addr_bytes[4], addr->addr_bytes[5]);\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * DPDK callback to remove a MAC address.\n+ *\n+ * @param dev\n+ * Pointer to Ethernet device structure.\n+ * @param index\n+ * MAC address index.\n+ */\n+static void hinic_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)\n+{\n+\tstruct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n+\tu16 func_id;\n+\tint ret;\n+\n+\tif (index >= HINIC_MAX_UC_MAC_ADDRS) {\n+\t\tPMD_DRV_LOG(INFO, \"Remove mac index(%u) is out of range\",\n+\t\t\t index);\n+\t\treturn;\n+\t}\n+\n+\tfunc_id = hinic_global_func_id(nic_dev->hwdev);\n+\tret = hinic_del_mac(nic_dev->hwdev,\n+\t\t\t dev->data->mac_addrs[index].addr_bytes, 0, func_id);\n+\tif (ret)\n+\t\treturn;\n+\n+\tmemset(&dev->data->mac_addrs[index], 0, sizeof(struct rte_ether_addr));\n+}\n+\n+/**\n+ * DPDK callback to add a MAC address.\n+ *\n+ * @param dev\n+ * Pointer to Ethernet device structure.\n+ * @param mac_addr\n+ * MAC address to register.\n+ * @param index\n+ * MAC address index.\n+ * @param vmdq\n+ * VMDq pool index to associate address with (ignored).\n+ *\n+ * @return\n+ * 0 on success, a negative errno value otherwise and rte_errno is set.\n+ */\n+\n+static int hinic_mac_addr_add(struct rte_eth_dev *dev,\n+\t\t\t struct rte_ether_addr *mac_addr, uint32_t index,\n+\t\t\t __rte_unused uint32_t vmdq)\n+{\n+\tstruct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n+\tunsigned int i;\n+\tu16 func_id;\n+\tint ret;\n+\n+\tif (index >= HINIC_MAX_UC_MAC_ADDRS) {\n+\t\tPMD_DRV_LOG(INFO, \"Add mac index(%u) is out of range,\", index);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\t/* First, make sure this address isn't already configured. */\n+\tfor (i = 0; (i != HINIC_MAX_UC_MAC_ADDRS); ++i) {\n+\t\t/* Skip this index, it's going to be reconfigured. */\n+\t\tif (i == index)\n+\t\t\tcontinue;\n+\n+\t\tif (memcmp(&dev->data->mac_addrs[i],\n+\t\t\tmac_addr, sizeof(*mac_addr)))\n+\t\t\tcontinue;\n+\n+\t\tPMD_DRV_LOG(INFO, \"MAC address already configured\");\n+\t\treturn -EADDRINUSE;\n+\t}\n+\n+\tfunc_id = hinic_global_func_id(nic_dev->hwdev);\n+\tret = hinic_set_mac(nic_dev->hwdev, mac_addr->addr_bytes, 0, func_id);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tdev->data->mac_addrs[index] = *mac_addr;\n+\treturn 0;\n+}\n+\n+/**\n+ * DPDK callback to set multicast mac address\n+ *\n+ * @param dev\n+ * Pointer to Ethernet device structure.\n+ * @param mc_addr_set\n+ * Pointer to multicast mac address\n+ * @param nb_mc_addr\n+ * mc addr count\n+ * @return\n+ * 0 on success, negative error value otherwise.\n+ */\n+static int hinic_set_mc_addr_list(struct rte_eth_dev *dev,\n+\t\t\t\t struct rte_ether_addr *mc_addr_set,\n+\t\t\t\t uint32_t nb_mc_addr)\n+{\n+\tstruct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);\n+\tu16 func_id;\n+\tint ret;\n+\tu32 i;\n+\n+\tfunc_id = hinic_global_func_id(nic_dev->hwdev);\n+\n+\t/* delete old multi_cast addrs firstly */\n+\thinic_delete_mc_addr_list(nic_dev);\n+\n+\tif (nb_mc_addr > HINIC_MAX_MC_MAC_ADDRS)\n+\t\tgoto allmulti;\n+\n+\tfor (i = 0; i < nb_mc_addr; i++) {\n+\t\tret = hinic_set_mac(nic_dev->hwdev, mc_addr_set[i].addr_bytes,\n+\t\t\t\t 0, func_id);\n+\t\t/* if add mc addr failed, set all multi_cast */\n+\t\tif (ret) {\n+\t\t\thinic_delete_mc_addr_list(nic_dev);\n+\t\t\tgoto allmulti;\n+\t\t}\n+\n+\t\trte_ether_addr_copy(&mc_addr_set[i], &nic_dev->mc_list[i]);\n+\t}\n+\n+\treturn 0;\n+\n+allmulti:\n+\thinic_dev_allmulticast_enable(dev);\n+\n+\treturn 0;\n+}\n \n static int hinic_set_default_pause_feature(struct hinic_nic_dev *nic_dev)\n {\n@@ -2539,6 +2732,10 @@ static void hinic_dev_close(struct rte_eth_dev *dev)\n \t.xstats_get = hinic_dev_xstats_get,\n \t.xstats_reset = hinic_dev_xstats_reset,\n \t.xstats_get_names = hinic_dev_xstats_get_names,\n+\t.mac_addr_set = hinic_set_mac_addr,\n+\t.mac_addr_remove = hinic_mac_addr_remove,\n+\t.mac_addr_add = hinic_mac_addr_add,\n+\t.set_mc_addr_list = hinic_set_mc_addr_list,\n };\n \n static const struct eth_dev_ops hinic_pmd_vf_ops = {\n@@ -2566,6 +2763,10 @@ static void hinic_dev_close(struct rte_eth_dev *dev)\n \t.xstats_get = hinic_dev_xstats_get,\n \t.xstats_reset = hinic_dev_xstats_reset,\n \t.xstats_get_names = hinic_dev_xstats_get_names,\n+\t.mac_addr_set = hinic_set_mac_addr,\n+\t.mac_addr_remove = hinic_mac_addr_remove,\n+\t.mac_addr_add = hinic_mac_addr_add,\n+\t.set_mc_addr_list = hinic_set_mc_addr_list,\n };\n \n static int hinic_func_init(struct rte_eth_dev *eth_dev)\n@@ -2573,6 +2774,7 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)\n \tstruct rte_pci_device *pci_dev;\n \tstruct rte_ether_addr *eth_addr;\n \tstruct hinic_nic_dev *nic_dev;\n+\tu32 mac_size;\n \tint rc;\n \n \tpci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n@@ -2599,7 +2801,8 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)\n \t\t pci_dev->addr.devid, pci_dev->addr.function);\n \n \t/* alloc mac_addrs */\n-\teth_addr = rte_zmalloc(\"hinic_mac\", sizeof(*eth_addr), 0);\n+\tmac_size = HINIC_MAX_UC_MAC_ADDRS * sizeof(struct rte_ether_addr);\n+\teth_addr = rte_zmalloc(\"hinic_mac\", mac_size, 0);\n \tif (!eth_addr) {\n \t\tPMD_DRV_LOG(ERR, \"Allocate ethernet addresses' memory failed, dev_name: %s\",\n \t\t\t eth_dev->data->name);\n@@ -2608,6 +2811,15 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)\n \t}\n \teth_dev->data->mac_addrs = eth_addr;\n \n+\tmac_size = HINIC_MAX_MC_MAC_ADDRS * sizeof(struct rte_ether_addr);\n+\tnic_dev->mc_list = rte_zmalloc(\"hinic_mc\", mac_size, 0);\n+\tif (!nic_dev->mc_list) {\n+\t\tPMD_DRV_LOG(ERR, \"Allocate mcast address' memory failed, dev_name: %s\",\n+\t\t\t eth_dev->data->name);\n+\t\trc = -ENOMEM;\n+\t\tgoto mc_addr_fail;\n+\t}\n+\n \t/*\n \t * Pass the information to the rte_eth_dev_close() that it should also\n \t * release the private port resources.\n@@ -2672,6 +2884,10 @@ static int hinic_func_init(struct rte_eth_dev *eth_dev)\n \thinic_nic_dev_destroy(eth_dev);\n \n create_nic_dev_fail:\n+\trte_free(nic_dev->mc_list);\n+\tnic_dev->mc_list = NULL;\n+\n+mc_addr_fail:\n \trte_free(eth_addr);\n \teth_dev->data->mac_addrs = NULL;\n \n@@ -2716,6 +2932,8 @@ static int hinic_dev_uninit(struct rte_eth_dev *dev)\n \tdev->rx_pkt_burst = NULL;\n \tdev->tx_pkt_burst = NULL;\n \n+\trte_free(nic_dev->mc_list);\n+\n \trte_free(dev->data->mac_addrs);\n \tdev->data->mac_addrs = NULL;\n \ndiff --git a/drivers/net/hinic/hinic_pmd_ethdev.h b/drivers/net/hinic/hinic_pmd_ethdev.h\nindex f7a1167..b4f93ad 100644\n--- a/drivers/net/hinic/hinic_pmd_ethdev.h\n+++ b/drivers/net/hinic/hinic_pmd_ethdev.h\n@@ -56,6 +56,8 @@ struct hinic_nic_dev {\n \n \tu32 vfta[HINIC_VFTA_SIZE];\t/* VLAN bitmap */\n \n+\tstruct rte_ether_addr default_addr;\n+\tstruct rte_ether_addr *mc_list;\n \t/* info */\n \tunsigned int flags;\n \tstruct nic_service_cap nic_cap;\n", "prefixes": [ "v3", "06/19" ] }{ "id": 60193, "url": "