Re: [PATCH v1 3/5] net/zxdh: add support set link speed get autoneg stats

Stephen Hemminger
2025-12-21T16:58:03Z

On Sat, 20 Dec 2025 14:15:19 +0800
Junlong Wang <wang.junlong1@zte.com.cn> wrote:

> +int32_t zxdh_link_speed_set(struct rte_eth_dev *dev)
> +{
> + struct zxdh_hw *hw = dev->data->dev_private;
> + struct zxdh_msg_info msg = {0};
> + uint8_t zxdh_msg_reply_info[ZXDH_ST_SZ_BYTES(msg_reply_info)] = {0};
> + void *reply_body_addr = ZXDH_ADDR_OF(msg_reply_info, zxdh_msg_reply_info, reply_body);
> + uint32_t link_speed = 0;
> + int32_t spm_speed_modes = 0;
> + int32_t ret = 0;
> +
> + spm_speed_modes =
> + zxdh_speed_mode_to_spm(dev->data->dev_conf.link_speeds & ~RTE_ETH_LINK_SPEED_FIXED);
> + if (spm_speed_modes == -1 || spm_speed_modes == hw->speed_mode) {

Avoid unnecessary initialization. This driver seems to do this a lot.
The extra initialization defeats many of the compiler checks for use of uninitialized variables.