From patchwork Wed Jun 13 04:26:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roopa Prabhu X-Patchwork-Id: 928655 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=cumulusnetworks.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=cumulusnetworks.com header.i=@cumulusnetworks.com header.b="Almk757k"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 415DHC4rDFz9s3C for ; Wed, 13 Jun 2018 14:27:03 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754364AbeFME0Q (ORCPT ); Wed, 13 Jun 2018 00:26:16 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:43607 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754244AbeFME0P (ORCPT ); Wed, 13 Jun 2018 00:26:15 -0400 Received: by mail-pl0-f68.google.com with SMTP id c41-v6so737770plj.10 for ; Tue, 12 Jun 2018 21:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cumulusnetworks.com; s=google; h=from:to:cc:subject:date:message-id; bh=aPmuQR5SobcsuMdMR4oxjDPxin9cE7YBocYh4cfkang=; b=Almk757kcHpO+HYbssM5AurHD9UZOCzo7uygc+DLVWhjAHexctgL40H/5Ol5ctopmF XouM+DcBJQNUwinsu43IiMecGolUJgJEaE9WCoNFNsLAVNncxgEyyN43GlvLgNRpMDyo EBchdMiNyQxhvfDQOfKq5/7Z3hDEwW4MoTKQk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aPmuQR5SobcsuMdMR4oxjDPxin9cE7YBocYh4cfkang=; b=TCYCBDvAAihjuHo/+RWEgBI0mrqVYrBbLhHG0fsbVJYaIJlmOnRwcigcaUtD8T/yGx HmDex2MxbQ3ue3ULBPnmaV9hyW8Wt/7M154sV3qRGMpTsgQwUWK3ESPn0cnzTUkSs2DE s+Qij7NVwm1heR5ddTN91CvEydGpfmsHLHOkLvncE8ikUhCeKIvXdLV26QcD2AW1/D59 sWJlTc3BIg7MPHFjqMSHwsHrbOylGFxy124KJGpJ/EXmz+esLpDGawanYKRFLb+RTx9H 4LMh9QmScuj4+O66qF/a6HHVouEeBvQtllVOloUGhOJ7t6wqJ4qAJ/Mzqr0mgKfrmuNm d03Q== X-Gm-Message-State: APt69E0uRdtsmLS7hMFtAoJWMNdtL6y/04zox90zjzccDeIRwpC5INBi x2hWP/UIm/x5vvTylz/y9n++/eGT X-Google-Smtp-Source: ADUXVKLq4T/SwNT+Yq7P90+vPgUDBXwryNUXMyUjlUxHd+r1ZgsJBOgWRb7ZulSq0QJsAL2bdQOh5g== X-Received: by 2002:a17:902:16a:: with SMTP id 97-v6mr3374011plb.336.1528863975195; Tue, 12 Jun 2018 21:26:15 -0700 (PDT) Received: from monster-08.mvlab.cumulusnetworks.com. (fw.cumulusnetworks.com. [216.129.126.126]) by smtp.googlemail.com with ESMTPSA id i67-v6sm1596995pgc.77.2018.06.12.21.26.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Jun 2018 21:26:14 -0700 (PDT) From: Roopa Prabhu X-Google-Original-From: Roopa Prabhu To: davem@davemloft.net Cc: netdev@vger.kernel.org Subject: [PATCH net] neighbour: skip NTF_EXT_LEARNED entries during forced gc Date: Tue, 12 Jun 2018 21:26:10 -0700 Message-Id: <1528863970-15799-1-git-send-email-roopa@cumulusnetworks.com> X-Mailer: git-send-email 2.1.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Roopa Prabhu Commit 9ce33e46531d ("neighbour: support for NTF_EXT_LEARNED flag") added support for NTF_EXT_LEARNED for neighbour entries. NTF_EXT_LEARNED entries are neigh entries managed by control plane (eg: Ethernet VPN implementation in FRR routing suite). Periodic gc already excludes these entries. This patch extends it to forced gc which the earlier patch missed. Fixes: 9ce33e46531d ("neighbour: support for NTF_EXT_LEARNED flag") Signed-off-by: Roopa Prabhu --- net/core/neighbour.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/core/neighbour.c b/net/core/neighbour.c index a7a9c3d..8e3fda9 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -119,13 +119,14 @@ unsigned long neigh_rand_reach_time(unsigned long base) EXPORT_SYMBOL(neigh_rand_reach_time); -static bool neigh_del(struct neighbour *n, __u8 state, +static bool neigh_del(struct neighbour *n, __u8 state, __u8 flags, struct neighbour __rcu **np, struct neigh_table *tbl) { bool retval = false; write_lock(&n->lock); - if (refcount_read(&n->refcnt) == 1 && !(n->nud_state & state)) { + if (refcount_read(&n->refcnt) == 1 && !(n->nud_state & state) && + !(n->flags & flags)) { struct neighbour *neigh; neigh = rcu_dereference_protected(n->next, @@ -157,7 +158,7 @@ bool neigh_remove_one(struct neighbour *ndel, struct neigh_table *tbl) while ((n = rcu_dereference_protected(*np, lockdep_is_held(&tbl->lock)))) { if (n == ndel) - return neigh_del(n, 0, np, tbl); + return neigh_del(n, 0, 0, np, tbl); np = &n->next; } return false; @@ -185,7 +186,8 @@ static int neigh_forced_gc(struct neigh_table *tbl) * - nobody refers to it. * - it is not permanent */ - if (neigh_del(n, NUD_PERMANENT, np, tbl)) { + if (neigh_del(n, NUD_PERMANENT, NTF_EXT_LEARNED, np, + tbl)) { shrunk = 1; continue; }