[dpdk-dev] [PATCH 2/3] net/bonding: fix not checked return value
Havlík Martin
xhavli56 at stud.fit.vutbr.cz
Thu Jul 8 15:20:57 CEST 2021
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 at intel.com
>>
>> Signed-off-by: Martin Havlik <xhavli56 at stud.fit.vutbr.cz>
>> Cc: Jan Viktorin <viktorin at 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 */
>>
More information about the dev
mailing list