stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Chris Mi <cmi@nvidia.com>,
	Tariq Toukan <tariqt@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1 046/102] net/mlx5: E-switch, Create ingress ACL when needed
Date: Tue,  9 Jul 2024 13:10:09 +0200	[thread overview]
Message-ID: <20240709110653.163840328@linuxfoundation.org> (raw)
In-Reply-To: <20240709110651.353707001@linuxfoundation.org>

6.1-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chris Mi <cmi@nvidia.com>

[ Upstream commit b20c2fb45470d0c7a603613c9cfa5d45720e17f2 ]

Currently, ingress acl is used for three features. It is created only
when vport metadata match and prio tag are enabled. But active-backup
lag mode also uses it. It is independent of vport metadata match and
prio tag. And vport metadata match can be disabled using the
following devlink command:

 # devlink dev param set pci/0000:08:00.0 name esw_port_metadata \
	value false cmode runtime

If ingress acl is not created, will hit panic when creating drop rule
for active-backup lag mode. If always create it, there will be about
5% performance degradation.

Fix it by creating ingress acl when needed. If esw_port_metadata is
true, ingress acl exists, then create drop rule using existing
ingress acl. If esw_port_metadata is false, create ingress acl and
then create drop rule.

Fixes: 1749c4c51c16 ("net/mlx5: E-switch, add drop rule support to ingress ACL")
Signed-off-by: Chris Mi <cmi@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../mellanox/mlx5/core/esw/acl/ingress_ofld.c | 37 +++++++++++++++----
 1 file changed, 29 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c
index db578a7e7008a..59fb31201c35e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_ofld.c
@@ -6,6 +6,9 @@
 #include "helper.h"
 #include "ofld.h"
 
+static int
+acl_ingress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport);
+
 static bool
 esw_acl_ingress_prio_tag_enabled(struct mlx5_eswitch *esw,
 				 const struct mlx5_vport *vport)
@@ -123,18 +126,31 @@ static int esw_acl_ingress_src_port_drop_create(struct mlx5_eswitch *esw,
 {
 	struct mlx5_flow_act flow_act = {};
 	struct mlx5_flow_handle *flow_rule;
+	bool created = false;
 	int err = 0;
 
+	if (!vport->ingress.acl) {
+		err = acl_ingress_ofld_setup(esw, vport);
+		if (err)
+			return err;
+		created = true;
+	}
+
 	flow_act.action = MLX5_FLOW_CONTEXT_ACTION_DROP;
 	flow_act.fg = vport->ingress.offloads.drop_grp;
 	flow_rule = mlx5_add_flow_rules(vport->ingress.acl, NULL, &flow_act, NULL, 0);
 	if (IS_ERR(flow_rule)) {
 		err = PTR_ERR(flow_rule);
-		goto out;
+		goto err_out;
 	}
 
 	vport->ingress.offloads.drop_rule = flow_rule;
-out:
+
+	return 0;
+err_out:
+	/* Only destroy ingress acl created in this function. */
+	if (created)
+		esw_acl_ingress_ofld_cleanup(esw, vport);
 	return err;
 }
 
@@ -299,16 +315,12 @@ static void esw_acl_ingress_ofld_groups_destroy(struct mlx5_vport *vport)
 	}
 }
 
-int esw_acl_ingress_ofld_setup(struct mlx5_eswitch *esw,
-			       struct mlx5_vport *vport)
+static int
+acl_ingress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport)
 {
 	int num_ftes = 0;
 	int err;
 
-	if (!mlx5_eswitch_vport_match_metadata_enabled(esw) &&
-	    !esw_acl_ingress_prio_tag_enabled(esw, vport))
-		return 0;
-
 	esw_acl_ingress_allow_rule_destroy(vport);
 
 	if (mlx5_eswitch_vport_match_metadata_enabled(esw))
@@ -347,6 +359,15 @@ int esw_acl_ingress_ofld_setup(struct mlx5_eswitch *esw,
 	return err;
 }
 
+int esw_acl_ingress_ofld_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport)
+{
+	if (!mlx5_eswitch_vport_match_metadata_enabled(esw) &&
+	    !esw_acl_ingress_prio_tag_enabled(esw, vport))
+		return 0;
+
+	return acl_ingress_ofld_setup(esw, vport);
+}
+
 void esw_acl_ingress_ofld_cleanup(struct mlx5_eswitch *esw,
 				  struct mlx5_vport *vport)
 {
-- 
2.43.0




  parent reply	other threads:[~2024-07-09 11:30 UTC|newest]

Thread overview: 120+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09 11:09 [PATCH 6.1 000/102] 6.1.98-rc1 review Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 001/102] locking/mutex: Introduce devm_mutex_init() Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 002/102] crypto: hisilicon/debugfs - Fix debugfs uninit process issue Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 003/102] drm/lima: fix shared irq handling on driver remove Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 004/102] powerpc: Avoid nmi_enter/nmi_exit in real mode interrupt Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 005/102] media: dvb: as102-fe: Fix as10x_register_addr packing Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 006/102] media: dvb-usb: dib0700_devices: Add missing release_firmware() Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 007/102] IB/core: Implement a limit on UMAD receive List Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 008/102] scsi: qedf: Make qedf_execute_tmf() non-preemptible Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 009/102] irqchip/gic-v3-its: Remove BUG_ON in its_vpe_irq_domain_alloc Greg Kroah-Hartman
2024-07-09 12:05   ` Zenghui Yu
2024-07-11  9:36     ` Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 010/102] crypto: aead,cipher - zeroize key buffer after use Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 011/102] drm/amdgpu: Fix uninitialized variable warnings Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 012/102] drm/amdgpu: Initialize timestamp for some legacy SOCs Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 013/102] drm/amd/display: Check index msg_id before read or write Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 014/102] drm/amd/display: Check pipe offset before setting vblank Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 015/102] drm/amd/display: Skip finding free audio for unknown engine_id Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 016/102] drm/amdgpu: fix uninitialized scalar variable warning Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 017/102] media: dw2102: Dont translate i2c read into write Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 018/102] sctp: prefer struct_size over open coded arithmetic Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 019/102] firmware: dmi: Stop decoding on broken entry Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 020/102] Input: ff-core - prefer struct_size over open coded arithmetic Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 021/102] usb: xhci: prevent potential failure in handle_tx_event() for Transfer events without TRB Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 022/102] wifi: mt76: replace skb_put with skb_put_zero Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 023/102] net: dsa: mv88e6xxx: Correct check for empty list Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 024/102] media: dvb-frontends: tda18271c2dd: Remove casting during div Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 025/102] media: s2255: Use refcount_t instead of atomic_t for num_channels Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 026/102] media: dvb-frontends: tda10048: Fix integer overflow Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 027/102] i2c: i801: Annotate apanel_addr as __ro_after_init Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 028/102] powerpc/64: Set _IO_BASE to POISON_POINTER_DELTA not 0 for CONFIG_PCI=n Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 029/102] orangefs: fix out-of-bounds fsid access Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 030/102] kunit: Fix timeout message Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 031/102] kunit: Handle test faults Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 032/102] powerpc/xmon: Check cpu id in commands "c#", "dp#" and "dx#" Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 033/102] igc: fix a log entry using uninitialized netdev Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 034/102] bpf: Avoid uninitialized value in BPF_CORE_READ_BITFIELD Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 035/102] f2fs: check validation of fault attrs in f2fs_build_fault_attr() Greg Kroah-Hartman
2024-07-09 11:09 ` [PATCH 6.1 036/102] scsi: mpi3mr: Sanitise num_phys Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 037/102] serial: imx: Raise TX trigger level to 8 Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 038/102] jffs2: Fix potential illegal address access in jffs2_free_inode Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 039/102] s390: Mark psw in __load_psw_mask() as __unitialized Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 040/102] s390/pkey: Wipe sensitive data on failure Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 041/102] btrfs: scrub: initialize ret in scrub_simple_mirror() to fix compilation warning Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 042/102] cdrom: rearrange last_media_change check to avoid unintentional overflow Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 043/102] tools/power turbostat: Remember global max_die_id Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 044/102] mac802154: fix time calculation in ieee802154_configure_durations() Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 045/102] UPSTREAM: tcp: fix DSACK undo in fast recovery to call tcp_try_to_open() Greg Kroah-Hartman
2024-07-09 11:10 ` Greg Kroah-Hartman [this message]
2024-07-09 11:10 ` [PATCH 6.1 047/102] net/mlx5e: Add mqprio_rl cleanup and free in mlx5e_priv_cleanup() Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 048/102] tcp_metrics: validate source addr length Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 049/102] KVM: s390: fix LPSWEY handling Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 050/102] e1000e: Fix S0ix residency on corporate systems Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 051/102] net: allow skb_datagram_iter to be called from any context Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 052/102] net: ntb_netdev: Move ntb_netdev_rx_handler() to call netif_rx() from __netif_rx() Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 053/102] wifi: wilc1000: fix ies_len type in connect path Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 054/102] riscv: kexec: Avoid deadlock in kexec crash path Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 055/102] netfilter: nf_tables: unconditionally flush pending work before notifier Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 056/102] bonding: Fix out-of-bounds read in bond_option_arp_ip_targets_set() Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 057/102] selftests: fix OOM in msg_zerocopy selftest Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 058/102] selftests: make order checking verbose " Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 059/102] inet_diag: Initialize pad field in struct inet_diag_req_v2 Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 060/102] mlxsw: core_linecards: Fix double memory deallocation in case of invalid INI file Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 061/102] platform/x86: toshiba_acpi: Fix quickstart quirk handling Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 062/102] Revert "igc: fix a log entry using uninitialized netdev" Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 063/102] nilfs2: fix inode number range checks Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 064/102] nilfs2: add missing check for inode numbers on directory entries Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 065/102] mm: optimize the redundant loop of mm_update_owner_next() Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 066/102] mm: avoid overflows in dirty throttling logic Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 067/102] btrfs: fix adding block group to a reclaim list and the unused list during reclaim Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 068/102] f2fs: Add inline to f2fs_build_fault_attr() stub Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 069/102] scsi: mpi3mr: Use proper format specifier in mpi3mr_sas_port_add() Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 070/102] Bluetooth: qca: Fix BT enable failure again for QCA6390 after warm reboot Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 071/102] can: kvaser_usb: Explicitly initialize family in leafimx driver_info struct Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 072/102] fsnotify: Do not generate events for O_PATH file descriptors Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 073/102] Revert "mm/writeback: fix possible divide-by-zero in wb_dirty_limits(), again" Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 074/102] drm/nouveau: fix null pointer dereference in nouveau_connector_get_modes Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 075/102] drm/amdgpu/atomfirmware: silence UBSAN warning Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 076/102] drm: panel-orientation-quirks: Add quirk for Valve Galileo Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 077/102] powerpc/pseries: Fix scv instruction crash with kexec Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 078/102] mtd: rawnand: Ensure ECC configuration is propagated to upper layers Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 079/102] mtd: rawnand: Bypass a couple of sanity checks during NAND identification Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 080/102] mtd: rawnand: rockchip: ensure NVDDR timings are rejected Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 081/102] bnx2x: Fix multiple UBSAN array-index-out-of-bounds Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 082/102] arm64: dts: rockchip: Fix the DCDC_REG2 minimum voltage on Quartz64 Model B Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 083/102] ima: Avoid blocking in RCU read-side critical section Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 084/102] media: dw2102: fix a potential buffer overflow Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 085/102] clk: qcom: gcc-sm6350: Fix gpll6* & gpll7 parents Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 086/102] clk: mediatek: clk-mtk: Register MFG notifier in mtk_clk_simple_probe() Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 087/102] clk: mediatek: mt8183: Only enable runtime PM on mt8183-mfgcfg Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 088/102] i2c: pnx: Fix potential deadlock warning from del_timer_sync() call in isr Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 089/102] fs/ntfs3: Mark volume as dirty if xattr is broken Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 090/102] ALSA: hda/realtek: Enable headset mic of JP-IK LEAP W502 with ALC897 Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 091/102] nvme-multipath: find NUMA path only for online numa-node Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 092/102] dma-mapping: benchmark: avoid needless copy_to_user if benchmark fails Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 093/102] nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 094/102] regmap-i2c: Subtract reg size from max_write Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 095/102] platform/x86: touchscreen_dmi: Add info for GlobalSpace SolT IVW 11.6" tablet Greg Kroah-Hartman
2024-07-09 11:10 ` [PATCH 6.1 096/102] platform/x86: touchscreen_dmi: Add info for the EZpad 6s Pro Greg Kroah-Hartman
2024-07-09 11:11 ` [PATCH 6.1 097/102] nvmet: fix a possible leak when destroy a ctrl during qp establishment Greg Kroah-Hartman
2024-07-09 11:11 ` [PATCH 6.1 098/102] kbuild: fix short log for AS in link-vmlinux.sh Greg Kroah-Hartman
2024-07-09 11:11 ` [PATCH 6.1 099/102] nfc/nci: Add the inconsistency check between the input data length and count Greg Kroah-Hartman
2024-07-09 11:11 ` [PATCH 6.1 100/102] spi: cadence: Ensure data lines set to low during dummy-cycle period Greg Kroah-Hartman
2024-07-09 11:11 ` [PATCH 6.1 101/102] null_blk: Do not allow runt zone with zone capacity smaller then zone size Greg Kroah-Hartman
2024-07-09 11:11 ` [PATCH 6.1 102/102] nilfs2: fix incorrect inode allocation from reserved inodes Greg Kroah-Hartman
2024-07-09 18:41 ` [PATCH 6.1 000/102] 6.1.98-rc1 review SeongJae Park
2024-07-09 19:38 ` Pavel Machek
2024-07-09 19:56 ` Kelsey Steele
2024-07-09 20:27 ` Peter Schneider
2024-07-09 21:37 ` Mark Brown
2024-07-09 23:27 ` Shuah Khan
2024-07-10  8:34 ` Jon Hunter
2024-07-10  9:18 ` Shreeya Patel
2024-07-10 13:06 ` Ron Economos
2024-07-10 13:17 ` Yann Sionneau
2024-07-10 15:40 ` Naresh Kamboju
2024-07-11  9:43   ` Greg Kroah-Hartman
2024-07-11 11:18 ` Pavel Machek
2024-07-11 11:20 ` Pavel Machek
2024-07-12 17:05 ` Florian Fainelli

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=20240709110653.163840328@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=cmi@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tariqt@nvidia.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).