netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Fixes for unlocked cls hardware offload API refactoring
@ 2019-08-28 16:41 Vlad Buslov
  2019-08-28 16:41 ` [PATCH net-next 1/2] net: sched: cls_matchall: cleanup flow_action before deallocating Vlad Buslov
  2019-08-28 16:41 ` [PATCH net-next 2/2] net/mlx5e: Move local var definition into ifdef block Vlad Buslov
  0 siblings, 2 replies; 5+ messages in thread
From: Vlad Buslov @ 2019-08-28 16:41 UTC (permalink / raw)
  To: netdev; +Cc: jhs, xiyou.wangcong, jiri, davem, saeedm, idosch, Vlad Buslov

Two fixes for my "Refactor cls hardware offload API to support
rtnl-independent drivers" series.

Vlad Buslov (2):
  net: sched: cls_matchall: cleanup flow_action before deallocating
  net/mlx5e: Move local var definition into ifdef block

 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 ++++--
 net/sched/cls_matchall.c                          | 2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

-- 
2.21.0


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

* [PATCH net-next 1/2] net: sched: cls_matchall: cleanup flow_action before deallocating
  2019-08-28 16:41 [PATCH net-next 0/2] Fixes for unlocked cls hardware offload API refactoring Vlad Buslov
@ 2019-08-28 16:41 ` Vlad Buslov
  2019-08-28 16:41 ` [PATCH net-next 2/2] net/mlx5e: Move local var definition into ifdef block Vlad Buslov
  1 sibling, 0 replies; 5+ messages in thread
From: Vlad Buslov @ 2019-08-28 16:41 UTC (permalink / raw)
  To: netdev; +Cc: jhs, xiyou.wangcong, jiri, davem, saeedm, idosch, Vlad Buslov

Recent rtnl lock removal patch changed flow_action infra to require proper
cleanup besides simple memory deallocation. However, matchall classifier
was not updated to call tc_cleanup_flow_action(). Add proper cleanup to
mall_replace_hw_filter() and mall_reoffload().

Fixes: 5a6ff4b13d59 ("net: sched: take reference to action dev before calling offloads")
Reported-by: Ido Schimmel <idosch@mellanox.com>
Tested-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
---
 net/sched/cls_matchall.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c
index 3266f25011cc..7fc2eb62aa98 100644
--- a/net/sched/cls_matchall.c
+++ b/net/sched/cls_matchall.c
@@ -111,6 +111,7 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
 
 	err = tc_setup_cb_add(block, tp, TC_SETUP_CLSMATCHALL, &cls_mall,
 			      skip_sw, &head->flags, &head->in_hw_count, true);
+	tc_cleanup_flow_action(&cls_mall.rule->action);
 	kfree(cls_mall.rule);
 
 	if (err) {
@@ -313,6 +314,7 @@ static int mall_reoffload(struct tcf_proto *tp, bool add, flow_setup_cb_t *cb,
 	err = tc_setup_cb_reoffload(block, tp, add, cb, TC_SETUP_CLSMATCHALL,
 				    &cls_mall, cb_priv, &head->flags,
 				    &head->in_hw_count);
+	tc_cleanup_flow_action(&cls_mall.rule->action);
 	kfree(cls_mall.rule);
 
 	if (err)
-- 
2.21.0


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

* [PATCH net-next 2/2] net/mlx5e: Move local var definition into ifdef block
  2019-08-28 16:41 [PATCH net-next 0/2] Fixes for unlocked cls hardware offload API refactoring Vlad Buslov
  2019-08-28 16:41 ` [PATCH net-next 1/2] net: sched: cls_matchall: cleanup flow_action before deallocating Vlad Buslov
@ 2019-08-28 16:41 ` Vlad Buslov
  2019-08-29  9:29   ` Sergei Shtylyov
  1 sibling, 1 reply; 5+ messages in thread
From: Vlad Buslov @ 2019-08-28 16:41 UTC (permalink / raw)
  To: netdev
  Cc: jhs, xiyou.wangcong, jiri, davem, saeedm, idosch, Vlad Buslov,
	tanhuazhong

New local variable "struct flow_block_offload *f" was added to
mlx5e_setup_tc() in recent rtnl lock removal patches. The variable is used
in code that is only compiled when CONFIG_MLX5_ESWITCH is enabled. This
results compilation warning about unused variable when CONFIG_MLX5_ESWITCH
is not set. Move the variable definition into eswitch-specific code block
from the begging of mlx5e_setup_tc() function.

Fixes: c9f14470d048 ("net: sched: add API for registering unlocked offload block callbacks")
Reported-by: tanhuazhong <tanhuazhong@huawei.com>
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index 8592b98d0e70..c10a1fc8e469 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3470,16 +3470,18 @@ static int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type,
 			  void *type_data)
 {
 	struct mlx5e_priv *priv = netdev_priv(dev);
-	struct flow_block_offload *f = type_data;
 
 	switch (type) {
 #ifdef CONFIG_MLX5_ESWITCH
-	case TC_SETUP_BLOCK:
+	case TC_SETUP_BLOCK: {
+		struct flow_block_offload *f = type_data;
+
 		f->unlocked_driver_cb = true;
 		return flow_block_cb_setup_simple(type_data,
 						  &mlx5e_block_cb_list,
 						  mlx5e_setup_tc_block_cb,
 						  priv, priv, true);
+	}
 #endif
 	case TC_SETUP_QDISC_MQPRIO:
 		return mlx5e_setup_tc_mqprio(priv, type_data);
-- 
2.21.0


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

* Re: [PATCH net-next 2/2] net/mlx5e: Move local var definition into ifdef block
  2019-08-28 16:41 ` [PATCH net-next 2/2] net/mlx5e: Move local var definition into ifdef block Vlad Buslov
@ 2019-08-29  9:29   ` Sergei Shtylyov
  2019-08-29 16:13     ` Vlad Buslov
  0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2019-08-29  9:29 UTC (permalink / raw)
  To: Vlad Buslov, netdev
  Cc: jhs, xiyou.wangcong, jiri, davem, saeedm, idosch, tanhuazhong

Hello!

On 28.08.2019 19:41, Vlad Buslov wrote:

> New local variable "struct flow_block_offload *f" was added to
> mlx5e_setup_tc() in recent rtnl lock removal patches. The variable is used
> in code that is only compiled when CONFIG_MLX5_ESWITCH is enabled. This
> results compilation warning about unused variable when CONFIG_MLX5_ESWITCH
> is not set. Move the variable definition into eswitch-specific code block
> from the begging of mlx5e_setup_tc() function.

    Beginning?

> Fixes: c9f14470d048 ("net: sched: add API for registering unlocked offload block callbacks")
> Reported-by: tanhuazhong <tanhuazhong@huawei.com>
> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
[...]

MBR, Sergei

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

* Re: [PATCH net-next 2/2] net/mlx5e: Move local var definition into ifdef block
  2019-08-29  9:29   ` Sergei Shtylyov
@ 2019-08-29 16:13     ` Vlad Buslov
  0 siblings, 0 replies; 5+ messages in thread
From: Vlad Buslov @ 2019-08-29 16:13 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Vlad Buslov, netdev@vger.kernel.org, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
	Saeed Mahameed, Ido Schimmel, tanhuazhong


On Thu 29 Aug 2019 at 12:29, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
> Hello!
>
> On 28.08.2019 19:41, Vlad Buslov wrote:
>
>> New local variable "struct flow_block_offload *f" was added to
>> mlx5e_setup_tc() in recent rtnl lock removal patches. The variable is used
>> in code that is only compiled when CONFIG_MLX5_ESWITCH is enabled. This
>> results compilation warning about unused variable when CONFIG_MLX5_ESWITCH
>> is not set. Move the variable definition into eswitch-specific code block
>> from the begging of mlx5e_setup_tc() function.
>
>    Beginning?

Yep. Thanks for spotting it!

>
>> Fixes: c9f14470d048 ("net: sched: add API for registering unlocked offload block callbacks")
>> Reported-by: tanhuazhong <tanhuazhong@huawei.com>
>> Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
> [...]
>
> MBR, Sergei


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

end of thread, other threads:[~2019-08-29 16:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-28 16:41 [PATCH net-next 0/2] Fixes for unlocked cls hardware offload API refactoring Vlad Buslov
2019-08-28 16:41 ` [PATCH net-next 1/2] net: sched: cls_matchall: cleanup flow_action before deallocating Vlad Buslov
2019-08-28 16:41 ` [PATCH net-next 2/2] net/mlx5e: Move local var definition into ifdef block Vlad Buslov
2019-08-29  9:29   ` Sergei Shtylyov
2019-08-29 16:13     ` Vlad Buslov

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