Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3099292ybb; Mon, 30 Mar 2020 20:57:32 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvV4us0zd+P7cd/vrALhV1ufWOoNTKAIsritrIUIlsi0xqaGii6RNUEujLaWk0qmuY71Hd5 X-Received: by 2002:aca:4c57:: with SMTP id z84mr833915oia.53.1585627052350; Mon, 30 Mar 2020 20:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585627052; cv=none; d=google.com; s=arc-20160816; b=tDuhf/1wZ/hNSzjcJIYXoS5mNL5rOOnIeU6u+XqV/H7mLZ/B3RYN9eAdssYMxTlgq3 vu8DdMHY33SjMqspv2sDuQgGHSyBOIYuRNd276qAnSmNQW8woEJ+fsqWgketjc2GvtLV iCtzNbjWN9Xdbqsusb99wg3DM0uH8TrUwdqnzjPH40HwIAfFUeAGCl/pLcxvhbZKWR+c LT1c5JXBLtrUVr6gyiNlrgLFRUxB6/kD+/wWfWRRTCIt/HektlqYZw3su9qdcE2+8yVN FbKTmQmQJJKR7eoBknCfAqbOPLaDEBJrzQ0g1iAAGAnovSFjQxUO+/5EPU9fRu2+j9+W pnhg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=l6zOMsj/lu5sqdc3O6nPMj6+ZYZ1spKTyWJ/1EiiVY4=; b=mRYkKzJ9ALB7mQr5pYi5H3begOVZ3Rq834eDz/3nKY/rYW/xNdPBz+Dsgq3lbPmcxG UcomRfrC2XBaNsWg1tM+qj/sX1TT9yQj5uCDotzg+TN9ETUwZjOLWPBHj5wjKubFV4RR gu6F5n5NTmmracY8YDK0GOauEoleRSwaLyf3xD6MBvASv3N8VMa1BA7zDGwouJNZDXG9 EFdsQ0wiC9RziOgbS0yZhh8i2+oqgr9SLUPVHPoxlP2KrH7Qo0XIKiSwrqj0gNKlcBsX RUFgYxIzChG3KBdEPoNqcNZkMm99NkZ76ysfHeXv8ZyZwyFvplw5iYRa0qb80eIHlKWW pqdA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k20si6661146otb.168.2020.03.30.20.57.20; Mon, 30 Mar 2020 20:57:32 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729813AbgCaD5E (ORCPT + 99 others); Mon, 30 Mar 2020 23:57:04 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12658 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727358AbgCaD5D (ORCPT ); Mon, 30 Mar 2020 23:57:03 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 9325F2252625F8F9FCB5; Tue, 31 Mar 2020 11:57:01 +0800 (CST) Received: from [127.0.0.1] (10.173.223.60) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Tue, 31 Mar 2020 11:56:58 +0800 Subject: Re: [PATCH net] veth: xdp: use head instead of hard_start To: Toshiaki Makita , Jesper Dangaard Brouer CC: , , , , , , , , , , , , , , , , References: <20200330102631.31286-1-maowenan@huawei.com> <20200330133442.132bde0c@carbon> <3053de4c-cee6-f6fc-efc2-09c6250f3ef2@gmail.com> From: maowenan Message-ID: Date: Tue, 31 Mar 2020 11:56:56 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <3053de4c-cee6-f6fc-efc2-09c6250f3ef2@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.173.223.60] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/3/31 7:35, Toshiaki Makita wrote: > Hi Mao & Jesper > (Resending with plain text...) > > On 2020/03/30 20:34, Jesper Dangaard Brouer wrote: >> On Mon, 30 Mar 2020 18:26:31 +0800 >> Mao Wenan wrote: >> >>> xdp.data_hard_start is mapped to the first >>> address of xdp_frame, but the pointer hard_start >>> is the offset(sizeof(struct xdp_frame)) of xdp_frame, >>> it should use head instead of hard_start to >>> set xdp.data_hard_start. Otherwise, if BPF program >>> calls helper_function such as bpf_xdp_adjust_head, it >>> will be confused for xdp_frame_end. >> >> I have noticed this[1] and have a patch in my current patchset for >> fixing this.  IMHO is is not so important fix right now, as the effect >> is that you currently only lose 32 bytes of headroom. >> I consider that it is needed because bpf_xdp_adjust_head() just a common helper function, veth as one driver application should keep the same as 32 bytes of headroom as other driver. And convert_to_xdp_frame set() also store info in top of packet, and set: xdp_frame = xdp->data_hard_start; >> [1] https://lore.kernel.org/netdev/158446621887.702578.17234304084556809684.stgit@firesoul/ > > You are right, the subtraction is not necessary here. I guess you mean that previous subtraction is not necessary ? this line : void *head = hard_start - sizeof(struct xdp_frame); ? But in the veth_xdp_rcv_one,below line will use head pointer, case XDP_TX: orig_frame = *frame; xdp.data_hard_start = head; > Thank you for working on this. > > Toshiaki Makita > > .