From patchwork Wed Mar 9 03:40:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitris Michailidis X-Patchwork-Id: 12774708 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55547C433F5 for ; Wed, 9 Mar 2022 03:40:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231775AbiCIDlf (ORCPT ); Tue, 8 Mar 2022 22:41:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231757AbiCIDld (ORCPT ); Tue, 8 Mar 2022 22:41:33 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 553AC15D3AF for ; Tue, 8 Mar 2022 19:40:36 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id t19so862560plr.5 for ; Tue, 08 Mar 2022 19:40:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fungible.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d8iYS1V3752EcivD5gS9Doq8Vci/f5Uceo1Z4TNLkj0=; b=e5hn3kdhhuGTBTbvKPt6cgGtLlfmjA50QDF5+uyYTXeSo+uyG+7kBaS5tLdaP7663N l9sZW8ERxJI7Uq220HSZhtF+g5lhVxDLZy144x3wun+RGElAkqSP5eZBNqnL89GrTsui 8a0uHYsyt9z7okzIrSme3fBD0wT+KmDeQDBz8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d8iYS1V3752EcivD5gS9Doq8Vci/f5Uceo1Z4TNLkj0=; b=rQwOFFqOZxcqfIFFX7q5tFj7DnW+IbL+qjEZAgPo4oVFA3DNuNuXgKFxmc1arhiN5p XDZsljIGkZQgzJwIHKqhxjJtbueVDUTVzP5lGPReW5+yUF2pdG7oM3v7DOwzTOIHrM7C Sr2LlYc3uhRPpXae2V/y/v8oxLSIE6F1x0AMFlT5fmbb+Q57RRp3AVrfe+Zg7dzaZB4b x9RxVVfyUblB9YZ58PB+5N9FR/uOZCFjB4RHX0aSbi5BlrNXBXyYvauSUDNc6AIW/DsC OwwMD9MQ+0jxiKEZIG2Lx+JwcCu+qr+qACE4avN8KKycURXpXPKPsYtmR7jZRFl+3XYX 3uVw== X-Gm-Message-State: AOAM532AaVAYzyQhI84Y19q8t3MmDDqs2TdHYa90Q3rB/JeNy9H3noAW bOfqWNVctyUdJs31S7G0FIAl8A== X-Google-Smtp-Source: ABdhPJy0gO6JX3dXkNWMK+gXTsY8+sUJUQhWScsUh/AqNdCKDq2pY4l8wsIkoH6//AwJeiyqNXEzJQ== X-Received: by 2002:a17:902:d2c3:b0:151:fa59:95ab with SMTP id n3-20020a170902d2c300b00151fa5995abmr8654051plc.154.1646797235858; Tue, 08 Mar 2022 19:40:35 -0800 (PST) Received: from cab09-qa-09.fungible.local ([12.190.10.11]) by smtp.gmail.com with ESMTPSA id l10-20020a056a00140a00b004c55d0dcbd1sm578631pfu.120.2022.03.08.19.40.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 19:40:35 -0800 (PST) From: Dimitris Michailidis X-Google-Original-From: Dimitris Michailidis To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, d.michailidis@fungible.com, rdunlap@infradead.org Cc: kernel test robot Subject: [PATCH net-next 1/2] net/tls: Provide {__,}tls_driver_ctx() unconditionally Date: Tue, 8 Mar 2022 19:40:31 -0800 Message-Id: <20220309034032.405212-2-dmichail@fungible.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309034032.405212-1-dmichail@fungible.com> References: <20220309034032.405212-1-dmichail@fungible.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Having the definitions of {__,}tls_driver_ctx() under an #if guard means code referencing them also needs to rely on the preprocessor. The protection doesn't appear needed so make the definitions unconditional. Fixes: db37bc177dae ("net/funeth: add the data path") Reported-by: Randy Dunlap Reported-by: kernel test robot Suggested-by: Jakub Kicinski Signed-off-by: Dimitris Michailidis Acked-by: Jakub Kicinski --- include/net/tls.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/net/tls.h b/include/net/tls.h index 526cb2c3b724..b6968a5b5538 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -626,7 +626,6 @@ tls_offload_ctx_rx(const struct tls_context *tls_ctx) return (struct tls_offload_context_rx *)tls_ctx->priv_ctx_rx; } -#if IS_ENABLED(CONFIG_TLS_DEVICE) static inline void *__tls_driver_ctx(struct tls_context *tls_ctx, enum tls_offload_ctx_dir direction) { @@ -641,7 +640,6 @@ tls_driver_ctx(const struct sock *sk, enum tls_offload_ctx_dir direction) { return __tls_driver_ctx(tls_get_ctx(sk), direction); } -#endif #define RESYNC_REQ BIT(0) #define RESYNC_REQ_ASYNC BIT(1) From patchwork Wed Mar 9 03:40:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dimitris Michailidis X-Patchwork-Id: 12774709 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DB45C433EF for ; Wed, 9 Mar 2022 03:40:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231776AbiCIDlk (ORCPT ); Tue, 8 Mar 2022 22:41:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231757AbiCIDlf (ORCPT ); Tue, 8 Mar 2022 22:41:35 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5D3615F346 for ; Tue, 8 Mar 2022 19:40:37 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id e6so884876pgn.2 for ; Tue, 08 Mar 2022 19:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fungible.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8l82j1bqSchFMC8x0jswNZ2s7NeD3YuYOg0jV9p2Gxo=; b=IJO8wrPkAR2inzyvb+UP4Lsbi0/NKv9mVkQDCYQu4bLXywb787vBRIYxHKhhz43Ijr AZ/RjCkEQBMea+XzLyqPNrSqSinUUEFFGyUihRUdZC/88yLFe0aye8m/SDyiU4+JOyIH BfH4KbSkm5ENl2xn7HxyrlTn3tIXQ5gD6BgT0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8l82j1bqSchFMC8x0jswNZ2s7NeD3YuYOg0jV9p2Gxo=; b=ZQcVKtMN3Jc2Yupb57C8k43Ft0ynN3x3M5GacFxZezogkZcViUo93ZMKxhy6HJbmKP 4NrqYoe3g22P9j3SO8pb0KQWakyY94rmePD8df7vsyR+cZX1CqMKapi5y6x7Ss/BQGju +k4e4uvNU6vtP23dyd022tNwxlEJHwg5ns+03gtEzxLYNRJEcCY5M6+aIqsdnmcpORS8 m2vilipNvJauAL9avAW4WV2hZNV67XnU6taK19Qb6qL44eq7yrDF88LpkLcqw9zcsCWM eUcr7Fe5G55TjLcHVmmpJ+cOaBI0raZG3HXynh4mG8orExUj5iZFg8uYWgpbbFraaE6P kBlg== X-Gm-Message-State: AOAM533u8tKit5lYts1jMnCb6rxbLGTmEaK3SM43nPC9yXItHTKQ6Ntq 1IhbsUNKsH6714nBMxOXAmz7EA== X-Google-Smtp-Source: ABdhPJyZq5EwvJrtDRKEZNhYCFfYTaFFpN60qxcAoguXZdbOEF272zATqiFMaXYPsTQJGr5ZqLpE8g== X-Received: by 2002:a05:6a00:10c9:b0:4ce:146e:6edf with SMTP id d9-20020a056a0010c900b004ce146e6edfmr21605078pfu.6.1646797237188; Tue, 08 Mar 2022 19:40:37 -0800 (PST) Received: from cab09-qa-09.fungible.local ([12.190.10.11]) by smtp.gmail.com with ESMTPSA id l10-20020a056a00140a00b004c55d0dcbd1sm578631pfu.120.2022.03.08.19.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 19:40:36 -0800 (PST) From: Dimitris Michailidis X-Google-Original-From: Dimitris Michailidis To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org, d.michailidis@fungible.com, rdunlap@infradead.org Cc: kernel test robot Subject: [PATCH net-next 2/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n Date: Tue, 8 Mar 2022 19:40:32 -0800 Message-Id: <20220309034032.405212-3-dmichail@fungible.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309034032.405212-1-dmichail@fungible.com> References: <20220309034032.405212-1-dmichail@fungible.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Include the TLS headers unconditionally and define driver TLS symbols used in code compiled also when CONFIG_TLS_DEVICE=n to fix the following errors: ../drivers/net/ethernet/fungible/funeth/funeth_tx.c: In function ‘write_pkt_desc’: ../drivers/net/ethernet/fungible/funeth/funeth_tx.c:244:13: error: implicit declaration of function ‘tls_driver_ctx’ [-Werror=implicit-function-declaration] 244 | tls_ctx = tls_driver_ctx(skb->sk, TLS_OFFLOAD_CTX_DIR_TX); | ^~~~~~~~~~~~~~ ../drivers/net/ethernet/fungible/funeth/funeth_tx.c:244:37: error: ‘TLS_OFFLOAD_CTX_DIR_TX’ undeclared (first use in this function) 244 | tls_ctx = tls_driver_ctx(skb->sk, TLS_OFFLOAD_CTX_DIR_TX); | ^~~~~~~~~~~~~~~~~~~~~~ ../drivers/net/ethernet/fungible/funeth/funeth_tx.c:244:37: note: each undeclared identifier is reported only once for each function it appears in ../drivers/net/ethernet/fungible/funeth/funeth_tx.c:245:23: error: dereferencing pointer to incomplete type ‘struct fun_ktls_tx_ctx’ 245 | tls->tlsid = tls_ctx->tlsid; | ^~ ../drivers/net/ethernet/fungible/funeth/funeth_tx.c: In function ‘fun_start_xmit’: ../drivers/net/ethernet/fungible/funeth/funeth_tx.c:310:6: error: implicit declaration of function ‘tls_is_sk_tx_device_offloaded’ [-Werror=implicit-function-declaration] 310 | tls_is_sk_tx_device_offloaded(skb->sk)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../drivers/net/ethernet/fungible/funeth/funeth_tx.c:311:9: error: implicit declaration of function ‘fun_tls_tx’; did you mean ‘fun_xdp_tx’? [-Werror=implicit-function-declaration] 311 | skb = fun_tls_tx(skb, q, &tls_len); | ^~~~~~~~~~ | fun_xdp_tx ../drivers/net/ethernet/fungible/funeth/funeth_tx.c:311:7: warning: assignment to ‘struct sk_buff *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] 311 | skb = fun_tls_tx(skb, q, &tls_len); | ^ Fixes: db37bc177dae ("net/funeth: add the data path") Reported-by: Randy Dunlap Reported-by: kernel test robot Signed-off-by: Dimitris Michailidis --- drivers/net/ethernet/fungible/funeth/funeth_ktls.h | 7 +++---- drivers/net/ethernet/fungible/funeth/funeth_tx.c | 9 +++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/fungible/funeth/funeth_ktls.h b/drivers/net/ethernet/fungible/funeth/funeth_ktls.h index 1b21cccf1278..9d6f2141a959 100644 --- a/drivers/net/ethernet/fungible/funeth/funeth_ktls.h +++ b/drivers/net/ethernet/fungible/funeth/funeth_ktls.h @@ -3,17 +3,16 @@ #ifndef _FUN_KTLS_H #define _FUN_KTLS_H -struct net_device; -struct funeth_priv; - -#ifdef CONFIG_TLS_DEVICE #include +struct funeth_priv; + struct fun_ktls_tx_ctx { __be64 tlsid; u32 next_seq; }; +#if IS_ENABLED(CONFIG_TLS_DEVICE) int fun_ktls_init(struct net_device *netdev); void fun_ktls_cleanup(struct funeth_priv *fp); diff --git a/drivers/net/ethernet/fungible/funeth/funeth_tx.c b/drivers/net/ethernet/fungible/funeth/funeth_tx.c index 46684afa97a0..ff6e29237253 100644 --- a/drivers/net/ethernet/fungible/funeth/funeth_tx.c +++ b/drivers/net/ethernet/fungible/funeth/funeth_tx.c @@ -7,6 +7,7 @@ #include #include #include "funeth.h" +#include "funeth_ktls.h" #include "funeth_txrx.h" #include "funeth_trace.h" #include "fun_queue.h" @@ -75,12 +76,10 @@ static __be16 tcp_hdr_doff_flags(const struct tcphdr *th) return *(__be16 *)&tcp_flag_word(th); } -#if IS_ENABLED(CONFIG_TLS_DEVICE) -#include "funeth_ktls.h" - static struct sk_buff *fun_tls_tx(struct sk_buff *skb, struct funeth_txq *q, unsigned int *tls_len) { +#if IS_ENABLED(CONFIG_TLS_DEVICE) const struct fun_ktls_tx_ctx *tls_ctx; u32 datalen, seq; @@ -108,8 +107,10 @@ static struct sk_buff *fun_tls_tx(struct sk_buff *skb, struct funeth_txq *q, FUN_QSTAT_INC(q, tx_tls_drops); return skb; -} +#else + return NULL; #endif +} /* Write as many descriptors as needed for the supplied skb starting at the * current producer location. The caller has made certain enough descriptors