Netdev List
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Saeed Mahameed <saeedm@mellanox.com>,
	Walter Harms <wharms@bfs.de>, Mark Bloch <markb@mellanox.com>,
	Vlad Buslov <vladbu@mellanox.com>
Subject: [net-next 03/14] net/mlx5e: Use ipv6_stub to avoid dependency with ipv6 being a module
Date: Thu, 5 Sep 2019 21:50:58 +0000	[thread overview]
Message-ID: <20190905215034.22713-4-saeedm@mellanox.com> (raw)
In-Reply-To: <20190905215034.22713-1-saeedm@mellanox.com>

mlx5 is dependent on IPv6 tristate since we use ipv6's nd_tbl directly,
alternatively we can use ipv6_stub->nd_tbl and remove the dependency.

Reported-by: Walter Harms <wharms@bfs.de>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Reviewed-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../net/ethernet/mellanox/mlx5/core/Kconfig   |  1 -
 .../net/ethernet/mellanox/mlx5/core/en_rep.c  | 23 +++++++++++--------
 .../net/ethernet/mellanox/mlx5/core/en_tc.c   |  2 +-
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
index a496f2ac20b0..0dba272a5b2f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
@@ -33,7 +33,6 @@ config MLX5_FPGA
 config MLX5_CORE_EN
 	bool "Mellanox 5th generation network adapters (ConnectX series) Ethernet support"
 	depends on NETDEVICES && ETHERNET && INET && PCI && MLX5_CORE
-	depends on IPV6=y || IPV6=n || MLX5_CORE=m
 	select PAGE_POOL
 	select DIMLIB
 	default n
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 1623cd32f303..95892a3b63a1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -38,6 +38,7 @@
 #include <net/netevent.h>
 #include <net/arp.h>
 #include <net/devlink.h>
+#include <net/ipv6_stubs.h>
 
 #include "eswitch.h"
 #include "en.h"
@@ -499,16 +500,18 @@ void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv)
 	mlx5e_sqs2vport_stop(esw, rep);
 }
 
+static unsigned long mlx5e_rep_ipv6_interval(void)
+{
+	if (IS_ENABLED(CONFIG_IPV6) && ipv6_stub->nd_tbl)
+		return NEIGH_VAR(&ipv6_stub->nd_tbl->parms, DELAY_PROBE_TIME);
+
+	return ~0UL;
+}
+
 static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv)
 {
-#if IS_ENABLED(CONFIG_IPV6)
-	unsigned long ipv6_interval = NEIGH_VAR(&nd_tbl.parms,
-						DELAY_PROBE_TIME);
-#else
-	unsigned long ipv6_interval = ~0UL;
-#endif
-	unsigned long ipv4_interval = NEIGH_VAR(&arp_tbl.parms,
-						DELAY_PROBE_TIME);
+	unsigned long ipv4_interval = NEIGH_VAR(&arp_tbl.parms, DELAY_PROBE_TIME);
+	unsigned long ipv6_interval = mlx5e_rep_ipv6_interval();
 	struct net_device *netdev = rpriv->netdev;
 	struct mlx5e_priv *priv = netdev_priv(netdev);
 
@@ -917,7 +920,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
 	case NETEVENT_NEIGH_UPDATE:
 		n = ptr;
 #if IS_ENABLED(CONFIG_IPV6)
-		if (n->tbl != &nd_tbl && n->tbl != &arp_tbl)
+		if (n->tbl != ipv6_stub->nd_tbl && n->tbl != &arp_tbl)
 #else
 		if (n->tbl != &arp_tbl)
 #endif
@@ -944,7 +947,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
 		 * done per device delay prob time parameter.
 		 */
 #if IS_ENABLED(CONFIG_IPV6)
-		if (!p->dev || (p->tbl != &nd_tbl && p->tbl != &arp_tbl))
+		if (!p->dev || (p->tbl != ipv6_stub->nd_tbl && p->tbl != &arp_tbl))
 #else
 		if (!p->dev || p->tbl != &arp_tbl)
 #endif
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 30d26eba75a3..98d1f7a48304 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1492,7 +1492,7 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
 		tbl = &arp_tbl;
 #if IS_ENABLED(CONFIG_IPV6)
 	else if (m_neigh->family == AF_INET6)
-		tbl = &nd_tbl;
+		tbl = ipv6_stub->nd_tbl;
 #endif
 	else
 		return;
-- 
2.21.0


  parent reply	other threads:[~2019-09-05 21:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05 21:50 [pull request][net-next 00/14] Mellanox, mlx5 cleanups & port congestion stats Saeed Mahameed
2019-09-05 21:50 ` [net-next 01/14] net/mlx5e: Fix static checker warning of potential pointer math issue Saeed Mahameed
2019-09-05 21:50 ` [net-next 02/14] net/mlx5: Kconfig: Fix MLX5_CORE dependency with PCI_HYPERV_INTERFACE Saeed Mahameed
2019-09-05 21:50 ` Saeed Mahameed [this message]
2019-09-05 21:51 ` [net-next 04/14] net/mlx5e: Remove leftover declaration Saeed Mahameed
2019-09-05 21:51 ` [net-next 05/14] net/mlx5: fix spelling mistake "offlaods" -> "offloads" Saeed Mahameed
2019-09-05 21:51 ` [net-next 06/14] net/mlx5: fix missing assignment of variable err Saeed Mahameed
2019-09-05 21:51 ` [net-next 07/14] net/mlx5: Use PTR_ERR_OR_ZERO rather than its implementation Saeed Mahameed
2019-09-05 21:51 ` [net-next 08/14] net/mlx5e: kTLS, Remove unused function parameter Saeed Mahameed
2019-09-05 21:51 ` [net-next 09/14] net/mlx5e: Remove unnecessary clear_bit()s Saeed Mahameed
2019-09-05 21:51 ` [net-next 10/14] net/mlx5: DR, Remove useless set memory to zero use memset() Saeed Mahameed
2019-09-05 21:51 ` [net-next 11/14] net/mlx5: DR, Fix error return code in dr_domain_init_resources() Saeed Mahameed
2019-09-05 21:51 ` [net-next 12/14] net/mlx5: DR, Remove redundant dev_name print from err log Saeed Mahameed
2019-09-05 21:51 ` [net-next 13/14] net/mlx5: Expose HW capability bits for port buffer per priority congestion counters Saeed Mahameed
2019-09-05 21:51 ` [net-next 14/14] net/mlx5e: Add port buffer's " Saeed Mahameed
2019-09-07 15:40 ` [pull request][net-next 00/14] Mellanox, mlx5 cleanups & port congestion stats 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=20190905215034.22713-4-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=markb@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=vladbu@mellanox.com \
    --cc=wharms@bfs.de \
    /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