Re: [PATCH net-next v05 03/14] hinic3: HW common function initialization

From: Simon Horman

Date: Thu Sep 11 2025 - 08:31:27 EST


On Tue, Sep 09, 2025 at 03:33:28PM +0800, Fan Gong wrote:
> Add initialization for data structures and functions(cmdq ceq mbox ceq)
> that interact with hardware.
>
> Co-developed-by: Zhu Yikai <zhuyikai1@xxxxxxxxxxxxxx>
> Signed-off-by: Zhu Yikai <zhuyikai1@xxxxxxxxxxxxxx>
> Signed-off-by: Fan Gong <gongfan1@xxxxxxxxxx>

The nits below notwithstanding, this looks good to me.

Reviewed-by: Simon Horman <horms@xxxxxxxxxx>

...

> diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_hw_comm.c b/drivers/net/ethernet/huawei/hinic3/hinic3_hw_comm.c

...

> @@ -61,3 +62,176 @@ int hinic3_func_reset(struct hinic3_hwdev *hwdev, u16 func_id, u64 reset_flag)
>
> return 0;
> }
> +
> +static int hinic3_comm_features_nego(struct hinic3_hwdev *hwdev, u8 opcode,
> + u64 *s_feature, u16 size)
> +{
> + struct comm_cmd_feature_nego feature_nego = {};
> + struct mgmt_msg_params msg_params = {};
> + int err;
> +
> + feature_nego.func_id = hinic3_global_func_id(hwdev);
> + feature_nego.opcode = opcode;
> + if (opcode == MGMT_MSG_CMD_OP_SET)
> + memcpy(feature_nego.s_feature, s_feature, (size * sizeof(u64)));

nit: This could use array_size()

> +
> + mgmt_msg_params_init_default(&msg_params, &feature_nego,
> + sizeof(feature_nego));
> +
> + err = hinic3_send_mbox_to_mgmt(hwdev, MGMT_MOD_COMM,
> + COMM_CMD_FEATURE_NEGO, &msg_params);
> + if (err || feature_nego.head.status) {
> + dev_err(hwdev->dev, "Failed to negotiate feature, err: %d, status: 0x%x\n",
> + err, feature_nego.head.status);
> + return -EINVAL;
> + }
> +
> + if (opcode == MGMT_MSG_CMD_OP_GET)
> + memcpy(s_feature, feature_nego.s_feature, (size * sizeof(u64)));

Ditto.

> +
> + return 0;
> +}

...