From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D7D2C43381 for ; Thu, 14 Feb 2019 20:49:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02CD92147C for ; Thu, 14 Feb 2019 20:49:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408121AbfBNUtd (ORCPT ); Thu, 14 Feb 2019 15:49:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47430 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408115AbfBNUtd (ORCPT ); Thu, 14 Feb 2019 15:49:33 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 25F75A787C; Thu, 14 Feb 2019 20:49:33 +0000 (UTC) Received: from localhost (ovpn-200-19.brq.redhat.com [10.40.200.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DDB05600C1; Thu, 14 Feb 2019 20:49:30 +0000 (UTC) Date: Thu, 14 Feb 2019 21:49:26 +0100 From: Stefano Brivio To: Vlad Buslov Cc: netdev@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net Subject: Re: [PATCH net-next 04/12] net: sched: flower: track filter deletion with flag Message-ID: <20190214214926.0cb839a7@redhat.com> In-Reply-To: <20190214074712.17846-5-vladbu@mellanox.com> References: <20190214074712.17846-1-vladbu@mellanox.com> <20190214074712.17846-5-vladbu@mellanox.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 14 Feb 2019 20:49:33 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, 14 Feb 2019 09:47:04 +0200 Vlad Buslov wrote: > +static int __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f, > + bool *last, struct netlink_ext_ack *extack) This would be easier to follow (at least for me): > { > struct cls_fl_head *head = fl_head_dereference(tp); > bool async = tcf_exts_get_net(&f->exts); > - bool last; > - > - idr_remove(&head->handle_idr, f->handle); > - list_del_rcu(&f->list); > - last = fl_mask_put(head, f->mask, async); > - if (!tc_skip_hw(f->flags)) > - fl_hw_destroy_filter(tp, f, extack); > - tcf_unbind_filter(tp, &f->res); > - __fl_put(f); > + int err = 0; without this > + > + (*last) = false; with *last = false; > + > + if (!f->deleted) { with: if (f->deleted) return -ENOENT; > + f->deleted = true; > + rhashtable_remove_fast(&f->mask->ht, &f->ht_node, > + f->mask->filter_ht_params); > + idr_remove(&head->handle_idr, f->handle); > + list_del_rcu(&f->list); > + (*last) = fl_mask_put(head, f->mask, async); with: *last = fl_mask_put(head, f->mask, async); > + if (!tc_skip_hw(f->flags)) > + fl_hw_destroy_filter(tp, f, extack); > + tcf_unbind_filter(tp, &f->res); > + __fl_put(f); and a return 0; here > + } else { > + err = -ENOENT; > + } > > - return last; > + return err; > } > > [...] > > @@ -1520,14 +1541,14 @@ static int fl_delete(struct tcf_proto *tp, void *arg, bool *last, > { > struct cls_fl_head *head = fl_head_dereference(tp); > struct cls_fl_filter *f = arg; > + bool last_on_mask; This is unused in this series, maybe change __fl_delete() to optionally take NULL as 'bool *last' argument? > + int err = 0; Nit: no need to initialise this. > - rhashtable_remove_fast(&f->mask->ht, &f->ht_node, > - f->mask->filter_ht_params); > - __fl_delete(tp, f, extack); > + err = __fl_delete(tp, f, &last_on_mask, extack); > *last = list_empty(&head->masks); > __fl_put(f); > > - return 0; > + return err; > } > > static void fl_walk(struct tcf_proto *tp, struct tcf_walker *arg, -- Stefano