From patchwork Wed Nov 30 10:08:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 700943 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3tTGRt6YFBz9t1C for ; Wed, 30 Nov 2016 21:12:10 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="o2VCTyCI"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933968AbcK3KKG (ORCPT ); Wed, 30 Nov 2016 05:10:06 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33944 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038AbcK3KJL (ORCPT ); Wed, 30 Nov 2016 05:09:11 -0500 Received: by mail-wm0-f68.google.com with SMTP id g23so28647551wme.1 for ; Wed, 30 Nov 2016 02:09:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=URqPnVIKOfGm1AauaG/MptmByA5zIg7FoGK6mYs/ZDI=; b=o2VCTyCIWs2geM1zBlr4KOtHWdNT2z6n6N5Oruw0chhwRB1x/yze91E+4PQti4zbPr pPE/dCfEFhm/WhqvLe8NFbZL2R2KYCgEKpRCcmE98JQlfMSqEeaHukfeTb//oNOzF+4t ZhOGozrKY+nz7RM+jnFtpU7O/WO+GDvgcDEyEf/qDGiBCmaazFSQUWY3DfObo+oTYVm8 W53H8kBdXnr/VUvaeTTo+NZVDYNR3AM1z7/M2DOKu8UfoJwGjWo1qb/Bzah45otPEgX8 oInOtd9VDyv0i6NfO4w3EtwXKP/MMzA6BXYx5Fnjx7AsiaTzPZ1ulqEPsQjcugaZyhUZ 9I9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=URqPnVIKOfGm1AauaG/MptmByA5zIg7FoGK6mYs/ZDI=; b=TL4zMxtdSXJTkx9okjndqOK1a1rW84i6BjZQdfxZz4yBQl4I9C3EcTmM8z9iioqn1m AZXM1hXOSJ1rzNUXc8qCNv8NEqUu1uZ6/puXnf6CsLpZvK0/JsrKZOPJB/Y28g7nnWfp KKZIZ4fde6vOVR2WV6LJtJ20AH54FZP83MTPjbtmyWIO9N7ROXaQ2TPjgiN+CeUtBADC wRn5SojdDr89LefcXS1K7kuXE10bKnLv+HOLdY+i19Yy/NLbTnQ2RY7n/PQd7mqyzwFE TdwyEBGKL8zL2jzMQmCaAtx0vHMdaYNt15wMUTMLL/hbsx0SlR4NF3toahIlKdDFjnwX jJxw== X-Gm-Message-State: AKaTC00WZiN2z5ffUDj3HeUExCECesuNOTmnRcNlL7j0wO9WGsMpDOL6oEk0Mk5wKC91LA== X-Received: by 10.28.228.5 with SMTP id b5mr26565665wmh.129.1480500550383; Wed, 30 Nov 2016 02:09:10 -0800 (PST) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id ba10sm72076236wjb.32.2016.11.30.02.09.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Nov 2016 02:09:09 -0800 (PST) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, idosch@mellanox.com, eladr@mellanox.com, yotamg@mellanox.com, nogahf@mellanox.com, arkadis@mellanox.com, ogerlitz@mellanox.com, roopa@cumulusnetworks.com, dsa@cumulusnetworks.com, nikolay@cumulusnetworks.com, andy@greyhouse.net, vivien.didelot@savoirfairelinux.com, andrew@lunn.ch, f.fainelli@gmail.com, alexander.h.duyck@intel.com, hannes@stressinduktion.org, kaber@trash.net Subject: [patch net-next v3 02/12] ipv4: fib: Add fib_info_hold() helper Date: Wed, 30 Nov 2016 11:08:56 +0100 Message-Id: <1480500546-2544-3-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1480500546-2544-1-git-send-email-jiri@resnulli.us> References: <1480500546-2544-1-git-send-email-jiri@resnulli.us> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel As explained in the previous commit, modules are going to need to take a reference on fib info and then drop it using fib_info_put(). Add the fib_info_hold() helper to make the code more readable and also symmetric with fib_info_put(). Signed-off-by: Ido Schimmel Suggested-by: Jiri Pirko Signed-off-by: Jiri Pirko --- include/net/ip_fib.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index f390c3b..6c67b93 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -397,6 +397,11 @@ static inline void fib_combine_itag(u32 *itag, const struct fib_result *res) void free_fib_info(struct fib_info *fi); +static inline void fib_info_hold(struct fib_info *fi) +{ + atomic_inc(&fi->fib_clntref); +} + static inline void fib_info_put(struct fib_info *fi) { if (atomic_dec_and_test(&fi->fib_clntref))