From: Anjali Singhai Jain <anjali.singhai@intel.com>
To: netdev@vger.kernel.org
Cc: Anjali Singhai Jain <anjali.singhai@intel.com>,
jeffrey.t.kirsher@intel.com
Subject: [PATCH v5 4/5] geneve: Add geneve_get_rx_port support
Date: Mon, 14 Dec 2015 12:21:20 -0800 [thread overview]
Message-ID: <1450124481-206978-5-git-send-email-anjali.singhai@intel.com> (raw)
In-Reply-To: <1450124481-206978-1-git-send-email-anjali.singhai@intel.com>
This patch adds an op that the drivers can call into to get existing
geneve ports.
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
---
drivers/net/geneve.c | 24 ++++++++++++++++++++++++
include/net/geneve.h | 8 ++++++++
2 files changed, 32 insertions(+)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 89325e4..31b19fd 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1109,6 +1109,30 @@ static struct device_type geneve_type = {
.name = "geneve",
};
+/* Calls the ndo_add_geneve_port of the caller in order to
+ * supply the listening GENEVE udp ports. Callers are expected
+ * to implement the ndo_add_geneve_port.
+ */
+void geneve_get_rx_port(struct net_device *dev)
+{
+ struct net *net = dev_net(dev);
+ struct geneve_net *gn = net_generic(net, geneve_net_id);
+ struct geneve_sock *gs;
+ sa_family_t sa_family;
+ struct sock *sk;
+ __be16 port;
+
+ rcu_read_lock();
+ list_for_each_entry_rcu(gs, &gn->sock_list, list) {
+ sk = gs->sock->sk;
+ sa_family = sk->sk_family;
+ port = inet_sk(sk)->inet_sport;
+ dev->netdev_ops->ndo_add_geneve_port(dev, sa_family, port);
+ }
+ rcu_read_unlock();
+}
+EXPORT_SYMBOL_GPL(geneve_get_rx_port);
+
/* Initialize the device structure. */
static void geneve_setup(struct net_device *dev)
{
diff --git a/include/net/geneve.h b/include/net/geneve.h
index 3106ed6..e6c23dc 100644
--- a/include/net/geneve.h
+++ b/include/net/geneve.h
@@ -62,6 +62,14 @@ struct genevehdr {
struct geneve_opt options[];
};
+#if IS_ENABLED(CONFIG_GENEVE)
+void geneve_get_rx_port(struct net_device *netdev);
+#else
+static inline void geneve_get_rx_port(struct net_device *netdev)
+{
+}
+#endif
+
#ifdef CONFIG_INET
struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
u8 name_assign_type, u16 dst_port);
--
1.8.1.4
next prev parent reply other threads:[~2015-12-14 20:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-14 20:21 [PATCH v5 0/5] Add support for Geneve udp port offload Anjali Singhai Jain
2015-12-14 20:21 ` [PATCH v5 1/5] geneve: Add geneve udp port offload for ethernet devices Anjali Singhai Jain
2015-12-14 20:21 ` [PATCH v5 2/5] i40e: geneve tunnel offload support Anjali Singhai Jain
2015-12-14 20:21 ` [PATCH v5 3/5] i40e: Kernel dependency update for i40e to support geneve offload Anjali Singhai Jain
2015-12-14 20:21 ` Anjali Singhai Jain [this message]
2015-12-14 20:21 ` [PATCH v5 5/5] i40e: Call geneve_get_rx_port to get the existing Geneve ports Anjali Singhai Jain
2015-12-16 15:59 ` [PATCH v5 0/5] Add support for Geneve udp port offload David Miller
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=1450124481-206978-5-git-send-email-anjali.singhai@intel.com \
--to=anjali.singhai@intel.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=netdev@vger.kernel.org \
/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).