diff mbox series

[net-next,08/15] sfc: register devlink port with ops

Message ID 20230524121836.2070879-9-jiri@resnulli.us (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series devlink: move port ops into separate structure | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers warning 1 maintainers not CCed: linux-net-drivers@amd.com
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jiri Pirko May 24, 2023, 12:18 p.m. UTC
From: Jiri Pirko <jiri@nvidia.com>

Use newly introduce devlink port registration function variant and
register devlink port passing ops.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
 drivers/net/ethernet/sfc/efx_devlink.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Alejandro Lucero Palau May 24, 2023, 5:57 p.m. UTC | #1
Hi Jiri,

On 5/24/23 13:18, Jiri Pirko wrote:
> CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
>
>
> From: Jiri Pirko <jiri@nvidia.com>
>
> Use newly introduce devlink port registration function variant and
> register devlink port passing ops.
>
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> ---
>   drivers/net/ethernet/sfc/efx_devlink.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/sfc/efx_devlink.c b/drivers/net/ethernet/sfc/efx_devlink.c
> index 381b805659d3..f93437757ba3 100644
> --- a/drivers/net/ethernet/sfc/efx_devlink.c
> +++ b/drivers/net/ethernet/sfc/efx_devlink.c
> @@ -25,6 +25,10 @@ struct efx_devlink {
>   };
>
>   #ifdef CONFIG_SFC_SRIOV
> +
> +static const struct devlink_port_ops sfc_devlink_port_ops = {
> +};
> +

We can have devlink port without SRIOV, so we need this outside the 
previous ifdef.

Apart from that, it looks OK. I'll test it and report back.

>   static void efx_devlink_del_port(struct devlink_port *dl_port)
>   {
>          if (!dl_port)
> @@ -57,7 +61,9 @@ static int efx_devlink_add_port(struct efx_nic *efx,
>
>          mport->dl_port.index = mport->mport_id;
>
> -       return devl_port_register(efx->devlink, &mport->dl_port, mport->mport_id);
> +       return devl_port_register_with_ops(efx->devlink, &mport->dl_port,
> +                                          mport->mport_id,
> +                                          &sfc_devlink_port_ops);
>   }
>
>   static int efx_devlink_port_addr_get(struct devlink_port *port, u8 *hw_addr,
> --
> 2.39.2
>
>
Jiri Pirko May 25, 2023, 6:10 a.m. UTC | #2
Wed, May 24, 2023 at 07:57:50PM CEST, alucerop@amd.com wrote:
>Hi Jiri,
>
>On 5/24/23 13:18, Jiri Pirko wrote:
>> CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.

Awesome, could you manage to remove this irrelevant text in your mailer?


>> 
>> 
>> From: Jiri Pirko <jiri@nvidia.com>
>> 
>> Use newly introduce devlink port registration function variant and
>> register devlink port passing ops.
>> 
>> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>> ---
>>   drivers/net/ethernet/sfc/efx_devlink.c | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/ethernet/sfc/efx_devlink.c b/drivers/net/ethernet/sfc/efx_devlink.c
>> index 381b805659d3..f93437757ba3 100644
>> --- a/drivers/net/ethernet/sfc/efx_devlink.c
>> +++ b/drivers/net/ethernet/sfc/efx_devlink.c
>> @@ -25,6 +25,10 @@ struct efx_devlink {
>>   };
>> 
>>   #ifdef CONFIG_SFC_SRIOV
>> +
>> +static const struct devlink_port_ops sfc_devlink_port_ops = {
>> +};
>> +
>
>We can have devlink port without SRIOV, so we need this outside the previous
>ifdef.

Nope, in the original code, efx_devlink_add_port() is under this ifdef
too. So ifdef-wise, this patch does not change anything. Why do you
think so?


>
>Apart from that, it looks OK. I'll test it and report back.
>
>>   static void efx_devlink_del_port(struct devlink_port *dl_port)
>>   {
>>          if (!dl_port)
>> @@ -57,7 +61,9 @@ static int efx_devlink_add_port(struct efx_nic *efx,
>> 
>>          mport->dl_port.index = mport->mport_id;
>> 
>> -       return devl_port_register(efx->devlink, &mport->dl_port, mport->mport_id);
>> +       return devl_port_register_with_ops(efx->devlink, &mport->dl_port,
>> +                                          mport->mport_id,
>> +                                          &sfc_devlink_port_ops);
>>   }
>> 
>>   static int efx_devlink_port_addr_get(struct devlink_port *port, u8 *hw_addr,
>> --
>> 2.39.2
>> 
>>
Alejandro Lucero Palau May 25, 2023, 3:13 p.m. UTC | #3
On 5/24/23 18:57, Alejandro Lucero Palau wrote:
> Hi Jiri,
>
> On 5/24/23 13:18, Jiri Pirko wrote:
>>
>> From: Jiri Pirko <jiri@nvidia.com>
>>
>> Use newly introduce devlink port registration function variant and
>> register devlink port passing ops.
>>
>> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>> ---
>>   drivers/net/ethernet/sfc/efx_devlink.c | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/sfc/efx_devlink.c 
>> b/drivers/net/ethernet/sfc/efx_devlink.c
>> index 381b805659d3..f93437757ba3 100644
>> --- a/drivers/net/ethernet/sfc/efx_devlink.c
>> +++ b/drivers/net/ethernet/sfc/efx_devlink.c
>> @@ -25,6 +25,10 @@ struct efx_devlink {
>>   };
>>
>>   #ifdef CONFIG_SFC_SRIOV
>> +
>> +static const struct devlink_port_ops sfc_devlink_port_ops = {
>> +};
>> +
>
> We can have devlink port without SRIOV, so we need this outside the 
> previous ifdef.
>
> Apart from that, it looks OK. I'll test it and report back.
>
Apart from the change requested:

Reviewed-by: Alejandro Lucero<alucerop@amd.com>
Tested-by: Alejandro Lucero<alucerop@amd.com>

>>   static void efx_devlink_del_port(struct devlink_port *dl_port)
>>   {
>>          if (!dl_port)
>> @@ -57,7 +61,9 @@ static int efx_devlink_add_port(struct efx_nic *efx,
>>
>>          mport->dl_port.index = mport->mport_id;
>>
>> -       return devl_port_register(efx->devlink, &mport->dl_port, 
>> mport->mport_id);
>> +       return devl_port_register_with_ops(efx->devlink, 
>> &mport->dl_port,
>> +                                          mport->mport_id,
>> + &sfc_devlink_port_ops);
>>   }
>>
>>   static int efx_devlink_port_addr_get(struct devlink_port *port, u8 
>> *hw_addr,
>> -- 
>> 2.39.2
>>
>>
>
Jiri Pirko May 25, 2023, 4:52 p.m. UTC | #4
Thu, May 25, 2023 at 05:13:57PM CEST, alucerop@amd.com wrote:
>
>On 5/24/23 18:57, Alejandro Lucero Palau wrote:
>> Hi Jiri,
>> 
>> On 5/24/23 13:18, Jiri Pirko wrote:
>> > 
>> > From: Jiri Pirko <jiri@nvidia.com>
>> > 
>> > Use newly introduce devlink port registration function variant and
>> > register devlink port passing ops.
>> > 
>> > Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>> > ---
>> >   drivers/net/ethernet/sfc/efx_devlink.c | 8 +++++++-
>> >   1 file changed, 7 insertions(+), 1 deletion(-)
>> > 
>> > diff --git a/drivers/net/ethernet/sfc/efx_devlink.c
>> > b/drivers/net/ethernet/sfc/efx_devlink.c
>> > index 381b805659d3..f93437757ba3 100644
>> > --- a/drivers/net/ethernet/sfc/efx_devlink.c
>> > +++ b/drivers/net/ethernet/sfc/efx_devlink.c
>> > @@ -25,6 +25,10 @@ struct efx_devlink {
>> >   };
>> > 
>> >   #ifdef CONFIG_SFC_SRIOV
>> > +
>> > +static const struct devlink_port_ops sfc_devlink_port_ops = {
>> > +};
>> > +
>> 
>> We can have devlink port without SRIOV, so we need this outside the
>> previous ifdef.
>> 
>> Apart from that, it looks OK. I'll test it and report back.
>> 
>Apart from the change requested:

Did you see the reply to your email?

>
>Reviewed-by: Alejandro Lucero<alucerop@amd.com>
>Tested-by: Alejandro Lucero<alucerop@amd.com>
>
>> >   static void efx_devlink_del_port(struct devlink_port *dl_port)
>> >   {
>> >          if (!dl_port)
>> > @@ -57,7 +61,9 @@ static int efx_devlink_add_port(struct efx_nic *efx,
>> > 
>> >          mport->dl_port.index = mport->mport_id;
>> > 
>> > -       return devl_port_register(efx->devlink, &mport->dl_port,
>> > mport->mport_id);
>> > +       return devl_port_register_with_ops(efx->devlink,
>> > &mport->dl_port,
>> > +                                          mport->mport_id,
>> > + &sfc_devlink_port_ops);
>> >   }
>> > 
>> >   static int efx_devlink_port_addr_get(struct devlink_port *port, u8
>> > *hw_addr,
>> > -- 
>> > 2.39.2
>> > 
>> > 
>>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/sfc/efx_devlink.c b/drivers/net/ethernet/sfc/efx_devlink.c
index 381b805659d3..f93437757ba3 100644
--- a/drivers/net/ethernet/sfc/efx_devlink.c
+++ b/drivers/net/ethernet/sfc/efx_devlink.c
@@ -25,6 +25,10 @@  struct efx_devlink {
 };
 
 #ifdef CONFIG_SFC_SRIOV
+
+static const struct devlink_port_ops sfc_devlink_port_ops = {
+};
+
 static void efx_devlink_del_port(struct devlink_port *dl_port)
 {
 	if (!dl_port)
@@ -57,7 +61,9 @@  static int efx_devlink_add_port(struct efx_nic *efx,
 
 	mport->dl_port.index = mport->mport_id;
 
-	return devl_port_register(efx->devlink, &mport->dl_port, mport->mport_id);
+	return devl_port_register_with_ops(efx->devlink, &mport->dl_port,
+					   mport->mport_id,
+					   &sfc_devlink_port_ops);
 }
 
 static int efx_devlink_port_addr_get(struct devlink_port *port, u8 *hw_addr,