libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig
Subsystems (4)
PATCH 1/1 libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig
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.
--- drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 13 +++++++------ drivers/scsi/cxgbi/libcxgbi.c | 9 ++++++--- 2 files changed, 13 insertions(+), 9 deletions(-)
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +7 -6
@@ -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 );
drivers/scsi/cxgbi/libcxgbi.c +6 -3
@@ -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
Signature · 1 line
2.0.4
David Miller
maintainerFrom: Anish Bhatt <[email protected]>
Date: Tue, 12 Aug 2014 14:54:41 -0700
Quoted 7 lines
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 <[email protected]>
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.
David Miller
maintainerFrom: Anish Bhatt <[email protected]>
Date: Tue, 12 Aug 2014 14:54:41 -0700
Quoted 7 lines
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 <[email protected]>
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.
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 [[email protected]]
Sent: Tuesday, August 12, 2014 3:22 PM
To: Anish Bhatt
Cc: [email protected]; [email protected]; Karen Xie; Manoj Malviya; [email protected]; [email protected]
Subject: Re: [PATCH net-next] libcxgbi/cxgb4i : Fix ipv6 build failure caught with randconfig
From: Anish Bhatt <[email protected]>
Date: Tue, 12 Aug 2014 14:54:41 -0700
Quoted 7 lines
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 <[email protected]>
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.
David Miller
maintainerFrom: Anish Bhatt <[email protected]>
Date: Tue, 12 Aug 2014 22:40:35 +0000
Quoted 2 lines
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.
Quoted 2 lines
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.
Quoted 5 lines
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.
Quoted 6 lines
Quoted 2 lines
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.
Quoted 2 lines
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.