Skip to content

Commit

Permalink
Merge branch 'net-fungible-fix-errors-when-config_tls_device-n'
Browse files Browse the repository at this point in the history
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.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Mar 10, 2022
2 parents 4a5eaa2 + b23f923 commit c01e605
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
7 changes: 3 additions & 4 deletions drivers/net/ethernet/fungible/funeth/funeth_ktls.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
9 changes: 5 additions & 4 deletions drivers/net/ethernet/fungible/funeth/funeth_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions include/net/tls.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down

0 comments on commit c01e605

Please sign in to comment.