[11/15] bus/dpaa: pass interface name as a string instead of pointer

Message ID 20220928052516.1279442-12-g.singh@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series DPAA and DPAA2 driver changes |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Gagandeep Singh Sept. 28, 2022, 5:25 a.m. UTC
  From: Rohit Raj <rohit.raj@nxp.com>

Due to change in latest kernel, passing the interface name to
kernel through IOCTL as string instead of character pointer.

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
---
 drivers/bus/dpaa/base/qbman/process.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Ferruh Yigit Oct. 5, 2022, 2:21 p.m. UTC | #1
On 9/28/2022 6:25 AM, Gagandeep Singh wrote:
> From: Rohit Raj <rohit.raj@nxp.com>
> 
> Due to change in latest kernel, passing the interface name to
> kernel through IOCTL as string instead of character pointer.
> 

This kernel component is the one that is delivered part of SDK I assume, 
instead of an upstreamed one.

What is the way for user match kernel code and DPDK driver, like is 
there any matching version information documented?

> Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
> ---
>   drivers/bus/dpaa/base/qbman/process.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/bus/dpaa/base/qbman/process.c b/drivers/bus/dpaa/base/qbman/process.c
> index 9bc92681cd..3504ec97db 100644
> --- a/drivers/bus/dpaa/base/qbman/process.c
> +++ b/drivers/bus/dpaa/base/qbman/process.c
> @@ -302,7 +302,7 @@ int bman_free_raw_portal(struct dpaa_raw_portal *portal)
>   	_IOW(DPAA_IOCTL_MAGIC, 0x0E, struct usdpaa_ioctl_link_status)
>   
>   #define DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT \
> -	_IOW(DPAA_IOCTL_MAGIC, 0x0F, char*)
> +	_IOW(DPAA_IOCTL_MAGIC, 0x0F, char[IF_NAME_MAX_LEN])
>   
>   int dpaa_intr_enable(char *if_name, int efd)
>   {
> @@ -330,7 +330,7 @@ int dpaa_intr_disable(char *if_name)
>   	if (ret)
>   		return ret;
>   
> -	ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT, &if_name);
> +	ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT, if_name);
>   	if (ret) {
>   		if (errno == EINVAL)
>   			printf("Failed to disable interrupt: Not Supported\n");
> @@ -472,7 +472,7 @@ int dpaa_update_link_speed(char *if_name, int link_speed, int link_duplex)
>   }
>   
>   #define DPAA_IOCTL_RESTART_LINK_AUTONEG \
> -	_IOW(DPAA_IOCTL_MAGIC, 0x13, char *)
> +	_IOW(DPAA_IOCTL_MAGIC, 0x13, char[IF_NAME_MAX_LEN])
>   
>   int dpaa_restart_link_autoneg(char *if_name)
>   {
> @@ -481,7 +481,7 @@ int dpaa_restart_link_autoneg(char *if_name)
>   	if (ret)
>   		return ret;
>   
> -	ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, &if_name);
> +	ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, if_name);
>   	if (ret) {
>   		if (errno == EINVAL)
>   			printf("Failed to restart autoneg: Not Supported\n");
  
Gagandeep Singh Oct. 6, 2022, 8:51 a.m. UTC | #2
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: Wednesday, October 5, 2022 7:52 PM
> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org
> Cc: Rohit Raj <rohit.raj@nxp.com>
> Subject: Re: [PATCH 11/15] bus/dpaa: pass interface name as a string instead
> of pointer
> 
> On 9/28/2022 6:25 AM, Gagandeep Singh wrote:
> > From: Rohit Raj <rohit.raj@nxp.com>
> >
> > Due to change in latest kernel, passing the interface name to kernel
> > through IOCTL as string instead of character pointer.
> >
> 
> This kernel component is the one that is delivered part of SDK I assume,
> instead of an upstreamed one.
> 
> What is the way for user match kernel code and DPDK driver, like is there any
> matching version information documented?
> 
We share the version compatible information in our internal SDK release document.

> > Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
> > ---
> >   drivers/bus/dpaa/base/qbman/process.c | 8 ++++----
> >   1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/bus/dpaa/base/qbman/process.c
> > b/drivers/bus/dpaa/base/qbman/process.c
> > index 9bc92681cd..3504ec97db 100644
> > --- a/drivers/bus/dpaa/base/qbman/process.c
> > +++ b/drivers/bus/dpaa/base/qbman/process.c
> > @@ -302,7 +302,7 @@ int bman_free_raw_portal(struct dpaa_raw_portal
> *portal)
> >   	_IOW(DPAA_IOCTL_MAGIC, 0x0E, struct usdpaa_ioctl_link_status)
> >
> >   #define DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT \
> > -	_IOW(DPAA_IOCTL_MAGIC, 0x0F, char*)
> > +	_IOW(DPAA_IOCTL_MAGIC, 0x0F, char[IF_NAME_MAX_LEN])
> >
> >   int dpaa_intr_enable(char *if_name, int efd)
> >   {
> > @@ -330,7 +330,7 @@ int dpaa_intr_disable(char *if_name)
> >   	if (ret)
> >   		return ret;
> >
> > -	ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT,
> &if_name);
> > +	ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT,
> if_name);
> >   	if (ret) {
> >   		if (errno == EINVAL)
> >   			printf("Failed to disable interrupt: Not Supported\n");
> @@ -472,7
> > +472,7 @@ int dpaa_update_link_speed(char *if_name, int link_speed, int
> link_duplex)
> >   }
> >
> >   #define DPAA_IOCTL_RESTART_LINK_AUTONEG \
> > -	_IOW(DPAA_IOCTL_MAGIC, 0x13, char *)
> > +	_IOW(DPAA_IOCTL_MAGIC, 0x13, char[IF_NAME_MAX_LEN])
> >
> >   int dpaa_restart_link_autoneg(char *if_name)
> >   {
> > @@ -481,7 +481,7 @@ int dpaa_restart_link_autoneg(char *if_name)
> >   	if (ret)
> >   		return ret;
> >
> > -	ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, &if_name);
> > +	ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, if_name);
> >   	if (ret) {
> >   		if (errno == EINVAL)
> >   			printf("Failed to restart autoneg: Not Supported\n");
  
Ferruh Yigit Oct. 6, 2022, 9:39 a.m. UTC | #3
On 10/6/2022 9:51 AM, Gagandeep Singh wrote:
> 
> 
>> -----Original Message-----
>> From: Ferruh Yigit <ferruh.yigit@amd.com>
>> Sent: Wednesday, October 5, 2022 7:52 PM
>> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org
>> Cc: Rohit Raj <rohit.raj@nxp.com>
>> Subject: Re: [PATCH 11/15] bus/dpaa: pass interface name as a string instead
>> of pointer
>>
>> On 9/28/2022 6:25 AM, Gagandeep Singh wrote:
>>> From: Rohit Raj <rohit.raj@nxp.com>
>>>
>>> Due to change in latest kernel, passing the interface name to kernel
>>> through IOCTL as string instead of character pointer.
>>>
>>
>> This kernel component is the one that is delivered part of SDK I assume,
>> instead of an upstreamed one.
>>
>> What is the way for user match kernel code and DPDK driver, like is there any
>> matching version information documented?
>>
> We share the version compatible information in our internal SDK release document.
> 

That is what I thought, does it make sense to link to that information 
from DPDK documentation?

>>> Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
>>> ---
>>>    drivers/bus/dpaa/base/qbman/process.c | 8 ++++----
>>>    1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/bus/dpaa/base/qbman/process.c
>>> b/drivers/bus/dpaa/base/qbman/process.c
>>> index 9bc92681cd..3504ec97db 100644
>>> --- a/drivers/bus/dpaa/base/qbman/process.c
>>> +++ b/drivers/bus/dpaa/base/qbman/process.c
>>> @@ -302,7 +302,7 @@ int bman_free_raw_portal(struct dpaa_raw_portal
>> *portal)
>>>    	_IOW(DPAA_IOCTL_MAGIC, 0x0E, struct usdpaa_ioctl_link_status)
>>>
>>>    #define DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT \
>>> -	_IOW(DPAA_IOCTL_MAGIC, 0x0F, char*)
>>> +	_IOW(DPAA_IOCTL_MAGIC, 0x0F, char[IF_NAME_MAX_LEN])
>>>
>>>    int dpaa_intr_enable(char *if_name, int efd)
>>>    {
>>> @@ -330,7 +330,7 @@ int dpaa_intr_disable(char *if_name)
>>>    	if (ret)
>>>    		return ret;
>>>
>>> -	ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT,
>> &if_name);
>>> +	ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT,
>> if_name);
>>>    	if (ret) {
>>>    		if (errno == EINVAL)
>>>    			printf("Failed to disable interrupt: Not Supported\n");
>> @@ -472,7
>>> +472,7 @@ int dpaa_update_link_speed(char *if_name, int link_speed, int
>> link_duplex)
>>>    }
>>>
>>>    #define DPAA_IOCTL_RESTART_LINK_AUTONEG \
>>> -	_IOW(DPAA_IOCTL_MAGIC, 0x13, char *)
>>> +	_IOW(DPAA_IOCTL_MAGIC, 0x13, char[IF_NAME_MAX_LEN])
>>>
>>>    int dpaa_restart_link_autoneg(char *if_name)
>>>    {
>>> @@ -481,7 +481,7 @@ int dpaa_restart_link_autoneg(char *if_name)
>>>    	if (ret)
>>>    		return ret;
>>>
>>> -	ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, &if_name);
>>> +	ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, if_name);
>>>    	if (ret) {
>>>    		if (errno == EINVAL)
>>>    			printf("Failed to restart autoneg: Not Supported\n");
>
  
Gagandeep Singh Oct. 6, 2022, 11:18 a.m. UTC | #4
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@amd.com>
> Sent: Thursday, October 6, 2022 3:10 PM
> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org
> Cc: Rohit Raj <rohit.raj@nxp.com>
> Subject: Re: [PATCH 11/15] bus/dpaa: pass interface name as a string instead
> of pointer
> 
> On 10/6/2022 9:51 AM, Gagandeep Singh wrote:
> >
> >
> >> -----Original Message-----
> >> From: Ferruh Yigit <ferruh.yigit@amd.com>
> >> Sent: Wednesday, October 5, 2022 7:52 PM
> >> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org
> >> Cc: Rohit Raj <rohit.raj@nxp.com>
> >> Subject: Re: [PATCH 11/15] bus/dpaa: pass interface name as a string
> >> instead of pointer
> >>
> >> On 9/28/2022 6:25 AM, Gagandeep Singh wrote:
> >>> From: Rohit Raj <rohit.raj@nxp.com>
> >>>
> >>> Due to change in latest kernel, passing the interface name to kernel
> >>> through IOCTL as string instead of character pointer.
> >>>
> >>
> >> This kernel component is the one that is delivered part of SDK I
> >> assume, instead of an upstreamed one.
> >>
> >> What is the way for user match kernel code and DPDK driver, like is
> >> there any matching version information documented?
> >>
> > We share the version compatible information in our internal SDK release
> document.
> >
> 
> That is what I thought, does it make sense to link to that information from
> DPDK documentation?
> 
Sure, I will update the DPAA NIC guide for this.


> >>> Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
> >>> ---
> >>>    drivers/bus/dpaa/base/qbman/process.c | 8 ++++----
> >>>    1 file changed, 4 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/drivers/bus/dpaa/base/qbman/process.c
> >>> b/drivers/bus/dpaa/base/qbman/process.c
> >>> index 9bc92681cd..3504ec97db 100644
> >>> --- a/drivers/bus/dpaa/base/qbman/process.c
> >>> +++ b/drivers/bus/dpaa/base/qbman/process.c
> >>> @@ -302,7 +302,7 @@ int bman_free_raw_portal(struct
> dpaa_raw_portal
> >> *portal)
> >>>    	_IOW(DPAA_IOCTL_MAGIC, 0x0E, struct usdpaa_ioctl_link_status)
> >>>
> >>>    #define DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT \
> >>> -	_IOW(DPAA_IOCTL_MAGIC, 0x0F, char*)
> >>> +	_IOW(DPAA_IOCTL_MAGIC, 0x0F, char[IF_NAME_MAX_LEN])
> >>>
> >>>    int dpaa_intr_enable(char *if_name, int efd)
> >>>    {
> >>> @@ -330,7 +330,7 @@ int dpaa_intr_disable(char *if_name)
> >>>    	if (ret)
> >>>    		return ret;
> >>>
> >>> -	ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT,
> >> &if_name);
> >>> +	ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT,
> >> if_name);
> >>>    	if (ret) {
> >>>    		if (errno == EINVAL)
> >>>    			printf("Failed to disable interrupt: Not Supported\n");
> >> @@ -472,7
> >>> +472,7 @@ int dpaa_update_link_speed(char *if_name, int link_speed,
> >>> +int
> >> link_duplex)
> >>>    }
> >>>
> >>>    #define DPAA_IOCTL_RESTART_LINK_AUTONEG \
> >>> -	_IOW(DPAA_IOCTL_MAGIC, 0x13, char *)
> >>> +	_IOW(DPAA_IOCTL_MAGIC, 0x13, char[IF_NAME_MAX_LEN])
> >>>
> >>>    int dpaa_restart_link_autoneg(char *if_name)
> >>>    {
> >>> @@ -481,7 +481,7 @@ int dpaa_restart_link_autoneg(char *if_name)
> >>>    	if (ret)
> >>>    		return ret;
> >>>
> >>> -	ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, &if_name);
> >>> +	ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, if_name);
> >>>    	if (ret) {
> >>>    		if (errno == EINVAL)
> >>>    			printf("Failed to restart autoneg: Not Supported\n");
> >
  

Patch

diff --git a/drivers/bus/dpaa/base/qbman/process.c b/drivers/bus/dpaa/base/qbman/process.c
index 9bc92681cd..3504ec97db 100644
--- a/drivers/bus/dpaa/base/qbman/process.c
+++ b/drivers/bus/dpaa/base/qbman/process.c
@@ -302,7 +302,7 @@  int bman_free_raw_portal(struct dpaa_raw_portal *portal)
 	_IOW(DPAA_IOCTL_MAGIC, 0x0E, struct usdpaa_ioctl_link_status)
 
 #define DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT \
-	_IOW(DPAA_IOCTL_MAGIC, 0x0F, char*)
+	_IOW(DPAA_IOCTL_MAGIC, 0x0F, char[IF_NAME_MAX_LEN])
 
 int dpaa_intr_enable(char *if_name, int efd)
 {
@@ -330,7 +330,7 @@  int dpaa_intr_disable(char *if_name)
 	if (ret)
 		return ret;
 
-	ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT, &if_name);
+	ret = ioctl(fd, DPAA_IOCTL_DISABLE_LINK_STATUS_INTERRUPT, if_name);
 	if (ret) {
 		if (errno == EINVAL)
 			printf("Failed to disable interrupt: Not Supported\n");
@@ -472,7 +472,7 @@  int dpaa_update_link_speed(char *if_name, int link_speed, int link_duplex)
 }
 
 #define DPAA_IOCTL_RESTART_LINK_AUTONEG \
-	_IOW(DPAA_IOCTL_MAGIC, 0x13, char *)
+	_IOW(DPAA_IOCTL_MAGIC, 0x13, char[IF_NAME_MAX_LEN])
 
 int dpaa_restart_link_autoneg(char *if_name)
 {
@@ -481,7 +481,7 @@  int dpaa_restart_link_autoneg(char *if_name)
 	if (ret)
 		return ret;
 
-	ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, &if_name);
+	ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, if_name);
 	if (ret) {
 		if (errno == EINVAL)
 			printf("Failed to restart autoneg: Not Supported\n");