All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/mlx5: Add np_min_time_between_cnps and rp_max_rate debug params
@ 2020-03-03 14:08 Parav Pandit
  2020-03-03 14:08 ` [PATCH] IB/mlx5: Fix missing debugfs entries Parav Pandit
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Parav Pandit @ 2020-03-03 14:08 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: parav, jiri, moshe, vladyslavt, saeedm, leon

Add two debugfs parameters described below.

np_min_time_between_cnps - Minimum time between sending CNPs from the
                           port.
                           Unit = microseconds.
                           Default = 0.

rp_max_rate - Maximum rate at which reaction point node can transmit.
              Once this limit is reached, RP is no longer rate limited.
              Unit = Mbits/sec
              Default = 0 (full speed)

issue: 961226
Change-Id: I14544168ed115acaeb8ff900ac092fad2f1bb68f
Signed-off-by: Parav Pandit <parav@mellanox.com>
---
 drivers/infiniband/hw/mlx5/cong.c    | 20 ++++++++++++++++++++
 drivers/infiniband/hw/mlx5/mlx5_ib.h |  2 ++
 2 files changed, 22 insertions(+)

diff --git a/drivers/infiniband/hw/mlx5/cong.c b/drivers/infiniband/hw/mlx5/cong.c
index 8ba439fabf7f..de4da92b81a6 100644
--- a/drivers/infiniband/hw/mlx5/cong.c
+++ b/drivers/infiniband/hw/mlx5/cong.c
@@ -47,6 +47,7 @@ static const char * const mlx5_ib_dbg_cc_name[] = {
 	"rp_byte_reset",
 	"rp_threshold",
 	"rp_ai_rate",
+	"rp_max_rate",
 	"rp_hai_rate",
 	"rp_min_dec_fac",
 	"rp_min_rate",
@@ -56,6 +57,7 @@ static const char * const mlx5_ib_dbg_cc_name[] = {
 	"rp_rate_reduce_monitor_period",
 	"rp_initial_alpha_value",
 	"rp_gd",
+	"np_min_time_between_cnps",
 	"np_cnp_dscp",
 	"np_cnp_prio_mode",
 	"np_cnp_prio",
@@ -66,6 +68,7 @@ static const char * const mlx5_ib_dbg_cc_name[] = {
 #define MLX5_IB_RP_TIME_RESET_ATTR			BIT(3)
 #define MLX5_IB_RP_BYTE_RESET_ATTR			BIT(4)
 #define MLX5_IB_RP_THRESHOLD_ATTR			BIT(5)
+#define MLX5_IB_RP_MAX_RATE_ATTR			BIT(6)
 #define MLX5_IB_RP_AI_RATE_ATTR				BIT(7)
 #define MLX5_IB_RP_HAI_RATE_ATTR			BIT(8)
 #define MLX5_IB_RP_MIN_DEC_FAC_ATTR			BIT(9)
@@ -77,6 +80,7 @@ static const char * const mlx5_ib_dbg_cc_name[] = {
 #define MLX5_IB_RP_INITIAL_ALPHA_VALUE_ATTR		BIT(15)
 #define MLX5_IB_RP_GD_ATTR				BIT(16)
 
+#define MLX5_IB_NP_MIN_TIME_BETWEEN_CNPS_ATTR		BIT(2)
 #define MLX5_IB_NP_CNP_DSCP_ATTR			BIT(3)
 #define MLX5_IB_NP_CNP_PRIO_MODE_ATTR			BIT(4)
 
@@ -111,6 +115,9 @@ static u32 mlx5_get_cc_param_val(void *field, int offset)
 	case MLX5_IB_DBG_CC_RP_AI_RATE:
 		return MLX5_GET(cong_control_r_roce_ecn_rp, field,
 				rpg_ai_rate);
+	case MLX5_IB_DBG_CC_RP_MAX_RATE:
+		return MLX5_GET(cong_control_r_roce_ecn_rp, field,
+				rpg_max_rate);
 	case MLX5_IB_DBG_CC_RP_HAI_RATE:
 		return MLX5_GET(cong_control_r_roce_ecn_rp, field,
 				rpg_hai_rate);
@@ -138,6 +145,9 @@ static u32 mlx5_get_cc_param_val(void *field, int offset)
 	case MLX5_IB_DBG_CC_RP_GD:
 		return MLX5_GET(cong_control_r_roce_ecn_rp, field,
 				rpg_gd);
+	case MLX5_IB_DBG_CC_NP_MIN_TIME_BETWEEN_CNPS:
+		return MLX5_GET(cong_control_r_roce_ecn_np, field,
+				min_time_between_cnps);
 	case MLX5_IB_DBG_CC_NP_CNP_DSCP:
 		return MLX5_GET(cong_control_r_roce_ecn_np, field,
 				cnp_dscp);
@@ -186,6 +196,11 @@ static void mlx5_ib_set_cc_param_mask_val(void *field, int offset,
 		MLX5_SET(cong_control_r_roce_ecn_rp, field,
 			 rpg_ai_rate, var);
 		break;
+	case MLX5_IB_DBG_CC_RP_MAX_RATE:
+		*attr_mask |= MLX5_IB_RP_MAX_RATE_ATTR;
+		MLX5_SET(cong_control_r_roce_ecn_rp, field,
+			 rpg_max_rate, var);
+		break;
 	case MLX5_IB_DBG_CC_RP_HAI_RATE:
 		*attr_mask |= MLX5_IB_RP_HAI_RATE_ATTR;
 		MLX5_SET(cong_control_r_roce_ecn_rp, field,
@@ -231,6 +246,11 @@ static void mlx5_ib_set_cc_param_mask_val(void *field, int offset,
 		MLX5_SET(cong_control_r_roce_ecn_rp, field,
 			 rpg_gd, var);
 		break;
+	case MLX5_IB_DBG_CC_NP_MIN_TIME_BETWEEN_CNPS:
+		*attr_mask |= MLX5_IB_NP_MIN_TIME_BETWEEN_CNPS_ATTR;
+		MLX5_SET(cong_control_r_roce_ecn_np, field,
+			 min_time_between_cnps, var);
+		break;
 	case MLX5_IB_DBG_CC_NP_CNP_DSCP:
 		*attr_mask |= MLX5_IB_NP_CNP_DSCP_ATTR;
 		MLX5_SET(cong_control_r_roce_ecn_np, field, cnp_dscp, var);
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index d9bffcc93587..4cbc87c79951 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -792,6 +792,7 @@ enum mlx5_ib_dbg_cc_types {
 	MLX5_IB_DBG_CC_RP_BYTE_RESET,
 	MLX5_IB_DBG_CC_RP_THRESHOLD,
 	MLX5_IB_DBG_CC_RP_AI_RATE,
+	MLX5_IB_DBG_CC_RP_MAX_RATE,
 	MLX5_IB_DBG_CC_RP_HAI_RATE,
 	MLX5_IB_DBG_CC_RP_MIN_DEC_FAC,
 	MLX5_IB_DBG_CC_RP_MIN_RATE,
@@ -801,6 +802,7 @@ enum mlx5_ib_dbg_cc_types {
 	MLX5_IB_DBG_CC_RP_RATE_REDUCE_MONITOR_PERIOD,
 	MLX5_IB_DBG_CC_RP_INITIAL_ALPHA_VALUE,
 	MLX5_IB_DBG_CC_RP_GD,
+	MLX5_IB_DBG_CC_NP_MIN_TIME_BETWEEN_CNPS,
 	MLX5_IB_DBG_CC_NP_CNP_DSCP,
 	MLX5_IB_DBG_CC_NP_CNP_PRIO_MODE,
 	MLX5_IB_DBG_CC_NP_CNP_PRIO,
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] IB/mlx5: Fix missing debugfs entries
  2020-03-03 14:08 [PATCH] IB/mlx5: Add np_min_time_between_cnps and rp_max_rate debug params Parav Pandit
@ 2020-03-03 14:08 ` Parav Pandit
  2020-03-03 14:10   ` Parav Pandit
  2020-03-03 14:08 ` [PATCH] net: sched: fix cleanup NULL pointer exception in act_mirr Parav Pandit
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Parav Pandit @ 2020-03-03 14:08 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: parav, jiri, moshe, vladyslavt, saeedm, leon

Cited commit missed to include congestion control related debugfs
stage initialization.
This resulted in missing debugfs entries for cc_params.

Add them back.

issue: 2084629
Fixes: b5ca15ad7e61 ("IB/mlx5: Add proper representors support")
Change-Id: I435f03f117d44107f032800442b0dc9e5a15fe06
Signed-off-by: Parav Pandit <parav@mellanox.com>
---
 drivers/infiniband/hw/mlx5/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index e4bcfa81b70a..e54661d3b37c 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -7077,6 +7077,9 @@ const struct mlx5_ib_profile raw_eth_profile = {
 	STAGE_CREATE(MLX5_IB_STAGE_COUNTERS,
 		     mlx5_ib_stage_counters_init,
 		     mlx5_ib_stage_counters_cleanup),
+	STAGE_CREATE(MLX5_IB_STAGE_CONG_DEBUGFS,
+		     mlx5_ib_stage_cong_debugfs_init,
+		     mlx5_ib_stage_cong_debugfs_cleanup),
 	STAGE_CREATE(MLX5_IB_STAGE_UAR,
 		     mlx5_ib_stage_uar_init,
 		     mlx5_ib_stage_uar_cleanup),
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] net: sched: fix cleanup NULL pointer exception in act_mirr
  2020-03-03 14:08 [PATCH] IB/mlx5: Add np_min_time_between_cnps and rp_max_rate debug params Parav Pandit
  2020-03-03 14:08 ` [PATCH] IB/mlx5: Fix missing debugfs entries Parav Pandit
@ 2020-03-03 14:08 ` Parav Pandit
  2020-03-03 14:11   ` Parav Pandit
  2020-03-03 14:08 ` [PATCH] Revert "net/mlx5: Support lockless FTE read lookups" Parav Pandit
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Parav Pandit @ 2020-03-03 14:08 UTC (permalink / raw)
  To: netdev, davem, kuba
  Cc: parav, jiri, moshe, vladyslavt, saeedm, leon, John Hurley

From: John Hurley <john.hurley@netronome.com>

A new mirred action is created by the tcf_mirred_init function. This
contains a list head struct which is inserted into a global list on
successful creation of a new action. However, after a creation, it is
still possible to error out and call the tcf_idr_release function. This,
in turn, calls the act_mirr cleanup function via __tcf_idr_release and
__tcf_action_put. This cleanup function tries to delete the list entry
which is as yet uninitialised, leading to a NULL pointer exception.

Fix this by initialising the list entry on creation of a new action.

Bug report:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
PGD 8000000840c73067 P4D 8000000840c73067 PUD 858dcc067 PMD 0
Oops: 0002 [#1] SMP PTI
CPU: 32 PID: 5636 Comm: handler194 Tainted: G           OE     5.0.0+ #186
Hardware name: Dell Inc. PowerEdge R730/0599V5, BIOS 1.3.6 06/03/2015
RIP: 0010:tcf_mirred_release+0x42/0xa7 [act_mirred]
Code: f0 90 39 c0 e8 52 04 57 c8 48 c7 c7 b8 80 39 c0 e8 94 fa d4 c7 48 8b 93 d0 00 00 00 48 8b 83 d8 00 00 00 48 c7 c7 f0 90 39 c0 <48> 89 42 08 48 89 10 48 b8 00 01 00 00 00 00 ad de 48 89 83 d0 00
RSP: 0018:ffffac4aa059f688 EFLAGS: 00010282
RAX: 0000000000000000 RBX: ffff9dcd1b214d00 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffff9dcd1fa165f8 RDI: ffffffffc03990f0
RBP: ffff9dccf9c7af80 R08: 0000000000000a3b R09: 0000000000000000
R10: ffff9dccfa11f420 R11: 0000000000000000 R12: 0000000000000001
R13: ffff9dcd16b433c0 R14: ffff9dcd1b214d80 R15: 0000000000000000
FS:  00007f441bfff700(0000) GS:ffff9dcd1fa00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000008 CR3: 0000000839e64004 CR4: 00000000001606e0
Call Trace:
tcf_action_cleanup+0x59/0xca
__tcf_action_put+0x54/0x6b
__tcf_idr_release.cold.33+0x9/0x12
tcf_mirred_init.cold.20+0x22e/0x3b0 [act_mirred]
tcf_action_init_1+0x3d0/0x4c0
tcf_action_init+0x9c/0x130
tcf_exts_validate+0xab/0xc0
fl_change+0x1ca/0x982 [cls_flower]
tc_new_tfilter+0x647/0x8d0
? load_balance+0x14b/0x9e0
rtnetlink_rcv_msg+0xe3/0x370
? __switch_to_asm+0x40/0x70
? __switch_to_asm+0x34/0x70
? _cond_resched+0x15/0x30
? __kmalloc_node_track_caller+0x1d4/0x2b0
? rtnl_calcit.isra.31+0xf0/0xf0
netlink_rcv_skb+0x49/0x110
netlink_unicast+0x16f/0x210
netlink_sendmsg+0x1df/0x390
sock_sendmsg+0x36/0x40
___sys_sendmsg+0x27b/0x2c0
? futex_wake+0x80/0x140
? do_futex+0x2b9/0xac0
? ep_scan_ready_list.constprop.22+0x1f2/0x210
? ep_poll+0x7a/0x430
__sys_sendmsg+0x47/0x80
do_syscall_64+0x55/0x100
entry_SYSCALL_64_after_hwframe+0x44/0xa9

Fixes: 4e232818bd32 ("net: sched: act_mirred: remove dependency on rtnl lock")
Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/sched/act_mirred.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index cd712e4e8998..17cc6bd4c57c 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -159,12 +159,15 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
 		tcf_idr_release(*a, bind);
 		return -EEXIST;
 	}
+
+	m = to_mirred(*a);
+	if (ret == ACT_P_CREATED)
+		INIT_LIST_HEAD(&m->tcfm_list);
+
 	err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
 	if (err < 0)
 		goto release_idr;
 
-	m = to_mirred(*a);
-
 	spin_lock_bh(&m->tcf_lock);
 
 	if (parm->ifindex) {
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] Revert "net/mlx5: Support lockless FTE read lookups"
  2020-03-03 14:08 [PATCH] IB/mlx5: Add np_min_time_between_cnps and rp_max_rate debug params Parav Pandit
  2020-03-03 14:08 ` [PATCH] IB/mlx5: Fix missing debugfs entries Parav Pandit
  2020-03-03 14:08 ` [PATCH] net: sched: fix cleanup NULL pointer exception in act_mirr Parav Pandit
@ 2020-03-03 14:08 ` Parav Pandit
  2020-03-03 14:12   ` Parav Pandit
  2020-03-03 14:08 ` [PATCH] Revert "RDMA/cma: Simplify rdma_resolve_addr() error flow" Parav Pandit
  2020-03-03 14:10 ` [PATCH] IB/mlx5: Add np_min_time_between_cnps and rp_max_rate debug params Parav Pandit
  4 siblings, 1 reply; 10+ messages in thread
From: Parav Pandit @ 2020-03-03 14:08 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: parav, jiri, moshe, vladyslavt, saeedm, leon

This reverts commit 7dee607ed0e04500459db53001d8e02f8831f084.

During cleanup path, FTE's parent node group is removed which is
referenced by the FTE while freeing the FTE.
Hence FTE's lockless read lookup optimization done in cited commit is
not possible at the moment.

Hence, revert the commit.

This avoid below KAZAN call trace.

[  110.390896] BUG: KASAN: use-after-free in find_root.isra.14+0x56/0x60
[mlx5_core]
[  110.391048] Read of size 4 at addr ffff888c19e6d220 by task
swapper/12/0

[  110.391219] CPU: 12 PID: 0 Comm: swapper/12 Not tainted 5.5.0-rc1+
[  110.391222] Hardware name: HP ProLiant DL380p Gen8, BIOS P70
08/02/2014
[  110.391225] Call Trace:
[  110.391229]  <IRQ>
[  110.391246]  dump_stack+0x95/0xd5
[  110.391307]  ? find_root.isra.14+0x56/0x60 [mlx5_core]
[  110.391320]  print_address_description.constprop.5+0x20/0x320
[  110.391379]  ? find_root.isra.14+0x56/0x60 [mlx5_core]
[  110.391435]  ? find_root.isra.14+0x56/0x60 [mlx5_core]
[  110.391441]  __kasan_report+0x149/0x18c
[  110.391499]  ? find_root.isra.14+0x56/0x60 [mlx5_core]
[  110.391504]  kasan_report+0x12/0x20
[  110.391511]  __asan_report_load4_noabort+0x14/0x20
[  110.391567]  find_root.isra.14+0x56/0x60 [mlx5_core]
[  110.391625]  del_sw_fte_rcu+0x4a/0x100 [mlx5_core]
[  110.391633]  rcu_core+0x404/0x1950
[  110.391640]  ? rcu_accelerate_cbs_unlocked+0x100/0x100
[  110.391649]  ? run_rebalance_domains+0x201/0x280
[  110.391654]  rcu_core_si+0xe/0x10
[  110.391661]  __do_softirq+0x181/0x66c
[  110.391670]  irq_exit+0x12c/0x150
[  110.391675]  smp_apic_timer_interrupt+0xf0/0x370
[  110.391681]  apic_timer_interrupt+0xf/0x20
[  110.391684]  </IRQ>
[  110.391695] RIP: 0010:cpuidle_enter_state+0xfa/0xba0
[  110.391703] Code: 3d c3 9b b5 50 e8 56 75 6e fe 48 89 45 c8 0f 1f 44
00 00 31 ff e8 a6 94 6e fe 45 84 ff 0f 85 f6 02 00 00 fb 66 0f 1f 44 00
00 <45> 85 f6 0f 88 db 06 00 00 4d 63 fe 4b 8d 04 7f 49 8d 04 87 49 8d
[  110.391706] RSP: 0018:ffff888c23a6fce8 EFLAGS: 00000246 ORIG_RAX:
ffffffffffffff13
[  110.391712] RAX: dffffc0000000000 RBX: ffffe8ffff7002f8 RCX:
000000000000001f
[  110.391715] RDX: 1ffff11184ee6cb5 RSI: 0000000040277d83 RDI:
ffff888c277365a8
[  110.391718] RBP: ffff888c23a6fd40 R08: 0000000000000002 R09:
0000000000035280
[  110.391721] R10: ffff888c23a6fc80 R11: ffffed11847485d0 R12:
ffffffffb1017740
[  110.391723] R13: 0000000000000003 R14: 0000000000000003 R15:
0000000000000000
[  110.391732]  ? cpuidle_enter_state+0xea/0xba0
[  110.391738]  cpuidle_enter+0x4f/0xa0
[  110.391747]  call_cpuidle+0x6d/0xc0
[  110.391752]  do_idle+0x360/0x430
[  110.391758]  ? arch_cpu_idle_exit+0x40/0x40
[  110.391765]  ? complete+0x67/0x80
[  110.391771]  cpu_startup_entry+0x1d/0x20
[  110.391779]  start_secondary+0x2f3/0x3c0
[  110.391784]  ? set_cpu_sibling_map+0x2500/0x2500
[  110.391795]  secondary_startup_64+0xa4/0xb0

[  110.391841] Allocated by task 290:
[  110.391917]  save_stack+0x21/0x90
[  110.391921]  __kasan_kmalloc.constprop.8+0xa7/0xd0
[  110.391925]  kasan_kmalloc+0x9/0x10
[  110.391929]  kmem_cache_alloc_trace+0xf6/0x270
[  110.391987]  create_root_ns.isra.36+0x58/0x260 [mlx5_core]
[  110.392044]  mlx5_init_fs+0x5fd/0x1ee0 [mlx5_core]
[  110.392092]  mlx5_load_one+0xc7a/0x3860 [mlx5_core]
[  110.392139]  init_one+0x6ff/0xf90 [mlx5_core]
[  110.392145]  local_pci_probe+0xde/0x190
[  110.392150]  work_for_cpu_fn+0x56/0xa0
[  110.392153]  process_one_work+0x678/0x1140
[  110.392157]  worker_thread+0x573/0xba0
[  110.392162]  kthread+0x341/0x400
[  110.392166]  ret_from_fork+0x1f/0x40

[  110.392218] Freed by task 2742:
[  110.392288]  save_stack+0x21/0x90
[  110.392292]  __kasan_slab_free+0x137/0x190
[  110.392296]  kasan_slab_free+0xe/0x10
[  110.392299]  kfree+0x94/0x250
[  110.392357]  tree_put_node+0x257/0x360 [mlx5_core]
[  110.392413]  tree_remove_node+0x63/0xb0 [mlx5_core]
[  110.392469]  clean_tree+0x199/0x240 [mlx5_core]
[  110.392525]  mlx5_cleanup_fs+0x76/0x580 [mlx5_core]
[  110.392572]  mlx5_unload+0x22/0xc0 [mlx5_core]
[  110.392619]  mlx5_unload_one+0x99/0x260 [mlx5_core]
[  110.392666]  remove_one+0x61/0x160 [mlx5_core]
[  110.392671]  pci_device_remove+0x10b/0x2c0
[  110.392677]  device_release_driver_internal+0x1e4/0x490
[  110.392681]  device_driver_detach+0x36/0x40
[  110.392685]  unbind_store+0x147/0x200
[  110.392688]  drv_attr_store+0x6f/0xb0
[  110.392693]  sysfs_kf_write+0x127/0x1d0
[  110.392697]  kernfs_fop_write+0x296/0x420
[  110.392702]  __vfs_write+0x66/0x110
[  110.392707]  vfs_write+0x1a0/0x500
[  110.392711]  ksys_write+0x164/0x250
[  110.392715]  __x64_sys_write+0x73/0xb0
[  110.392720]  do_syscall_64+0x9f/0x3a0
[  110.392725]  entry_SYSCALL_64_after_hwframe+0x44/0xa9

issue: none
Change-Id: I668429961e776a8bd290f3845068f9c7b05ec211
Fixes: 7dee607ed0e0 ("net/mlx5: Support lockless FTE read lookups")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../net/ethernet/mellanox/mlx5/core/fs_core.c | 70 ++++---------------
 .../net/ethernet/mellanox/mlx5/core/fs_core.h |  1 -
 2 files changed, 15 insertions(+), 56 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index d60577484567..7eadb38fc645 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -531,16 +531,9 @@ static void del_hw_fte(struct fs_node *node)
 	}
 }
 
-static void del_sw_fte_rcu(struct rcu_head *head)
-{
-	struct fs_fte *fte = container_of(head, struct fs_fte, rcu);
-	struct mlx5_flow_steering *steering = get_steering(&fte->node);
-
-	kmem_cache_free(steering->ftes_cache, fte);
-}
-
 static void del_sw_fte(struct fs_node *node)
 {
+	struct mlx5_flow_steering *steering = get_steering(node);
 	struct mlx5_flow_group *fg;
 	struct fs_fte *fte;
 	int err;
@@ -553,8 +546,7 @@ static void del_sw_fte(struct fs_node *node)
 				     rhash_fte);
 	WARN_ON(err);
 	ida_simple_remove(&fg->fte_allocator, fte->index - fg->start_index);
-
-	call_rcu(&fte->rcu, del_sw_fte_rcu);
+	kmem_cache_free(steering->ftes_cache, fte);
 }
 
 static void del_hw_flow_group(struct fs_node *node)
@@ -1633,47 +1625,22 @@ static u64 matched_fgs_get_version(struct list_head *match_head)
 }
 
 static struct fs_fte *
-lookup_fte_for_write_locked(struct mlx5_flow_group *g, const u32 *match_value)
+lookup_fte_locked(struct mlx5_flow_group *g,
+		  const u32 *match_value,
+		  bool take_write)
 {
 	struct fs_fte *fte_tmp;
 
-	nested_down_write_ref_node(&g->node, FS_LOCK_PARENT);
-
-	fte_tmp = rhashtable_lookup_fast(&g->ftes_hash, match_value, rhash_fte);
-	if (!fte_tmp || !tree_get_node(&fte_tmp->node)) {
-		fte_tmp = NULL;
-		goto out;
-	}
-
-	if (!fte_tmp->node.active) {
-		tree_put_node(&fte_tmp->node, false);
-		fte_tmp = NULL;
-		goto out;
-	}
-	nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
-
-out:
-	up_write_ref_node(&g->node, false);
-	return fte_tmp;
-}
-
-static struct fs_fte *
-lookup_fte_for_read_locked(struct mlx5_flow_group *g, const u32 *match_value)
-{
-	struct fs_fte *fte_tmp;
-
-	if (!tree_get_node(&g->node))
-		return NULL;
-
-	rcu_read_lock();
-	fte_tmp = rhashtable_lookup(&g->ftes_hash, match_value, rhash_fte);
+	if (take_write)
+		nested_down_write_ref_node(&g->node, FS_LOCK_PARENT);
+	else
+		nested_down_read_ref_node(&g->node, FS_LOCK_PARENT);
+	fte_tmp = rhashtable_lookup_fast(&g->ftes_hash, match_value,
+					 rhash_fte);
 	if (!fte_tmp || !tree_get_node(&fte_tmp->node)) {
-		rcu_read_unlock();
 		fte_tmp = NULL;
 		goto out;
 	}
-	rcu_read_unlock();
-
 	if (!fte_tmp->node.active) {
 		tree_put_node(&fte_tmp->node, false);
 		fte_tmp = NULL;
@@ -1681,19 +1648,12 @@ lookup_fte_for_read_locked(struct mlx5_flow_group *g, const u32 *match_value)
 	}
 
 	nested_down_write_ref_node(&fte_tmp->node, FS_LOCK_CHILD);
-
 out:
-	tree_put_node(&g->node, false);
-	return fte_tmp;
-}
-
-static struct fs_fte *
-lookup_fte_locked(struct mlx5_flow_group *g, const u32 *match_value, bool write)
-{
-	if (write)
-		return lookup_fte_for_write_locked(g, match_value);
+	if (take_write)
+		up_write_ref_node(&g->node, false);
 	else
-		return lookup_fte_for_read_locked(g, match_value);
+		up_read_ref_node(&g->node);
+	return fte_tmp;
 }
 
 static struct mlx5_flow_handle *
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
index e8cd997f413e..c2621b911563 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
@@ -203,7 +203,6 @@ struct fs_fte {
 	enum fs_fte_status		status;
 	struct mlx5_fc			*counter;
 	struct rhash_head		hash;
-	struct rcu_head	rcu;
 	int				modify_mask;
 };
 
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] Revert "RDMA/cma: Simplify rdma_resolve_addr() error flow"
  2020-03-03 14:08 [PATCH] IB/mlx5: Add np_min_time_between_cnps and rp_max_rate debug params Parav Pandit
                   ` (2 preceding siblings ...)
  2020-03-03 14:08 ` [PATCH] Revert "net/mlx5: Support lockless FTE read lookups" Parav Pandit
@ 2020-03-03 14:08 ` Parav Pandit
  2020-03-03 14:12   ` Parav Pandit
  2020-03-03 14:10 ` [PATCH] IB/mlx5: Add np_min_time_between_cnps and rp_max_rate debug params Parav Pandit
  4 siblings, 1 reply; 10+ messages in thread
From: Parav Pandit @ 2020-03-03 14:08 UTC (permalink / raw)
  To: netdev, davem, kuba; +Cc: parav, jiri, moshe, vladyslavt, saeedm, leon

This reverts commit 219d2e9dfda9431b808c28d5efc74b404b95b638.

In below flow requires cm_id_priv's destination address to be setup
before performing rdma_bind_addr().
Without which source port allocation for existing bind list fails when
port range is small, resulting into rdma_resolve_addr() failure.

rdma_resolve_addr()
  cma_bind_addr()
    rdma_bind_addr()
      cma_get_port()
        cma_alloc_any_port()
          cma_port_is_unique() <- compares with zero daddr

issue: 2064711
Change-Id: Ib81faae224a78d10879b10c94aae8b141b8debc6
Signed-off-by: Parav Pandit <parav@mellanox.com>
---
 drivers/infiniband/core/cma.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 43a6f07e0afe..ada28075d946 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -3180,19 +3180,25 @@ int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
 	int ret;
 
 	id_priv = container_of(id, struct rdma_id_private, id);
+	memcpy(cma_dst_addr(id_priv), dst_addr, rdma_addr_size(dst_addr));
 	if (id_priv->state == RDMA_CM_IDLE) {
 		ret = cma_bind_addr(id, src_addr, dst_addr);
-		if (ret)
+		if (ret) {
+			memset(cma_dst_addr(id_priv), 0, rdma_addr_size(dst_addr));
 			return ret;
+		}
 	}
 
-	if (cma_family(id_priv) != dst_addr->sa_family)
+	if (cma_family(id_priv) != dst_addr->sa_family) {
+		memset(cma_dst_addr(id_priv), 0, rdma_addr_size(dst_addr));
 		return -EINVAL;
+	}
 
-	if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY))
+	if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY)) {
+		memset(cma_dst_addr(id_priv), 0, rdma_addr_size(dst_addr));
 		return -EINVAL;
+	}
 
-	memcpy(cma_dst_addr(id_priv), dst_addr, rdma_addr_size(dst_addr));
 	if (cma_any_addr(dst_addr)) {
 		ret = cma_resolve_loopback(id_priv);
 	} else {
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* RE: [PATCH] IB/mlx5: Add np_min_time_between_cnps and rp_max_rate debug params
  2020-03-03 14:08 [PATCH] IB/mlx5: Add np_min_time_between_cnps and rp_max_rate debug params Parav Pandit
                   ` (3 preceding siblings ...)
  2020-03-03 14:08 ` [PATCH] Revert "RDMA/cma: Simplify rdma_resolve_addr() error flow" Parav Pandit
@ 2020-03-03 14:10 ` Parav Pandit
  4 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2020-03-03 14:10 UTC (permalink / raw)
  To: Parav Pandit, netdev, davem, kuba
  Cc: Jiri Pirko, Moshe Shemesh, Vladyslav Tarasiuk, Saeed Mahameed, leon

I am sorry for sending unrelated patches here.
Sent from wrong directory.


> -----Original Message-----
> From: Parav Pandit <parav@mellanox.com>
> Sent: Tuesday, March 3, 2020 8:09 AM
> To: netdev@vger.kernel.org; davem@davemloft.net; kuba@kernel.org
> Cc: Parav Pandit <parav@mellanox.com>; Jiri Pirko <jiri@mellanox.com>;
> Moshe Shemesh <moshe@mellanox.com>; Vladyslav Tarasiuk
> <vladyslavt@mellanox.com>; Saeed Mahameed <saeedm@mellanox.com>;
> leon@kernel.org
> Subject: [PATCH] IB/mlx5: Add np_min_time_between_cnps and
> rp_max_rate debug params
> 
> Add two debugfs parameters described below.
> 
> np_min_time_between_cnps - Minimum time between sending CNPs from
> the
>                            port.
>                            Unit = microseconds.
>                            Default = 0.
> 
> rp_max_rate - Maximum rate at which reaction point node can transmit.
>               Once this limit is reached, RP is no longer rate limited.
>               Unit = Mbits/sec
>               Default = 0 (full speed)
> 
> issue: 961226
> Change-Id: I14544168ed115acaeb8ff900ac092fad2f1bb68f
> Signed-off-by: Parav Pandit <parav@mellanox.com>
> ---
>  drivers/infiniband/hw/mlx5/cong.c    | 20 ++++++++++++++++++++
>  drivers/infiniband/hw/mlx5/mlx5_ib.h |  2 ++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/mlx5/cong.c
> b/drivers/infiniband/hw/mlx5/cong.c
> index 8ba439fabf7f..de4da92b81a6 100644
> --- a/drivers/infiniband/hw/mlx5/cong.c
> +++ b/drivers/infiniband/hw/mlx5/cong.c
> @@ -47,6 +47,7 @@ static const char * const mlx5_ib_dbg_cc_name[] = {
>  	"rp_byte_reset",
>  	"rp_threshold",
>  	"rp_ai_rate",
> +	"rp_max_rate",
>  	"rp_hai_rate",
>  	"rp_min_dec_fac",
>  	"rp_min_rate",
> @@ -56,6 +57,7 @@ static const char * const mlx5_ib_dbg_cc_name[] = {
>  	"rp_rate_reduce_monitor_period",
>  	"rp_initial_alpha_value",
>  	"rp_gd",
> +	"np_min_time_between_cnps",
>  	"np_cnp_dscp",
>  	"np_cnp_prio_mode",
>  	"np_cnp_prio",
> @@ -66,6 +68,7 @@ static const char * const mlx5_ib_dbg_cc_name[] = {
>  #define MLX5_IB_RP_TIME_RESET_ATTR			BIT(3)
>  #define MLX5_IB_RP_BYTE_RESET_ATTR			BIT(4)
>  #define MLX5_IB_RP_THRESHOLD_ATTR			BIT(5)
> +#define MLX5_IB_RP_MAX_RATE_ATTR			BIT(6)
>  #define MLX5_IB_RP_AI_RATE_ATTR				BIT(7)
>  #define MLX5_IB_RP_HAI_RATE_ATTR			BIT(8)
>  #define MLX5_IB_RP_MIN_DEC_FAC_ATTR			BIT(9)
> @@ -77,6 +80,7 @@ static const char * const mlx5_ib_dbg_cc_name[] = {
>  #define MLX5_IB_RP_INITIAL_ALPHA_VALUE_ATTR		BIT(15)
>  #define MLX5_IB_RP_GD_ATTR				BIT(16)
> 
> +#define MLX5_IB_NP_MIN_TIME_BETWEEN_CNPS_ATTR		BIT(2)
>  #define MLX5_IB_NP_CNP_DSCP_ATTR			BIT(3)
>  #define MLX5_IB_NP_CNP_PRIO_MODE_ATTR			BIT(4)
> 
> @@ -111,6 +115,9 @@ static u32 mlx5_get_cc_param_val(void *field, int
> offset)
>  	case MLX5_IB_DBG_CC_RP_AI_RATE:
>  		return MLX5_GET(cong_control_r_roce_ecn_rp, field,
>  				rpg_ai_rate);
> +	case MLX5_IB_DBG_CC_RP_MAX_RATE:
> +		return MLX5_GET(cong_control_r_roce_ecn_rp, field,
> +				rpg_max_rate);
>  	case MLX5_IB_DBG_CC_RP_HAI_RATE:
>  		return MLX5_GET(cong_control_r_roce_ecn_rp, field,
>  				rpg_hai_rate);
> @@ -138,6 +145,9 @@ static u32 mlx5_get_cc_param_val(void *field, int
> offset)
>  	case MLX5_IB_DBG_CC_RP_GD:
>  		return MLX5_GET(cong_control_r_roce_ecn_rp, field,
>  				rpg_gd);
> +	case MLX5_IB_DBG_CC_NP_MIN_TIME_BETWEEN_CNPS:
> +		return MLX5_GET(cong_control_r_roce_ecn_np, field,
> +				min_time_between_cnps);
>  	case MLX5_IB_DBG_CC_NP_CNP_DSCP:
>  		return MLX5_GET(cong_control_r_roce_ecn_np, field,
>  				cnp_dscp);
> @@ -186,6 +196,11 @@ static void mlx5_ib_set_cc_param_mask_val(void
> *field, int offset,
>  		MLX5_SET(cong_control_r_roce_ecn_rp, field,
>  			 rpg_ai_rate, var);
>  		break;
> +	case MLX5_IB_DBG_CC_RP_MAX_RATE:
> +		*attr_mask |= MLX5_IB_RP_MAX_RATE_ATTR;
> +		MLX5_SET(cong_control_r_roce_ecn_rp, field,
> +			 rpg_max_rate, var);
> +		break;
>  	case MLX5_IB_DBG_CC_RP_HAI_RATE:
>  		*attr_mask |= MLX5_IB_RP_HAI_RATE_ATTR;
>  		MLX5_SET(cong_control_r_roce_ecn_rp, field, @@ -231,6
> +246,11 @@ static void mlx5_ib_set_cc_param_mask_val(void *field, int
> offset,
>  		MLX5_SET(cong_control_r_roce_ecn_rp, field,
>  			 rpg_gd, var);
>  		break;
> +	case MLX5_IB_DBG_CC_NP_MIN_TIME_BETWEEN_CNPS:
> +		*attr_mask |=
> MLX5_IB_NP_MIN_TIME_BETWEEN_CNPS_ATTR;
> +		MLX5_SET(cong_control_r_roce_ecn_np, field,
> +			 min_time_between_cnps, var);
> +		break;
>  	case MLX5_IB_DBG_CC_NP_CNP_DSCP:
>  		*attr_mask |= MLX5_IB_NP_CNP_DSCP_ATTR;
>  		MLX5_SET(cong_control_r_roce_ecn_np, field, cnp_dscp,
> var); diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h
> b/drivers/infiniband/hw/mlx5/mlx5_ib.h
> index d9bffcc93587..4cbc87c79951 100644
> --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
> +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
> @@ -792,6 +792,7 @@ enum mlx5_ib_dbg_cc_types {
>  	MLX5_IB_DBG_CC_RP_BYTE_RESET,
>  	MLX5_IB_DBG_CC_RP_THRESHOLD,
>  	MLX5_IB_DBG_CC_RP_AI_RATE,
> +	MLX5_IB_DBG_CC_RP_MAX_RATE,
>  	MLX5_IB_DBG_CC_RP_HAI_RATE,
>  	MLX5_IB_DBG_CC_RP_MIN_DEC_FAC,
>  	MLX5_IB_DBG_CC_RP_MIN_RATE,
> @@ -801,6 +802,7 @@ enum mlx5_ib_dbg_cc_types {
>  	MLX5_IB_DBG_CC_RP_RATE_REDUCE_MONITOR_PERIOD,
>  	MLX5_IB_DBG_CC_RP_INITIAL_ALPHA_VALUE,
>  	MLX5_IB_DBG_CC_RP_GD,
> +	MLX5_IB_DBG_CC_NP_MIN_TIME_BETWEEN_CNPS,
>  	MLX5_IB_DBG_CC_NP_CNP_DSCP,
>  	MLX5_IB_DBG_CC_NP_CNP_PRIO_MODE,
>  	MLX5_IB_DBG_CC_NP_CNP_PRIO,
> --
> 2.19.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] IB/mlx5: Fix missing debugfs entries
  2020-03-03 14:08 ` [PATCH] IB/mlx5: Fix missing debugfs entries Parav Pandit
@ 2020-03-03 14:10   ` Parav Pandit
  0 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2020-03-03 14:10 UTC (permalink / raw)
  To: Parav Pandit, netdev, davem, kuba
  Cc: Jiri Pirko, Moshe Shemesh, Vladyslav Tarasiuk, Saeed Mahameed, leon



> From: Parav Pandit <parav@mellanox.com>
> Sent: Tuesday, March 3, 2020 8:09 AM
> To: netdev@vger.kernel.org; davem@davemloft.net; kuba@kernel.org
> Cc: Parav Pandit <parav@mellanox.com>; Jiri Pirko <jiri@mellanox.com>;
> Moshe Shemesh <moshe@mellanox.com>; Vladyslav Tarasiuk
> <vladyslavt@mellanox.com>; Saeed Mahameed <saeedm@mellanox.com>;
> leon@kernel.org
> Subject: [PATCH] IB/mlx5: Fix missing debugfs entries

Please ignore the noise of this unrelated patch.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] net: sched: fix cleanup NULL pointer exception in act_mirr
  2020-03-03 14:08 ` [PATCH] net: sched: fix cleanup NULL pointer exception in act_mirr Parav Pandit
@ 2020-03-03 14:11   ` Parav Pandit
  0 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2020-03-03 14:11 UTC (permalink / raw)
  To: Parav Pandit, netdev, davem, kuba
  Cc: Jiri Pirko, Moshe Shemesh, Vladyslav Tarasiuk, Saeed Mahameed,
	leon, John Hurley



> From: Parav Pandit <parav@mellanox.com>
> Sent: Tuesday, March 3, 2020 8:09 AM
> To: netdev@vger.kernel.org; davem@davemloft.net; kuba@kernel.org
> Cc: Parav Pandit <parav@mellanox.com>; Jiri Pirko <jiri@mellanox.com>;
> Moshe Shemesh <moshe@mellanox.com>; Vladyslav Tarasiuk
> <vladyslavt@mellanox.com>; Saeed Mahameed <saeedm@mellanox.com>;
> leon@kernel.org; John Hurley <john.hurley@netronome.com>
> Subject: [PATCH] net: sched: fix cleanup NULL pointer exception in act_mirr

Please ignore the noise of this unrelated patch. Sent from wrong directory.
Sorry for the noise.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] Revert "RDMA/cma: Simplify rdma_resolve_addr() error flow"
  2020-03-03 14:08 ` [PATCH] Revert "RDMA/cma: Simplify rdma_resolve_addr() error flow" Parav Pandit
@ 2020-03-03 14:12   ` Parav Pandit
  0 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2020-03-03 14:12 UTC (permalink / raw)
  To: Parav Pandit, netdev, davem, kuba
  Cc: Jiri Pirko, Moshe Shemesh, Vladyslav Tarasiuk, Saeed Mahameed, leon



> Sent: Tuesday, March 3, 2020 8:09 AM
> To: netdev@vger.kernel.org; davem@davemloft.net; kuba@kernel.org
> Cc: Parav Pandit <parav@mellanox.com>; Jiri Pirko <jiri@mellanox.com>;
> Moshe Shemesh <moshe@mellanox.com>; Vladyslav Tarasiuk
> <vladyslavt@mellanox.com>; Saeed Mahameed <saeedm@mellanox.com>;
> leon@kernel.org
> Subject: [PATCH] Revert "RDMA/cma: Simplify rdma_resolve_addr() error
> flow"
> 
> This reverts commit 219d2e9dfda9431b808c28d5efc74b404b95b638.

Please ignore the noise of this unrelated patch. Sent from wrong directory.
Sorry for the noise.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH] Revert "net/mlx5: Support lockless FTE read lookups"
  2020-03-03 14:08 ` [PATCH] Revert "net/mlx5: Support lockless FTE read lookups" Parav Pandit
@ 2020-03-03 14:12   ` Parav Pandit
  0 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2020-03-03 14:12 UTC (permalink / raw)
  To: Parav Pandit, netdev, davem, kuba
  Cc: Jiri Pirko, Moshe Shemesh, Vladyslav Tarasiuk, Saeed Mahameed, leon



> Sent: Tuesday, March 3, 2020 8:09 AM
> To: netdev@vger.kernel.org; davem@davemloft.net; kuba@kernel.org
> Cc: Parav Pandit <parav@mellanox.com>; Jiri Pirko <jiri@mellanox.com>;
> Moshe Shemesh <moshe@mellanox.com>; Vladyslav Tarasiuk
> <vladyslavt@mellanox.com>; Saeed Mahameed <saeedm@mellanox.com>;
> leon@kernel.org
> Subject: [PATCH] Revert "net/mlx5: Support lockless FTE read lookups"

Please ignore the noise of this unrelated patch. Sent from wrong directory.
Sorry for the noise.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-03-03 14:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 14:08 [PATCH] IB/mlx5: Add np_min_time_between_cnps and rp_max_rate debug params Parav Pandit
2020-03-03 14:08 ` [PATCH] IB/mlx5: Fix missing debugfs entries Parav Pandit
2020-03-03 14:10   ` Parav Pandit
2020-03-03 14:08 ` [PATCH] net: sched: fix cleanup NULL pointer exception in act_mirr Parav Pandit
2020-03-03 14:11   ` Parav Pandit
2020-03-03 14:08 ` [PATCH] Revert "net/mlx5: Support lockless FTE read lookups" Parav Pandit
2020-03-03 14:12   ` Parav Pandit
2020-03-03 14:08 ` [PATCH] Revert "RDMA/cma: Simplify rdma_resolve_addr() error flow" Parav Pandit
2020-03-03 14:12   ` Parav Pandit
2020-03-03 14:10 ` [PATCH] IB/mlx5: Add np_min_time_between_cnps and rp_max_rate debug params Parav Pandit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.