[1/2] net/bonding: fix more incorrect slave id types
diff mbox series

Message ID 1553200094-5487-1-git-send-email-david.marchand@redhat.com
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • [1/2] net/bonding: fix more incorrect slave id types
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

David Marchand March 21, 2019, 8:28 p.m. UTC
From: Zhaohui <zhaohui8@huawei.com>

mode_bond_id and mode_band_id are slave ids, stored on 16bits.

Fixes: f8244c6399d9 ("ethdev: increase port id range")
Cc: stable@dpdk.org

Signed-off-by: Zhaohui <zhaohui8@huawei.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/bonding/rte_eth_bond_8023ad.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Maxime Coquelin March 22, 2019, 11:18 a.m. UTC | #1
On 3/21/19 9:28 PM, David Marchand wrote:
> From: Zhaohui <zhaohui8@huawei.com>
> 
> mode_bond_id and mode_band_id are slave ids, stored on 16bits.
> 
> Fixes: f8244c6399d9 ("ethdev: increase port id range")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Zhaohui <zhaohui8@huawei.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>   drivers/net/bonding/rte_eth_bond_8023ad.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
> index 1e6a3fc..3943ec1 100644
> --- a/drivers/net/bonding/rte_eth_bond_8023ad.c
> +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
> @@ -638,7 +638,7 @@
>   	SM_FLAG_CLR(port, NTT);
>   }
>   
> -static uint8_t
> +static uint16_t
>   max_index(uint64_t *a, int n)
>   {
>   	if (n <= 0)
> @@ -672,7 +672,8 @@
>   	uint64_t agg_bandwidth[8] = {0};
>   	uint64_t agg_count[8] = {0};
>   	uint16_t default_slave = 0;
> -	uint8_t mode_count_id, mode_band_id;
> +	uint16_t mode_count_id;
> +	uint16_t mode_band_id;
>   	struct rte_eth_link link_info;
>   
>   	slaves = internals->active_slaves;
> @@ -708,13 +709,11 @@
>   
>   	switch (internals->mode4.agg_selection) {
>   	case AGG_COUNT:
> -		mode_count_id = max_index(
> -				(uint64_t *)agg_count, slaves_count);
> +		mode_count_id = max_index(agg_count, slaves_count);
>   		new_agg_id = mode_count_id;
>   		break;
>   	case AGG_BANDWIDTH:
> -		mode_band_id = max_index(
> -				(uint64_t *)agg_bandwidth, slaves_count);
> +		mode_band_id = max_index(agg_bandwidth, slaves_count);
>   		new_agg_id = mode_band_id;
>   		break;
>   	case AGG_STABLE:
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Chas Williams March 24, 2019, 1:28 p.m. UTC | #2
See inline.

On 3/21/19 4:28 PM, David Marchand wrote:
> From: Zhaohui <zhaohui8@huawei.com>
> 
> mode_bond_id and mode_band_id are slave ids, stored on 16bits.

Please change mode_bond_id to mode_count_id in this commit message.
Otherwise, this looks fine.

> Fixes: f8244c6399d9 ("ethdev: increase port id range")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Zhaohui <zhaohui8@huawei.com>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>   drivers/net/bonding/rte_eth_bond_8023ad.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
> index 1e6a3fc..3943ec1 100644
> --- a/drivers/net/bonding/rte_eth_bond_8023ad.c
> +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
> @@ -638,7 +638,7 @@
>   	SM_FLAG_CLR(port, NTT);
>   }
>   
> -static uint8_t
> +static uint16_t
>   max_index(uint64_t *a, int n)
>   {
>   	if (n <= 0)
> @@ -672,7 +672,8 @@
>   	uint64_t agg_bandwidth[8] = {0};
>   	uint64_t agg_count[8] = {0};
>   	uint16_t default_slave = 0;
> -	uint8_t mode_count_id, mode_band_id;
> +	uint16_t mode_count_id;
> +	uint16_t mode_band_id;
>   	struct rte_eth_link link_info;
>   
>   	slaves = internals->active_slaves;
> @@ -708,13 +709,11 @@
>   
>   	switch (internals->mode4.agg_selection) {
>   	case AGG_COUNT:
> -		mode_count_id = max_index(
> -				(uint64_t *)agg_count, slaves_count);
> +		mode_count_id = max_index(agg_count, slaves_count);
>   		new_agg_id = mode_count_id;
>   		break;
>   	case AGG_BANDWIDTH:
> -		mode_band_id = max_index(
> -				(uint64_t *)agg_bandwidth, slaves_count);
> +		mode_band_id = max_index(agg_bandwidth, slaves_count);
>   		new_agg_id = mode_band_id;
>   		break;
>   	case AGG_STABLE:
>
David Marchand March 24, 2019, 5:13 p.m. UTC | #3
On Sun, Mar 24, 2019 at 2:28 PM Chas Williams <3chas3@gmail.com> wrote:

> See inline.
>
> On 3/21/19 4:28 PM, David Marchand wrote:
> > From: Zhaohui <zhaohui8@huawei.com>
> >
> > mode_bond_id and mode_band_id are slave ids, stored on 16bits.
>
> Please change mode_bond_id to mode_count_id in this commit message.
> Otherwise, this looks fine.
>

Indeed... I should have gone to bed earlier ;-)
Yigit, Ferruh Sept. 30, 2019, 1:49 p.m. UTC | #4
On 3/22/2019 11:18 AM, Maxime Coquelin wrote:
> 
> 
> On 3/21/19 9:28 PM, David Marchand wrote:
>> From: Zhaohui <zhaohui8@huawei.com>
>>
>> mode_bond_id and mode_band_id are slave ids, stored on 16bits.
>>
>> Fixes: f8244c6399d9 ("ethdev: increase port id range")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Zhaohui <zhaohui8@huawei.com>
>> Signed-off-by: David Marchand <david.marchand@redhat.com>
>> ---
>>   drivers/net/bonding/rte_eth_bond_8023ad.c | 11 +++++------
>>   1 file changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
>> index 1e6a3fc..3943ec1 100644
>> --- a/drivers/net/bonding/rte_eth_bond_8023ad.c
>> +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
>> @@ -638,7 +638,7 @@
>>   	SM_FLAG_CLR(port, NTT);
>>   }
>>   
>> -static uint8_t
>> +static uint16_t
>>   max_index(uint64_t *a, int n)
>>   {
>>   	if (n <= 0)
>> @@ -672,7 +672,8 @@
>>   	uint64_t agg_bandwidth[8] = {0};
>>   	uint64_t agg_count[8] = {0};
>>   	uint16_t default_slave = 0;
>> -	uint8_t mode_count_id, mode_band_id;
>> +	uint16_t mode_count_id;
>> +	uint16_t mode_band_id;
>>   	struct rte_eth_link link_info;
>>   
>>   	slaves = internals->active_slaves;
>> @@ -708,13 +709,11 @@
>>   
>>   	switch (internals->mode4.agg_selection) {
>>   	case AGG_COUNT:
>> -		mode_count_id = max_index(
>> -				(uint64_t *)agg_count, slaves_count);
>> +		mode_count_id = max_index(agg_count, slaves_count);
>>   		new_agg_id = mode_count_id;
>>   		break;
>>   	case AGG_BANDWIDTH:
>> -		mode_band_id = max_index(
>> -				(uint64_t *)agg_bandwidth, slaves_count);
>> +		mode_band_id = max_index(agg_bandwidth, slaves_count);
>>   		new_agg_id = mode_band_id;
>>   		break;
>>   	case AGG_STABLE:
>>
> 
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 

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

Patch
diff mbox series

diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index 1e6a3fc..3943ec1 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -638,7 +638,7 @@ 
 	SM_FLAG_CLR(port, NTT);
 }
 
-static uint8_t
+static uint16_t
 max_index(uint64_t *a, int n)
 {
 	if (n <= 0)
@@ -672,7 +672,8 @@ 
 	uint64_t agg_bandwidth[8] = {0};
 	uint64_t agg_count[8] = {0};
 	uint16_t default_slave = 0;
-	uint8_t mode_count_id, mode_band_id;
+	uint16_t mode_count_id;
+	uint16_t mode_band_id;
 	struct rte_eth_link link_info;
 
 	slaves = internals->active_slaves;
@@ -708,13 +709,11 @@ 
 
 	switch (internals->mode4.agg_selection) {
 	case AGG_COUNT:
-		mode_count_id = max_index(
-				(uint64_t *)agg_count, slaves_count);
+		mode_count_id = max_index(agg_count, slaves_count);
 		new_agg_id = mode_count_id;
 		break;
 	case AGG_BANDWIDTH:
-		mode_band_id = max_index(
-				(uint64_t *)agg_bandwidth, slaves_count);
+		mode_band_id = max_index(agg_bandwidth, slaves_count);
 		new_agg_id = mode_band_id;
 		break;
 	case AGG_STABLE: