mbox series

[pull,request,net-next,00/17] mlx5 misc updates 2021-05-26

Message ID 20210527043609.654854-1-saeed@kernel.org
Headers show
Series mlx5 misc updates 2021-05-26 | expand

Message

Saeed Mahameed May 27, 2021, 4:35 a.m. UTC
From: Saeed Mahameed <saeedm@nvidia.com>

Hi Dave, Jakub,

This series provides small misc updates.
For more information please see tag log below.

Please pull and let me know if there is any problem.

Thanks,
Saeed.

---
The following changes since commit 59c56342459a483d5e563ed8b5fdb77ab7622a73:

  Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue (2021-05-26 18:33:01 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2021-05-26

for you to fetch changes up to 3cccb9cb9982e20a3b74cc4e32a2e6fb6ebb93db:

  net/mlx5: Improve performance in SF allocation (2021-05-26 20:48:10 -0700)

----------------------------------------------------------------
mlx5-updates-2021-05-26

Misc update for mlx5 driver,

1) Clean up patches for lag and SF, ensure SF BAR size is at least PAGE_SIZE

2) Reserve bit 31 in steering register C1 for IPSec offload usage

3) Move steering tables pool logic into the steering core and
  increase the maximum table size to 2G entries when software steering
  is enabled.

----------------------------------------------------------------
Eli Cohen (5):
      net/mlx5: Remove unnecessary spin lock protection
      net/mlx5: Use boolean arithmetic to evaluate roce_lag
      net/mlx5: Fix lag port remapping logic
      net/mlx5: Ensure SF BAR size is at least PAGE_SIZE
      net/mlx5: Improve performance in SF allocation

Huy Nguyen (2):
      net/mlx5e: TC: Reserved bit 31 of REG_C1 for IPsec offload
      net/mlx5e: IPsec/rep_tc: Fix rep_tc_update_skb drops IPsec packet

Paul Blakey (7):
      net/mlx5: CT: Avoid reusing modify header context for natted entries
      net/mlx5e: TC: Use bit counts for register mapping
      net/mlx5: Add case for FS_FT_NIC_TX FT in MLX5_CAP_FLOWTABLE_TYPE
      net/mlx5: Move table size calculation to steering cmd layer
      net/mlx5: Move chains ft pool to be used by all firmware steering
      net/mlx5: DR, Set max table size to 2G entries
      net/mlx5: Cap the maximum flow group size to 16M entries

Roi Dayan (1):
      net/mlx5e: CT, Remove newline from ct_dbg call

Tariq Toukan (1):
      net/mlx5e: RX, Remove unnecessary check in RX CQE compression handling

Yevgeny Kliteynik (1):
      net/mlx5: DR, Remove unused field of send_ring struct

 drivers/net/ethernet/mellanox/mlx5/core/Makefile   |  2 +-
 .../net/ethernet/mellanox/mlx5/core/en/rep/tc.c    |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 58 +++++++++----
 drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h | 23 +++---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c    |  8 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    | 86 +++++++++++++-------
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.h    |  8 +-
 drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c   | 29 +++++--
 drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.h   |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c  | 40 ++++++---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.h  |  1 +
 .../net/ethernet/mellanox/mlx5/core/fs_ft_pool.c   | 83 +++++++++++++++++++
 .../net/ethernet/mellanox/mlx5/core/fs_ft_pool.h   | 21 +++++
 drivers/net/ethernet/mellanox/mlx5/core/lag.c      | 28 ++++---
 .../ethernet/mellanox/mlx5/core/lib/fs_chains.c    | 94 ++--------------------
 .../net/ethernet/mellanox/mlx5/core/sf/dev/dev.c   |  3 +-
 .../net/ethernet/mellanox/mlx5/core/sf/hw_table.c  | 23 +++---
 .../mellanox/mlx5/core/steering/dr_types.h         |  1 -
 .../ethernet/mellanox/mlx5/core/steering/fs_dr.c   |  6 +-
 include/linux/mlx5/driver.h                        |  2 +
 include/linux/mlx5/eswitch.h                       | 17 ++--
 21 files changed, 333 insertions(+), 204 deletions(-)
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.c
 create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.h

Comments

Parav Pandit May 27, 2021, 5:36 a.m. UTC | #1
> From: Saeed Mahameed <saeed@kernel.org>
> Sent: Thursday, May 27, 2021 10:06 AM
> From: Eli Cohen <elic@nvidia.com>
> 
> Avoid second traversal on the SF table by recording the first free entry and
> using it in case the looked up entry was not found in the table.
> 
> Signed-off-by: Eli Cohen <elic@nvidia.com>
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> ---
>  .../ethernet/mellanox/mlx5/core/sf/hw_table.c | 23 +++++++++++--------
>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
> b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
> index ef5f892aafad..0c1fbf711fe6 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
> @@ -74,26 +74,29 @@ static int mlx5_sf_hw_table_id_alloc(struct
> mlx5_sf_hw_table *table, u32 control
>  				     u32 usr_sfnum)
>  {
>  	struct mlx5_sf_hwc_table *hwc;
> +	int free_idx = -1;
>  	int i;
> 
>  	hwc = mlx5_sf_controller_to_hwc(table->dev, controller);
>  	if (!hwc->sfs)
>  		return -ENOSPC;
> 
> -	/* Check if sf with same sfnum already exists or not. */
> -	for (i = 0; i < hwc->max_fn; i++) {
> -		if (hwc->sfs[i].allocated && hwc->sfs[i].usr_sfnum ==
> usr_sfnum)
> -			return -EEXIST;
> -	}
> -	/* Find the free entry and allocate the entry from the array */
>  	for (i = 0; i < hwc->max_fn; i++) {
>  		if (!hwc->sfs[i].allocated) {
> -			hwc->sfs[i].usr_sfnum = usr_sfnum;
> -			hwc->sfs[i].allocated = true;
> -			return i;
It is supposed to return an allocated entry.
> +			free_idx = free_idx == -1 ? i : -1;
This is incorrect. On first attempt it allocates the free index.
On iterating second entry, free index is valid, so this condition is false and assigns -1 to free index, making it invalid again.
This leads to never able to allocate an SF situation.

> +			continue;
>  		}
> +
> +		if (hwc->sfs[i].usr_sfnum == usr_sfnum)
> +			return -EEXIST;
>  	}
> -	return -ENOSPC;
> +
> +	if (free_idx == -1)
> +		return -ENOSPC;
> +
> +	hwc->sfs[free_idx].usr_sfnum = usr_sfnum;
> +	hwc->sfs[free_idx].allocated = true;
> +	return 0;
This is incorrect. It must return the free_index and not zero.

>  }
> 
>  static void mlx5_sf_hw_table_id_free(struct mlx5_sf_hw_table *table, u32
> controller, int id)
> --
> 2.31.1

With this erroneous patch single SF allocation fails.
Our internal tests are failing too.
Please drop this patch from the series.

This patch needs below additional small changes, which I verified.

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
index 0c1fbf711fe6..9cc6ba7085a5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
@@ -82,12 +82,12 @@ static int mlx5_sf_hw_table_id_alloc(struct mlx5_sf_hw_table *table, u32 control
                return -ENOSPC;

        for (i = 0; i < hwc->max_fn; i++) {
-               if (!hwc->sfs[i].allocated) {
-                       free_idx = free_idx == -1 ? i : -1;
+               if (!hwc->sfs[i].allocated && free_idx == -1) {
+                       free_idx = i;
                        continue;
                }

-               if (hwc->sfs[i].usr_sfnum == usr_sfnum)
+               if (hwc->sfs[i].allocated && hwc->sfs[i].usr_sfnum == usr_sfnum)
                        return -EEXIST;
        }

@@ -96,7 +96,7 @@ static int mlx5_sf_hw_table_id_alloc(struct mlx5_sf_hw_table *table, u32 control

        hwc->sfs[free_idx].usr_sfnum = usr_sfnum;
        hwc->sfs[free_idx].allocated = true;
-       return 0;
+       return free_idx;
 }
Saeed Mahameed May 27, 2021, 6:52 p.m. UTC | #2
On Thu, 2021-05-27 at 05:36 +0000, Parav Pandit wrote:
> 
> > From: Saeed Mahameed <saeed@kernel.org>
> > Sent: Thursday, May 27, 2021 10:06 AM
> > From: Eli Cohen <elic@nvidia.com>
> > 
> > +                       continue;
> >                 }
> > +
> > +               if (hwc->sfs[i].usr_sfnum == usr_sfnum)
> > +                       return -EEXIST;
> >         }
> > -       return -ENOSPC;
> > +
> > +       if (free_idx == -1)
> > +               return -ENOSPC;
> > +
> > +       hwc->sfs[free_idx].usr_sfnum = usr_sfnum;
> > +       hwc->sfs[free_idx].allocated = true;
> > +       return 0;
> This is incorrect. It must return the free_index and not zero.

Thanks Parav, I will drop the patches,
Please post those comments internally so Eli will handle, I waited for
your comments internally for weeks.
Parav Pandit May 28, 2021, 3:42 a.m. UTC | #3
> From: Saeed Mahameed <saeed@kernel.org>

> Sent: Friday, May 28, 2021 12:22 AM

> 

> On Thu, 2021-05-27 at 05:36 +0000, Parav Pandit wrote:

> >

> > > From: Saeed Mahameed <saeed@kernel.org>

> > > Sent: Thursday, May 27, 2021 10:06 AM

> > > From: Eli Cohen <elic@nvidia.com>

> > >

> > > +                       continue;

> > >                 }

> > > +

> > > +               if (hwc->sfs[i].usr_sfnum == usr_sfnum)

> > > +                       return -EEXIST;

> > >         }

> > > -       return -ENOSPC;

> > > +

> > > +       if (free_idx == -1)

> > > +               return -ENOSPC;

> > > +

> > > +       hwc->sfs[free_idx].usr_sfnum = usr_sfnum;

> > > +       hwc->sfs[free_idx].allocated = true;

> > > +       return 0;

> > This is incorrect. It must return the free_index and not zero.

> 

> Thanks Parav, I will drop the patches,

> Please post those comments internally so Eli will handle, I waited for your

> comments internally for weeks.

My bad.
When regression tests started failing it caught my attention and triggered the review.
I will review them timely going forward.