Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1509396ybb; Thu, 2 Apr 2020 02:07:13 -0700 (PDT) X-Google-Smtp-Source: APiQypKOvTJk+fKqcJtTUqYniOvwSmd3oKRAi/JD86ULhycmbo6C0h8ysRBD5zPJQMKgQ1Y8psPs X-Received: by 2002:a9d:6142:: with SMTP id c2mr1642169otk.92.1585818433328; Thu, 02 Apr 2020 02:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585818433; cv=none; d=google.com; s=arc-20160816; b=XKvydQf8aDWU/NVlOHf3SD55RXRx/clZ5wOch63h9S+rZlpvnGqHBjI3uZ58P7UvxV t1NExrS0elTdCm50WYzEkC3WEwqfcwnnRfDEdoJqg0k3xHAbiI3FHGxkxYa1EhKRiPC7 Fs7LNB5ahJXI5C3r3ivGg5SNP7Tjb0YM815/1vRJkPdh4mZ7t4EG9qmYKWWy6rw4EVhj GYwOfSxZOBeAA1yUKfblkOxI8g24Vq8chg1g/xvTR4aVgs9w0BwyVnO/OXnS6vgGhOTI HXE8zy6fpIXURx2aYzLiyJ0TOeUER2nbgBLA68YiEJGpPeIxUuljr2z+eeIkdh/DfIoU hZhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=65cLaBQBBxQNS4tib9PUIecsC4BcpagR0uIUdTj5N9c=; b=pehLO8GQDYbt2gIHO6u3Uf2ZPz6qZ9ffQ8Tn4j4V6/h4xqKJz5Kd1yqvbSfJYMM+Yp vtBi40ZAsAb+LtpQrOwKHCSW7D+K/kCHKoJrgEVZe3sFNmox2DifQ5JGhP+gdBKZxtjC PprHsRcj2XRLubPFVpG6zEycCyhcxxdmhJr9KS2y+ceH2ykcKVeI5i8KVvaJ2M1dng9i oDGXzNV5SCXLYyzjzhWeXE5NY8C+qEdXktsmiIyZUDmslgrBLshjOV9J54hDa2q0sjLv fj41pBaCqLDR2WVSdkASLYUdNtt+1N5NJf56j8pdiWv2zwN0YfLCcbJD814ghhlJ3NSE bY7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N5KoIne3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 51si2082228oty.202.2020.04.02.02.07.01; Thu, 02 Apr 2020 02:07:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N5KoIne3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387857AbgDBJGj (ORCPT + 99 others); Thu, 2 Apr 2020 05:06:39 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:30186 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387716AbgDBJGi (ORCPT ); Thu, 2 Apr 2020 05:06:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585818397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=65cLaBQBBxQNS4tib9PUIecsC4BcpagR0uIUdTj5N9c=; b=N5KoIne36YXUT9uW4cRYgza9cWPTR4Grwx3HX8V86nGXgHVYm2u8C+YJ7b+4PIYpp4tHC6 19vOvYqBLJQ5CvsT2ZKbcJg6+g18j6kQTZDxXFTnl6/TegVyqLd2uzdHDdRDCZek/du3/b +ZDepoSXTdsky9RpYxBZME57qmo26F0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-175-xaPBBNPnMLaUxkTVbBxdmA-1; Thu, 02 Apr 2020 05:06:33 -0400 X-MC-Unique: xaPBBNPnMLaUxkTVbBxdmA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EAE4F1083E8A; Thu, 2 Apr 2020 09:06:29 +0000 (UTC) Received: from carbon (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5033526DC3; Thu, 2 Apr 2020 09:06:21 +0000 (UTC) Date: Thu, 2 Apr 2020 11:06:19 +0200 From: Jesper Dangaard Brouer To: Toshiaki Makita Cc: Mao Wenan , davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net, kuba@kernel.org, hawk@kernel.org, john.fastabend@gmail.com, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, andriin@fb.com, jwi@linux.ibm.com, jianglidong3@jd.com, edumazet@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, kernel-janitors@vger.kernel.org, brouer@redhat.com Subject: Re: [PATCH net v2] veth: xdp: use head instead of hard_start Message-ID: <20200402110619.48f31a63@carbon> In-Reply-To: References: <20200331060641.79999-1-maowenan@huawei.com> <7a1d55ad-1427-67fe-f204-4d4a0ab2c4b1@gmail.com> <20200401181419.7acd2aa6@carbon> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2 Apr 2020 09:47:03 +0900 Toshiaki Makita wrote: > On 2020/04/02 1:15, Jesper Dangaard Brouer wrote: > ... > > [PATCH RFC net-next] veth: adjust hard_start offset on redirect XDP frames > > > > When native XDP redirect into a veth device, the frame arrives in the > > xdp_frame structure. It is then processed in veth_xdp_rcv_one(), > > which can run a new XDP bpf_prog on the packet. Doing so requires > > converting xdp_frame to xdp_buff, but the tricky part is that > > xdp_frame memory area is located in the top (data_hard_start) memory > > area that xdp_buff will point into. > > > > The current code tried to protect the xdp_frame area, by assigning > > xdp_buff.data_hard_start past this memory. This results in 32 bytes > > less headroom to expand into via BPF-helper bpf_xdp_adjust_head(). > > > > This protect step is actually not needed, because BPF-helper > > bpf_xdp_adjust_head() already reserve this area, and don't allow > > BPF-prog to expand into it. Thus, it is safe to point data_hard_start > > directly at xdp_frame memory area. > > > > Cc: Toshiaki Makita > > FYI: This mail address is deprecated. > > > Fixes: 9fc8d518d9d5 ("veth: Handle xdp_frames in xdp napi ring") > > Reported-by: Mao Wenan > > Signed-off-by: Jesper Dangaard Brouer > > FWIW, > > Acked-by: Toshiaki Makita Thanks. I have updated your email and added your ack in my patchset. I will submit this officially once net-next opens up again[1], as part my larger patchset for introducing XDP frame_sz. [1] http://vger.kernel.org/~davem/net-next.html -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer