aboutsummaryrefslogtreecommitdiffstats
path: root/net/tls/tls_device.c
diff options
context:
space:
mode:
authorBoris Pismenny <borisp@mellanox.com>2018-07-13 07:33:39 -0400
committerDavid S. Miller <davem@davemloft.net>2018-07-16 03:12:09 -0400
commitd80a1b9d186057ddb0d384ba601cf2b7d214539c (patch)
treeb3492f9b27e73c3a77f1e47d3cea02fee9189e90 /net/tls/tls_device.c
parent41ed9c04aac2f8c6ee922e29ce5e69f185c5125b (diff)
tls: Refactor tls_offload variable names
For symmetry, we rename tls_offload_context to tls_offload_context_tx before we add tls_offload_context_rx. Signed-off-by: Boris Pismenny <borisp@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tls/tls_device.c')
-rw-r--r--net/tls/tls_device.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
index a7a8f8e20ff3..332a5d1459b6 100644
--- a/net/tls/tls_device.c
+++ b/net/tls/tls_device.c
@@ -52,9 +52,8 @@ static DEFINE_SPINLOCK(tls_device_lock);
52 52
53static void tls_device_free_ctx(struct tls_context *ctx) 53static void tls_device_free_ctx(struct tls_context *ctx)
54{ 54{
55 struct tls_offload_context *offload_ctx = tls_offload_ctx(ctx); 55 kfree(tls_offload_ctx_tx(ctx));
56 56
57 kfree(offload_ctx);
58 kfree(ctx); 57 kfree(ctx);
59} 58}
60 59
@@ -125,7 +124,7 @@ static void destroy_record(struct tls_record_info *record)
125 kfree(record); 124 kfree(record);
126} 125}
127 126
128static void delete_all_records(struct tls_offload_context *offload_ctx) 127static void delete_all_records(struct tls_offload_context_tx *offload_ctx)
129{ 128{
130 struct tls_record_info *info, *temp; 129 struct tls_record_info *info, *temp;
131 130
@@ -141,14 +140,14 @@ static void tls_icsk_clean_acked(struct sock *sk, u32 acked_seq)
141{ 140{
142 struct tls_context *tls_ctx = tls_get_ctx(sk); 141 struct tls_context *tls_ctx = tls_get_ctx(sk);
143 struct tls_record_info *info, *temp; 142 struct tls_record_info *info, *temp;
144 struct tls_offload_context *ctx; 143 struct tls_offload_context_tx *ctx;
145 u64 deleted_records = 0; 144 u64 deleted_records = 0;
146 unsigned long flags; 145 unsigned long flags;
147 146
148 if (!tls_ctx) 147 if (!tls_ctx)
149 return; 148 return;
150 149
151 ctx = tls_offload_ctx(tls_ctx); 150 ctx = tls_offload_ctx_tx(tls_ctx);
152 151
153 spin_lock_irqsave(&ctx->lock, flags); 152 spin_lock_irqsave(&ctx->lock, flags);
154 info = ctx->retransmit_hint; 153 info = ctx->retransmit_hint;
@@ -179,7 +178,7 @@ static void tls_icsk_clean_acked(struct sock *sk, u32 acked_seq)
179void tls_device_sk_destruct(struct sock *sk) 178void tls_device_sk_destruct(struct sock *sk)
180{ 179{
181 struct tls_context *tls_ctx = tls_get_ctx(sk); 180 struct tls_context *tls_ctx = tls_get_ctx(sk);
182 struct tls_offload_context *ctx = tls_offload_ctx(tls_ctx); 181 struct tls_offload_context_tx *ctx = tls_offload_ctx_tx(tls_ctx);
183 182
184 if (ctx->open_record) 183 if (ctx->open_record)
185 destroy_record(ctx->open_record); 184 destroy_record(ctx->open_record);
@@ -219,7 +218,7 @@ static void tls_append_frag(struct tls_record_info *record,
219 218
220static int tls_push_record(struct sock *sk, 219static int tls_push_record(struct sock *sk,
221 struct tls_context *ctx, 220 struct tls_context *ctx,
222 struct tls_offload_context *offload_ctx, 221 struct tls_offload_context_tx *offload_ctx,
223 struct tls_record_info *record, 222 struct tls_record_info *record,
224 struct page_frag *pfrag, 223 struct page_frag *pfrag,
225 int flags, 224 int flags,
@@ -264,7 +263,7 @@ static int tls_push_record(struct sock *sk,
264 return tls_push_sg(sk, ctx, offload_ctx->sg_tx_data, 0, flags); 263 return tls_push_sg(sk, ctx, offload_ctx->sg_tx_data, 0, flags);
265} 264}
266 265
267static int tls_create_new_record(struct tls_offload_context *offload_ctx, 266static int tls_create_new_record(struct tls_offload_context_tx *offload_ctx,
268 struct page_frag *pfrag, 267 struct page_frag *pfrag,
269 size_t prepend_size) 268 size_t prepend_size)
270{ 269{
@@ -290,7 +289,7 @@ static int tls_create_new_record(struct tls_offload_context *offload_ctx,
290} 289}
291 290
292static int tls_do_allocation(struct sock *sk, 291static int tls_do_allocation(struct sock *sk,
293 struct tls_offload_context *offload_ctx, 292 struct tls_offload_context_tx *offload_ctx,
294 struct page_frag *pfrag, 293 struct page_frag *pfrag,
295 size_t prepend_size) 294 size_t prepend_size)
296{ 295{
@@ -324,7 +323,7 @@ static int tls_push_data(struct sock *sk,
324 unsigned char record_type) 323 unsigned char record_type)
325{ 324{
326 struct tls_context *tls_ctx = tls_get_ctx(sk); 325 struct tls_context *tls_ctx = tls_get_ctx(sk);
327 struct tls_offload_context *ctx = tls_offload_ctx(tls_ctx); 326 struct tls_offload_context_tx *ctx = tls_offload_ctx_tx(tls_ctx);
328 int tls_push_record_flags = flags | MSG_SENDPAGE_NOTLAST; 327 int tls_push_record_flags = flags | MSG_SENDPAGE_NOTLAST;
329 int more = flags & (MSG_SENDPAGE_NOTLAST | MSG_MORE); 328 int more = flags & (MSG_SENDPAGE_NOTLAST | MSG_MORE);
330 struct tls_record_info *record = ctx->open_record; 329 struct tls_record_info *record = ctx->open_record;
@@ -477,7 +476,7 @@ out:
477 return rc; 476 return rc;
478} 477}
479 478
480struct tls_record_info *tls_get_record(struct tls_offload_context *context, 479struct tls_record_info *tls_get_record(struct tls_offload_context_tx *context,
481 u32 seq, u64 *p_record_sn) 480 u32 seq, u64 *p_record_sn)
482{ 481{
483 u64 record_sn = context->hint_record_sn; 482 u64 record_sn = context->hint_record_sn;
@@ -524,7 +523,7 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
524{ 523{
525 u16 nonce_size, tag_size, iv_size, rec_seq_size; 524 u16 nonce_size, tag_size, iv_size, rec_seq_size;
526 struct tls_record_info *start_marker_record; 525 struct tls_record_info *start_marker_record;
527 struct tls_offload_context *offload_ctx; 526 struct tls_offload_context_tx *offload_ctx;
528 struct tls_crypto_info *crypto_info; 527 struct tls_crypto_info *crypto_info;
529 struct net_device *netdev; 528 struct net_device *netdev;
530 char *iv, *rec_seq; 529 char *iv, *rec_seq;
@@ -546,7 +545,7 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
546 goto out; 545 goto out;
547 } 546 }
548 547
549 offload_ctx = kzalloc(TLS_OFFLOAD_CONTEXT_SIZE, GFP_KERNEL); 548 offload_ctx = kzalloc(TLS_OFFLOAD_CONTEXT_SIZE_TX, GFP_KERNEL);
550 if (!offload_ctx) { 549 if (!offload_ctx) {
551 rc = -ENOMEM; 550 rc = -ENOMEM;
552 goto free_marker_record; 551 goto free_marker_record;