2024-04-03 08:33:47

by Huisong Li

[permalink] [raw]
Subject: [PATCH 1/2] soc: hisilicon: kunpeng_hccs: Add the check for obtaining complete port attribute

The hccs_get_all_port_attr() is used to obtained the attribute of all
ports on a specified DIE from firmware. However, this interface doesn't
ensure whether firmware reports the complete attribute of all ports or not.
So this patch adds the check for this.

Signed-off-by: Huisong Li <[email protected]>
---
drivers/soc/hisilicon/kunpeng_hccs.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c
index 9ff70b38e5e9..bb69a95b5f2d 100644
--- a/drivers/soc/hisilicon/kunpeng_hccs.c
+++ b/drivers/soc/hisilicon/kunpeng_hccs.c
@@ -556,6 +556,12 @@ static int hccs_get_all_port_attr(struct hccs_dev *hdev,
start_id = rsp_head.next_id;
}

+ if (left_buf_len != 0) {
+ dev_err(hdev->dev, "do not get the expected port number(%u) attribute.\n",
+ size);
+ return -EINVAL;
+ }
+
return 0;
}

--
2.22.0



2024-04-15 01:17:31

by Wei Xu

[permalink] [raw]
Subject: Re: [PATCH 1/2] soc: hisilicon: kunpeng_hccs: Add the check for obtaining complete port attribute

Hi Huisong,

On 2024/4/3 16:19, Huisong Li wrote:
> The hccs_get_all_port_attr() is used to obtained the attribute of all
> ports on a specified DIE from firmware. However, this interface doesn't
> ensure whether firmware reports the complete attribute of all ports or not.
> So this patch adds the check for this.
>
> Signed-off-by: Huisong Li <[email protected]>
> ---
> drivers/soc/hisilicon/kunpeng_hccs.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c
> index 9ff70b38e5e9..bb69a95b5f2d 100644
> --- a/drivers/soc/hisilicon/kunpeng_hccs.c
> +++ b/drivers/soc/hisilicon/kunpeng_hccs.c
> @@ -556,6 +556,12 @@ static int hccs_get_all_port_attr(struct hccs_dev *hdev,
> start_id = rsp_head.next_id;
> }
>
> + if (left_buf_len != 0) {
> + dev_err(hdev->dev, "do not get the expected port number(%u) attribute.\n",

How about changing to "failed to get the expected port number(%u) attribute.\n"?

Best Regards,
Wei

> + size);
> + return -EINVAL;
> + }
> +
> return 0;
> }
>
>

2024-04-16 01:19:20

by Huisong Li

[permalink] [raw]
Subject: Re: [PATCH 1/2] soc: hisilicon: kunpeng_hccs: Add the check for obtaining complete port attribute


在 2024/4/15 9:17, Wei Xu 写道:
> Hi Huisong,
>
> On 2024/4/3 16:19, Huisong Li wrote:
>> The hccs_get_all_port_attr() is used to obtained the attribute of all
>> ports on a specified DIE from firmware. However, this interface doesn't
>> ensure whether firmware reports the complete attribute of all ports or not.
>> So this patch adds the check for this.
>>
>> Signed-off-by: Huisong Li <[email protected]>
>> ---
>> drivers/soc/hisilicon/kunpeng_hccs.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c
>> index 9ff70b38e5e9..bb69a95b5f2d 100644
>> --- a/drivers/soc/hisilicon/kunpeng_hccs.c
>> +++ b/drivers/soc/hisilicon/kunpeng_hccs.c
>> @@ -556,6 +556,12 @@ static int hccs_get_all_port_attr(struct hccs_dev *hdev,
>> start_id = rsp_head.next_id;
>> }
>>
>> + if (left_buf_len != 0) {
>> + dev_err(hdev->dev, "do not get the expected port number(%u) attribute.\n",
> How about changing to "failed to get the expected port number(%u) attribute.\n"?
ok, I will fix it in next version.
>
> Best Regards,
> Wei
>
>> + size);
>> + return -EINVAL;
>> + }
>> +
>> return 0;
>> }
>>
>>
> .