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=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,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 A3993C10F11 for ; Wed, 10 Apr 2019 15:48:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C09620830 for ; Wed, 10 Apr 2019 15:48:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b="1izQ0uHb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387443AbfDJPsg (ORCPT ); Wed, 10 Apr 2019 11:48:36 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:32903 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727042AbfDJPsg (ORCPT ); Wed, 10 Apr 2019 11:48:36 -0400 Received: by mail-qt1-f195.google.com with SMTP id k14so3470172qtb.0 for ; Wed, 10 Apr 2019 08:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=JJoL+KHFvaMjm3BLwfYVAPKCIfGRWAGOsOb42DdTfwg=; b=1izQ0uHbOBcj8bHTrpkcp+BNDbfzvycRNwoJ9haojZFwTqpsdNxsHhwU8MlwwE+W3s 0LbFht6DYgvI5/6pJX+8uAj000TNLLs6tWZQlGkXF6vlGKoTivlIa9o6Qhf4cE9H5koY fPMKGC6MbJmja9Qvh6jfugrpXHgIfNGTA6vN5qK8pRbctZ0qrAjFxNwOyEVq9xcz8ycn ya3n1OJiCLGSjvxoK5bnEolX/ddkHZMFqH2hc/WxwDGymGXZOhsSjehuoy+5gIoyLqP0 gh6T+z6xyjnBMDgFncq+lMB4JB9CS4Rqz+aB7kN4YogGv0JhBv0fLppJ49QmMbCTyXOi 8JpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=JJoL+KHFvaMjm3BLwfYVAPKCIfGRWAGOsOb42DdTfwg=; b=keXMoToAUUNDDa4/bnOwc/yZKfLP9GhETkfNZ1rpKG9E29ooJu1IfiHTh4zj3uXAuT D5n2oU0lVIk2kpWQB8fXBIfg/Z3N9vNPcUhYRzo64DExIMbOAn3wN9VG7nlPAo6B+4CL zijmZTotuEMvpFCuwHjll/8hWWk+cEDgGMBZVisyGFVOaGrXHbui5bIOjfYhDCRJTjM/ mabvCPjHsO2EFDX9WDOawfPWeb9FEOgbNaBVrmceVnTHpuIo+KbHR0c9k4NOzqqkauVg 64ZlFSER0Pqz0PaCJtxPXlJ1XG1rTXrQxH/nLfXXo7eLricpJg0ZxS4DQ88X1Zu3uNaH +bIA== X-Gm-Message-State: APjAAAXLqezTDiPew83qGWo6FD/HBe054ZkgiSjJ2S8CqCISTcAM568A uOFz5rGw/wh6mrBB74fIn08DbObZh2Y= X-Google-Smtp-Source: APXvYqwcO7WDyFYhamNeog1OQpmv+wa23KNoIrWvEGwWhsEF5QzBsJ3KPCCFD5ionPQXbE8MFiEHRA== X-Received: by 2002:ac8:45d4:: with SMTP id e20mr35510526qto.72.1554911315229; Wed, 10 Apr 2019 08:48:35 -0700 (PDT) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id x8sm23277647qtj.45.2019.04.10.08.48.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Apr 2019 08:48:35 -0700 (PDT) Date: Wed, 10 Apr 2019 08:48:30 -0700 From: Jakub Kicinski To: Vlad Buslov Cc: "netdev@vger.kernel.org" , "jhs@mojatatu.com" , "xiyou.wangcong@gmail.com" , "jiri@resnulli.us" , "davem@davemloft.net" , "john.hurley@netronome.com" Subject: Re: [PATCH net-next] net: sched: flower: insert filter to ht before offloading it to hw Message-ID: <20190410084830.378b37fa@cakuba.netronome.com> In-Reply-To: References: <20190405175626.4123-1-vladbu@mellanox.com> <20190408152655.1891ee77@cakuba.netronome.com> <20190409101023.4fe0ad04@cakuba.netronome.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 10 Apr 2019 14:53:53 +0000, Vlad Buslov wrote: > >> For my next patch set that unlocks the offloads API I implemented the > >> algorithm to track reoffload count for each tp that works like this: > >> > >> 1. struct tcf_proto is extended with reoffload_count counter that > >> incremented each time reoffload is called on particular tp instance. > >> Counter is protected by tp->lock. > >> > >> 2. struct cls_fl_filter is also extended with reoffload_count counter. > >> Its value is set to current tp->reoffload_count when offloading the > >> filter. > >> > >> 3. After offloading the filter, but before inserting it to idr, > >> f->reoffload_count is compared with tp->reoffload_count. If values > >> don't match, filter is deleted and -EAGAIN is returned. Cls API > >> retries filter insertion on -EAGAIN. > > > > Sounds good for add. Does this solve delete case as well? > > > > CPU 0 CPU 1 > > > > __fl_delete > > IDR remove > > cb unregister > > hw delete all flows <- doesn't see the > > remove in progress > > > > hw delete <- doesn't see > > the removed cb > > Thanks for pointing that out! Looks like I need to move call to hw > delete in __fl_delete() function to be executed before idr removal. Ack, plus you need to do the same retry mechanism. Save CB "count"/seq, hw delete, remove from IDR, if CB "count"/seq changed hw delete again. Right?