Thread (21 messages) flat view 21 messages, 5 authors, 2018-03-22

Re: [PATCH V2 net-next 06/14] net/tls: Add generic NIC offload infrastructure

From: Eric Dumazet <hidden>
Date: 2018-03-21 21:10:28


On 03/21/2018 02:01 PM, Saeed Mahameed wrote:
From: Ilya Lesokhin <redacted>

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help