net/bonding: fix socket_id type

Message ID 20221012114523.9569-1-markus.theil@tu-ilmenau.de (mailing list archive)
State New
Delegated to: Ferruh Yigit
Headers
Series net/bonding: fix socket_id type |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed

Commit Message

Markus Theil Oct. 12, 2022, 11:45 a.m. UTC
  From: Thorben Roemer <thorben.roemer@secunet.com>

DPDK uses int or u32 in most other places for
socket IDs. Fix compilation warnings by also
using int in the bonding code.

Signed-off-by: Thorben Roemer <thorben.roemer@secunet.com>
---
 drivers/net/bonding/rte_eth_bond.h     | 2 +-
 drivers/net/bonding/rte_eth_bond_api.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit Oct. 12, 2022, 12:23 p.m. UTC | #1
On 10/12/2022 12:45 PM, Markus Theil wrote:
> From: Thorben Roemer <thorben.roemer@secunet.com>
> 
> DPDK uses int or u32 in most other places for
> socket IDs. Fix compilation warnings by also
> using int in the bonding code.
> 

Hi Markus,

'rte_eth_bond_create()' is part of API, so changing it impacts the users.

Since 'rte_socket_id()' returns 'int', it is reasonable to make 
'socket_id' parameter type 'int', but I am not sure if it worth the 
trouble it may cause in user end.

Maybe we can announce the change in this release and update the API in 
v23.11?


Can you please list the mentioned compile warning?

> Signed-off-by: Thorben Roemer <thorben.roemer@secunet.com>
> ---
>   drivers/net/bonding/rte_eth_bond.h     | 2 +-
>   drivers/net/bonding/rte_eth_bond_api.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h
> index 874aa91a5f..3ce2b29052 100644
> --- a/drivers/net/bonding/rte_eth_bond.h
> +++ b/drivers/net/bonding/rte_eth_bond.h
> @@ -99,7 +99,7 @@ extern "C" {
>    *	Port Id of created rte_eth_dev on success, negative value otherwise
>    */
>   int
> -rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id);
> +rte_eth_bond_create(const char *name, uint8_t mode, int socket_id);
>   
>   /**
>    * Free a bonded rte_eth_dev device
> diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
> index b44dd219cb..3c6e236382 100644
> --- a/drivers/net/bonding/rte_eth_bond_api.c
> +++ b/drivers/net/bonding/rte_eth_bond_api.c
> @@ -148,7 +148,7 @@ deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id)
>   }
>   
>   int
> -rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
> +rte_eth_bond_create(const char *name, uint8_t mode, int socket_id)
>   {
>   	struct bond_dev_private *internals;
>   	struct rte_eth_dev *bond_dev;
  
Markus Theil Oct. 12, 2022, 2:20 p.m. UTC | #2
On 10/12/22 14:23, Ferruh Yigit wrote:
> On 10/12/2022 12:45 PM, Markus Theil wrote:
>> From: Thorben Roemer <thorben.roemer@secunet.com>
>>
>> DPDK uses int or u32 in most other places for
>> socket IDs. Fix compilation warnings by also
>> using int in the bonding code.
>>
>
> Hi Markus,
>
> 'rte_eth_bond_create()' is part of API, so changing it impacts the users.
>
> Since 'rte_socket_id()' returns 'int', it is reasonable to make 
> 'socket_id' parameter type 'int', but I am not sure if it worth the 
> trouble it may cause in user end.
>
> Maybe we can announce the change in this release and update the API in 
> v23.11?
>
Hi Ferruh,

I've searched in the whole DPDK for the usage of socket IDs. Nearly 
every integral type pops up when doing this. We should postpone this 
patch. Maybe announce a cleanup + API change for the next release and 
fix this treewide (I can try to do this after 22.11 is out and you agree 
with the cleanup).

>
> Can you please list the mentioned compile warning?
The warning only happens when we compile our code, which uses DPDK with 
Wconversion enabled. Our code stores socket ids as int. Therefore the 
compiler notices the int to u8 conversion and warns us.
>
>> Signed-off-by: Thorben Roemer <thorben.roemer@secunet.com>
>> ---
>>   drivers/net/bonding/rte_eth_bond.h     | 2 +-
>>   drivers/net/bonding/rte_eth_bond_api.c | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/bonding/rte_eth_bond.h 
>> b/drivers/net/bonding/rte_eth_bond.h
>> index 874aa91a5f..3ce2b29052 100644
>> --- a/drivers/net/bonding/rte_eth_bond.h
>> +++ b/drivers/net/bonding/rte_eth_bond.h
>> @@ -99,7 +99,7 @@ extern "C" {
>>    *    Port Id of created rte_eth_dev on success, negative value 
>> otherwise
>>    */
>>   int
>> -rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id);
>> +rte_eth_bond_create(const char *name, uint8_t mode, int socket_id);
>>     /**
>>    * Free a bonded rte_eth_dev device
>> diff --git a/drivers/net/bonding/rte_eth_bond_api.c 
>> b/drivers/net/bonding/rte_eth_bond_api.c
>> index b44dd219cb..3c6e236382 100644
>> --- a/drivers/net/bonding/rte_eth_bond_api.c
>> +++ b/drivers/net/bonding/rte_eth_bond_api.c
>> @@ -148,7 +148,7 @@ deactivate_slave(struct rte_eth_dev *eth_dev, 
>> uint16_t port_id)
>>   }
>>     int
>> -rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
>> +rte_eth_bond_create(const char *name, uint8_t mode, int socket_id)
>>   {
>>       struct bond_dev_private *internals;
>>       struct rte_eth_dev *bond_dev;
>
  
Ferruh Yigit Oct. 12, 2022, 3:15 p.m. UTC | #3
On 10/12/2022 3:20 PM, Markus Theil wrote:
> On 10/12/22 14:23, Ferruh Yigit wrote:
>> On 10/12/2022 12:45 PM, Markus Theil wrote:
>>> From: Thorben Roemer <thorben.roemer@secunet.com>
>>>
>>> DPDK uses int or u32 in most other places for
>>> socket IDs. Fix compilation warnings by also
>>> using int in the bonding code.
>>>
>>
>> Hi Markus,
>>
>> 'rte_eth_bond_create()' is part of API, so changing it impacts the users.
>>
>> Since 'rte_socket_id()' returns 'int', it is reasonable to make 
>> 'socket_id' parameter type 'int', but I am not sure if it worth the 
>> trouble it may cause in user end.
>>
>> Maybe we can announce the change in this release and update the API in 
>> v23.11?
>>
> Hi Ferruh,
> 
> I've searched in the whole DPDK for the usage of socket IDs. Nearly 
> every integral type pops up when doing this. We should postpone this 
> patch. Maybe announce a cleanup + API change for the next release and 
> fix this treewide (I can try to do this after 22.11 is out and you agree 
> with the cleanup).
> 

I agree to cleanup.

But unfortunately some of it is user interfacing and only can be done in 
ABI breaking releases, next one is 23.11.

The process is:
Send a patch to update deprecation notice 
('doc/guides/rel_notes/deprecation.rst') explaining what will be done 
and why, with a target date.
This patch needs to get three ack to be accepted.
When it is accepted, this is the way to communicate with users about the 
oncoming change.
In target release, for this case it is likely 23.11, do the batch 
cleanup and remove the deprecation note.

Deprecation notice patch can trigger discussion and clarifies how to 
proceed.

>>
>> Can you please list the mentioned compile warning?
> The warning only happens when we compile our code, which uses DPDK with 
> Wconversion enabled. Our code stores socket ids as int. Therefore the 
> compiler notices the int to u8 conversion and warns us.

Got it, so there is nothing to fix in the upstream dpdk code.

>>
>>> Signed-off-by: Thorben Roemer <thorben.roemer@secunet.com>
>>> ---
>>>   drivers/net/bonding/rte_eth_bond.h     | 2 +-
>>>   drivers/net/bonding/rte_eth_bond_api.c | 2 +-
>>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/bonding/rte_eth_bond.h 
>>> b/drivers/net/bonding/rte_eth_bond.h
>>> index 874aa91a5f..3ce2b29052 100644
>>> --- a/drivers/net/bonding/rte_eth_bond.h
>>> +++ b/drivers/net/bonding/rte_eth_bond.h
>>> @@ -99,7 +99,7 @@ extern "C" {
>>>    *    Port Id of created rte_eth_dev on success, negative value 
>>> otherwise
>>>    */
>>>   int
>>> -rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id);
>>> +rte_eth_bond_create(const char *name, uint8_t mode, int socket_id);
>>>     /**
>>>    * Free a bonded rte_eth_dev device
>>> diff --git a/drivers/net/bonding/rte_eth_bond_api.c 
>>> b/drivers/net/bonding/rte_eth_bond_api.c
>>> index b44dd219cb..3c6e236382 100644
>>> --- a/drivers/net/bonding/rte_eth_bond_api.c
>>> +++ b/drivers/net/bonding/rte_eth_bond_api.c
>>> @@ -148,7 +148,7 @@ deactivate_slave(struct rte_eth_dev *eth_dev, 
>>> uint16_t port_id)
>>>   }
>>>     int
>>> -rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
>>> +rte_eth_bond_create(const char *name, uint8_t mode, int socket_id)
>>>   {
>>>       struct bond_dev_private *internals;
>>>       struct rte_eth_dev *bond_dev;
>>
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h
index 874aa91a5f..3ce2b29052 100644
--- a/drivers/net/bonding/rte_eth_bond.h
+++ b/drivers/net/bonding/rte_eth_bond.h
@@ -99,7 +99,7 @@  extern "C" {
  *	Port Id of created rte_eth_dev on success, negative value otherwise
  */
 int
-rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id);
+rte_eth_bond_create(const char *name, uint8_t mode, int socket_id);
 
 /**
  * Free a bonded rte_eth_dev device
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index b44dd219cb..3c6e236382 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -148,7 +148,7 @@  deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id)
 }
 
 int
-rte_eth_bond_create(const char *name, uint8_t mode, uint8_t socket_id)
+rte_eth_bond_create(const char *name, uint8_t mode, int socket_id)
 {
 	struct bond_dev_private *internals;
 	struct rte_eth_dev *bond_dev;