On Thu, 22 Aug 2019 15:43:47 +0300, Vlad Buslov wrote:
> diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
> index 4215c849f4a3..d8ef7a9e6906 100644
> --- a/net/sched/cls_api.c
> +++ b/net/sched/cls_api.c
> @@ -3099,9 +3099,13 @@ int tc_setup_cb_add(struct tcf_block *block, struct
> tcf_proto *tp,
> }
>
> ok_count = __tc_setup_cb_call(block, type, type_data, err_stop);
> - if (ok_count > 0)
> - tc_cls_offload_cnt_update(block, tp, in_hw_count, flags,
> - ok_count, true);
> + if (ok_count >= 0) {
> + if (tp->ops->hw_add)
> + tp->ops->hw_add(tp, type_data);
> + if (ok_count > 0)
> + tc_cls_offload_cnt_update(block, tp, in_hw_count, flags,
> + ok_count, true);
> + }
nit:
if (ok_count < 0)
goto err_unlock;
if (tp->ops->hw_add)
tp->ops->hw_add(tp, type_data);
if (ok_count > 0)
tc_cls_offload_cnt_update(block, tp, in_hw_count, flags,
ok_count, true);
IOW try to keep the "success flow" unindented.
> errout:
> up_read(&block->cb_lock);
> return ok_count;