Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Maor Gottlieb <maorg@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [net 01/12] net/mlx5: Fix flow table chaining
Date: Tue, 27 Jul 2021 16:20:39 -0700	[thread overview]
Message-ID: <20210727232050.606896-2-saeed@kernel.org> (raw)
In-Reply-To: <20210727232050.606896-1-saeed@kernel.org>

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(-)

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;
-- 
2.31.1


  reply	other threads:[~2021-07-27 23:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 23:20 [pull request][net 00/12] mlx5 fixes 2021-07-27 Saeed Mahameed
2021-07-27 23:20 ` Saeed Mahameed [this message]
2021-07-28  8:30   ` [net 01/12] net/mlx5: Fix flow table chaining patchwork-bot+netdevbpf
2021-07-27 23:20 ` [net 02/12] net/mlx5e: Disable Rx ntuple offload for uplink representor Saeed Mahameed
2021-07-27 23:20 ` [net 03/12] net/mlx5: E-Switch, Set destination vport vhca id only when merged eswitch is supported Saeed Mahameed
2021-07-27 23:20 ` [net 04/12] net/mlx5: E-Switch, handle devcom events only for ports on the same device Saeed Mahameed
2021-07-27 23:20 ` [net 05/12] net/mlx5e: RX, Avoid possible data corruption when relaxed ordering and LRO combined Saeed Mahameed
2021-07-27 23:20 ` [net 06/12] net/mlx5e: Add NETIF_F_HW_TC to hw_features when HTB offload is available Saeed Mahameed
2021-07-27 23:20 ` [net 07/12] net/mlx5e: Consider PTP-RQ when setting RX VLAN stripping Saeed Mahameed
2021-07-27 23:20 ` [net 08/12] net/mlx5e: Fix page allocation failure for trap-RQ over SF Saeed Mahameed
2021-07-27 23:20 ` [net 09/12] net/mlx5e: Fix page allocation failure for ptp-RQ " Saeed Mahameed
2021-07-27 23:20 ` [net 10/12] net/mlx5: Unload device upon firmware fatal error Saeed Mahameed
2021-07-27 23:20 ` [net 11/12] net/mlx5e: Fix nullptr in mlx5e_hairpin_get_mdev() Saeed Mahameed
2021-07-27 23:20 ` [net 12/12] net/mlx5: Fix mlx5_vport_tbl_attr chain from u16 to u32 Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210727232050.606896-2-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=maorg@nvidia.com \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    --subject='Re: [net 01/12] net/mlx5: Fix flow table chaining' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).