provided promiscuous/allmulticast ops.<br /> <br />Signed-off-by: Junlong Wang <wang.junlong1@zte.com.cn> <br />---<br /> doc/guides/nics/features/zxdh.ini | 2 +<br /> doc/guides/nics/zxdh.rst | 2 +<br /> drivers/net/zxdh/zxdh_ethdev.c | 21 ++-<br /> drivers/net/zxdh/zxdh_ethdev.h | 2 +<br /> drivers/net/zxdh/zxdh_ethdev_ops.c | 132 +++++++++++++++++<br /> drivers/net/zxdh/zxdh_ethdev_ops.h | 4 +<br /> drivers/net/zxdh/zxdh_msg.h | 10 ++<br /> drivers/net/zxdh/zxdh_tables.c | 223 +++++++++++++++++++++++++++++<br /> drivers/net/zxdh/zxdh_tables.h | 22 +++<br /> 9 files changed, 417 insertions(+), 1 deletion(-)<br /> <br />diff --git a/doc/guides/nics/features/zxdh.ini b/doc/guides/nics/features/zxdh.ini<br />index dc09fe3453..e9b237e102 100644<br />--- a/doc/guides/nics/features/zxdh.ini<br />+++ b/doc/guides/nics/features/zxdh.ini<br />@@ -14,3 +14,5 @@ Link status = Y<br /> Link status event = Y<br /> Unicast MAC filter = Y<br /> Multicast MAC filter = Y<br />+Promiscuous mode = Y<br />+Allmulticast mode = Y<br />diff --git a/doc/guides/nics/zxdh.rst b/doc/guides/nics/zxdh.rst<br />index e0b0776aca..0399df1302 100644<br />--- a/doc/guides/nics/zxdh.rst<br />+++ b/doc/guides/nics/zxdh.rst<br />@@ -26,6 +26,8 @@ Features of the ZXDH PMD are:<br /> - Set Link down or up<br /> - Unicast MAC filter<br /> - Multicast MAC filter<br />+- Promiscuous mode<br />+- Multicast mode<br /> <br /> <br /> Driver compilation and testing<br />diff --git a/drivers/net/zxdh/zxdh_ethdev.c b/drivers/net/zxdh/zxdh_ethdev.c<br />index 85ada87cdc..1d64b877c1 100644<br />--- a/drivers/net/zxdh/zxdh_ethdev.c<br />+++ b/drivers/net/zxdh/zxdh_ethdev.c<br />@@ -901,8 +901,16 @@ zxdh_tables_uninit(struct rte_eth_dev *dev)<br /> int ret;<br /> <br /> ret = zxdh_port_attr_uninit(dev);<br />- if (ret)<br />+ if (ret) {<br /> PMD_DRV_LOG(ERR, "zxdh_port_attr_uninit failed");<br />+ return ret;<br />+ }<br />+<br />+ ret = zxdh_promisc_table_uninit(dev);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "uninit promisc_table failed");<br />+ return ret;<br />+ }<br /> <br /> return ret;<br /> }<br />@@ -1055,6 +1063,10 @@ static const struct eth_dev_ops zxdh_eth_dev_ops = {<br /> .mac_addr_add = zxdh_dev_mac_addr_add,<br /> .mac_addr_remove = zxdh_dev_mac_addr_remove,<br /> .mac_addr_set = zxdh_dev_mac_addr_set,<br />+ .promiscuous_enable = zxdh_dev_promiscuous_enable,<br />+ .promiscuous_disable = zxdh_dev_promiscuous_disable,<br />+ .allmulticast_enable = zxdh_dev_allmulticast_enable,<br />+ .allmulticast_disable = zxdh_dev_allmulticast_disable,<br /> };<br /> <br /> static int32_t<br />@@ -1306,6 +1318,13 @@ zxdh_tables_init(struct rte_eth_dev *dev)<br /> PMD_DRV_LOG(ERR, " panel table init failed");<br /> return ret;<br /> }<br />+<br />+ ret = zxdh_promisc_table_init(dev);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "promisc_table_init failed");<br />+ return ret;<br />+ }<br />+<br /> return ret;<br /> }<br /> <br />diff --git a/drivers/net/zxdh/zxdh_ethdev.h b/drivers/net/zxdh/zxdh_ethdev.h<br />index 5b95cb1c2a..3cdac5de73 100644<br />--- a/drivers/net/zxdh/zxdh_ethdev.h<br />+++ b/drivers/net/zxdh/zxdh_ethdev.h<br />@@ -98,6 +98,8 @@ struct zxdh_hw {<br /> uint8_t has_tx_offload;<br /> uint8_t has_rx_offload;<br /> uint8_t admin_status;<br />+ uint8_t promisc_status;<br />+ uint8_t allmulti_status;<br /> };<br /> <br /> struct zxdh_dtb_shared_data {<br />diff --git a/drivers/net/zxdh/zxdh_ethdev_ops.c b/drivers/net/zxdh/zxdh_ethdev_ops.c<br />index 751f80e9b4..aed4e6410c 100644<br />--- a/drivers/net/zxdh/zxdh_ethdev_ops.c<br />+++ b/drivers/net/zxdh/zxdh_ethdev_ops.c<br />@@ -397,3 +397,135 @@ void zxdh_dev_mac_addr_remove(struct rte_eth_dev *dev __rte_unused, uint32_t ind<br /> }<br /> memset(&dev->data->mac_addrs[index], 0, sizeof(struct rte_ether_addr));<br /> }<br />+<br />+int zxdh_dev_promiscuous_enable(struct rte_eth_dev *dev)<br />+{<br />+ struct zxdh_hw *hw = dev->data->dev_private;<br />+ struct zxdh_msg_info msg_info = {0};<br />+ int16_t ret = 0;<br />+<br />+ if (hw->promisc_status == 0) {<br />+ if (hw->is_pf) {<br />+ ret = zxdh_dev_unicast_table_set(hw, hw->vport.vport, true);<br />+ if (hw->allmulti_status == 0)<br />+ ret = zxdh_dev_multicast_table_set(hw, hw->vport.vport, true);<br />+<br />+ } else {<br />+ struct zxdh_port_promisc_msg *promisc_msg = &msg_info.data.port_promisc_msg;<br />+<br />+ zxdh_msg_head_build(hw, ZXDH_PORT_PROMISC_SET, &msg_info);<br />+ promisc_msg->mode = ZXDH_PROMISC_MODE;<br />+ promisc_msg->value = true;<br />+ if (hw->allmulti_status == 0)<br />+ promisc_msg->mc_follow = true;<br />+<br />+ ret = zxdh_vf_send_msg_to_pf(dev, &msg_info, sizeof(msg_info), NULL, 0);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "Failed to send msg: port 0x%x msg type %d",<br />+ hw->vport.vport, ZXDH_PROMISC_MODE);<br />+ return ret;<br />+ }<br />+ }<br />+ hw->promisc_status = 1;<br />+ }<br />+ return ret;<br />+}<br />+/**<br />+ * Fun:<br />+ */<br />+int zxdh_dev_promiscuous_disable(struct rte_eth_dev *dev)<br />+{<br />+ struct zxdh_hw *hw = dev->data->dev_private;<br />+ int16_t ret = 0;<br />+ struct zxdh_msg_info msg_info = {0};<br />+<br />+ if (hw->promisc_status == 1) {<br />+ if (hw->is_pf) {<br />+ ret = zxdh_dev_unicast_table_set(hw, hw->vport.vport, false);<br />+ if (hw->allmulti_status == 0)<br />+ ret = zxdh_dev_multicast_table_set(hw, hw->vport.vport, false);<br />+<br />+ } else {<br />+ struct zxdh_port_promisc_msg *promisc_msg = &msg_info.data.port_promisc_msg;<br />+<br />+ zxdh_msg_head_build(hw, ZXDH_PORT_PROMISC_SET, &msg_info);<br />+ promisc_msg->mode = ZXDH_PROMISC_MODE;<br />+ promisc_msg->value = false;<br />+ if (hw->allmulti_status == 0)<br />+ promisc_msg->mc_follow = true;<br />+<br />+ ret = zxdh_vf_send_msg_to_pf(dev, &msg_info, sizeof(msg_info), NULL, 0);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "Failed to send msg: port 0x%x msg type %d",<br />+ hw->vport.vport, ZXDH_PROMISC_MODE);<br />+ return ret;<br />+ }<br />+ }<br />+ hw->promisc_status = 0;<br />+ }<br />+ return ret;<br />+}<br />+/**<br />+ * Fun:<br />+ */<br />+int zxdh_dev_allmulticast_enable(struct rte_eth_dev *dev)<br />+{<br />+ struct zxdh_hw *hw = dev->data->dev_private;<br />+ int16_t ret = 0;<br />+ struct zxdh_msg_info msg_info = {0};<br />+<br />+ if (hw->allmulti_status == 0) {<br />+ if (hw->is_pf) {<br />+ ret = zxdh_dev_multicast_table_set(hw, hw->vport.vport, true);<br />+ } else {<br />+ struct zxdh_port_promisc_msg *promisc_msg = &msg_info.data.port_promisc_msg;<br />+<br />+ zxdh_msg_head_build(hw, ZXDH_PORT_PROMISC_SET, &msg_info);<br />+<br />+ promisc_msg->mode = ZXDH_ALLMULTI_MODE;<br />+ promisc_msg->value = true;<br />+ ret = zxdh_vf_send_msg_to_pf(dev, &msg_info, sizeof(msg_info), NULL, 0);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "Failed to send msg: port 0x%x msg type %d",<br />+ hw->vport.vport, ZXDH_ALLMULTI_MODE);<br />+ return ret;<br />+ }<br />+ }<br />+ hw->allmulti_status = 1;<br />+ }<br />+ return ret;<br />+}<br />+<br />+int zxdh_dev_allmulticast_disable(struct rte_eth_dev *dev)<br />+{<br />+ struct zxdh_hw *hw = dev->data->dev_private;<br />+ int16_t ret = 0;<br />+ struct zxdh_msg_info msg_info = {0};<br />+<br />+ if (hw->allmulti_status == 1) {<br />+ if (hw->is_pf) {<br />+ if (hw->promisc_status == 1)<br />+ goto end;<br />+ ret = zxdh_dev_multicast_table_set(hw, hw->vport.vport, false);<br />+ } else {<br />+ struct zxdh_port_promisc_msg *promisc_msg = &msg_info.data.port_promisc_msg;<br />+<br />+ zxdh_msg_head_build(hw, ZXDH_PORT_PROMISC_SET, &msg_info);<br />+ if (hw->promisc_status == 1)<br />+ goto end;<br />+ promisc_msg->mode = ZXDH_ALLMULTI_MODE;<br />+ promisc_msg->value = false;<br />+ ret = zxdh_vf_send_msg_to_pf(dev, &msg_info, sizeof(msg_info), NULL, 0);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "Failed to send msg: port 0x%x msg type %d",<br />+ hw->vport.vport, ZXDH_ALLMULTI_MODE);<br />+ return ret;<br />+ }<br />+ }<br />+ hw->allmulti_status = 0;<br />+ }<br />+ return ret;<br />+end:<br />+ hw->allmulti_status = 0;<br />+ return ret;<br />+}<br />diff --git a/drivers/net/zxdh/zxdh_ethdev_ops.h b/drivers/net/zxdh/zxdh_ethdev_ops.h<br />index 4630bb70db..394ddedc0e 100644<br />--- a/drivers/net/zxdh/zxdh_ethdev_ops.h<br />+++ b/drivers/net/zxdh/zxdh_ethdev_ops.h<br />@@ -14,5 +14,9 @@ int zxdh_dev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_ad<br /> uint32_t index, uint32_t vmdq);<br /> int zxdh_dev_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr);<br /> void zxdh_dev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);<br />+int zxdh_dev_promiscuous_enable(struct rte_eth_dev *dev);<br />+int zxdh_dev_promiscuous_disable(struct rte_eth_dev *dev);<br />+int zxdh_dev_allmulticast_enable(struct rte_eth_dev *dev);<br />+int zxdh_dev_allmulticast_disable(struct rte_eth_dev *dev);<br /> <br /> #endif /* ZXDH_ETHDEV_OPS_H */<br />diff --git a/drivers/net/zxdh/zxdh_msg.h b/drivers/net/zxdh/zxdh_msg.h<br />index 44ce5d1b7f..2abf579a80 100644<br />--- a/drivers/net/zxdh/zxdh_msg.h<br />+++ b/drivers/net/zxdh/zxdh_msg.h<br />@@ -48,6 +48,8 @@<br /> <br /> #define ZXDH_MAC_FILTER 0xaa<br /> #define ZXDH_MAC_UNFILTER 0xff<br />+#define ZXDH_PROMISC_MODE 1<br />+#define ZXDH_ALLMULTI_MODE 2<br /> <br /> enum ZXDH_DRIVER_TYPE {<br /> ZXDH_MSG_CHAN_END_MPF = 0,<br />@@ -180,6 +182,7 @@ enum zxdh_msg_type {<br /> ZXDH_MAC_DEL = 4,<br /> <br /> ZXDH_PORT_ATTRS_SET = 25,<br />+ ZXDH_PORT_PROMISC_SET = 26,<br /> <br /> ZXDH_MSG_TYPE_END,<br /> };<br />@@ -325,6 +328,12 @@ struct zxdh_mac_filter {<br /> struct rte_ether_addr mac;<br /> } __rte_packed;<br /> <br />+struct zxdh_port_promisc_msg {<br />+ uint8_t mode;<br />+ uint8_t value;<br />+ uint8_t mc_follow;<br />+} __rte_packed;<br />+<br /> struct zxdh_msg_head {<br /> enum zxdh_msg_type msg_type;<br /> uint16_t vport;<br />@@ -353,6 +362,7 @@ struct zxdh_msg_info {<br /> struct zxdh_port_attr_set_msg port_attr_msg;<br /> struct zxdh_link_info_msg link_msg;<br /> struct zxdh_mac_filter mac_filter_msg;<br />+ struct zxdh_port_promisc_msg port_promisc_msg;<br /> } __rte_packed data;<br /> } __rte_packed;<br /> <br />diff --git a/drivers/net/zxdh/zxdh_tables.c b/drivers/net/zxdh/zxdh_tables.c<br />index f5b607584d..45aeb3e3e4 100644<br />--- a/drivers/net/zxdh/zxdh_tables.c<br />+++ b/drivers/net/zxdh/zxdh_tables.c<br />@@ -10,10 +10,15 @@<br /> <br /> #define ZXDH_SDT_VPORT_ATT_TABLE 1<br /> #define ZXDH_SDT_PANEL_ATT_TABLE 2<br />+#define ZXDH_SDT_BROCAST_ATT_TABLE 6<br />+#define ZXDH_SDT_UNICAST_ATT_TABLE 10<br />+#define ZXDH_SDT_MULTICAST_ATT_TABLE 11<br /> <br /> #define ZXDH_MAC_HASH_INDEX_BASE 64<br /> #define ZXDH_MAC_HASH_INDEX(index) (ZXDH_MAC_HASH_INDEX_BASE + (index))<br /> #define ZXDH_MC_GROUP_NUM 4<br />+#define ZXDH_BASE_VFID 1152<br />+#define ZXDH_TABLE_HIT_FLAG 128<br /> <br /> int<br /> zxdh_set_port_attr(uint16_t vfid, struct zxdh_port_attr_table *port_attr)<br />@@ -346,3 +351,221 @@ zxdh_del_mac_table(uint16_t vport, struct rte_ether_addr *addr, uint8_t hash_se<br /> }<br /> return 0;<br /> }<br />+<br />+int<br />+zxdh_promisc_table_init(struct rte_eth_dev *dev)<br />+{<br />+ struct zxdh_hw *hw = dev->data->dev_private;<br />+ uint32_t ret, vf_group_id = 0;<br />+ struct zxdh_brocast_table brocast_table = {0};<br />+ struct zxdh_unitcast_table uc_table = {0};<br />+ struct zxdh_multicast_table mc_table = {0};<br />+<br />+ if (!hw->is_pf)<br />+ return 0;<br />+<br />+ for (; vf_group_id < 4; vf_group_id++) {<br />+ brocast_table.flag = rte_be_to_cpu_32(ZXDH_TABLE_HIT_FLAG);<br />+ ZXDH_DTB_ERAM_ENTRY_INFO_T eram_brocast_entry = {<br />+ .index = ((hw->vfid - ZXDH_BASE_VFID) << 2) + vf_group_id,<br />+ .p_data = (uint32_t *)&brocast_table<br />+ };<br />+ ZXDH_DTB_USER_ENTRY_T entry_brocast = {<br />+ .sdt_no = ZXDH_SDT_BROCAST_ATT_TABLE,<br />+ .p_entry_data = (void *)&eram_brocast_entry<br />+ };<br />+<br />+ ret = zxdh_np_dtb_table_entry_write(ZXDH_DEVICE_NO,<br />+ g_dtb_data.queueid, 1, &entry_brocast);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "write brocast table failed");<br />+ return ret;<br />+ }<br />+<br />+ uc_table.uc_flood_pf_enable = rte_be_to_cpu_32(ZXDH_TABLE_HIT_FLAG);<br />+ ZXDH_DTB_ERAM_ENTRY_INFO_T eram_uc_entry = {<br />+ .index = ((hw->vfid - ZXDH_BASE_VFID) << 2) + vf_group_id,<br />+ .p_data = (uint32_t *)&uc_table<br />+ };<br />+ ZXDH_DTB_USER_ENTRY_T entry_unicast = {<br />+ .sdt_no = ZXDH_SDT_UNICAST_ATT_TABLE,<br />+ .p_entry_data = (void *)&eram_uc_entry<br />+ };<br />+<br />+ ret = zxdh_np_dtb_table_entry_write(ZXDH_DEVICE_NO,<br />+ g_dtb_data.queueid, 1, &entry_unicast);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "write unicast table failed");<br />+ return ret;<br />+ }<br />+<br />+ mc_table.mc_flood_pf_enable = rte_be_to_cpu_32(ZXDH_TABLE_HIT_FLAG);<br />+ ZXDH_DTB_ERAM_ENTRY_INFO_T eram_mc_entry = {<br />+ .index = ((hw->vfid - ZXDH_BASE_VFID) << 2) + vf_group_id,<br />+ .p_data = (uint32_t *)&mc_table<br />+ };<br />+ ZXDH_DTB_USER_ENTRY_T entry_multicast = {<br />+ .sdt_no = ZXDH_SDT_MULTICAST_ATT_TABLE,<br />+ .p_entry_data = (void *)&eram_mc_entry<br />+ };<br />+<br />+ ret = zxdh_np_dtb_table_entry_write(ZXDH_DEVICE_NO, g_dtb_data.queueid,<br />+ 1, &entry_multicast);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "write multicast table failed");<br />+ return ret;<br />+ }<br />+ }<br />+<br />+ return ret;<br />+}<br />+<br />+int<br />+zxdh_promisc_table_uninit(struct rte_eth_dev *dev)<br />+{<br />+ struct zxdh_hw *hw = dev->data->dev_private;<br />+ uint32_t ret, vf_group_id = 0;<br />+ struct zxdh_brocast_table brocast_table = {0};<br />+ struct zxdh_unitcast_table uc_table = {0};<br />+ struct zxdh_multicast_table mc_table = {0};<br />+<br />+ if (!hw->is_pf)<br />+ return 0;<br />+<br />+ for (; vf_group_id < 4; vf_group_id++) {<br />+ brocast_table.flag = rte_be_to_cpu_32(ZXDH_TABLE_HIT_FLAG);<br />+ ZXDH_DTB_ERAM_ENTRY_INFO_T eram_brocast_entry = {<br />+ .index = ((hw->vfid - ZXDH_BASE_VFID) << 2) + vf_group_id,<br />+ .p_data = (uint32_t *)&brocast_table<br />+ };<br />+ ZXDH_DTB_USER_ENTRY_T entry_brocast = {<br />+ .sdt_no = ZXDH_SDT_BROCAST_ATT_TABLE,<br />+ .p_entry_data = (void *)&eram_brocast_entry<br />+ };<br />+<br />+ ret = zxdh_np_dtb_table_entry_delete(ZXDH_DEVICE_NO,<br />+ g_dtb_data.queueid, 1, &entry_brocast);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "write brocast table failed");<br />+ return ret;<br />+ }<br />+<br />+ uc_table.uc_flood_pf_enable = rte_be_to_cpu_32(ZXDH_TABLE_HIT_FLAG);<br />+ ZXDH_DTB_ERAM_ENTRY_INFO_T eram_uc_entry = {<br />+ .index = ((hw->vfid - ZXDH_BASE_VFID) << 2) + vf_group_id,<br />+ .p_data = (uint32_t *)&uc_table<br />+ };<br />+ ZXDH_DTB_USER_ENTRY_T entry_unicast = {<br />+ .sdt_no = ZXDH_SDT_UNICAST_ATT_TABLE,<br />+ .p_entry_data = (void *)&eram_uc_entry<br />+ };<br />+<br />+ ret = zxdh_np_dtb_table_entry_delete(ZXDH_DEVICE_NO,<br />+ g_dtb_data.queueid, 1, &entry_unicast);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "write unicast table failed");<br />+ return ret;<br />+ }<br />+<br />+ mc_table.mc_flood_pf_enable = rte_be_to_cpu_32(ZXDH_TABLE_HIT_FLAG);<br />+ ZXDH_DTB_ERAM_ENTRY_INFO_T eram_mc_entry = {<br />+ .index = ((hw->vfid - ZXDH_BASE_VFID) << 2) + vf_group_id,<br />+ .p_data = (uint32_t *)&mc_table<br />+ };<br />+ ZXDH_DTB_USER_ENTRY_T entry_multicast = {<br />+ .sdt_no = ZXDH_SDT_MULTICAST_ATT_TABLE,<br />+ .p_entry_data = (void *)&eram_mc_entry<br />+ };<br />+<br />+ ret = zxdh_np_dtb_table_entry_delete(ZXDH_DEVICE_NO, g_dtb_data.queueid,<br />+ 1, &entry_multicast);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "write multicast table failed");<br />+ return ret;<br />+ }<br />+ }<br />+<br />+ return ret;<br />+}<br />+<br />+int<br />+zxdh_dev_unicast_table_set(struct zxdh_hw *hw, uint16_t vport, bool enable)<br />+{<br />+ int16_t ret = 0;<br />+ struct zxdh_unitcast_table uc_table = {0};<br />+ union zxdh_virport_num vport_num = (union zxdh_virport_num)vport;<br />+<br />+ ZXDH_DTB_ERAM_ENTRY_INFO_T uc_table_entry = {<br />+ .index = ((hw->vfid - ZXDH_BASE_VFID) << 2) + vport_num.vfid / 64,<br />+ .p_data = (uint32_t *)&uc_table<br />+ };<br />+ ZXDH_DTB_USER_ENTRY_T entry = {<br />+ .sdt_no = ZXDH_SDT_UNICAST_ATT_TABLE,<br />+ .p_entry_data = (void *)&uc_table_entry<br />+ };<br />+<br />+ ret = zxdh_np_dtb_table_entry_get(ZXDH_DEVICE_NO, g_dtb_data.queueid, &entry, 1);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "unicast_table_get_failed:%d", hw->vfid);<br />+ return -ret;<br />+ }<br />+<br />+ if (vport_num.vf_flag) {<br />+ if (enable)<br />+ uc_table.bitmap[(vport_num.vfid % 64) / 32] |=<br />+ UINT32_C(1) << (31 - (vport_num.vfid % 64) % 32);<br />+ else<br />+ uc_table.bitmap[(vport_num.vfid % 64) / 32] &=<br />+ ~(UINT32_C(1) << (31 - (vport_num.vfid % 64) % 32));<br />+ } else {<br />+ uc_table.uc_flood_pf_enable = rte_be_to_cpu_32(ZXDH_TABLE_HIT_FLAG + (enable << 6));<br />+ }<br />+<br />+ ret = zxdh_np_dtb_table_entry_write(ZXDH_DEVICE_NO, g_dtb_data.queueid, 1, &entry);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "unicast_table_set_failed:%d", hw->vfid);<br />+ return -ret;<br />+ }<br />+ return 0;<br />+}<br />+<br />+int<br />+zxdh_dev_multicast_table_set(struct zxdh_hw *hw, uint16_t vport, bool enable)<br />+{<br />+ int16_t ret = 0;<br />+ struct zxdh_multicast_table mc_table = {0};<br />+ union zxdh_virport_num vport_num = (union zxdh_virport_num)vport;<br />+<br />+ ZXDH_DTB_ERAM_ENTRY_INFO_T mc_table_entry = {<br />+ .index = ((hw->vfid - ZXDH_BASE_VFID) << 2) + vport_num.vfid / 64,<br />+ .p_data = (uint32_t *)&mc_table<br />+ };<br />+ ZXDH_DTB_USER_ENTRY_T entry = {<br />+ .sdt_no = ZXDH_SDT_MULTICAST_ATT_TABLE,<br />+ .p_entry_data = (void *)&mc_table_entry<br />+ };<br />+<br />+ ret = zxdh_np_dtb_table_entry_get(ZXDH_DEVICE_NO, g_dtb_data.queueid, &entry, 1);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "allmulti_table_get_failed:%d", hw->vfid);<br />+ return -ret;<br />+ }<br />+<br />+ if (vport_num.vf_flag) {<br />+ if (enable)<br />+ mc_table.bitmap[(vport_num.vfid % 64) / 32] |=<br />+ UINT32_C(1) << (31 - (vport_num.vfid % 64) % 32);<br />+ else<br />+ mc_table.bitmap[(vport_num.vfid % 64) / 32] &=<br />+ ~(UINT32_C(1) << (31 - (vport_num.vfid % 64) % 32));<br />+<br />+ } else {<br />+ mc_table.mc_flood_pf_enable = rte_be_to_cpu_32(ZXDH_TABLE_HIT_FLAG + (enable << 6));<br />+ }<br />+ ret = zxdh_np_dtb_table_entry_write(ZXDH_DEVICE_NO, g_dtb_data.queueid, 1, &entry);<br />+ if (ret) {<br />+ PMD_DRV_LOG(ERR, "allmulti_table_set_failed:%d", hw->vfid);<br />+ return -ret;<br />+ }<br />+ return 0;<br />+}<br />diff --git a/drivers/net/zxdh/zxdh_tables.h b/drivers/net/zxdh/zxdh_tables.h<br />index f16c4923ef..0a1ddf7d9e 100644<br />--- a/drivers/net/zxdh/zxdh_tables.h<br />+++ b/drivers/net/zxdh/zxdh_tables.h<br />@@ -176,12 +176,34 @@ struct zxdh_mac_multicast_table {<br /> struct zxdh_mac_multicast_entry entry;<br /> };<br /> <br />+struct zxdh_brocast_table {<br />+ uint32_t flag;<br />+ uint32_t rsv;<br />+ uint32_t bitmap[2];<br />+};<br />+<br />+struct zxdh_unitcast_table {<br />+ uint32_t uc_flood_pf_enable;<br />+ uint32_t rsv;<br />+ uint32_t bitmap[2];<br />+};<br />+<br />+struct zxdh_multicast_table {<br />+ uint32_t mc_flood_pf_enable;<br />+ uint32_t rsv;<br />+ uint32_t bitmap[2];<br />+};<br />+<br /> int zxdh_port_attr_init(struct rte_eth_dev *dev);<br /> int zxdh_panel_table_init(struct rte_eth_dev *dev);<br /> int zxdh_set_port_attr(uint16_t vfid, struct zxdh_port_attr_table *port_attr);<br /> int zxdh_port_attr_uninit(struct rte_eth_dev *dev);<br />+int zxdh_promisc_table_init(struct rte_eth_dev *dev);<br />+int zxdh_promisc_table_uninit(struct rte_eth_dev *dev);<br /> int zxdh_get_port_attr(uint16_t vfid, struct zxdh_port_attr_table *port_attr);<br /> int zxdh_set_mac_table(uint16_t vport, struct rte_ether_addr *addr, uint8_t hash_search_idx);<br /> int zxdh_del_mac_table(uint16_t vport, struct rte_ether_addr *addr, uint8_t hash_search_idx);<br />+int zxdh_dev_unicast_table_set(struct zxdh_hw *hw, uint16_t vport, bool enable);<br />+int zxdh_dev_multicast_table_set(struct zxdh_hw *hw, uint16_t vport, bool enable);<br /> <br /> #endif /* ZXDH_TABLES_H */<br />-- <br />2.27.0<br />