All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] libcxgbi:cxgb4i Guard ipv6 code with a config check
@ 2014-07-18  1:34 Anish Bhatt
  2014-07-20  7:46 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Anish Bhatt @ 2014-07-18  1:34 UTC (permalink / raw)
  To: netdev; +Cc: davem, kxie, manojmalviya, Anish Bhatt

Fixes: fc8d0590d914 ("libcxgbi: Add ipv6 api to driver")
Fixes: 759a0cc5a3e1 ("cxgb4i: Add ipv6 code to driver, call into libcxgbi ipv6
api")
Signed-off-by: Anish Bhatt <anish@chelsio.com>
---
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 18 +++++++++++++++---
 drivers/scsi/cxgbi/libcxgbi.c      |  4 ++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 1041574edcfc..a4a4e98effdd 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -1289,8 +1289,14 @@ static int init_act_open(struct cxgbi_sock *csk)
 
 	if (csk->csk_family == AF_INET)
 		daddr = &csk->daddr.sin_addr.s_addr;
-	else
+#if IS_ENABLED(CONFIG_IPV6)
+	else if (csk->csk_family == AF_INET6)
 		daddr = &csk->daddr6.sin6_addr;
+#endif
+	else {
+		pr_err("address family 0x%x not supported\n", csk->csk_family);
+		goto rel_resource;
+	}
 
 	n = dst_neigh_lookup(csk->dst, daddr);
 
@@ -1631,6 +1637,7 @@ static int cxgb4i_ddp_init(struct cxgbi_device *cdev)
 	return 0;
 }
 
+#if IS_ENABLED(CONFIG_IPV6)
 static int cxgbi_inet6addr_handler(struct notifier_block *this,
 				   unsigned long event, void *data)
 {
@@ -1755,6 +1762,7 @@ static void cxgbi_update_clip(struct cxgbi_device *cdev)
 	}
 	rcu_read_unlock();
 }
+#endif /* IS_ENABLED(CONFIG_IPV6) */
 
 static void *t4_uld_add(const struct cxgb4_lld_info *lldi)
 {
@@ -1874,7 +1882,9 @@ 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)
 		cxgbi_update_clip(cdev);
+#endif
 		/* re-initialize */
 		break;
 	case CXGB4_STATE_START_RECOVERY:
@@ -1906,15 +1916,17 @@ static int __init cxgb4i_init_module(void)
 		return rc;
 	cxgb4_register_uld(CXGB4_ULD_ISCSI, &cxgb4i_uld_info);
 
+#if IS_ENABLED(CONFIG_IPV6)
 	register_inet6addr_notifier(&cxgbi_inet6addr_notifier);
-
+#endif
 	return 0;
 }
 
 static void __exit cxgb4i_exit_module(void)
 {
+#if IS_ENABLED(CONFIG_IPV6)
 	unregister_inet6addr_notifier(&cxgbi_inet6addr_notifier);
-
+#endif
 	cxgb4_unregister_uld(CXGB4_ULD_ISCSI);
 	cxgbi_device_unregister_all(CXGBI_FLAG_DEV_T4);
 	cxgbi_iscsi_cleanup(&cxgb4i_iscsi_transport, &cxgb4i_stt);
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index d2fe507fc695..3d5322d59f15 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -602,6 +602,7 @@ err_out:
 	return ERR_PTR(err);
 }
 
+#if IS_ENABLED(CONFIG_IPV6)
 static struct rt6_info *find_route_ipv6(const struct in6_addr *saddr,
 					const struct in6_addr *daddr)
 {
@@ -716,6 +717,7 @@ rel_rt:
 err_out:
 	return ERR_PTR(err);
 }
+#endif /* IS_ENABLED(CONFIG_IPV6) */
 
 void cxgbi_sock_established(struct cxgbi_sock *csk, unsigned int snd_isn,
 			unsigned int opt)
@@ -2638,8 +2640,10 @@ 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)
 	} else if (dst_addr->sa_family == AF_INET6) {
 		csk = cxgbi_check_route6(dst_addr);
+#endif
 	} else {
 		pr_info("address family 0x%x NOT supported.\n",
 			dst_addr->sa_family);
-- 
2.0.1

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

* Re: [PATCH net-next] libcxgbi:cxgb4i Guard ipv6 code with a config check
  2014-07-18  1:34 [PATCH net-next] libcxgbi:cxgb4i Guard ipv6 code with a config check Anish Bhatt
@ 2014-07-20  7:46 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-07-20  7:46 UTC (permalink / raw)
  To: anish; +Cc: netdev, kxie, manojmalviya

From: Anish Bhatt <anish@chelsio.com>
Date: Thu, 17 Jul 2014 18:34:44 -0700

> Fixes: fc8d0590d914 ("libcxgbi: Add ipv6 api to driver")
> Fixes: 759a0cc5a3e1 ("cxgb4i: Add ipv6 code to driver, call into libcxgbi ipv6
> api")
> Signed-off-by: Anish Bhatt <anish@chelsio.com>

Applied, thanks.

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

end of thread, other threads:[~2014-07-20  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-18  1:34 [PATCH net-next] libcxgbi:cxgb4i Guard ipv6 code with a config check Anish Bhatt
2014-07-20  7:46 ` David Miller

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.