netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Duyck <aduyck@mirantis.com>
To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org
Cc: hannes@redhat.com, jesse@kernel.org, jbenc@redhat.com,
	alexander.duyck@gmail.com, saeedm@mellanox.com,
	ariel.elior@qlogic.com, tom@herbertland.com,
	Dept-GELinuxNICDev@qlogic.com, davem@davemloft.net,
	eugenia@mellanox.com
Subject: [net-next PATCH 12/15] qede: Move all UDP port notifiers to single function
Date: Mon, 13 Jun 2016 10:49:37 -0700	[thread overview]
Message-ID: <20160613174937.15186.69027.stgit@localhost.localdomain> (raw)
In-Reply-To: <20160613173750.15186.24381.stgit@localhost.localdomain>

This patch goes through and combines the notifiers for VXLAN and GENEVE
into a single function for each action.  So there is now one combined
function for getting ports, one for adding the ports, and one for deleting
the ports.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
---
 drivers/net/ethernet/qlogic/qede/qede_main.c |  113 ++++++++++++++------------
 1 file changed, 59 insertions(+), 54 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index 423168ba7c98..c5d9e0f15ae9 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -2112,72 +2112,84 @@ int qede_set_features(struct net_device *dev, netdev_features_t features)
 	return 0;
 }
 
-#ifdef CONFIG_QEDE_VXLAN
-static void qede_add_vxlan_port(struct net_device *dev,
-				sa_family_t sa_family, __be16 port)
+#if defined(CONFIG_QEDE_VXLAN) || defined(CONFIG_QEDE_GENEVE)
+static void qede_add_udp_enc_port(struct net_device *dev,
+				  sa_family_t sa_family, __be16 port,
+				  unsigned int type)
 {
 	struct qede_dev *edev = netdev_priv(dev);
 	u16 t_port = ntohs(port);
 
-	if (edev->vxlan_dst_port)
-		return;
+	switch (type) {
+#ifdef CONFIG_QEDE_VXLAN
+	case UDP_ENC_OFFLOAD_TYPE_VXLAN:
+		if (edev->vxlan_dst_port)
+			return;
 
-	edev->vxlan_dst_port = t_port;
+		edev->vxlan_dst_port = t_port;
 
-	DP_VERBOSE(edev, QED_MSG_DEBUG, "Added vxlan port=%d", t_port);
+		DP_VERBOSE(edev, QED_MSG_DEBUG, "Added vxlan port=%d",
+			   t_port);
 
-	set_bit(QEDE_SP_VXLAN_PORT_CONFIG, &edev->sp_flags);
-	schedule_delayed_work(&edev->sp_task, 0);
-}
+		set_bit(QEDE_SP_VXLAN_PORT_CONFIG, &edev->sp_flags);
+		break;
+#endif
+#ifdef CONFIG_QEDE_GENEVE
+	case UDP_ENC_OFFLOAD_TYPE_GENEVE:
+		if (edev->geneve_dst_port)
+			return;
 
-static void qede_del_vxlan_port(struct net_device *dev,
-				sa_family_t sa_family, __be16 port)
-{
-	struct qede_dev *edev = netdev_priv(dev);
-	u16 t_port = ntohs(port);
+		edev->geneve_dst_port = t_port;
 
-	if (t_port != edev->vxlan_dst_port)
+		DP_VERBOSE(edev, QED_MSG_DEBUG, "Added geneve port=%d",
+			   t_port);
+		set_bit(QEDE_SP_GENEVE_PORT_CONFIG, &edev->sp_flags);
+		break;
+#endif
+	default:
 		return;
+	}
 
-	edev->vxlan_dst_port = 0;
-
-	DP_VERBOSE(edev, QED_MSG_DEBUG, "Deleted vxlan port=%d", t_port);
-
-	set_bit(QEDE_SP_VXLAN_PORT_CONFIG, &edev->sp_flags);
 	schedule_delayed_work(&edev->sp_task, 0);
 }
-#endif
 
-#ifdef CONFIG_QEDE_GENEVE
-static void qede_add_geneve_port(struct net_device *dev,
-				 sa_family_t sa_family, __be16 port)
+static void qede_del_udp_enc_port(struct net_device *dev,
+				  sa_family_t sa_family, __be16 port,
+				  unsigned int type)
 {
 	struct qede_dev *edev = netdev_priv(dev);
 	u16 t_port = ntohs(port);
 
-	if (edev->geneve_dst_port)
-		return;
+	switch (type) {
+#ifdef CONFIG_QEDE_VXLAN
+	case UDP_ENC_OFFLOAD_TYPE_VXLAN:
+		if (t_port != edev->vxlan_dst_port)
+			return;
 
-	edev->geneve_dst_port = t_port;
+		edev->vxlan_dst_port = 0;
 
-	DP_VERBOSE(edev, QED_MSG_DEBUG, "Added geneve port=%d", t_port);
-	set_bit(QEDE_SP_GENEVE_PORT_CONFIG, &edev->sp_flags);
-	schedule_delayed_work(&edev->sp_task, 0);
-}
+		DP_VERBOSE(edev, QED_MSG_DEBUG, "Deleted vxlan port=%d",
+			   t_port);
 
-static void qede_del_geneve_port(struct net_device *dev,
-				 sa_family_t sa_family, __be16 port)
-{
-	struct qede_dev *edev = netdev_priv(dev);
-	u16 t_port = ntohs(port);
+		set_bit(QEDE_SP_VXLAN_PORT_CONFIG, &edev->sp_flags);
+		break;
+#endif
+#ifdef CONFIG_QEDE_GENEVE
+	case UDP_ENC_OFFLOAD_TYPE_GENEVE:
+		if (t_port != edev->geneve_dst_port)
+			return;
 
-	if (t_port != edev->geneve_dst_port)
-		return;
+		edev->geneve_dst_port = 0;
 
-	edev->geneve_dst_port = 0;
+		DP_VERBOSE(edev, QED_MSG_DEBUG, "Deleted geneve port=%d",
+			   t_port);
+		set_bit(QEDE_SP_GENEVE_PORT_CONFIG, &edev->sp_flags);
+		break;
+#endif
+	default:
+		return;
+	}
 
-	DP_VERBOSE(edev, QED_MSG_DEBUG, "Deleted geneve port=%d", t_port);
-	set_bit(QEDE_SP_GENEVE_PORT_CONFIG, &edev->sp_flags);
 	schedule_delayed_work(&edev->sp_task, 0);
 }
 #endif
@@ -2204,13 +2216,9 @@ static const struct net_device_ops qede_netdev_ops = {
 	.ndo_get_vf_config = qede_get_vf_config,
 	.ndo_set_vf_rate = qede_set_vf_rate,
 #endif
-#ifdef CONFIG_QEDE_VXLAN
-	.ndo_add_vxlan_port = qede_add_vxlan_port,
-	.ndo_del_vxlan_port = qede_del_vxlan_port,
-#endif
-#ifdef CONFIG_QEDE_GENEVE
-	.ndo_add_geneve_port = qede_add_geneve_port,
-	.ndo_del_geneve_port = qede_del_geneve_port,
+#if defined(CONFIG_QEDE_VXLAN) || defined(CONFIG_QEDE_GENEVE)
+	.ndo_add_udp_enc_port = qede_add_udp_enc_port,
+	.ndo_del_udp_enc_port = qede_del_udp_enc_port,
 #endif
 };
 
@@ -3579,11 +3587,8 @@ static int qede_open(struct net_device *ndev)
 	if (rc)
 		return rc;
 
-#ifdef CONFIG_QEDE_VXLAN
-	vxlan_get_rx_port(ndev);
-#endif
-#ifdef CONFIG_QEDE_GENEVE
-	geneve_get_rx_port(ndev);
+#if defined(CONFIG_QEDE_VXLAN) || defined(CONFIG_QEDE_GENEVE)
+	udp_tunnel_get_rx_port(ndev);
 #endif
 	return 0;
 }

  parent reply	other threads:[~2016-06-13 17:49 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 17:47 [net-next PATCH 00/15] Future-proof tunnel offload handlers Alexander Duyck
2016-06-13 17:47 ` [net-next PATCH 01/15] net: Combine GENEVE and VXLAN port offload notifiers into single functions Alexander Duyck
2016-06-13 19:55   ` Tom Herbert
2016-06-13 20:24     ` Alexander Duyck
2016-06-13 20:36       ` Tom Herbert
2016-06-13 21:51         ` Alexander Duyck
2016-06-13 22:17           ` Tom Herbert
2016-06-13 23:12             ` Alexander Duyck
2016-06-14  0:28               ` Tom Herbert
2016-06-14  2:50                 ` Alexander Duyck
2016-06-15  7:22                   ` David Miller
2016-06-15 16:12                     ` Tom Herbert
2016-06-13 17:48 ` [net-next PATCH 02/15] net: Merge VXLAN and GENEVE push notifiers into a single notifier Alexander Duyck
2016-06-13 17:57   ` Hannes Frederic Sowa
2016-06-13 19:31     ` Tom Herbert
2016-06-13 19:47     ` Alexander Duyck
2016-06-13 21:08       ` Hannes Frederic Sowa
2016-06-13 21:58         ` Alexander Duyck
2016-06-13 20:03   ` [Intel-wired-lan] " kbuild test robot
2016-06-13 17:48 ` [net-next PATCH 03/15] bnx2x: Move all UDP port notifiers to single function Alexander Duyck
2016-06-13 18:48   ` [Intel-wired-lan] " kbuild test robot
2016-06-13 17:48 ` [net-next PATCH 04/15] bnxt: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port Alexander Duyck
2016-06-13 18:41   ` Jesse Gross
2016-06-13 19:14     ` Hannes Frederic Sowa
2016-06-13 19:16       ` Alex Duyck
2016-06-13 19:16     ` Michael Chan
2016-06-13 19:31   ` [Intel-wired-lan] " kbuild test robot
2016-06-13 19:45   ` kbuild test robot
2016-06-13 17:48 ` [net-next PATCH 05/15] benet: " Alexander Duyck
2016-06-13 17:48 ` [net-next PATCH 06/15] fm10k: " Alexander Duyck
2016-06-13 17:48 ` [net-next PATCH 07/15] i40e: Move all UDP port notifiers to single function Alexander Duyck
2016-06-13 17:48 ` [net-next PATCH 08/15] ixgbe: Replace ndo_add/del_vxlan_port with ndo_add/del_udp_enc_port Alexander Duyck
2016-06-13 17:49 ` [net-next PATCH 09/15] mlx4_en: " Alexander Duyck
2016-06-13 17:49 ` [net-next PATCH 10/15] mlx5_en: " Alexander Duyck
2016-06-13 17:49 ` [net-next PATCH 11/15] nfp: " Alexander Duyck
2016-06-13 17:49 ` Alexander Duyck [this message]
2016-06-13 17:49 ` [net-next PATCH 13/15] qlcnic: " Alexander Duyck
2016-06-13 17:49 ` [net-next PATCH 14/15] net: Remove deprecated tunnel specific UDP offload functions Alexander Duyck
2016-06-13 17:50 ` [net-next PATCH 15/15] vxlan: Add new UDP encapsulation offload type for VXLAN-GPE Alexander Duyck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160613174937.15186.69027.stgit@localhost.localdomain \
    --to=aduyck@mirantis.com \
    --cc=Dept-GELinuxNICDev@qlogic.com \
    --cc=alexander.duyck@gmail.com \
    --cc=ariel.elior@qlogic.com \
    --cc=davem@davemloft.net \
    --cc=eugenia@mellanox.com \
    --cc=hannes@redhat.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jbenc@redhat.com \
    --cc=jesse@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    --cc=tom@herbertland.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).