From patchwork Thu Apr 25 11:03:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 239492 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 C35732C00BF for ; Thu, 25 Apr 2013 21:04:17 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757968Ab3DYLEN (ORCPT ); Thu, 25 Apr 2013 07:04:13 -0400 Received: from na3sys010aog107.obsmtp.com ([74.125.245.82]:52871 "HELO na3sys010aog107.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1757916Ab3DYLEL (ORCPT ); Thu, 25 Apr 2013 07:04:11 -0400 Received: from mail-wi0-f200.google.com ([209.85.212.200]) (using TLSv1) by na3sys010aob107.postini.com ([74.125.244.12]) with SMTP ID DSNKUXkNqnaOfQQw442TRC/RaUoREzKQT+Kq@postini.com; Thu, 25 Apr 2013 04:04:11 PDT Received: by mail-wi0-f200.google.com with SMTP id m6so3888494wiv.3 for ; Thu, 25 Apr 2013 04:04:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=jOS1LjMhf8eSsOjI8uOkclhKmkp32FiHSVpPMhm5Jlc=; b=hMvigKLsnoHWsGu0vtE4cphx+sJykchzdcOOLStbBl5ITU8dbztBFQYXF92C2SNi3/ VfQ4dTJTv8jXSHQ2XAwkaTLsnufXz+wA6pH3ZvPGPKfr64g1YRkeN689ZEIRAmo6Le27 2WwJvJMrpX6JI9oTGr751j2v33VqXQBfL4UqXq/848hkn8HHaT2jYHxyQAAqT1dJZfoK JaHmvwigRFW3IY/e+v7niWrmrCJNxLWtoMc+/Zbwt34DNyefaGJaoThAC+JYBuuSZ3x6 1LcAe7jStIZQ2KGLrpjs+3uMsP3fLMeD0jzSyQ8c94SxEXSYNPiBlGUJQhct9AGc9LNf QoiA== X-Received: by 10.180.72.228 with SMTP id g4mr87915895wiv.22.1366887849734; Thu, 25 Apr 2013 04:04:09 -0700 (PDT) X-Received: by 10.180.72.228 with SMTP id g4mr87915548wiv.22.1366887846832; Thu, 25 Apr 2013 04:04:06 -0700 (PDT) Received: from mike.rapoport@ravellosystems.com (93-172-42-194.bb.netvision.net.il. [93.172.42.194]) by mx.google.com with ESMTPSA id o3sm10098343wia.2.2013.04.25.04.04.04 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 04:04:06 -0700 (PDT) Received: by mike.rapoport@ravellosystems.com (sSMTP sendmail emulation); Thu, 25 Apr 2013 14:04:02 +0300 From: Mike Rapoport To: netdev@vger.kernel.org Cc: Mike Rapoport Subject: [PATCH net-next 1/2] vxlan: introduce vxlan_rdst_append Date: Thu, 25 Apr 2013 14:03:48 +0300 Message-Id: <1366887829-3950-2-git-send-email-mike.rapoport@ravellosystems.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1366887829-3950-1-git-send-email-mike.rapoport@ravellosystems.com> References: <1366887829-3950-1-git-send-email-mike.rapoport@ravellosystems.com> X-Gm-Message-State: ALoCoQlcSfcEc8gRjqOcZqZQ+wMx/pc7qFXZfaLngce39HF21W+GCN0OwiFd/mGKzwOMC5sBQQBkgKwKN7yKO1U72AZXS5jCS2ojYwAl6V+TbQendzw88aQ1YZ+5M5IR6Qm4vRyfYCD6SG010itguSVslgX8MGiAdBKAhYrijGLMXLthRMJSyXw= Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org to allow remotes list management for both FDB entries and default destinations Signed-off-by: Mike Rapoport --- drivers/net/vxlan.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index be42e00..8963a83 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -387,14 +387,13 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan, return NULL; } -/* Add/update destinations for multicast */ -static int vxlan_fdb_append(struct vxlan_fdb *f, union vxlan_addr *ip, - __u32 port, __u32 vni, __u32 ifindex) +static int vxlan_rdst_append(struct vxlan_rdst *rdst, union vxlan_addr *ip, + __u32 port, __u32 vni, __u32 ifindex) { struct vxlan_rdst *rd_prev, *rd; rd_prev = NULL; - for (rd = &f->remote; rd; rd = rd->remote_next) { + for (rd = rdst; rd; rd = rd->remote_next) { if (vxlan_addr_equal(&rd->remote_ip, ip) && rd->remote_port == port && rd->remote_vni == vni && @@ -414,6 +413,13 @@ static int vxlan_fdb_append(struct vxlan_fdb *f, union vxlan_addr *ip, return 1; } +/* Add/update destinations for multicast */ +static int vxlan_fdb_append(struct vxlan_fdb *f, union vxlan_addr *ip, + __u32 port, __u32 vni, __u32 ifindex) +{ + return vxlan_rdst_append(&f->remote, ip, port, vni, ifindex); +} + /* Add new entry to forwarding table -- assumes lock held */ static int vxlan_fdb_create(struct vxlan_dev *vxlan, const u8 *mac, union vxlan_addr *ip,