diff mbox series

[mlx5-next,6/9] RDMA/mlx5: Use represntor E-Switch when getting netdev and metadata

Message ID 20210311070915.321814-7-saeed@kernel.org (mailing list archive)
State Not Applicable
Headers show
Series mlx5 next updates 2021-03-10 | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix success Link
netdev/cc_maintainers fail 3 maintainers not CCed: jgg@ziepe.ca dledford@redhat.com leon@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 31 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Saeed Mahameed March 11, 2021, 7:09 a.m. UTC
From: Mark Bloch <mbloch@nvidia.com>

Now that a pointer to the managing E-Switch is stored in the representor
use it.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/infiniband/hw/mlx5/fs.c     | 2 +-
 drivers/infiniband/hw/mlx5/ib_rep.c | 2 +-
 drivers/infiniband/hw/mlx5/main.c   | 3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)

Comments

Jason Gunthorpe March 11, 2021, 5:33 p.m. UTC | #1
On Wed, Mar 10, 2021 at 11:09:12PM -0800, Saeed Mahameed wrote:
> From: Mark Bloch <mbloch@nvidia.com>
> 
> Now that a pointer to the managing E-Switch is stored in the representor
> use it.
> 
> Signed-off-by: Mark Bloch <mbloch@nvidia.com>
> Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> ---
>  drivers/infiniband/hw/mlx5/fs.c     | 2 +-
>  drivers/infiniband/hw/mlx5/ib_rep.c | 2 +-
>  drivers/infiniband/hw/mlx5/main.c   | 3 +--
>  3 files changed, 3 insertions(+), 4 deletions(-)

Spelling error in the subject

 
> diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/fs.c
> index 25da0b05b4e2..01370d9a871a 100644
> --- a/drivers/infiniband/hw/mlx5/fs.c
> +++ b/drivers/infiniband/hw/mlx5/fs.c
> @@ -879,7 +879,7 @@ static void mlx5_ib_set_rule_source_port(struct mlx5_ib_dev *dev,
>  				    misc_parameters_2);
>  
>  		MLX5_SET(fte_match_set_misc2, misc, metadata_reg_c_0,
> -			 mlx5_eswitch_get_vport_metadata_for_match(esw,
> +			 mlx5_eswitch_get_vport_metadata_for_match(rep->esw,
>  								   rep->vport));

Why not change the esw reference above too?

Seems Ok otherwise

Acked-by: Jason Gunthorpe <jgg@nvidia.com>

Jason
Mark Bloch March 11, 2021, 8:43 p.m. UTC | #2
On 3/11/21 7:33 PM, Jason Gunthorpe wrote:
> On Wed, Mar 10, 2021 at 11:09:12PM -0800, Saeed Mahameed wrote:
>> From: Mark Bloch <mbloch@nvidia.com>
>>
>> Now that a pointer to the managing E-Switch is stored in the representor
>> use it.
>>
>> Signed-off-by: Mark Bloch <mbloch@nvidia.com>
>> Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
>> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
>> ---
>>  drivers/infiniband/hw/mlx5/fs.c     | 2 +-
>>  drivers/infiniband/hw/mlx5/ib_rep.c | 2 +-
>>  drivers/infiniband/hw/mlx5/main.c   | 3 +--
>>  3 files changed, 3 insertions(+), 4 deletions(-)
> 
> Spelling error in the subject
> 
>  
>> diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/fs.c
>> index 25da0b05b4e2..01370d9a871a 100644
>> --- a/drivers/infiniband/hw/mlx5/fs.c
>> +++ b/drivers/infiniband/hw/mlx5/fs.c
>> @@ -879,7 +879,7 @@ static void mlx5_ib_set_rule_source_port(struct mlx5_ib_dev *dev,
>>  				    misc_parameters_2);
>>  
>>  		MLX5_SET(fte_match_set_misc2, misc, metadata_reg_c_0,
>> -			 mlx5_eswitch_get_vport_metadata_for_match(esw,
>> +			 mlx5_eswitch_get_vport_metadata_for_match(rep->esw,
>>  								   rep->vport));
> 
> Why not change the esw reference above too?

The if that checks if metadata is enabled uses the eswitch that rule is going to be inserted to.
The representor has a pointer to the eswitch it was created on.

Mark

> 
> Seems Ok otherwise
> 
> Acked-by: Jason Gunthorpe <jgg@nvidia.com>
> 
> Jason
>
Saeed Mahameed March 11, 2021, 10:38 p.m. UTC | #3
On Thu, 2021-03-11 at 13:33 -0400, Jason Gunthorpe wrote:
> On Wed, Mar 10, 2021 at 11:09:12PM -0800, Saeed Mahameed wrote:
> > From: Mark Bloch <mbloch@nvidia.com>
> > 
> > Now that a pointer to the managing E-Switch is stored in the
> > representor
> > use it.
> > 
> > Signed-off-by: Mark Bloch <mbloch@nvidia.com>
> > Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
> > Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> > ---
> >  drivers/infiniband/hw/mlx5/fs.c     | 2 +-
> >  drivers/infiniband/hw/mlx5/ib_rep.c | 2 +-
> >  drivers/infiniband/hw/mlx5/main.c   | 3 +--
> >  3 files changed, 3 insertions(+), 4 deletions(-)
> 
> Spelling error in the subject
> 

Will fix this up before I apply the series,

Thanks !
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/fs.c
index 25da0b05b4e2..01370d9a871a 100644
--- a/drivers/infiniband/hw/mlx5/fs.c
+++ b/drivers/infiniband/hw/mlx5/fs.c
@@ -879,7 +879,7 @@  static void mlx5_ib_set_rule_source_port(struct mlx5_ib_dev *dev,
 				    misc_parameters_2);
 
 		MLX5_SET(fte_match_set_misc2, misc, metadata_reg_c_0,
-			 mlx5_eswitch_get_vport_metadata_for_match(esw,
+			 mlx5_eswitch_get_vport_metadata_for_match(rep->esw,
 								   rep->vport));
 		misc = MLX5_ADDR_OF(fte_match_param, spec->match_criteria,
 				    misc_parameters_2);
diff --git a/drivers/infiniband/hw/mlx5/ib_rep.c b/drivers/infiniband/hw/mlx5/ib_rep.c
index 9164cc069ad4..4eae7131b0ce 100644
--- a/drivers/infiniband/hw/mlx5/ib_rep.c
+++ b/drivers/infiniband/hw/mlx5/ib_rep.c
@@ -20,7 +20,7 @@  mlx5_ib_set_vport_rep(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
 	rep->rep_data[REP_IB].priv = ibdev;
 	write_lock(&ibdev->port[vport_index].roce.netdev_lock);
 	ibdev->port[vport_index].roce.netdev =
-		mlx5_ib_get_rep_netdev(dev->priv.eswitch, rep->vport);
+		mlx5_ib_get_rep_netdev(rep->esw, rep->vport);
 	write_unlock(&ibdev->port[vport_index].roce.netdev_lock);
 
 	return 0;
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 0d69a697d75f..7a7f6ccd02a5 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -126,7 +126,6 @@  static struct mlx5_roce *mlx5_get_rep_roce(struct mlx5_ib_dev *dev,
 					   struct net_device *ndev,
 					   u8 *port_num)
 {
-	struct mlx5_eswitch *esw = dev->mdev->priv.eswitch;
 	struct net_device *rep_ndev;
 	struct mlx5_ib_port *port;
 	int i;
@@ -137,7 +136,7 @@  static struct mlx5_roce *mlx5_get_rep_roce(struct mlx5_ib_dev *dev,
 			continue;
 
 		read_lock(&port->roce.netdev_lock);
-		rep_ndev = mlx5_ib_get_rep_netdev(esw,
+		rep_ndev = mlx5_ib_get_rep_netdev(port->rep->esw,
 						  port->rep->vport);
 		if (rep_ndev == ndev) {
 			read_unlock(&port->roce.netdev_lock);