From patchwork Wed Apr 8 18:53:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11480655 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA06717D4 for ; Wed, 8 Apr 2020 18:54:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6A3A2075E for ; Wed, 8 Apr 2020 18:54:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728104AbgDHSyC (ORCPT ); Wed, 8 Apr 2020 14:54:02 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:44715 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727963AbgDHSyB (ORCPT ); Wed, 8 Apr 2020 14:54:01 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MgARS-1iniQS3Ncc-00heB6; Wed, 08 Apr 2020 20:53:34 +0200 From: Arnd Bergmann To: Ayush Sawal , Vinay Kumar Yadav , Rohit Maheshwari Cc: Arnd Bergmann , "David S. Miller" , Herbert Xu , YueHaibing , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] cxgb4/chcr: fix building without IPv6 Date: Wed, 8 Apr 2020 20:53:06 +0200 Message-Id: <20200408185330.190658-1-arnd@arndb.de> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:wAyktI553TRtAYJswrpygJEuztlihckN+PSEPstYcFGyO2DZuG0 swT5EivRwrnOxA8z729paYsUgWczyE0IxDgOrAFDY7HYvfDjCfSQ5OrNUnQDq1AaYCABvlN Be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ailing-List: linux-crypto@vger.kernel.org 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 --- 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 */