diff mbox series

[net,01/12] net/mlx5: Fix flow table chaining

Message ID 20210727232050.606896-2-saeed@kernel.org
State New
Headers show
Series mlx5 fixes 2021-07-27 | expand

Commit Message

Saeed Mahameed July 27, 2021, 11:20 p.m. UTC
From: Maor Gottlieb <maorg@nvidia.com>

Fix a bug when flow table is created in priority that already
has other flow tables as shown in the below diagram.
If the new flow table (FT-B) has the lowest level in the priority,
we need to connect the flow tables from the previous priority (p0)
to this new table. In addition when this flow table is destroyed
(FT-B), we need to connect the flow tables from the previous
priority (p0) to the next level flow table (FT-C) in the same
priority of the destroyed table (if exists).

                       ---------
                       |root_ns|
                       ---------
                            |
            --------------------------------
            |               |              |
       ----------      ----------      ---------
       |p(prio)-x|     |   p-y  |      |   p-n |
       ----------      ----------      ---------
            |               |
     ----------------  ------------------
     |ns(e.g bypass)|  |ns(e.g. kernel) |
     ----------------  ------------------
            |            |           |
	-------	       ------       ----
        |  p0 |        | p1 |       |p2|
        -------        ------       ----
           |             |    \
        --------       ------- ------
        | FT-A |       |FT-B | |FT-C|
        --------       ------- ------

Fixes: f90edfd279f3 ("net/mlx5_core: Connect flow tables")
Signed-off-by: Maor Gottlieb <maorg@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org July 28, 2021, 8:30 a.m. UTC | #1
Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Tue, 27 Jul 2021 16:20:39 -0700 you wrote:
> From: Maor Gottlieb <maorg@nvidia.com>
> 
> Fix a bug when flow table is created in priority that already
> has other flow tables as shown in the below diagram.
> If the new flow table (FT-B) has the lowest level in the priority,
> we need to connect the flow tables from the previous priority (p0)
> to this new table. In addition when this flow table is destroyed
> (FT-B), we need to connect the flow tables from the previous
> priority (p0) to the next level flow table (FT-C) in the same
> priority of the destroyed table (if exists).
> 
> [...]

Here is the summary with links:
  - [net,01/12] net/mlx5: Fix flow table chaining
    https://git.kernel.org/netdev/net/c/8b54874ef161
  - [net,02/12] net/mlx5e: Disable Rx ntuple offload for uplink representor
    https://git.kernel.org/netdev/net/c/90b22b9bcd24
  - [net,03/12] net/mlx5: E-Switch, Set destination vport vhca id only when merged eswitch is supported
    https://git.kernel.org/netdev/net/c/c671972534c6
  - [net,04/12] net/mlx5: E-Switch, handle devcom events only for ports on the same device
    https://git.kernel.org/netdev/net/c/dd3fddb82780
  - [net,05/12] net/mlx5e: RX, Avoid possible data corruption when relaxed ordering and LRO combined
    https://git.kernel.org/netdev/net/c/e2351e517068
  - [net,06/12] net/mlx5e: Add NETIF_F_HW_TC to hw_features when HTB offload is available
    https://git.kernel.org/netdev/net/c/9841d58f3550
  - [net,07/12] net/mlx5e: Consider PTP-RQ when setting RX VLAN stripping
    https://git.kernel.org/netdev/net/c/a759f845d1f7
  - [net,08/12] net/mlx5e: Fix page allocation failure for trap-RQ over SF
    https://git.kernel.org/netdev/net/c/497008e78345
  - [net,09/12] net/mlx5e: Fix page allocation failure for ptp-RQ over SF
    https://git.kernel.org/netdev/net/c/678b1ae1af4a
  - [net,10/12] net/mlx5: Unload device upon firmware fatal error
    https://git.kernel.org/netdev/net/c/7f331bf0f060
  - [net,11/12] net/mlx5e: Fix nullptr in mlx5e_hairpin_get_mdev()
    https://git.kernel.org/netdev/net/c/b1c2f6312c50
  - [net,12/12] net/mlx5: Fix mlx5_vport_tbl_attr chain from u16 to u32
    https://git.kernel.org/netdev/net/c/740452e09cf5

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index d7bf0a3e4a52..c0697e1b7118 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -1024,17 +1024,19 @@  static int connect_fwd_rules(struct mlx5_core_dev *dev,
 static int connect_flow_table(struct mlx5_core_dev *dev, struct mlx5_flow_table *ft,
 			      struct fs_prio *prio)
 {
-	struct mlx5_flow_table *next_ft;
+	struct mlx5_flow_table *next_ft, *first_ft;
 	int err = 0;
 
 	/* Connect_prev_fts and update_root_ft_create are mutually exclusive */
 
-	if (list_empty(&prio->node.children)) {
+	first_ft = list_first_entry_or_null(&prio->node.children,
+					    struct mlx5_flow_table, node.list);
+	if (!first_ft || first_ft->level > ft->level) {
 		err = connect_prev_fts(dev, ft, prio);
 		if (err)
 			return err;
 
-		next_ft = find_next_chained_ft(prio);
+		next_ft = first_ft ? first_ft : find_next_chained_ft(prio);
 		err = connect_fwd_rules(dev, ft, next_ft);
 		if (err)
 			return err;
@@ -2120,7 +2122,7 @@  static int disconnect_flow_table(struct mlx5_flow_table *ft)
 				node.list) == ft))
 		return 0;
 
-	next_ft = find_next_chained_ft(prio);
+	next_ft = find_next_ft(ft);
 	err = connect_fwd_rules(dev, next_ft, ft);
 	if (err)
 		return err;