[dpdk-dev] drivers/net/bonding: fix updating the slave link status

Message ID 20170425063049.4705-1-lnykww@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

wang wei April 25, 2017, 6:30 a.m. UTC
  we need to update dev->data->dev_link before handling lsc event.
Otherwise it will still have the initial value after the startup of
the program before interrupt callback was executed.

Signed-off-by: wang wei <lnykww@gmail.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Doherty, Declan April 27, 2017, 2:28 p.m. UTC | #1
On 25/04/2017 7:30 AM, wang wei wrote:
> we need to update dev->data->dev_link before handling lsc event.
> Otherwise it will still have the initial value after the startup of
> the program before interrupt callback was executed.
>
> Signed-off-by: wang wei <lnykww@gmail.com>
> ---
>  drivers/net/bonding/rte_eth_bond_pmd.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index c94071ffb..57b1012c4 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -1435,9 +1435,11 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>  	}
>
>  	/* If lsc interrupt is set, check initial slave's link status */
> -	if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
> +	if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
> +		slave_eth_dev->dev_ops->link_update(slave_eth_dev, 0);
>  		bond_ethdev_lsc_event_callback(slave_eth_dev->data->port_id,
>  			RTE_ETH_EVENT_INTR_LSC, &bonded_eth_dev->data->port_id);
> +	}
>
>  	return 0;
>  }
>

Acked-by: Declan Doherty <declan.doherty@intel.com>
  
Ferruh Yigit April 28, 2017, 5:15 a.m. UTC | #2
On 4/27/2017 3:28 PM, Declan Doherty wrote:
> On 25/04/2017 7:30 AM, wang wei wrote:
>> we need to update dev->data->dev_link before handling lsc event.
>> Otherwise it will still have the initial value after the startup of
>> the program before interrupt callback was executed.
>>
>> Signed-off-by: wang wei <lnykww@gmail.com>
>> ---
>>  drivers/net/bonding/rte_eth_bond_pmd.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
>> index c94071ffb..57b1012c4 100644
>> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
>> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
>> @@ -1435,9 +1435,11 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
>>  	}
>>
>>  	/* If lsc interrupt is set, check initial slave's link status */
>> -	if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
>> +	if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
>> +		slave_eth_dev->dev_ops->link_update(slave_eth_dev, 0);
>>  		bond_ethdev_lsc_event_callback(slave_eth_dev->data->port_id,
>>  			RTE_ETH_EVENT_INTR_LSC, &bonded_eth_dev->data->port_id);
>> +	}
>>
>>  	return 0;
>>  }
>>
> 
> Acked-by: Declan Doherty <declan.doherty@intel.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index c94071ffb..57b1012c4 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1435,9 +1435,11 @@  slave_configure(struct rte_eth_dev *bonded_eth_dev,
 	}
 
 	/* If lsc interrupt is set, check initial slave's link status */
-	if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
+	if (slave_eth_dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
+		slave_eth_dev->dev_ops->link_update(slave_eth_dev, 0);
 		bond_ethdev_lsc_event_callback(slave_eth_dev->data->port_id,
 			RTE_ETH_EVENT_INTR_LSC, &bonded_eth_dev->data->port_id);
+	}
 
 	return 0;
 }