* [dpdk-dev] [PATCH 0/4] bugfix for hns3 PMD
@ 2021-04-22 1:55 Min Hu (Connor)
2021-04-22 1:55 ` [dpdk-dev] [PATCH 1/4] net/hns3: fix error mbx messages prompt errors Min Hu (Connor)
` (4 more replies)
0 siblings, 5 replies; 19+ messages in thread
From: Min Hu (Connor) @ 2021-04-22 1:55 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
This patchset contains four bugfixes for hns3 PMD.
Chengwen Feng (4):
net/hns3: fix error mbx messages prompt errors
net/hns3: fix PF miss link status notify message
net/hns3: fix parse link fails code fail
net/hns3: delete unused macro and struct of mbx module
drivers/net/hns3/hns3_mbx.c | 18 +++++++++++-------
drivers/net/hns3/hns3_mbx.h | 10 ----------
2 files changed, 11 insertions(+), 17 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH 1/4] net/hns3: fix error mbx messages prompt errors
2021-04-22 1:55 [dpdk-dev] [PATCH 0/4] bugfix for hns3 PMD Min Hu (Connor)
@ 2021-04-22 1:55 ` Min Hu (Connor)
2021-04-22 1:55 ` [dpdk-dev] [PATCH 2/4] net/hns3: fix PF miss link status notify message Min Hu (Connor)
` (3 subsequent siblings)
4 siblings, 0 replies; 19+ messages in thread
From: Min Hu (Connor) @ 2021-04-22 1:55 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
From: Chengwen Feng <fengchengwen@huawei.com>
The hns3_dev_handle_mbx_msg() could be called under both PF and VF,
but the error messages show VF.
Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
drivers/net/hns3/hns3_mbx.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
index eb202dd..3b35c02 100644
--- a/drivers/net/hns3/hns3_mbx.c
+++ b/drivers/net/hns3/hns3_mbx.c
@@ -528,8 +528,7 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
hns3_handle_promisc_info(hw, req->msg[1]);
break;
default:
- hns3_err(hw,
- "VF received unsupported(%u) mbx msg from PF",
+ hns3_err(hw, "received unsupported(%u) mbx msg",
req->msg[0]);
break;
}
--
2.7.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH 2/4] net/hns3: fix PF miss link status notify message
2021-04-22 1:55 [dpdk-dev] [PATCH 0/4] bugfix for hns3 PMD Min Hu (Connor)
2021-04-22 1:55 ` [dpdk-dev] [PATCH 1/4] net/hns3: fix error mbx messages prompt errors Min Hu (Connor)
@ 2021-04-22 1:55 ` Min Hu (Connor)
2021-04-22 1:55 ` [dpdk-dev] [PATCH 3/4] net/hns3: fix parse link fails code fail Min Hu (Connor)
` (2 subsequent siblings)
4 siblings, 0 replies; 19+ messages in thread
From: Min Hu (Connor) @ 2021-04-22 1:55 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
From: Chengwen Feng <fengchengwen@huawei.com>
The opcode of the link status notification message reported by the
firmware is zero, it will be filtered out because driver treats it as
already processed message. As a result, the PF can't update the link
status in a timely manner.
Because only VF can set opcode to zero when process mailbox message,
so we add a judgment to make sure the PF messages will not filter out.
Fixes: dbbbad23e380 ("net/hns3: fix VF handling LSC event in secondary process")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
drivers/net/hns3/hns3_mbx.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
index 3b35c02..ba04ac9 100644
--- a/drivers/net/hns3/hns3_mbx.c
+++ b/drivers/net/hns3/hns3_mbx.c
@@ -438,16 +438,19 @@ hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw)
void
hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
{
+ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
struct hns3_cmq_ring *crq = &hw->cmq.crq;
struct hns3_mbx_pf_to_vf_cmd *req;
struct hns3_cmd_desc *desc;
+ bool handle_out;
uint8_t opcode;
uint16_t flag;
rte_spinlock_lock(&hw->cmq.crq.lock);
- if (rte_eal_process_type() != RTE_PROC_PRIMARY ||
- !rte_thread_is_intr()) {
+ handle_out = (rte_eal_process_type() != RTE_PROC_PRIMARY ||
+ !rte_thread_is_intr()) && hns->is_vf;
+ if (handle_out) {
/*
* Currently, any threads in the primary and secondary processes
* could send mailbox sync request, so it will need to process
@@ -491,7 +494,8 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
continue;
}
- if (desc->opcode == 0) {
+ handle_out = hns->is_vf && desc->opcode == 0;
+ if (handle_out) {
/* Message already processed by other thread */
crq->desc[crq->next_to_use].flag = 0;
hns3_mbx_ring_ptr_move_crq(crq);
--
2.7.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH 3/4] net/hns3: fix parse link fails code fail
2021-04-22 1:55 [dpdk-dev] [PATCH 0/4] bugfix for hns3 PMD Min Hu (Connor)
2021-04-22 1:55 ` [dpdk-dev] [PATCH 1/4] net/hns3: fix error mbx messages prompt errors Min Hu (Connor)
2021-04-22 1:55 ` [dpdk-dev] [PATCH 2/4] net/hns3: fix PF miss link status notify message Min Hu (Connor)
@ 2021-04-22 1:55 ` Min Hu (Connor)
2021-04-26 12:26 ` Ferruh Yigit
` (2 more replies)
2021-04-22 1:55 ` [dpdk-dev] [PATCH 4/4] net/hns3: delete unused macro and struct of mbx module Min Hu (Connor)
2021-04-26 12:52 ` [dpdk-dev] [PATCH 0/4] bugfix for hns3 PMD Ferruh Yigit
4 siblings, 3 replies; 19+ messages in thread
From: Min Hu (Connor) @ 2021-04-22 1:55 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
From: Chengwen Feng <fengchengwen@huawei.com>
The link fails code should be parsed using the structure
hns3_mbx_vf_to_pf_cmd, else it will parse fail.
Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
drivers/net/hns3/hns3_mbx.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
index ba04ac9..0550c9a 100644
--- a/drivers/net/hns3/hns3_mbx.c
+++ b/drivers/net/hns3/hns3_mbx.c
@@ -346,12 +346,13 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code)
}
static void
-hns3pf_handle_link_change_event(struct hns3_hw *hw,
- struct hns3_mbx_pf_to_vf_cmd *req)
+hns3pf_handle_link_change_event(struct hns3_hw *hw, void *data)
{
#define LINK_STATUS_OFFSET 1
#define LINK_FAIL_CODE_OFFSET 2
+ struct hns3_mbx_vf_to_pf_cmd *req = data;
+
if (!req->msg[LINK_STATUS_OFFSET])
hns3_link_fail_parse(hw, req->msg[LINK_FAIL_CODE_OFFSET]);
--
2.7.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH 4/4] net/hns3: delete unused macro and struct of mbx module
2021-04-22 1:55 [dpdk-dev] [PATCH 0/4] bugfix for hns3 PMD Min Hu (Connor)
` (2 preceding siblings ...)
2021-04-22 1:55 ` [dpdk-dev] [PATCH 3/4] net/hns3: fix parse link fails code fail Min Hu (Connor)
@ 2021-04-22 1:55 ` Min Hu (Connor)
2021-04-26 12:52 ` [dpdk-dev] [PATCH 0/4] bugfix for hns3 PMD Ferruh Yigit
4 siblings, 0 replies; 19+ messages in thread
From: Min Hu (Connor) @ 2021-04-22 1:55 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
From: Chengwen Feng <fengchengwen@huawei.com>
In hns3_mbx.h, some macro and structure were defined in previous
versions but never used.
Fixes: 463e748964f5 ("net/hns3: support mailbox")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
drivers/net/hns3/hns3_mbx.h | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h
index 0e9194d..86d32e6 100644
--- a/drivers/net/hns3/hns3_mbx.h
+++ b/drivers/net/hns3/hns3_mbx.h
@@ -5,8 +5,6 @@
#ifndef _HNS3_MBX_H_
#define _HNS3_MBX_H_
-#define HNS3_MBX_VF_MSG_DATA_NUM 16
-
enum HNS3_MBX_OPCODE {
HNS3_MBX_RESET = 0x01, /* (VF -> PF) assert reset */
HNS3_MBX_ASSERTING_RESET, /* (PF -> VF) PF is asserting reset */
@@ -80,8 +78,6 @@ enum hns3_mbx_link_fail_subcode {
#define HNS3_MBX_MAX_MSG_SIZE 16
#define HNS3_MBX_MAX_RESP_DATA_SIZE 8
-#define HNS3_MBX_RING_MAP_BASIC_MSG_NUM 3
-#define HNS3_MBX_RING_NODE_VARIABLE_NUM 3
enum {
HNS3_MBX_RESP_MATCHING_SCHEME_OF_ORIGINAL = 0,
@@ -147,12 +143,6 @@ struct hns3_vf_bind_vector_msg {
struct hns3_ring_chain_param param[HNS3_MBX_MAX_RING_CHAIN_PARAM_NUM];
};
-struct hns3_vf_rst_cmd {
- uint8_t dest_vfid;
- uint8_t vf_rst;
- uint8_t rsv[22];
-};
-
struct hns3_pf_rst_done_cmd {
uint8_t pf_rst_done;
uint8_t rsv[23];
--
2.7.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH 3/4] net/hns3: fix parse link fails code fail
2021-04-22 1:55 ` [dpdk-dev] [PATCH 3/4] net/hns3: fix parse link fails code fail Min Hu (Connor)
@ 2021-04-26 12:26 ` Ferruh Yigit
2021-04-26 12:41 ` fengchengwen
2021-04-26 13:42 ` [dpdk-dev] [PATCH v2] " Min Hu (Connor)
2021-04-27 12:17 ` [dpdk-dev] [PATCH v3] " Min Hu (Connor)
2 siblings, 1 reply; 19+ messages in thread
From: Ferruh Yigit @ 2021-04-26 12:26 UTC (permalink / raw)
To: Min Hu (Connor), dev
On 4/22/2021 2:55 AM, Min Hu (Connor) wrote:
> From: Chengwen Feng <fengchengwen@huawei.com>
>
> The link fails code should be parsed using the structure
> hns3_mbx_vf_to_pf_cmd, else it will parse fail.
>
> Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> ---
> drivers/net/hns3/hns3_mbx.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
> index ba04ac9..0550c9a 100644
> --- a/drivers/net/hns3/hns3_mbx.c
> +++ b/drivers/net/hns3/hns3_mbx.c
> @@ -346,12 +346,13 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code)
> }
>
> static void
> -hns3pf_handle_link_change_event(struct hns3_hw *hw,
> - struct hns3_mbx_pf_to_vf_cmd *req)
> +hns3pf_handle_link_change_event(struct hns3_hw *hw, void *data)
Why not s/struct hns3_mbx_pf_to_vf_cmd/struct hns3_mbx_vf_to_pf_cmd/ but change
to parameter to "void *", wouldn't it reduce the type check?
> {
> #define LINK_STATUS_OFFSET 1
> #define LINK_FAIL_CODE_OFFSET 2
>
> + struct hns3_mbx_vf_to_pf_cmd *req = data;
> +
> if (!req->msg[LINK_STATUS_OFFSET])
> hns3_link_fail_parse(hw, req->msg[LINK_FAIL_CODE_OFFSET]);
>
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH 3/4] net/hns3: fix parse link fails code fail
2021-04-26 12:26 ` Ferruh Yigit
@ 2021-04-26 12:41 ` fengchengwen
2021-04-26 12:50 ` Ferruh Yigit
0 siblings, 1 reply; 19+ messages in thread
From: fengchengwen @ 2021-04-26 12:41 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Min Hu (Connor), dev
On 2021/4/26 20:26, Ferruh Yigit wrote:
> On 4/22/2021 2:55 AM, Min Hu (Connor) wrote:
>> From: Chengwen Feng <fengchengwen@huawei.com>
>>
>> The link fails code should be parsed using the structure
>> hns3_mbx_vf_to_pf_cmd, else it will parse fail.
>>
>> Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>> ---
>> drivers/net/hns3/hns3_mbx.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
>> index ba04ac9..0550c9a 100644
>> --- a/drivers/net/hns3/hns3_mbx.c
>> +++ b/drivers/net/hns3/hns3_mbx.c
>> @@ -346,12 +346,13 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code)
>> }
>>
>> static void
>> -hns3pf_handle_link_change_event(struct hns3_hw *hw,
>> - struct hns3_mbx_pf_to_vf_cmd *req)
>> +hns3pf_handle_link_change_event(struct hns3_hw *hw, void *data)
>
> Why not s/struct hns3_mbx_pf_to_vf_cmd/struct hns3_mbx_vf_to_pf_cmd/ but change
> to parameter to "void *", wouldn't it reduce the type check?
>
Only this message needs to be converted using hns3_mbx_vf_to_pf_cmd.
All other messages are processed using hns3_mbx_pf_to_vf_cmd.
So here we simplifying fix it.
Beside we will refactor hns3_mbx module in later version because the
PF and VF process logic is mixed.
thanks
>> {
>> #define LINK_STATUS_OFFSET 1
>> #define LINK_FAIL_CODE_OFFSET 2
>>
>> + struct hns3_mbx_vf_to_pf_cmd *req = data;
>> +
>> if (!req->msg[LINK_STATUS_OFFSET])
>> hns3_link_fail_parse(hw, req->msg[LINK_FAIL_CODE_OFFSET]);
>>
>>
>
>
> .
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH 3/4] net/hns3: fix parse link fails code fail
2021-04-26 12:41 ` fengchengwen
@ 2021-04-26 12:50 ` Ferruh Yigit
2021-04-26 13:20 ` fengchengwen
0 siblings, 1 reply; 19+ messages in thread
From: Ferruh Yigit @ 2021-04-26 12:50 UTC (permalink / raw)
To: fengchengwen; +Cc: Min Hu (Connor), dev
On 4/26/2021 1:41 PM, fengchengwen wrote:
>
>
> On 2021/4/26 20:26, Ferruh Yigit wrote:
>> On 4/22/2021 2:55 AM, Min Hu (Connor) wrote:
>>> From: Chengwen Feng <fengchengwen@huawei.com>
>>>
>>> The link fails code should be parsed using the structure
>>> hns3_mbx_vf_to_pf_cmd, else it will parse fail.
>>>
>>> Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>>> ---
>>> drivers/net/hns3/hns3_mbx.c | 5 +++--
>>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
>>> index ba04ac9..0550c9a 100644
>>> --- a/drivers/net/hns3/hns3_mbx.c
>>> +++ b/drivers/net/hns3/hns3_mbx.c
>>> @@ -346,12 +346,13 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code)
>>> }
>>>
>>> static void
>>> -hns3pf_handle_link_change_event(struct hns3_hw *hw,
>>> - struct hns3_mbx_pf_to_vf_cmd *req)
>>> +hns3pf_handle_link_change_event(struct hns3_hw *hw, void *data)
>>
>> Why not s/struct hns3_mbx_pf_to_vf_cmd/struct hns3_mbx_vf_to_pf_cmd/ but change
>> to parameter to "void *", wouldn't it reduce the type check?
>>
>
> Only this message needs to be converted using hns3_mbx_vf_to_pf_cmd.
> All other messages are processed using hns3_mbx_pf_to_vf_cmd.
> So here we simplifying fix it.
>
There is a single caller of the function, which send parameter as "struct
hns3_mbx_pf_to_vf_cmd *req", so what is the point of making the parameter as
"void *" and inside the function cast it to "struct hns3_mbx_vf_to_pf_cmd *req =
data;"?
Instead of defining parameter as "struct hns3_mbx_pf_to_vf_cmd *req".
> Beside we will refactor hns3_mbx module in later version because the
> PF and VF process logic is mixed.
>
OK
> thanks
>
>>> {
>>> #define LINK_STATUS_OFFSET 1
>>> #define LINK_FAIL_CODE_OFFSET 2
>>>
>>> + struct hns3_mbx_vf_to_pf_cmd *req = data;
>>> +
>>> if (!req->msg[LINK_STATUS_OFFSET])
>>> hns3_link_fail_parse(hw, req->msg[LINK_FAIL_CODE_OFFSET]);
>>>
>>>
>>
>>
>> .
>>
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH 0/4] bugfix for hns3 PMD
2021-04-22 1:55 [dpdk-dev] [PATCH 0/4] bugfix for hns3 PMD Min Hu (Connor)
` (3 preceding siblings ...)
2021-04-22 1:55 ` [dpdk-dev] [PATCH 4/4] net/hns3: delete unused macro and struct of mbx module Min Hu (Connor)
@ 2021-04-26 12:52 ` Ferruh Yigit
4 siblings, 0 replies; 19+ messages in thread
From: Ferruh Yigit @ 2021-04-26 12:52 UTC (permalink / raw)
To: Min Hu (Connor), dev
On 4/22/2021 2:55 AM, Min Hu (Connor) wrote:
> This patchset contains four bugfixes for hns3 PMD.
>
> Chengwen Feng (4):
> net/hns3: fix error mbx messages prompt errors
> net/hns3: fix PF miss link status notify message
> net/hns3: fix parse link fails code fail
> net/hns3: delete unused macro and struct of mbx module
>
Except from 3/4,
Series applied to dpdk-next-net/main, thanks.
3/4 can be handled separately.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH 3/4] net/hns3: fix parse link fails code fail
2021-04-26 12:50 ` Ferruh Yigit
@ 2021-04-26 13:20 ` fengchengwen
0 siblings, 0 replies; 19+ messages in thread
From: fengchengwen @ 2021-04-26 13:20 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Min Hu (Connor), dev
On 2021/4/26 20:50, Ferruh Yigit wrote:
> On 4/26/2021 1:41 PM, fengchengwen wrote:
>>
>>
>> On 2021/4/26 20:26, Ferruh Yigit wrote:
>>> On 4/22/2021 2:55 AM, Min Hu (Connor) wrote:
>>>> From: Chengwen Feng <fengchengwen@huawei.com>
>>>>
>>>> The link fails code should be parsed using the structure
>>>> hns3_mbx_vf_to_pf_cmd, else it will parse fail.
>>>>
>>>> Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>>>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>>>> ---
>>>> drivers/net/hns3/hns3_mbx.c | 5 +++--
>>>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
>>>> index ba04ac9..0550c9a 100644
>>>> --- a/drivers/net/hns3/hns3_mbx.c
>>>> +++ b/drivers/net/hns3/hns3_mbx.c
>>>> @@ -346,12 +346,13 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code)
>>>> }
>>>>
>>>> static void
>>>> -hns3pf_handle_link_change_event(struct hns3_hw *hw,
>>>> - struct hns3_mbx_pf_to_vf_cmd *req)
>>>> +hns3pf_handle_link_change_event(struct hns3_hw *hw, void *data)
>>>
>>> Why not s/struct hns3_mbx_pf_to_vf_cmd/struct hns3_mbx_vf_to_pf_cmd/ but change
>>> to parameter to "void *", wouldn't it reduce the type check?
>>>
>>
>> Only this message needs to be converted using hns3_mbx_vf_to_pf_cmd.
>> All other messages are processed using hns3_mbx_pf_to_vf_cmd.
>> So here we simplifying fix it.
>>
>
> There is a single caller of the function, which send parameter as "struct
> hns3_mbx_pf_to_vf_cmd *req", so what is the point of making the parameter as
> "void *" and inside the function cast it to "struct hns3_mbx_vf_to_pf_cmd *req =
> data;"?
> Instead of defining parameter as "struct hns3_mbx_pf_to_vf_cmd *req".
>
We'll keep the original API interface and add comments in v2, thanks
>> Beside we will refactor hns3_mbx module in later version because the
>> PF and VF process logic is mixed.
>>
>
> OK
>
>> thanks
>>
>>>> {
>>>> #define LINK_STATUS_OFFSET 1
>>>> #define LINK_FAIL_CODE_OFFSET 2
>>>>
>>>> + struct hns3_mbx_vf_to_pf_cmd *req = data;
>>>> +
>>>> if (!req->msg[LINK_STATUS_OFFSET])
>>>> hns3_link_fail_parse(hw, req->msg[LINK_FAIL_CODE_OFFSET]);
>>>>
>>>>
>>>
>>>
>>> .
>>>
>>
>
>
> .
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH v2] net/hns3: fix parse link fails code fail
2021-04-22 1:55 ` [dpdk-dev] [PATCH 3/4] net/hns3: fix parse link fails code fail Min Hu (Connor)
2021-04-26 12:26 ` Ferruh Yigit
@ 2021-04-26 13:42 ` Min Hu (Connor)
2021-04-27 11:11 ` Ferruh Yigit
2021-04-27 12:17 ` [dpdk-dev] [PATCH v3] " Min Hu (Connor)
2 siblings, 1 reply; 19+ messages in thread
From: Min Hu (Connor) @ 2021-04-26 13:42 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
From: Chengwen Feng <fengchengwen@huawei.com>
The link fails code should be parsed using the structure
hns3_mbx_vf_to_pf_cmd, else it will parse fail.
Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
v2:
* kept original API interface.
---
drivers/net/hns3/hns3_mbx.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
index eb202dd..755298f 100644
--- a/drivers/net/hns3/hns3_mbx.c
+++ b/drivers/net/hns3/hns3_mbx.c
@@ -346,12 +346,20 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code)
}
static void
+
hns3pf_handle_link_change_event(struct hns3_hw *hw,
- struct hns3_mbx_pf_to_vf_cmd *req)
+ struct hns3_mbx_pf_to_vf_cmd *cmd)
{
#define LINK_STATUS_OFFSET 1
#define LINK_FAIL_CODE_OFFSET 2
+ /*
+ * This message is reported by the firmware and is reported in
+ * 'struct hns3_mbx_vf_to_pf_cmd' format. Therefore, we should cast
+ * the cmd to 'struct hns3_mbx_vf_to_pf_cmd' first.
+ */
+ struct hns3_mbx_vf_to_pf_cmd *req = (struct hns3_mbx_vf_to_pf_cmd *)cmd;
+
if (!req->msg[LINK_STATUS_OFFSET])
hns3_link_fail_parse(hw, req->msg[LINK_FAIL_CODE_OFFSET]);
--
2.7.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/hns3: fix parse link fails code fail
2021-04-26 13:42 ` [dpdk-dev] [PATCH v2] " Min Hu (Connor)
@ 2021-04-27 11:11 ` Ferruh Yigit
2021-04-27 12:31 ` Min Hu (Connor)
0 siblings, 1 reply; 19+ messages in thread
From: Ferruh Yigit @ 2021-04-27 11:11 UTC (permalink / raw)
To: Min Hu (Connor), dev
On 4/26/2021 2:42 PM, Min Hu (Connor) wrote:
> From: Chengwen Feng <fengchengwen@huawei.com>
>
> The link fails code should be parsed using the structure
> hns3_mbx_vf_to_pf_cmd, else it will parse fail.
>
> Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> ---
> v2:
> * kept original API interface.
> ---
> drivers/net/hns3/hns3_mbx.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
> index eb202dd..755298f 100644
> --- a/drivers/net/hns3/hns3_mbx.c
> +++ b/drivers/net/hns3/hns3_mbx.c
> @@ -346,12 +346,20 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code)
> }
>
> static void
> +
> hns3pf_handle_link_change_event(struct hns3_hw *hw,
> - struct hns3_mbx_pf_to_vf_cmd *req)
> + struct hns3_mbx_pf_to_vf_cmd *cmd)
> {
> #define LINK_STATUS_OFFSET 1
> #define LINK_FAIL_CODE_OFFSET 2
>
> + /*
> + * This message is reported by the firmware and is reported in
> + * 'struct hns3_mbx_vf_to_pf_cmd' format. Therefore, we should cast
> + * the cmd to 'struct hns3_mbx_vf_to_pf_cmd' first.
> + */
> + struct hns3_mbx_vf_to_pf_cmd *req = (struct hns3_mbx_vf_to_pf_cmd *)cmd;
> +
Hi Connor,
I guess I am missing something obvious, why not get the parameter as 'struct
hns3_mbx_vf_to_pf_cmd' at first place?
^ permalink raw reply [flat|nested] 19+ messages in thread
* [dpdk-dev] [PATCH v3] net/hns3: fix parse link fails code fail
2021-04-22 1:55 ` [dpdk-dev] [PATCH 3/4] net/hns3: fix parse link fails code fail Min Hu (Connor)
2021-04-26 12:26 ` Ferruh Yigit
2021-04-26 13:42 ` [dpdk-dev] [PATCH v2] " Min Hu (Connor)
@ 2021-04-27 12:17 ` Min Hu (Connor)
2021-04-27 12:45 ` Ferruh Yigit
2 siblings, 1 reply; 19+ messages in thread
From: Min Hu (Connor) @ 2021-04-27 12:17 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
From: Chengwen Feng <fengchengwen@huawei.com>
The link fails code should be parsed using the structure
hns3_mbx_vf_to_pf_cmd, else it will parse fail.
Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
v3:
* get the parameter as 'struct hns3_mbx_vf_to_pf_cmd' at first place.
v2:
* kept original API interface.
---
drivers/net/hns3/hns3_mbx.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
index ba04ac9..31ab130 100644
--- a/drivers/net/hns3/hns3_mbx.c
+++ b/drivers/net/hns3/hns3_mbx.c
@@ -347,7 +347,7 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code)
static void
hns3pf_handle_link_change_event(struct hns3_hw *hw,
- struct hns3_mbx_pf_to_vf_cmd *req)
+ struct hns3_mbx_vf_to_pf_cmd *req)
{
#define LINK_STATUS_OFFSET 1
#define LINK_FAIL_CODE_OFFSET 2
@@ -513,7 +513,14 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
hns3_handle_asserting_reset(hw, req);
break;
case HNS3_MBX_PUSH_LINK_STATUS:
- hns3pf_handle_link_change_event(hw, req);
+ /*
+ * This message is reported by the firmware and is
+ * reported in 'struct hns3_mbx_vf_to_pf_cmd' format.
+ * Therefore, we should cast the req variable to
+ * 'struct hns3_mbx_vf_to_pf_cmd' and then process it.
+ */
+ hns3pf_handle_link_change_event(hw,
+ (struct hns3_mbx_vf_to_pf_cmd *)req);
break;
case HNS3_MBX_PUSH_VLAN_INFO:
/*
--
2.7.4
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/hns3: fix parse link fails code fail
2021-04-27 11:11 ` Ferruh Yigit
@ 2021-04-27 12:31 ` Min Hu (Connor)
0 siblings, 0 replies; 19+ messages in thread
From: Min Hu (Connor) @ 2021-04-27 12:31 UTC (permalink / raw)
To: Ferruh Yigit, dev
在 2021/4/27 19:11, Ferruh Yigit 写道:
> On 4/26/2021 2:42 PM, Min Hu (Connor) wrote:
>> From: Chengwen Feng <fengchengwen@huawei.com>
>>
>> The link fails code should be parsed using the structure
>> hns3_mbx_vf_to_pf_cmd, else it will parse fail.
>>
>> Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>> ---
>> v2:
>> * kept original API interface.
>> ---
>> drivers/net/hns3/hns3_mbx.c | 10 +++++++++-
>> 1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
>> index eb202dd..755298f 100644
>> --- a/drivers/net/hns3/hns3_mbx.c
>> +++ b/drivers/net/hns3/hns3_mbx.c
>> @@ -346,12 +346,20 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code)
>> }
>>
>> static void
>> +
>> hns3pf_handle_link_change_event(struct hns3_hw *hw,
>> - struct hns3_mbx_pf_to_vf_cmd *req)
>> + struct hns3_mbx_pf_to_vf_cmd *cmd)
>> {
>> #define LINK_STATUS_OFFSET 1
>> #define LINK_FAIL_CODE_OFFSET 2
>>
>> + /*
>> + * This message is reported by the firmware and is reported in
>> + * 'struct hns3_mbx_vf_to_pf_cmd' format. Therefore, we should cast
>> + * the cmd to 'struct hns3_mbx_vf_to_pf_cmd' first.
>> + */
>> + struct hns3_mbx_vf_to_pf_cmd *req = (struct hns3_mbx_vf_to_pf_cmd *)cmd;
>> +
>
> Hi Connor,
>
> I guess I am missing something obvious, why not get the parameter as 'struct
> hns3_mbx_vf_to_pf_cmd' at first place?
> .
Hi, fixed in v3, thanks.
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH v3] net/hns3: fix parse link fails code fail
2021-04-27 12:17 ` [dpdk-dev] [PATCH v3] " Min Hu (Connor)
@ 2021-04-27 12:45 ` Ferruh Yigit
2021-04-27 13:03 ` Min Hu (Connor)
0 siblings, 1 reply; 19+ messages in thread
From: Ferruh Yigit @ 2021-04-27 12:45 UTC (permalink / raw)
To: Min Hu (Connor), dev
On 4/27/2021 1:17 PM, Min Hu (Connor) wrote:
> From: Chengwen Feng <fengchengwen@huawei.com>
>
> The link fails code should be parsed using the structure
> hns3_mbx_vf_to_pf_cmd, else it will parse fail.
>
> Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> ---
> v3:
> * get the parameter as 'struct hns3_mbx_vf_to_pf_cmd' at first place.
>
> v2:
> * kept original API interface.
> ---
> drivers/net/hns3/hns3_mbx.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
> index ba04ac9..31ab130 100644
> --- a/drivers/net/hns3/hns3_mbx.c
> +++ b/drivers/net/hns3/hns3_mbx.c
> @@ -347,7 +347,7 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code)
>
> static void
> hns3pf_handle_link_change_event(struct hns3_hw *hw,
> - struct hns3_mbx_pf_to_vf_cmd *req)
> + struct hns3_mbx_vf_to_pf_cmd *req)
> {
> #define LINK_STATUS_OFFSET 1
> #define LINK_FAIL_CODE_OFFSET 2
> @@ -513,7 +513,14 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
> hns3_handle_asserting_reset(hw, req);
> break;
> case HNS3_MBX_PUSH_LINK_STATUS:
> - hns3pf_handle_link_change_event(hw, req);
> + /*
> + * This message is reported by the firmware and is
> + * reported in 'struct hns3_mbx_vf_to_pf_cmd' format.
> + * Therefore, we should cast the req variable to
> + * 'struct hns3_mbx_vf_to_pf_cmd' and then process it.
> + */
I am asking just to double check, the 'msg' type is different of
'hns3_mbx_pf_to_vf_cmd' & 'hns3_mbx_vf_to_pf_cmd', one is 'uint8_t', other is
'uint16_t', and 'msg' is used in the function 'hns3pf_handle_link_change_event()'.
Is the 'msg' usage still correct after this change?
> + hns3pf_handle_link_change_event(hw,
> + (struct hns3_mbx_vf_to_pf_cmd *)req);
Will it be more readable if 'desc->data' cast to "struct hns3_mbx_vf_to_pf_cmd
*" (instead of 'req')? Up to you, I can proceed with this one if you prefer.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH v3] net/hns3: fix parse link fails code fail
2021-04-27 12:45 ` Ferruh Yigit
@ 2021-04-27 13:03 ` Min Hu (Connor)
2021-04-27 13:19 ` Ferruh Yigit
0 siblings, 1 reply; 19+ messages in thread
From: Min Hu (Connor) @ 2021-04-27 13:03 UTC (permalink / raw)
To: Ferruh Yigit, dev
在 2021/4/27 20:45, Ferruh Yigit 写道:
> On 4/27/2021 1:17 PM, Min Hu (Connor) wrote:
>> From: Chengwen Feng <fengchengwen@huawei.com>
>>
>> The link fails code should be parsed using the structure
>> hns3_mbx_vf_to_pf_cmd, else it will parse fail.
>>
>> Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>> ---
>> v3:
>> * get the parameter as 'struct hns3_mbx_vf_to_pf_cmd' at first place.
>>
>> v2:
>> * kept original API interface.
>> ---
>> drivers/net/hns3/hns3_mbx.c | 11 +++++++++--
>> 1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
>> index ba04ac9..31ab130 100644
>> --- a/drivers/net/hns3/hns3_mbx.c
>> +++ b/drivers/net/hns3/hns3_mbx.c
>> @@ -347,7 +347,7 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code)
>>
>> static void
>> hns3pf_handle_link_change_event(struct hns3_hw *hw,
>> - struct hns3_mbx_pf_to_vf_cmd *req)
>> + struct hns3_mbx_vf_to_pf_cmd *req)
>> {
>> #define LINK_STATUS_OFFSET 1
>> #define LINK_FAIL_CODE_OFFSET 2
>> @@ -513,7 +513,14 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
>> hns3_handle_asserting_reset(hw, req);
>> break;
>> case HNS3_MBX_PUSH_LINK_STATUS:
>> - hns3pf_handle_link_change_event(hw, req);
>> + /*
>> + * This message is reported by the firmware and is
>> + * reported in 'struct hns3_mbx_vf_to_pf_cmd' format.
>> + * Therefore, we should cast the req variable to
>> + * 'struct hns3_mbx_vf_to_pf_cmd' and then process it.
>> + */
>
> I am asking just to double check, the 'msg' type is different of
> 'hns3_mbx_pf_to_vf_cmd' & 'hns3_mbx_vf_to_pf_cmd', one is 'uint8_t', other is
> 'uint16_t', and 'msg' is used in the function 'hns3pf_handle_link_change_event()'.
> Is the 'msg' usage still correct after this change?
>
Hi, it is correct.
Currently, msg from PF or VF are all handled in the same
handler(hns3_dev_handle_mbx_msg), we do different handling
according to different msg.
In futrue, we will separate handler from PF and VF.
>> + hns3pf_handle_link_change_event(hw,
>> + (struct hns3_mbx_vf_to_pf_cmd *)req);
>
> Will it be more readable if 'desc->data' cast to "struct hns3_mbx_vf_to_pf_cmd
> *" (instead of 'req')? Up to you, I can proceed with this one if you prefer.
> .
OK, thanks Ferruh.
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH v3] net/hns3: fix parse link fails code fail
2021-04-27 13:03 ` Min Hu (Connor)
@ 2021-04-27 13:19 ` Ferruh Yigit
2021-04-27 13:43 ` Min Hu (Connor)
0 siblings, 1 reply; 19+ messages in thread
From: Ferruh Yigit @ 2021-04-27 13:19 UTC (permalink / raw)
To: Min Hu (Connor), dev
On 4/27/2021 2:03 PM, Min Hu (Connor) wrote:
>
>
> 在 2021/4/27 20:45, Ferruh Yigit 写道:
>> On 4/27/2021 1:17 PM, Min Hu (Connor) wrote:
>>> From: Chengwen Feng <fengchengwen@huawei.com>
>>>
>>> The link fails code should be parsed using the structure
>>> hns3_mbx_vf_to_pf_cmd, else it will parse fail.
>>>
>>> Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>>> ---
>>> v3:
>>> * get the parameter as 'struct hns3_mbx_vf_to_pf_cmd' at first place.
>>>
>>> v2:
>>> * kept original API interface.
>>> ---
>>> drivers/net/hns3/hns3_mbx.c | 11 +++++++++--
>>> 1 file changed, 9 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
>>> index ba04ac9..31ab130 100644
>>> --- a/drivers/net/hns3/hns3_mbx.c
>>> +++ b/drivers/net/hns3/hns3_mbx.c
>>> @@ -347,7 +347,7 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t
>>> link_fail_code)
>>> static void
>>> hns3pf_handle_link_change_event(struct hns3_hw *hw,
>>> - struct hns3_mbx_pf_to_vf_cmd *req)
>>> + struct hns3_mbx_vf_to_pf_cmd *req)
>>> {
>>> #define LINK_STATUS_OFFSET 1
>>> #define LINK_FAIL_CODE_OFFSET 2
>>> @@ -513,7 +513,14 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
>>> hns3_handle_asserting_reset(hw, req);
>>> break;
>>> case HNS3_MBX_PUSH_LINK_STATUS:
>>> - hns3pf_handle_link_change_event(hw, req);
>>> + /*
>>> + * This message is reported by the firmware and is
>>> + * reported in 'struct hns3_mbx_vf_to_pf_cmd' format.
>>> + * Therefore, we should cast the req variable to
>>> + * 'struct hns3_mbx_vf_to_pf_cmd' and then process it.
>>> + */
>>
>> I am asking just to double check, the 'msg' type is different of
>> 'hns3_mbx_pf_to_vf_cmd' & 'hns3_mbx_vf_to_pf_cmd', one is 'uint8_t', other is
>> 'uint16_t', and 'msg' is used in the function
>> 'hns3pf_handle_link_change_event()'.
>> Is the 'msg' usage still correct after this change?
>>
> Hi, it is correct.
> Currently, msg from PF or VF are all handled in the same
> handler(hns3_dev_handle_mbx_msg), we do different handling
> according to different msg.
> In futrue, we will separate handler from PF and VF.
>
Let me clarify what I mean, 'msg' is accessed with an index like
"req->msg[LINK_FAIL_CODE_OFFSET]", and the 'req->msg' type is different as you
change the 'req' type. It changes 'uint8_t' -> 'uint16_t', which makes
"req->msg[LINK_FAIL_CODE_OFFSET]" point completely different location, can you
please confirm this is expected/correct?
>>> + hns3pf_handle_link_change_event(hw,
>>> + (struct hns3_mbx_vf_to_pf_cmd *)req);
>>
>> Will it be more readable if 'desc->data' cast to "struct hns3_mbx_vf_to_pf_cmd
>> *" (instead of 'req')? Up to you, I can proceed with this one if you prefer.
>> .
> OK, thanks Ferruh.
So do you prefer to continue as it is, or will there be a change?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH v3] net/hns3: fix parse link fails code fail
2021-04-27 13:19 ` Ferruh Yigit
@ 2021-04-27 13:43 ` Min Hu (Connor)
2021-04-27 15:09 ` Ferruh Yigit
0 siblings, 1 reply; 19+ messages in thread
From: Min Hu (Connor) @ 2021-04-27 13:43 UTC (permalink / raw)
To: Ferruh Yigit, dev
在 2021/4/27 21:19, Ferruh Yigit 写道:
> On 4/27/2021 2:03 PM, Min Hu (Connor) wrote:
>>
>>
>> 在 2021/4/27 20:45, Ferruh Yigit 写道:
>>> On 4/27/2021 1:17 PM, Min Hu (Connor) wrote:
>>>> From: Chengwen Feng <fengchengwen@huawei.com>
>>>>
>>>> The link fails code should be parsed using the structure
>>>> hns3_mbx_vf_to_pf_cmd, else it will parse fail.
>>>>
>>>> Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>>>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>>>> ---
>>>> v3:
>>>> * get the parameter as 'struct hns3_mbx_vf_to_pf_cmd' at first place.
>>>>
>>>> v2:
>>>> * kept original API interface.
>>>> ---
>>>> drivers/net/hns3/hns3_mbx.c | 11 +++++++++--
>>>> 1 file changed, 9 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
>>>> index ba04ac9..31ab130 100644
>>>> --- a/drivers/net/hns3/hns3_mbx.c
>>>> +++ b/drivers/net/hns3/hns3_mbx.c
>>>> @@ -347,7 +347,7 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t
>>>> link_fail_code)
>>>> static void
>>>> hns3pf_handle_link_change_event(struct hns3_hw *hw,
>>>> - struct hns3_mbx_pf_to_vf_cmd *req)
>>>> + struct hns3_mbx_vf_to_pf_cmd *req)
>>>> {
>>>> #define LINK_STATUS_OFFSET 1
>>>> #define LINK_FAIL_CODE_OFFSET 2
>>>> @@ -513,7 +513,14 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
>>>> hns3_handle_asserting_reset(hw, req);
>>>> break;
>>>> case HNS3_MBX_PUSH_LINK_STATUS:
>>>> - hns3pf_handle_link_change_event(hw, req);
>>>> + /*
>>>> + * This message is reported by the firmware and is
>>>> + * reported in 'struct hns3_mbx_vf_to_pf_cmd' format.
>>>> + * Therefore, we should cast the req variable to
>>>> + * 'struct hns3_mbx_vf_to_pf_cmd' and then process it.
>>>> + */
>>>
>>> I am asking just to double check, the 'msg' type is different of
>>> 'hns3_mbx_pf_to_vf_cmd' & 'hns3_mbx_vf_to_pf_cmd', one is 'uint8_t', other is
>>> 'uint16_t', and 'msg' is used in the function
>>> 'hns3pf_handle_link_change_event()'.
>>> Is the 'msg' usage still correct after this change?
>>>
>> Hi, it is correct.
>> Currently, msg from PF or VF are all handled in the same
>> handler(hns3_dev_handle_mbx_msg), we do different handling
>> according to different msg.
>> In futrue, we will separate handler from PF and VF.
>>
>
> Let me clarify what I mean, 'msg' is accessed with an index like
> "req->msg[LINK_FAIL_CODE_OFFSET]", and the 'req->msg' type is different as you
> change the 'req' type. It changes 'uint8_t' -> 'uint16_t', which makes
> "req->msg[LINK_FAIL_CODE_OFFSET]" point completely different location, can you
> please confirm this is expected/correct?
>
Hi, it is corect, we have tested it.
>
>>>> + hns3pf_handle_link_change_event(hw,
>>>> + (struct hns3_mbx_vf_to_pf_cmd *)req);
>>>
>>> Will it be more readable if 'desc->data' cast to "struct hns3_mbx_vf_to_pf_cmd
>>> *" (instead of 'req')? Up to you, I can proceed with this one if you prefer.
>>> .
>> OK, thanks Ferruh.
>
> So do you prefer to continue as it is, or will there be a change?
>
continue as it is, thanks.
> .
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [dpdk-dev] [PATCH v3] net/hns3: fix parse link fails code fail
2021-04-27 13:43 ` Min Hu (Connor)
@ 2021-04-27 15:09 ` Ferruh Yigit
0 siblings, 0 replies; 19+ messages in thread
From: Ferruh Yigit @ 2021-04-27 15:09 UTC (permalink / raw)
To: Min Hu (Connor), dev
On 4/27/2021 2:43 PM, Min Hu (Connor) wrote:
>
>
> 在 2021/4/27 21:19, Ferruh Yigit 写道:
>> On 4/27/2021 2:03 PM, Min Hu (Connor) wrote:
>>>
>>>
>>> 在 2021/4/27 20:45, Ferruh Yigit 写道:
>>>> On 4/27/2021 1:17 PM, Min Hu (Connor) wrote:
>>>>> From: Chengwen Feng <fengchengwen@huawei.com>
>>>>>
>>>>> The link fails code should be parsed using the structure
>>>>> hns3_mbx_vf_to_pf_cmd, else it will parse fail.
>>>>>
>>>>> Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox")
>>>>> Cc: stable@dpdk.org
>>>>>
>>>>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>>>>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>>>>> ---
>>>>> v3:
>>>>> * get the parameter as 'struct hns3_mbx_vf_to_pf_cmd' at first place.
>>>>>
>>>>> v2:
>>>>> * kept original API interface.
>>>>> ---
>>>>> drivers/net/hns3/hns3_mbx.c | 11 +++++++++--
>>>>> 1 file changed, 9 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
>>>>> index ba04ac9..31ab130 100644
>>>>> --- a/drivers/net/hns3/hns3_mbx.c
>>>>> +++ b/drivers/net/hns3/hns3_mbx.c
>>>>> @@ -347,7 +347,7 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t
>>>>> link_fail_code)
>>>>> static void
>>>>> hns3pf_handle_link_change_event(struct hns3_hw *hw,
>>>>> - struct hns3_mbx_pf_to_vf_cmd *req)
>>>>> + struct hns3_mbx_vf_to_pf_cmd *req)
>>>>> {
>>>>> #define LINK_STATUS_OFFSET 1
>>>>> #define LINK_FAIL_CODE_OFFSET 2
>>>>> @@ -513,7 +513,14 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
>>>>> hns3_handle_asserting_reset(hw, req);
>>>>> break;
>>>>> case HNS3_MBX_PUSH_LINK_STATUS:
>>>>> - hns3pf_handle_link_change_event(hw, req);
>>>>> + /*
>>>>> + * This message is reported by the firmware and is
>>>>> + * reported in 'struct hns3_mbx_vf_to_pf_cmd' format.
>>>>> + * Therefore, we should cast the req variable to
>>>>> + * 'struct hns3_mbx_vf_to_pf_cmd' and then process it.
>>>>> + */
>>>>
>>>> I am asking just to double check, the 'msg' type is different of
>>>> 'hns3_mbx_pf_to_vf_cmd' & 'hns3_mbx_vf_to_pf_cmd', one is 'uint8_t', other is
>>>> 'uint16_t', and 'msg' is used in the function
>>>> 'hns3pf_handle_link_change_event()'.
>>>> Is the 'msg' usage still correct after this change?
>>>>
>>> Hi, it is correct.
>>> Currently, msg from PF or VF are all handled in the same
>>> handler(hns3_dev_handle_mbx_msg), we do different handling
>>> according to different msg.
>>> In futrue, we will separate handler from PF and VF.
>>>
>>
>> Let me clarify what I mean, 'msg' is accessed with an index like
>> "req->msg[LINK_FAIL_CODE_OFFSET]", and the 'req->msg' type is different as you
>> change the 'req' type. It changes 'uint8_t' -> 'uint16_t', which makes
>> "req->msg[LINK_FAIL_CODE_OFFSET]" point completely different location, can you
>> please confirm this is expected/correct?
>>
> Hi, it is corect, we have tested it.
Applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2021-04-27 15:09 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22 1:55 [dpdk-dev] [PATCH 0/4] bugfix for hns3 PMD Min Hu (Connor)
2021-04-22 1:55 ` [dpdk-dev] [PATCH 1/4] net/hns3: fix error mbx messages prompt errors Min Hu (Connor)
2021-04-22 1:55 ` [dpdk-dev] [PATCH 2/4] net/hns3: fix PF miss link status notify message Min Hu (Connor)
2021-04-22 1:55 ` [dpdk-dev] [PATCH 3/4] net/hns3: fix parse link fails code fail Min Hu (Connor)
2021-04-26 12:26 ` Ferruh Yigit
2021-04-26 12:41 ` fengchengwen
2021-04-26 12:50 ` Ferruh Yigit
2021-04-26 13:20 ` fengchengwen
2021-04-26 13:42 ` [dpdk-dev] [PATCH v2] " Min Hu (Connor)
2021-04-27 11:11 ` Ferruh Yigit
2021-04-27 12:31 ` Min Hu (Connor)
2021-04-27 12:17 ` [dpdk-dev] [PATCH v3] " Min Hu (Connor)
2021-04-27 12:45 ` Ferruh Yigit
2021-04-27 13:03 ` Min Hu (Connor)
2021-04-27 13:19 ` Ferruh Yigit
2021-04-27 13:43 ` Min Hu (Connor)
2021-04-27 15:09 ` Ferruh Yigit
2021-04-22 1:55 ` [dpdk-dev] [PATCH 4/4] net/hns3: delete unused macro and struct of mbx module Min Hu (Connor)
2021-04-26 12:52 ` [dpdk-dev] [PATCH 0/4] bugfix for hns3 PMD Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).