Subject: Re: [net-next 11/15] net/tls: Multi-threaded calls to TX tls_dev_del

From: Jakub Kicinski <[email-masked]>
Date: Wed, 6 Jul 2022 19:37:35 -0700

On Wed,  6 Jul 2022 16:24:17 -0700 Saeed Mahameed wrote:
> diff --git a/include/net/tls.h b/include/net/tls.h
> index 4fc16ca5f469..c4be74635502 100644
> --- a/include/net/tls.h
> +++ b/include/net/tls.h
> @@ -163,6 +163,11 @@ struct tls_record_info {
>  	skb_frag_t frags[MAX_SKB_FRAGS];
>  };
>  
> +struct destruct_work {
> +	struct work_struct work;
> +	struct tls_context *ctx;

Pretty strange to bundle the back-pointer with the work.
Why not put it directly in struct tls_offload_context_tx?

Also now that we have the backpointer, can we move the list member of
struct tls_context to the offload context? (I haven't checked if its
used in other places)

>  
>  	up_write(&device_offload_lock);
>  
> -	flush_work(&tls_device_gc_work);
> -
>  	return NOTIFY_DONE;
>  }
>  
> @@ -1435,6 +1416,5 @@ void __init tls_device_init(void)
>  void __exit tls_device_cleanup(void)
>  {
>  	unregister_netdevice_notifier(&tls_dev_notifier);
> -	flush_work(&tls_device_gc_work);
>  	clean_acked_data_flush();
>  }

Why don't we need the flush any more? The module reference is gone as
soon as destructor runs (i.e. on ULP cleanup), the work can still be
pending, no?