[2/3] net/bonding: fix not checked return value
Checks
Commit Message
Return value from bond_ethdev_8023ad_flow_set() is now checked
and appropriate message is logged on error.
Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP control")
Cc: tomaszx.kulasek@intel.com
Signed-off-by: Martin Havlik <xhavli56@stud.fit.vutbr.cz>
Cc: Jan Viktorin <viktorin@cesnet.cz>
---
drivers/net/bonding/rte_eth_bond_pmd.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
Comments
在 2021/6/22 17:25, Martin Havlik 写道:
> Return value from bond_ethdev_8023ad_flow_set() is now checked
> and appropriate message is logged on error.
>
> Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP control")
> Cc: tomaszx.kulasek@intel.com
>
> Signed-off-by: Martin Havlik <xhavli56@stud.fit.vutbr.cz>
> Cc: Jan Viktorin <viktorin@cesnet.cz>
> ---
> drivers/net/bonding/rte_eth_bond_pmd.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index 4c43bf916..a6755661c 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -1819,8 +1819,14 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
> internals->mode4.dedicated_queues.flow[slave_eth_dev->data->port_id],
> &flow_error);
>
> - bond_ethdev_8023ad_flow_set(bonded_eth_dev,
> + errval = bond_ethdev_8023ad_flow_set(bonded_eth_dev,
> slave_eth_dev->data->port_id);
> + if (errval != 0) {
> + RTE_BOND_LOG(ERR,
> + "bond_ethdev_8023ad_flow_set: port=%d, err (%d)",
> + slave_eth_dev->data->port_id, errval);
> + return errval;
> + }
> }
>
Firstly, I think your patch is OK,
But I want to know what is your standard to decide which function should
check return value or not(of course, they are none-void)?
While, I noticed "bond_ethdev_lsc_event_callback" nearby was not
checked, but you ignored it.
> /* Start device */
>
Dne 2021-07-08 14:43, Min Hu (Connor) napsal:
> 在 2021/6/22 17:25, Martin Havlik 写道:
>> Return value from bond_ethdev_8023ad_flow_set() is now checked
>> and appropriate message is logged on error.
>>
>> Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP
>> control")
>> Cc: tomaszx.kulasek@intel.com
>>
>> Signed-off-by: Martin Havlik <xhavli56@stud.fit.vutbr.cz>
>> Cc: Jan Viktorin <viktorin@cesnet.cz>
>> ---
>> drivers/net/bonding/rte_eth_bond_pmd.c | 8 +++++++-
>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c
>> b/drivers/net/bonding/rte_eth_bond_pmd.c
>> index 4c43bf916..a6755661c 100644
>> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
>> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
>> @@ -1819,8 +1819,14 @@ slave_configure(struct rte_eth_dev
>> *bonded_eth_dev,
>>
>> internals->mode4.dedicated_queues.flow[slave_eth_dev->data->port_id],
>> &flow_error);
>> - bond_ethdev_8023ad_flow_set(bonded_eth_dev,
>> + errval = bond_ethdev_8023ad_flow_set(bonded_eth_dev,
>> slave_eth_dev->data->port_id);
>> + if (errval != 0) {
>> + RTE_BOND_LOG(ERR,
>> + "bond_ethdev_8023ad_flow_set: port=%d, err (%d)",
>> + slave_eth_dev->data->port_id, errval);
>> + return errval;
>> + }
>> }
>>
> Firstly, I think your patch is OK,
> But I want to know what is your standard to decide which function
> should check return value or not(of course, they are none-void)?
>
I encountered the problem with dedicated queues on mlx5, I looked into
the source code and I saw the cause, so I fixed it. If I had seen any
other issue, I would've fixed it too. That, for example, applies to the
log message fix I included. My standard is to check all non-void return
values.
> While, I noticed "bond_ethdev_lsc_event_callback" nearby was not
> checked, but you ignored it.
>
Not ignored, just didn't properly review more code than what closely
surrounded the problematic lines.
>> /* Start device */
>>
在 2021/7/8 21:20, Havlík Martin 写道:
> Dne 2021-07-08 14:43, Min Hu (Connor) napsal:
>> 在 2021/6/22 17:25, Martin Havlik 写道:
>>> Return value from bond_ethdev_8023ad_flow_set() is now checked
>>> and appropriate message is logged on error.
>>>
>>> Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP
>>> control")
>>> Cc: tomaszx.kulasek@intel.com
>>>
>>> Signed-off-by: Martin Havlik <xhavli56@stud.fit.vutbr.cz>
>>> Cc: Jan Viktorin <viktorin@cesnet.cz>
>>> ---
>>> drivers/net/bonding/rte_eth_bond_pmd.c | 8 +++++++-
>>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c
>>> b/drivers/net/bonding/rte_eth_bond_pmd.c
>>> index 4c43bf916..a6755661c 100644
>>> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
>>> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
>>> @@ -1819,8 +1819,14 @@ slave_configure(struct rte_eth_dev
>>> *bonded_eth_dev,
>>>
>>> internals->mode4.dedicated_queues.flow[slave_eth_dev->data->port_id],
>>> &flow_error);
>>> - bond_ethdev_8023ad_flow_set(bonded_eth_dev,
>>> + errval = bond_ethdev_8023ad_flow_set(bonded_eth_dev,
>>> slave_eth_dev->data->port_id);
>>> + if (errval != 0) {
>>> + RTE_BOND_LOG(ERR,
>>> + "bond_ethdev_8023ad_flow_set: port=%d, err (%d)",
>>> + slave_eth_dev->data->port_id, errval);
>>> + return errval;
>>> + }
>>> }
>>>
>> Firstly, I think your patch is OK,
>> But I want to know what is your standard to decide which function
>> should check return value or not(of course, they are none-void)?
>>
> I encountered the problem with dedicated queues on mlx5, I looked into
> the source code and I saw the cause, so I fixed it. If I had seen any
> other issue, I would've fixed it too. That, for example, applies to the
> log message fix I included. My standard is to check all non-void return
> values.
Got it.
>> While, I noticed "bond_ethdev_lsc_event_callback" nearby was not
>> checked, but you ignored it.
>>
> Not ignored, just didn't properly review more code than what closely
> surrounded the problematic lines.
>>> /* Start device */
>>>
Acked by: Min Hu (Connor) <humin29@huawei.com>
> .
On 7/9/21 3:09 AM, Min Hu (Connor) wrote:
>
>
> 在 2021/7/8 21:20, Havlík Martin 写道:
>> Dne 2021-07-08 14:43, Min Hu (Connor) napsal:
>>> 在 2021/6/22 17:25, Martin Havlik 写道:
>>>> Return value from bond_ethdev_8023ad_flow_set() is now checked
>>>> and appropriate message is logged on error.
>>>>
>>>> Fixes: 112891cd27e5 ("net/bonding: add dedicated HW queues for LACP
>>>> control")
>>>> Cc: tomaszx.kulasek@intel.com
>>>>
>>>> Signed-off-by: Martin Havlik <xhavli56@stud.fit.vutbr.cz>
>>>> Cc: Jan Viktorin <viktorin@cesnet.cz>
>>>> ---
>>>> drivers/net/bonding/rte_eth_bond_pmd.c | 8 +++++++-
>>>> 1 file changed, 7 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c
>>>> b/drivers/net/bonding/rte_eth_bond_pmd.c
>>>> index 4c43bf916..a6755661c 100644
>>>> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
>>>> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
>>>> @@ -1819,8 +1819,14 @@ slave_configure(struct rte_eth_dev
>>>> *bonded_eth_dev,
>>>>
>>>> internals->mode4.dedicated_queues.flow[slave_eth_dev->data->port_id],
>>>> &flow_error);
>>>> - bond_ethdev_8023ad_flow_set(bonded_eth_dev,
>>>> + errval = bond_ethdev_8023ad_flow_set(bonded_eth_dev,
>>>> slave_eth_dev->data->port_id);
>>>> + if (errval != 0) {
>>>> + RTE_BOND_LOG(ERR,
>>>> + "bond_ethdev_8023ad_flow_set: port=%d, err (%d)",
>>>> + slave_eth_dev->data->port_id, errval);
>>>> + return errval;
>>>> + }
>>>> }
>>>>
>>> Firstly, I think your patch is OK,
>>> But I want to know what is your standard to decide which function
>>> should check return value or not(of course, they are none-void)?
>>>
>> I encountered the problem with dedicated queues on mlx5, I looked into
>> the source code and I saw the cause, so I fixed it. If I had seen any
>> other issue, I would've fixed it too. That, for example, applies to
>> the log message fix I included. My standard is to check all non-void
>> return values.
> Got it.
>>> While, I noticed "bond_ethdev_lsc_event_callback" nearby was not
>>> checked, but you ignored it.
>>>
>> Not ignored, just didn't properly review more code than what closely
>> surrounded the problematic lines.
>>>> /* Start device */
>>>>
> Acked by: Min Hu (Connor) <humin29@huawei.com>
>> .
Acked-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Applied, thanks.
@@ -1819,8 +1819,14 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
internals->mode4.dedicated_queues.flow[slave_eth_dev->data->port_id],
&flow_error);
- bond_ethdev_8023ad_flow_set(bonded_eth_dev,
+ errval = bond_ethdev_8023ad_flow_set(bonded_eth_dev,
slave_eth_dev->data->port_id);
+ if (errval != 0) {
+ RTE_BOND_LOG(ERR,
+ "bond_ethdev_8023ad_flow_set: port=%d, err (%d)",
+ slave_eth_dev->data->port_id, errval);
+ return errval;
+ }
}
/* Start device */