From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f48.google.com ([74.125.83.48]:41047 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753210AbeCUVK2 (ORCPT ); Wed, 21 Mar 2018 17:10:28 -0400 Received: by mail-pg0-f48.google.com with SMTP id m24so2421079pgv.8 for ; Wed, 21 Mar 2018 14:10:28 -0700 (PDT) Subject: Re: [PATCH V2 net-next 06/14] net/tls: Add generic NIC offload infrastructure To: Saeed Mahameed , "David S. Miller" Cc: netdev@vger.kernel.org, Dave Watson , Boris Pismenny , Ilya Lesokhin , Aviad Yehezkel References: <20180321210146.22537-1-saeedm@mellanox.com> <20180321210146.22537-7-saeedm@mellanox.com> From: Eric Dumazet Message-ID: <4cfad193-27f5-6982-66cc-4e327c8b10a0@gmail.com> Date: Wed, 21 Mar 2018 14:10:25 -0700 MIME-Version: 1.0 In-Reply-To: <20180321210146.22537-7-saeedm@mellanox.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On 03/21/2018 02:01 PM, Saeed Mahameed wrote: > From: Ilya Lesokhin > > This patch adds a generic infrastructure to offload TLS crypto to a ... > + > +static inline int tls_push_record(struct sock *sk, > + struct tls_context *ctx, > + struct tls_offload_context *offload_ctx, > + struct tls_record_info *record, > + struct page_frag *pfrag, > + int flags, > + unsigned char record_type) > +{ > + skb_frag_t *frag; > + struct tcp_sock *tp = tcp_sk(sk); > + struct page_frag fallback_frag; > + struct page_frag *tag_pfrag = pfrag; > + int i; > + > + /* fill prepand */ > + frag = &record->frags[0]; > + tls_fill_prepend(ctx, > + skb_frag_address(frag), > + record->len - ctx->prepend_size, > + record_type); > + > + if (unlikely(!skb_page_frag_refill(ctx->tag_size, pfrag, GFP_KERNEL))) { > + /* HW doesn't care about the data in the tag > + * so in case pfrag has no room > + * for a tag and we can't allocate a new pfrag > + * just use the page in the first frag > + * rather then write a complicated fall back code. > + */ > + tag_pfrag = &fallback_frag; > + tag_pfrag->page = skb_frag_page(frag); > + tag_pfrag->offset = 0; > + } > + If HW does not care, why even trying to call skb_page_frag_refill() ? If you remove it, then we remove one seldom used path and might uncover bugs This part looks very suspect to me, to be honest.