From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2898A3568F3 for ; Fri, 5 Sep 2025 17:20:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757092830; cv=none; b=BabwAKdp7m2+45N8+cndnQTLU6qCrCAJoM4Sio16Y6FZJA7wMYX9ATI9nDzNKhgxSxsGBKLAvPXKSBdYL+nHBBKOH0VqEsAxNMNrPSEYjLRAIQoMOmq2AzrsKDdXIaH6rdot4fMrBzJFb7lzYLN83KdifQY0LA4AxI4mxG1z+9M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757092830; c=relaxed/simple; bh=69VwV53pEtbwlpqFCXdqeHzoaEBq/NLT0xcX5Dl5RTE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Wpk3oaP4DTU8bwgB4q1V63gC+Pi++XYwlFbBDWKfJXWCyTCFRgxaAwcQDrhbrQLUBtoNjdurrjk2owvFHnFduE/gUZr6don1csfi5o2qBso9ItKhgP2z0Ii/uTV2oX6w3JmI4ivT7ZHLFnDKARBMcytURoYz30gVRvP0iN1oFdM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=c2dQePiF; arc=none smtp.client-ip=95.215.58.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="c2dQePiF" Message-ID: <9ac027eb-e1fa-43b7-9b36-f5a267e461f8@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1757092826; 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=DwgUa8pyKPwPOQ4M2XhOit+u2/9lsIIMXunBg9kdPhA=; b=c2dQePiF6hmccOFnJ4dZKjS5xDnXsi2rVVVxFF65kEVxvnVunxMge4VTrCLeStOpfCfTVd 7nLNVgTZHeQ9Gh3+v23IemaBk4QZHOx/XO2MfasXSqHHstIj8ItL7y/iMFcY+LPCG/U04y 6mAgJkDTjGOUS7MbgH6kxvMZOMSbsUg= Date: Fri, 5 Sep 2025 10:20:01 -0700 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [RFC bpf-next v1 0/7] Add kfunc bpf_xdp_pull_data To: Amery Hung Cc: Nimrod Oren , bpf@vger.kernel.org, netdev@vger.kernel.org, alexei.starovoitov@gmail.com, andrii@kernel.org, daniel@iogearbox.net, kuba@kernel.org, martin.lau@kernel.org, mohsin.bashr@gmail.com, saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com, maciej.fijalkowski@intel.com, kernel-team@meta.com, Dragos Tatulea References: <20250825193918.3445531-1-ameryhung@gmail.com> <7695218f-2193-47f8-82ac-fc843a3a56b0@nvidia.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 9/4/25 10:28 AM, Amery Hung wrote: > On Fri, Aug 29, 2025 at 11:22 AM Martin KaFai Lau wrote: >> >> On 8/28/25 6:39 AM, Nimrod Oren wrote: >>> I'm currently working on a series that converts the xdp_native program >>> to use dynptr for accessing header data. If accepted, it should provide >>> better performance, since dynptr can access without copying the data. >> >> The bpf_xdp_adjust_tail is aware of xdp_buff_has_frags. Is there a reason that >> bpf_xdp_adjust_head cannot handle frags also? > > I am not aware of reasons that would stop this. > > Are you suggesting another way to pop headers? E.g., use > bpf_xdp_adjust_head() to shrink the first frag from the front and call > bpf_xdp_store_bytes() to move the remaining headers bpf_xdp_pull_data is useful on its own, nothing change there. On top of that, bpf_xdp_adjust_head() should be useful also for bpf prog that does not care about the linear/frag layout and stay with the bpf_dynptr helpers (or the bpf_xdp_{store,load}_bytes you mentioned). Also, if I read it correctly, bpf_xdp_adjust_head can increase the head of multi buf xdp but not shrinking it while the bpf_xdp_adjust_tail can do both. It could be a surprise to use. The adjust_head support can be a followup though. I think some of your work in this series is pretty close to having adjust_head support also, so I was wondering if there is reason that adjust_head cannot be supported.