[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200408185330.190658-1-arnd@arndb.de>
Date: Wed, 8 Apr 2020 20:53:06 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Ayush Sawal <ayush.sawal@...lsio.com>,
Vinay Kumar Yadav <vinay.yadav@...lsio.com>,
Rohit Maheshwari <rohitm@...lsio.com>
Cc: Arnd Bergmann <arnd@...db.de>,
"David S. Miller" <davem@...emloft.net>,
Herbert Xu <herbert@...dor.apana.org.au>,
YueHaibing <yuehaibing@...wei.com>, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] cxgb4/chcr: fix building without IPv6
When IPv6 support is completely disabled, the chelsio driver fails
to build with
drivers/crypto/chelsio/chcr_ktls.c: In function 'chcr_ktls_act_open_req6':
include/net/sock.h:380:37: error: 'struct sock_common' has no member named 'skc_v6_rcv_saddr'; did you mean 'skc_rcv_saddr'?
380 | #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
| ^~~~~~~~~~~~~~~~
drivers/crypto/chelsio/chcr_ktls.c:258:37: note: in expansion of macro 'sk_v6_rcv_saddr'
258 | cpl->local_ip_hi = *(__be64 *)&sk->sk_v6_rcv_saddr.in6_u.u6_addr8[0];
| ^~~~~~~~~~~~~~~
drivers/crypto/chelsio/chcr_ktls.c:260:36: note: in expansion of macro 'sk_v6_daddr'
260 | cpl->peer_ip_hi = *(__be64 *)&sk->sk_v6_daddr.in6_u.u6_addr8[0];
| ^~~~~~~~~~~
drivers/crypto/chelsio/chcr_ktls.c:261:36: note: in expansion of macro 'sk_v6_daddr'
261 | cpl->peer_ip_lo = *(__be64 *)&sk->sk_v6_daddr.in6_u.u6_addr8[8];
| ^~~~~~~~~~~
drivers/crypto/chelsio/chcr_ktls.c:296:27: note: in expansion of macro 'sk_v6_daddr'
296 | ipv6_addr_type(&sk->sk_v6_daddr) == IPV6_ADDR_MAPPED)) {
| ^~~~~~~~~~~
drivers/crypto/chelsio/chcr_ktls.c:303:29: note: in expansion of macro 'sk_v6_rcv_saddr'
303 | (const u32 *)&sk->sk_v6_rcv_saddr.in6_u.u6_addr8,
| ^~~~~~~~~~~~~~~
drivers/crypto/chelsio/chcr_ktls.c: In function 'chcr_ktls_dev_del':
drivers/crypto/chelsio/chcr_ktls.c:401:26: note: in expansion of macro 'sk_v6_daddr'
401 | (const u32 *)&sk->sk_v6_daddr.in6_u.u6_addr8,
| ^~~~~~~~~~~
drivers/crypto/chelsio/chcr_ktls.c: In function 'chcr_ktls_dev_add':
drivers/crypto/chelsio/chcr_ktls.c:495:27: note: in expansion of macro 'sk_v6_daddr'
495 | ipv6_addr_type(&sk->sk_v6_daddr) == IPV6_ADDR_MAPPED)) {
| ^~~~~~~~~~~
drivers/crypto/chelsio/chcr_ktls.c:498:22: note: in expansion of macro 'sk_v6_daddr'
498 | memcpy(daaddr, sk->sk_v6_daddr.in6_u.u6_addr8, 16);
| ^~~~~~~~~~~
There is probably a good way to fix it, but this patch just adds a
bunch of #if checks to get it to build again, which gets a bit
ugly.
Fixes: 62370a4f346d ("cxgb4/chcr: Add ipv6 support and statistics")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
If you have a better idea to fix it, please send a different patch
instead and treat this as a bug report. ;-)
---
drivers/crypto/chelsio/chcr_ktls.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/crypto/chelsio/chcr_ktls.c b/drivers/crypto/chelsio/chcr_ktls.c
index 73658b71d4a3..3d3f8dfa4e96 100644
--- a/drivers/crypto/chelsio/chcr_ktls.c
+++ b/drivers/crypto/chelsio/chcr_ktls.c
@@ -222,6 +222,7 @@ static int chcr_ktls_act_open_req(struct sock *sk,
return cxgb4_l2t_send(tx_info->netdev, skb, tx_info->l2te);
}
+#if IS_ENABLED(CONFIG_IPV6)
/*
* chcr_ktls_act_open_req6: creates TCB entry for ipv6 connection.
* @sk - tcp socket.
@@ -271,6 +272,7 @@ static int chcr_ktls_act_open_req6(struct sock *sk,
return cxgb4_l2t_send(tx_info->netdev, skb, tx_info->l2te);
}
+#endif
/*
* chcr_setup_connection: create a TCB entry so that TP will form tcp packets.
@@ -291,12 +293,16 @@ static int chcr_setup_connection(struct sock *sk,
tx_info->atid = atid;
tx_info->ip_family = sk->sk_family;
- if (sk->sk_family == AF_INET ||
- (sk->sk_family == AF_INET6 && !sk->sk_ipv6only &&
- ipv6_addr_type(&sk->sk_v6_daddr) == IPV6_ADDR_MAPPED)) {
+ if (sk->sk_family == AF_INET
+#if IS_ENABLED(CONFIG_IPV6)
+ || (sk->sk_family == AF_INET6 && !sk->sk_ipv6only &&
+ ipv6_addr_type(&sk->sk_v6_daddr) == IPV6_ADDR_MAPPED)
+#endif
+ ) {
tx_info->ip_family = AF_INET;
ret = chcr_ktls_act_open_req(sk, tx_info, atid);
} else {
+#if IS_ENABLED(CONFIG_IPV6)
tx_info->ip_family = AF_INET6;
ret =
cxgb4_clip_get(tx_info->netdev,
@@ -305,6 +311,7 @@ static int chcr_setup_connection(struct sock *sk,
if (ret)
goto out;
ret = chcr_ktls_act_open_req6(sk, tx_info, atid);
+#endif
}
/* if return type is NET_XMIT_CN, msg will be sent but delayed, mark ret
@@ -395,11 +402,13 @@ static void chcr_ktls_dev_del(struct net_device *netdev,
if (tx_info->l2te)
cxgb4_l2t_release(tx_info->l2te);
+#if IS_ENABLED(CONFIG_IPV6)
/* clear clip entry */
if (tx_info->ip_family == AF_INET6)
cxgb4_clip_release(netdev,
(const u32 *)&sk->sk_v6_daddr.in6_u.u6_addr8,
1);
+#endif
/* clear tid */
if (tx_info->tid != -1) {
@@ -490,12 +499,17 @@ static int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk,
goto out2;
/* get peer ip */
- if (sk->sk_family == AF_INET ||
- (sk->sk_family == AF_INET6 && !sk->sk_ipv6only &&
- ipv6_addr_type(&sk->sk_v6_daddr) == IPV6_ADDR_MAPPED)) {
+ if (sk->sk_family == AF_INET
+#if IS_ENABLED(CONFIG_IPV6)
+ || (sk->sk_family == AF_INET6 && !sk->sk_ipv6only &&
+ ipv6_addr_type(&sk->sk_v6_daddr) == IPV6_ADDR_MAPPED)
+#endif
+ ) {
memcpy(daaddr, &sk->sk_daddr, 4);
} else {
+#if IS_ENABLED(CONFIG_IPV6)
memcpy(daaddr, sk->sk_v6_daddr.in6_u.u6_addr8, 16);
+#endif
}
/* get the l2t index */
--
2.26.0
Powered by blists - more mailing lists