On Mon, 7 Jul 2025 13:56:17 +0800 Junlong Wang <wang.junlo...@zte.com.cn> wrote:
> Fix error handling when MAC configuration fails. > This is issue was discovered during internal testing. > > Fixes: 1c8f68b64cfc ("net/zxdh: optimize MAC operations") > Cc: sta...@dpdk.org > > Signed-off-by: Junlong Wang <wang.junlo...@zte.com.cn> > --- > drivers/net/zxdh/zxdh_ethdev.c | 15 +++++++++++ > drivers/net/zxdh/zxdh_ethdev_ops.c | 34 +++++++++++++++++++----- > drivers/net/zxdh/zxdh_msg.c | 10 +++---- > drivers/net/zxdh/zxdh_tables.c | 42 ++++++++++++++++-------------- > 4 files changed, 69 insertions(+), 32 deletions(-) > > diff --git a/drivers/net/zxdh/zxdh_ethdev.c b/drivers/net/zxdh/zxdh_ethdev.c > index 80053678cb..8996d86b90 100644 > --- a/drivers/net/zxdh/zxdh_ethdev.c > +++ b/drivers/net/zxdh/zxdh_ethdev.c > @@ -1265,6 +1265,7 @@ static int > zxdh_mac_config(struct rte_eth_dev *eth_dev) > { > struct zxdh_hw *hw = eth_dev->data->dev_private; > + struct zxdh_msg_info msg_info = {0}; > int ret = 0; > > if (hw->is_pf) { > @@ -1274,7 +1275,21 @@ zxdh_mac_config(struct rte_eth_dev *eth_dev) > PMD_DRV_LOG(ERR, "Failed to add mac: port 0x%x", > hw->vport.vport); > return ret; > } > + hw->uc_num++; > + } else { > + struct zxdh_mac_filter *mac_filter = > &msg_info.data.mac_filter_msg; > + mac_filter->filter_flag = 0xff; > + memcpy(&mac_filter->mac, ð_dev->data->mac_addrs[0], > + sizeof(eth_dev->data->mac_addrs[0])); Since mac_filter->mac and eth_dev->data->mac_addrs are both of same type (rte_ether_addr), using structure assignment operation instead of memcpy is preferred. Assignment assures that types are the same. mac_filter->mac = eth_dev->data->mac_addrs;