Commit c01e6059 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'net-fungible-fix-errors-when-config_tls_device-n'

Dimitris Michailidis says:

====================
net/fungible: fix errors when CONFIG_TLS_DEVICE=n

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.
====================

Link: https://lore.kernel.org/r/20220309034032.405212-1-dmichail@fungible.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 4a5eaa2f b23f9239
...@@ -3,17 +3,16 @@ ...@@ -3,17 +3,16 @@
#ifndef _FUN_KTLS_H #ifndef _FUN_KTLS_H
#define _FUN_KTLS_H #define _FUN_KTLS_H
struct net_device;
struct funeth_priv;
#ifdef CONFIG_TLS_DEVICE
#include <net/tls.h> #include <net/tls.h>
struct funeth_priv;
struct fun_ktls_tx_ctx { struct fun_ktls_tx_ctx {
__be64 tlsid; __be64 tlsid;
u32 next_seq; u32 next_seq;
}; };
#if IS_ENABLED(CONFIG_TLS_DEVICE)
int fun_ktls_init(struct net_device *netdev); int fun_ktls_init(struct net_device *netdev);
void fun_ktls_cleanup(struct funeth_priv *fp); void fun_ktls_cleanup(struct funeth_priv *fp);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/tcp.h> #include <linux/tcp.h>
#include <uapi/linux/udp.h> #include <uapi/linux/udp.h>
#include "funeth.h" #include "funeth.h"
#include "funeth_ktls.h"
#include "funeth_txrx.h" #include "funeth_txrx.h"
#include "funeth_trace.h" #include "funeth_trace.h"
#include "fun_queue.h" #include "fun_queue.h"
...@@ -75,12 +76,10 @@ static __be16 tcp_hdr_doff_flags(const struct tcphdr *th) ...@@ -75,12 +76,10 @@ static __be16 tcp_hdr_doff_flags(const struct tcphdr *th)
return *(__be16 *)&tcp_flag_word(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, static struct sk_buff *fun_tls_tx(struct sk_buff *skb, struct funeth_txq *q,
unsigned int *tls_len) unsigned int *tls_len)
{ {
#if IS_ENABLED(CONFIG_TLS_DEVICE)
const struct fun_ktls_tx_ctx *tls_ctx; const struct fun_ktls_tx_ctx *tls_ctx;
u32 datalen, seq; u32 datalen, seq;
...@@ -108,8 +107,10 @@ static struct sk_buff *fun_tls_tx(struct sk_buff *skb, struct funeth_txq *q, ...@@ -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); FUN_QSTAT_INC(q, tx_tls_drops);
return skb; return skb;
} #else
return NULL;
#endif #endif
}
/* Write as many descriptors as needed for the supplied skb starting at the /* Write as many descriptors as needed for the supplied skb starting at the
* current producer location. The caller has made certain enough descriptors * current producer location. The caller has made certain enough descriptors
......
...@@ -626,7 +626,6 @@ tls_offload_ctx_rx(const struct tls_context *tls_ctx) ...@@ -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; 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, static inline void *__tls_driver_ctx(struct tls_context *tls_ctx,
enum tls_offload_ctx_dir direction) enum tls_offload_ctx_dir direction)
{ {
...@@ -641,7 +640,6 @@ tls_driver_ctx(const struct sock *sk, 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); return __tls_driver_ctx(tls_get_ctx(sk), direction);
} }
#endif
#define RESYNC_REQ BIT(0) #define RESYNC_REQ BIT(0)
#define RESYNC_REQ_ASYNC BIT(1) #define RESYNC_REQ_ASYNC BIT(1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment