diff mbox series

[net-next,2/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n

Message ID 20220309034032.405212-3-dmichail@fungible.com (mailing list archive)
State Accepted
Commit b23f9239195a1af116d6b388cd00c9002f80f80f
Delegated to: Netdev Maintainers
Headers show
Series net/fungible: fix errors when CONFIG_TLS_DEVICE=n | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 1 blamed authors not CCed: dmichail@fungible.com; 6 maintainers not CCed: hawk@kernel.org dmichail@fungible.com daniel@iogearbox.net john.fastabend@gmail.com bpf@vger.kernel.org ast@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: From:/Signed-off-by: email address mismatch: 'From: Dimitris Michailidis <d.michailidis@fungible.com>' != 'Signed-off-by: Dimitris Michailidis <dmichail@fungible.com>'
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Dimitris Michailidis March 9, 2022, 3:40 a.m. UTC
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 <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Dimitris Michailidis <dmichail@fungible.com>
---
 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 mbox series

Patch

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 <net/tls.h>
 
+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 <linux/tcp.h>
 #include <uapi/linux/udp.h>
 #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