All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig
@ 2014-08-12 21:54 Anish Bhatt
  2014-08-12 22:00 ` David Miller
  2014-08-12 22:22 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Anish Bhatt @ 2014-08-12 21:54 UTC (permalink / raw)
  To: netdev; +Cc: davem, hch, kxie, manojmalviya, jim.epost, sfr, Anish Bhatt

Previous guard of IS_ENABLED(CONFIG_IPV6) is not sufficient when cxgbi drivers
are built into kernel but ipv6 is not. Change guard to only enable when either
ipv6 is built-in or both are modules.

Fixes: e81fbf6cd652 ("libcxgbi:cxgb4i Guard ipv6 code with a config check")
Fixes: fc8d0590d914 ("libcxgbi: Add ipv6 api to driver")
Signed-off-by: Anish Bhatt <anish@chelsio.com>
---
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 13 +++++++------
 drivers/scsi/cxgbi/libcxgbi.c      |  9 ++++++---
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 79788a12712d..b5eb7c5f4529 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -1289,7 +1289,7 @@ static int init_act_open(struct cxgbi_sock *csk)
 
 	if (csk->csk_family == AF_INET)
 		daddr = &csk->daddr.sin_addr.s_addr;
-#if IS_ENABLED(CONFIG_IPV6)
+#if defined(CONFIG_IPV6) || (defined(CONFIG_IPV6_MODULE) && defined(MODULE))
 	else if (csk->csk_family == AF_INET6)
 		daddr = &csk->daddr6.sin6_addr;
 #endif
@@ -1635,7 +1635,7 @@ static int cxgb4i_ddp_init(struct cxgbi_device *cdev)
 	return 0;
 }
 
-#if IS_ENABLED(CONFIG_IPV6)
+#if defined(CONFIG_IPV6) || (defined(CONFIG_IPV6_MODULE) && defined(MODULE))
 static int cxgbi_inet6addr_handler(struct notifier_block *this,
 				   unsigned long event, void *data)
 {
@@ -1756,7 +1756,8 @@ static void cxgbi_update_clip(struct cxgbi_device *cdev)
 	}
 	rcu_read_unlock();
 }
-#endif /* IS_ENABLED(CONFIG_IPV6) */
+#endif /* defined(CONFIG_IPV6) ||
+ (defined(CONFIG_IPV6_MODULE) && defined(MODULE)) */
 
 static void *t4_uld_add(const struct cxgb4_lld_info *lldi)
 {
@@ -1876,7 +1877,7 @@ static int t4_uld_state_change(void *handle, enum cxgb4_state state)
 	switch (state) {
 	case CXGB4_STATE_UP:
 		pr_info("cdev 0x%p, UP.\n", cdev);
-#if IS_ENABLED(CONFIG_IPV6)
+#if defined(CONFIG_IPV6) || (defined(CONFIG_IPV6_MODULE) && defined(MODULE))
 		cxgbi_update_clip(cdev);
 #endif
 		/* re-initialize */
@@ -1910,7 +1911,7 @@ static int __init cxgb4i_init_module(void)
 		return rc;
 	cxgb4_register_uld(CXGB4_ULD_ISCSI, &cxgb4i_uld_info);
 
-#if IS_ENABLED(CONFIG_IPV6)
+#if defined(CONFIG_IPV6) || (defined(CONFIG_IPV6_MODULE) && defined(MODULE))
 	register_inet6addr_notifier(&cxgbi_inet6addr_notifier);
 #endif
 	return 0;
@@ -1918,7 +1919,7 @@ static int __init cxgb4i_init_module(void)
 
 static void __exit cxgb4i_exit_module(void)
 {
-#if IS_ENABLED(CONFIG_IPV6)
+#if defined(CONFIG_IPV6) || (defined(CONFIG_IPV6_MODULE) && defined(MODULE))
 	unregister_inet6addr_notifier(&cxgbi_inet6addr_notifier);
 #endif
 	cxgb4_unregister_uld(CXGB4_ULD_ISCSI);
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index d65df6dc106f..6e56c40040c2 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -560,6 +560,8 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
 	}
 
 	cdev = cxgbi_device_find_by_netdev(ndev, &port);
+	if (!cdev)
+		cdev = cxgbi_device_find_by_mac(ndev, &port);
 	if (!cdev) {
 		pr_info("dst %pI4, %s, NOT cxgbi device.\n",
 			&daddr->sin_addr.s_addr, ndev->name);
@@ -602,7 +604,7 @@ err_out:
 	return ERR_PTR(err);
 }
 
-#if IS_ENABLED(CONFIG_IPV6)
+#if defined(CONFIG_IPV6) || (defined(CONFIG_IPV6_MODULE) && defined(MODULE))
 static struct rt6_info *find_route_ipv6(const struct in6_addr *saddr,
 					const struct in6_addr *daddr)
 {
@@ -717,7 +719,8 @@ rel_rt:
 err_out:
 	return ERR_PTR(err);
 }
-#endif /* IS_ENABLED(CONFIG_IPV6) */
+#endif /* defined(CONFIG_IPV6) ||
+ (defined(CONFIG_IPV6_MODULE) && defined(MODULE)) */
 
 void cxgbi_sock_established(struct cxgbi_sock *csk, unsigned int snd_isn,
 			unsigned int opt)
@@ -2640,7 +2643,7 @@ struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *shost,
 
 	if (dst_addr->sa_family == AF_INET) {
 		csk = cxgbi_check_route(dst_addr);
-#if IS_ENABLED(CONFIG_IPV6)
+#if defined(CONFIG_IPV6) || (defined(CONFIG_IPV6_MODULE) && defined(MODULE))
 	} else if (dst_addr->sa_family == AF_INET6) {
 		csk = cxgbi_check_route6(dst_addr);
 #endif
-- 
2.0.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig
  2014-08-12 21:54 [PATCH net-next] libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig Anish Bhatt
@ 2014-08-12 22:00 ` David Miller
  2014-08-12 22:22 ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2014-08-12 22:00 UTC (permalink / raw)
  To: anish; +Cc: netdev, hch, kxie, manojmalviya, jim.epost, sfr

From: Anish Bhatt <anish@chelsio.com>
Date: Tue, 12 Aug 2014 14:54:41 -0700

> Previous guard of IS_ENABLED(CONFIG_IPV6) is not sufficient when cxgbi drivers
> are built into kernel but ipv6 is not. Change guard to only enable when either
> ipv6 is built-in or both are modules.
> 
> Fixes: e81fbf6cd652 ("libcxgbi:cxgb4i Guard ipv6 code with a config check")
> Fixes: fc8d0590d914 ("libcxgbi: Add ipv6 api to driver")
> Signed-off-by: Anish Bhatt <anish@chelsio.com>

Why are you targetting a serious fix at the net-next tree?

'net-next' is for new features and cleanups, whereas 'net' is for
bug fixes.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig
  2014-08-12 21:54 [PATCH net-next] libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig Anish Bhatt
  2014-08-12 22:00 ` David Miller
@ 2014-08-12 22:22 ` David Miller
  2014-08-12 22:40   ` Anish Bhatt
  1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2014-08-12 22:22 UTC (permalink / raw)
  To: anish; +Cc: netdev, hch, kxie, manojmalviya, jim.epost, sfr

From: Anish Bhatt <anish@chelsio.com>
Date: Tue, 12 Aug 2014 14:54:41 -0700

> Previous guard of IS_ENABLED(CONFIG_IPV6) is not sufficient when cxgbi drivers
> are built into kernel but ipv6 is not. Change guard to only enable when either
> ipv6 is built-in or both are modules.
> 
> Fixes: e81fbf6cd652 ("libcxgbi:cxgb4i Guard ipv6 code with a config check")
> Fixes: fc8d0590d914 ("libcxgbi: Add ipv6 api to driver")
> Signed-off-by: Anish Bhatt <anish@chelsio.com>

That's not how you fix problems like this.

Instead, you should use Kconfig conditions to make sure your driver is
enabled in a manner which is compatible with what IPV6 has been set to.

No user should have to know about these strange dependencies just to get
IPV6 enabled in your driver.

Really, your change makes IPV6 get disabled if IPV6 is modular and your
driver is built statically.  I do not think any user would consider that
reasonable behavior.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH net-next] libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig
  2014-08-12 22:22 ` David Miller
@ 2014-08-12 22:40   ` Anish Bhatt
  2014-08-12 22:46     ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Anish Bhatt @ 2014-08-12 22:40 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, hch, Karen Xie, Manoj Malviya, jim.epost, sfr

So the recommended fix would be that the inbuilt option for cxgbi should be
disabled if ipv6 is compiled as a module ?

This patch was based on code currently in net-next, and I presumed that would
be the correct way to go. I'll change it and rebase to net.
-Anish
________________________________________
From: David Miller [davem@davemloft.net]
Sent: Tuesday, August 12, 2014 3:22 PM
To: Anish Bhatt
Cc: netdev@vger.kernel.org; hch@infradead.org; Karen Xie; Manoj Malviya; jim.epost@gmail.com; sfr@canb.auug.org.au
Subject: Re: [PATCH net-next] libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig

From: Anish Bhatt <anish@chelsio.com>
Date: Tue, 12 Aug 2014 14:54:41 -0700

> Previous guard of IS_ENABLED(CONFIG_IPV6) is not sufficient when cxgbi drivers
> are built into kernel but ipv6 is not. Change guard to only enable when either
> ipv6 is built-in or both are modules.
>
> Fixes: e81fbf6cd652 ("libcxgbi:cxgb4i Guard ipv6 code with a config check")
> Fixes: fc8d0590d914 ("libcxgbi: Add ipv6 api to driver")
> Signed-off-by: Anish Bhatt <anish@chelsio.com>

That's not how you fix problems like this.

Instead, you should use Kconfig conditions to make sure your driver is
enabled in a manner which is compatible with what IPV6 has been set to.

No user should have to know about these strange dependencies just to get
IPV6 enabled in your driver.

Really, your change makes IPV6 get disabled if IPV6 is modular and your
driver is built statically.  I do not think any user would consider that
reasonable behavior.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig
  2014-08-12 22:40   ` Anish Bhatt
@ 2014-08-12 22:46     ` David Miller
  2014-08-12 22:54       ` Anish Bhatt
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2014-08-12 22:46 UTC (permalink / raw)
  To: anish; +Cc: netdev, hch, kxie, manojmalviya, jim.epost, sfr

From: Anish Bhatt <anish@chelsio.com>
Date: Tue, 12 Aug 2014 22:40:35 +0000

> So the recommended fix would be that the inbuilt option for cxgbi
> should be disabled if ipv6 is compiled as a module ?

If IPV6 is enabled, you should only allow cxgbi to be enabled in
a mode which is "compatible" with that setting.

This means if IPV6 is enabled statically, cxgbi should be offered
both statically and modular.  Whereas if IPV6 is modular, cxgbi
should only be offered to be enabled modular.

This occurs often enough that there is a common pattern for this
kind of dependency:

	depends on IPV6 || IPV6=n

Alternatively, depending upon what IPV6 interfaces you need to use
in the cxgbi driver, you can potentially move them into the ipv6
components we've split out to always be statically built into the
kernel in order to avoid problems of this nature.  See the code
linked in by the "obj-y +=" rule in net/ipv6/Makefile.

> This patch was based on code currently in net-next, and I presumed that would
> be the correct way to go. I'll change it and rebase to net.

The net-next tree isn't even open and active at this time, I said last week
(as I do every single merge window) that I would explicitly announce on
netdev when the net-next tree is openned.

But, much more importantly, bug fixes for issues present in 'net'
should always be targetted to the 'net' tree.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH net-next] libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig
  2014-08-12 22:46     ` David Miller
@ 2014-08-12 22:54       ` Anish Bhatt
  0 siblings, 0 replies; 6+ messages in thread
From: Anish Bhatt @ 2014-08-12 22:54 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, hch, Karen Xie, Manoj Malviya, jim.epost, sfr

>Alternatively, depending upon what IPV6 interfaces you need to use
>in the cxgbi driver, you can potentially move them into the ipv6
>components we've split out to always be statically built into the
>kernel in order to avoid problems of this nature.  See the code
>linked in by the "obj-y +=" rule in net/ipv6/Makefile.

Got it, will fix accordingly.

>> This patch was based on code currently in net-next, and I presumed that would
>> be the correct way to go. I'll change it and rebase to net.

>The net-next tree isn't even open and active at this time, I said last week
>(as I do every single merge window) that I would explicitly announce on
>netdev when the net-next tree is openned.

No, I meant the fix I proposed is currently being used by other code already present in the 
kernel. I'll try and fix that as well.

>But, much more importantly, bug fixes for issues present in 'net'
>should always be targetted to the 'net' tree.

My bad, I was not aware this code made it back to net.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-08-12 22:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-12 21:54 [PATCH net-next] libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig Anish Bhatt
2014-08-12 22:00 ` David Miller
2014-08-12 22:22 ` David Miller
2014-08-12 22:40   ` Anish Bhatt
2014-08-12 22:46     ` David Miller
2014-08-12 22:54       ` Anish Bhatt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.