All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n
@ 2022-03-09  3:40 Dimitris Michailidis
  2022-03-09  3:40 ` [PATCH net-next 1/2] net/tls: Provide {__,}tls_driver_ctx() unconditionally Dimitris Michailidis
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dimitris Michailidis @ 2022-03-09  3:40 UTC (permalink / raw)
  To: davem, kuba, netdev, d.michailidis, rdunlap

This pair of patches fix compile errors in funeth when
CONFIG_TLS_DEVICE=n. The errors are due to symbols that are not defined
in this config but are used in code guarded by
"if (IS_ENABLED(CONFIG_TLS_DEVICE) ..."

One option is to place this code under preprocessor guards that will
keep the compiler from looking at the code. The option adopted here is
to define the offending symbols also when CONFIG_TLS_DEVICE=n.

The first patch does this for two functions in tls.h.
The second does the same for driver symbols and makes tls.h inclusion
unconditional.

Dimitris Michailidis (2):
  net/tls: Provide {__,}tls_driver_ctx() unconditionally
  net/fungible: fix errors when CONFIG_TLS_DEVICE=n

 drivers/net/ethernet/fungible/funeth/funeth_ktls.h | 7 +++----
 drivers/net/ethernet/fungible/funeth/funeth_tx.c   | 9 +++++----
 include/net/tls.h                                  | 2 --
 3 files changed, 8 insertions(+), 10 deletions(-)

-- 
2.25.1


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

* [PATCH net-next 1/2] net/tls: Provide {__,}tls_driver_ctx() unconditionally
  2022-03-09  3:40 [PATCH net-next 0/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n Dimitris Michailidis
@ 2022-03-09  3:40 ` Dimitris Michailidis
  2022-03-09  6:00   ` Jakub Kicinski
  2022-03-09  3:40 ` [PATCH net-next 2/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n Dimitris Michailidis
  2022-03-10  4:20 ` [PATCH net-next 0/2] " patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Dimitris Michailidis @ 2022-03-09  3:40 UTC (permalink / raw)
  To: davem, kuba, netdev, d.michailidis, rdunlap; +Cc: kernel test robot

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 <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Dimitris Michailidis <dmichail@fungible.com>
---
 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)
-- 
2.25.1


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

* [PATCH net-next 2/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n
  2022-03-09  3:40 [PATCH net-next 0/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n Dimitris Michailidis
  2022-03-09  3:40 ` [PATCH net-next 1/2] net/tls: Provide {__,}tls_driver_ctx() unconditionally Dimitris Michailidis
@ 2022-03-09  3:40 ` Dimitris Michailidis
  2022-03-10  4:20 ` [PATCH net-next 0/2] " patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Dimitris Michailidis @ 2022-03-09  3:40 UTC (permalink / raw)
  To: davem, kuba, netdev, d.michailidis, rdunlap; +Cc: kernel test robot

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 --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
-- 
2.25.1


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

* Re: [PATCH net-next 1/2] net/tls: Provide {__,}tls_driver_ctx() unconditionally
  2022-03-09  3:40 ` [PATCH net-next 1/2] net/tls: Provide {__,}tls_driver_ctx() unconditionally Dimitris Michailidis
@ 2022-03-09  6:00   ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2022-03-09  6:00 UTC (permalink / raw)
  To: Dimitris Michailidis; +Cc: davem, netdev, rdunlap, kernel test robot

On Tue,  8 Mar 2022 19:40:31 -0800 Dimitris Michailidis wrote:
> 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 <rdunlap@infradead.org>
> Reported-by: kernel test robot <lkp@intel.com>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Dimitris Michailidis <dmichail@fungible.com>

Acked-by: Jakub Kicinski <kuba@kernel.org>

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

* Re: [PATCH net-next 0/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n
  2022-03-09  3:40 [PATCH net-next 0/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n Dimitris Michailidis
  2022-03-09  3:40 ` [PATCH net-next 1/2] net/tls: Provide {__,}tls_driver_ctx() unconditionally Dimitris Michailidis
  2022-03-09  3:40 ` [PATCH net-next 2/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n Dimitris Michailidis
@ 2022-03-10  4:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-10  4:20 UTC (permalink / raw)
  To: Dimitris Michailidis; +Cc: davem, kuba, netdev, rdunlap

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  8 Mar 2022 19:40:30 -0800 you wrote:
> This pair of patches fix compile errors in funeth when
> CONFIG_TLS_DEVICE=n. The errors are due to symbols that are not defined
> in this config but are used in code guarded by
> "if (IS_ENABLED(CONFIG_TLS_DEVICE) ..."
> 
> One option is to place this code under preprocessor guards that will
> keep the compiler from looking at the code. The option adopted here is
> to define the offending symbols also when CONFIG_TLS_DEVICE=n.
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] net/tls: Provide {__,}tls_driver_ctx() unconditionally
    https://git.kernel.org/netdev/net-next/c/77f09e66f613
  - [net-next,2/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n
    https://git.kernel.org/netdev/net-next/c/b23f9239195a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-03-10  4:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-09  3:40 [PATCH net-next 0/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n Dimitris Michailidis
2022-03-09  3:40 ` [PATCH net-next 1/2] net/tls: Provide {__,}tls_driver_ctx() unconditionally Dimitris Michailidis
2022-03-09  6:00   ` Jakub Kicinski
2022-03-09  3:40 ` [PATCH net-next 2/2] net/fungible: fix errors when CONFIG_TLS_DEVICE=n Dimitris Michailidis
2022-03-10  4:20 ` [PATCH net-next 0/2] " patchwork-bot+netdevbpf

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.