Skip to content

Commit 5837158

Browse files
Dave Watsondavem330
authored andcommitted
tls: Refactor variable names
Several config variables are prefixed with tx, drop the prefix since these will be used for both tx and rx. Signed-off-by: Dave Watson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f4a8e43 commit 5837158

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

include/net/tls.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ struct tls_context {
9999

100100
void *priv_ctx;
101101

102-
u8 tx_conf:2;
102+
u8 conf:2;
103103

104104
struct cipher_context tx;
105105

net/tls/tls_main.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ enum {
5252
};
5353

5454
enum {
55-
TLS_BASE_TX,
55+
TLS_BASE,
5656
TLS_SW_TX,
5757
TLS_NUM_CONFIG,
5858
};
@@ -65,7 +65,7 @@ static inline void update_sk_prot(struct sock *sk, struct tls_context *ctx)
6565
{
6666
int ip_ver = sk->sk_family == AF_INET6 ? TLSV6 : TLSV4;
6767

68-
sk->sk_prot = &tls_prots[ip_ver][ctx->tx_conf];
68+
sk->sk_prot = &tls_prots[ip_ver][ctx->conf];
6969
}
7070

7171
int wait_on_pending_writer(struct sock *sk, long *timeo)
@@ -238,7 +238,7 @@ static void tls_sk_proto_close(struct sock *sk, long timeout)
238238
lock_sock(sk);
239239
sk_proto_close = ctx->sk_proto_close;
240240

241-
if (ctx->tx_conf == TLS_BASE_TX) {
241+
if (ctx->conf == TLS_BASE) {
242242
kfree(ctx);
243243
goto skip_tx_cleanup;
244244
}
@@ -262,7 +262,7 @@ static void tls_sk_proto_close(struct sock *sk, long timeout)
262262
kfree(ctx->tx.rec_seq);
263263
kfree(ctx->tx.iv);
264264

265-
if (ctx->tx_conf == TLS_SW_TX)
265+
if (ctx->conf == TLS_SW_TX)
266266
tls_sw_free_tx_resources(sk);
267267

268268
skip_tx_cleanup:
@@ -371,7 +371,7 @@ static int do_tls_setsockopt_tx(struct sock *sk, char __user *optval,
371371
struct tls_crypto_info *crypto_info;
372372
struct tls_context *ctx = tls_get_ctx(sk);
373373
int rc = 0;
374-
int tx_conf;
374+
int conf;
375375

376376
if (!optval || (optlen < sizeof(*crypto_info))) {
377377
rc = -EINVAL;
@@ -418,11 +418,11 @@ static int do_tls_setsockopt_tx(struct sock *sk, char __user *optval,
418418

419419
/* currently SW is default, we will have ethtool in future */
420420
rc = tls_set_sw_offload(sk, ctx);
421-
tx_conf = TLS_SW_TX;
421+
conf = TLS_SW_TX;
422422
if (rc)
423423
goto err_crypto_info;
424424

425-
ctx->tx_conf = tx_conf;
425+
ctx->conf = conf;
426426
update_sk_prot(sk, ctx);
427427
ctx->sk_write_space = sk->sk_write_space;
428428
sk->sk_write_space = tls_write_space;
@@ -465,12 +465,12 @@ static int tls_setsockopt(struct sock *sk, int level, int optname,
465465

466466
static void build_protos(struct proto *prot, struct proto *base)
467467
{
468-
prot[TLS_BASE_TX] = *base;
469-
prot[TLS_BASE_TX].setsockopt = tls_setsockopt;
470-
prot[TLS_BASE_TX].getsockopt = tls_getsockopt;
471-
prot[TLS_BASE_TX].close = tls_sk_proto_close;
468+
prot[TLS_BASE] = *base;
469+
prot[TLS_BASE].setsockopt = tls_setsockopt;
470+
prot[TLS_BASE].getsockopt = tls_getsockopt;
471+
prot[TLS_BASE].close = tls_sk_proto_close;
472472

473-
prot[TLS_SW_TX] = prot[TLS_BASE_TX];
473+
prot[TLS_SW_TX] = prot[TLS_BASE];
474474
prot[TLS_SW_TX].sendmsg = tls_sw_sendmsg;
475475
prot[TLS_SW_TX].sendpage = tls_sw_sendpage;
476476
}
@@ -513,7 +513,7 @@ static int tls_init(struct sock *sk)
513513
mutex_unlock(&tcpv6_prot_mutex);
514514
}
515515

516-
ctx->tx_conf = TLS_BASE_TX;
516+
ctx->conf = TLS_BASE;
517517
update_sk_prot(sk, ctx);
518518
out:
519519
return rc;

0 commit comments

Comments
 (0)