From patchwork Wed Jun 15 22:08:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 636120 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 3rVLJF2NV0z9t1f for ; Thu, 16 Jun 2016 08:08:45 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mirantis.com header.i=@mirantis.com header.b=OJGpGEou; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933096AbcFOWIm (ORCPT ); Wed, 15 Jun 2016 18:08:42 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:34239 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933061AbcFOWIl (ORCPT ); Wed, 15 Jun 2016 18:08:41 -0400 Received: by mail-pa0-f43.google.com with SMTP id bz2so11246169pad.1 for ; Wed, 15 Jun 2016 15:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mirantis.com; s=google; h=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=yqjTupeqiF/um0p8pyHM4w7M9XwEnFmfHsth5/SUlU8=; b=OJGpGEouwXEtYpty5AH1AdA04+OUmMAdZA5eRBVV2Uq251GXKUMwgvBCd7HxyHtazd SIYjWl4fanAEbcvL/4+ULYegh+t0k+ODy54bS511CsX/hy4SyhVTGeICw/2EKkEZX7Ev NejHiwC/cmn8+ZhTEMBlR7oMYFrX3cH1i9TCY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=yqjTupeqiF/um0p8pyHM4w7M9XwEnFmfHsth5/SUlU8=; b=c6pVyIfKHBcYBYzbennjunTN314CL4dPjH+bVg83b2u1kknO8UnOY243hYpS2ECnzV uHHOPQExdvHr2E/KMWwm20x4a3UDa5ysaswofIylsqrZlrU+H+LFuq8JIbzlFlW42Ult gOZK4pm5hPlupoLbB1y+vGW73lXNrqFnv5fsO3UXo+tMpNCR+zN3J1wLQssRJecDlmbq OLwarGZoFnV1Vj6G3vibSwy8PtXczPlOoXj/xhFAKnZjmNO/r9nshT/bBKDWccnJpErF h2Sr5igjUCDVB0e8vbLR63+H1fyO0/3yJJCgiEqdp6V2SJKSZeTBHjB2W6JhMgxUEgII ImPA== X-Gm-Message-State: ALyK8tIi7uct7XU5HFrohGTEVL5SpVLwJF151CtjhIjUIau03r4qFYmYygOwGaJ9g4ciAXQ/ X-Received: by 10.66.119.40 with SMTP id kr8mr1030948pab.133.1466028520724; Wed, 15 Jun 2016 15:08:40 -0700 (PDT) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id 7sm26010982pfa.28.2016.06.15.15.08.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jun 2016 15:08:40 -0700 (PDT) Subject: [net-next PATCH v2 13/17] nfp: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port From: Alexander Duyck To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Cc: hannes@redhat.com, jesse@kernel.org, eugenia@mellanox.com, jbenc@redhat.com, alexander.duyck@gmail.com, saeedm@mellanox.com, ariel.elior@qlogic.com, tom@herbertland.com, michael.chan@broadcom.com, Dept-GELinuxNICDev@qlogic.com, davem@davemloft.net Date: Wed, 15 Jun 2016 15:08:39 -0700 Message-ID: <20160615220839.15575.8159.stgit@localhost.localdomain> In-Reply-To: <20160615220449.15575.17031.stgit@localhost.localdomain> References: <20160615220449.15575.17031.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This change replaces the network device operations for adding or removing a VXLAN port with operations that are more generically defined to be used for any UDP offload port but provide a type. As such by just adding a line to verify that the offload type is VXLAN we can maintain the same functionality. Signed-off-by: Alexander Duyck --- .../net/ethernet/netronome/nfp/nfp_net_common.c | 22 +++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index fa47c14c743a..2195ed3053da 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c @@ -1979,7 +1979,7 @@ static int __nfp_net_set_config_and_enable(struct nfp_net *nn) if (nn->ctrl & NFP_NET_CFG_CTRL_VXLAN) { memset(&nn->vxlan_ports, 0, sizeof(nn->vxlan_ports)); memset(&nn->vxlan_usecnt, 0, sizeof(nn->vxlan_usecnt)); - vxlan_get_rx_port(nn->netdev); + udp_tunnel_get_rx_info(nn->netdev); } return err; @@ -2551,26 +2551,32 @@ static int nfp_net_find_vxlan_idx(struct nfp_net *nn, __be16 port) } static void nfp_net_add_vxlan_port(struct net_device *netdev, - sa_family_t sa_family, __be16 port) + struct udp_tunnel_info *ti) { struct nfp_net *nn = netdev_priv(netdev); int idx; - idx = nfp_net_find_vxlan_idx(nn, port); + if (ti->type != UDP_TUNNEL_TYPE_VXLAN) + return; + + idx = nfp_net_find_vxlan_idx(nn, ti->port); if (idx == -ENOSPC) return; if (!nn->vxlan_usecnt[idx]++) - nfp_net_set_vxlan_port(nn, idx, port); + nfp_net_set_vxlan_port(nn, idx, ti->port); } static void nfp_net_del_vxlan_port(struct net_device *netdev, - sa_family_t sa_family, __be16 port) + struct udp_tunnel_info *ti) { struct nfp_net *nn = netdev_priv(netdev); int idx; - idx = nfp_net_find_vxlan_idx(nn, port); + if (ti->type != UDP_TUNNEL_TYPE_VXLAN) + return; + + idx = nfp_net_find_vxlan_idx(nn, ti->port); if (!nn->vxlan_usecnt[idx] || idx == -ENOSPC) return; @@ -2589,8 +2595,8 @@ static const struct net_device_ops nfp_net_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, .ndo_set_features = nfp_net_set_features, .ndo_features_check = nfp_net_features_check, - .ndo_add_vxlan_port = nfp_net_add_vxlan_port, - .ndo_del_vxlan_port = nfp_net_del_vxlan_port, + .ndo_udp_tunnel_add = nfp_net_add_vxlan_port, + .ndo_udp_tunnel_del = nfp_net_del_vxlan_port, }; /**