From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA9B13019DC for ; Sat, 11 Apr 2026 19:10:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775934648; cv=none; b=Nq8av3qpawmGjpiHKeJNvis+EykBLcxFIn1E1VDWzzBrek3TpUUdecuqpj0r8N3XI9RpkPd4fKLaBUMPe2HNHD5yS5vL7nyxM201P2QMWGHNvk/nZ9G2FUNrfn7JOdzDDSc6jzecq0mc8QbLI6r8Jb5tyS9IyR5k54exNkI+jL4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775934648; c=relaxed/simple; bh=Gt4Xxndsu0mDlG5v2kYyydGq7LlY+vq3JTORXpadg6I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=m7xQh/MzIqVsxSbt3Uqd2jNvGwuFmISlXCz4Z8eOMPSzH9RGa24pjUCrh7d2qMfH+ccBqKwjOofnNsmiUWnsjVxHPPs8XvDcG2ULIhMCLFWeFhNqo8dqw0kB5uqfblzZG7KsAkKnHZ99TCDPRuMF07TNUdjHm2h+0qv3pRXH+nA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SjY0BDFP; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SjY0BDFP" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-43cf3ee0fc1so1951325f8f.1 for ; Sat, 11 Apr 2026 12:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775934645; x=1776539445; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=LPCBZIgMpZdjyF6123ihZ+k6S7UbApuUK4u6pzDSw+I=; b=SjY0BDFPcsOF9p5onWb6jBx2+e4Pn2oT2tEf0KAKQ+tJVISfbeBJb63R1X9TYg2Udx ZuyYSWiFEKVOv4fph5zQTel3S5ZoyV+adYsSgF3njZy9siZVv4GXskQIRgUfge37ch1n 7dm6PYpykf2iAQyp0O5MtQJqRV1IuKtkzw4mE9bkd3jKWJP784dJMN0IXayi2ObZO4Ab AqUM7dSW2tgMu4Wge7nxViXsiJYqf5rH1zGSRUjGi8dRnK9cgc6c8SKknjK/DJyJ95sC 2EcIRVmVKHfreU+wMBZzFcYGTKqGKFW3lPm018Yy0nogJYcvkvqm0JRRrRwf4RGzATHO GUCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775934645; x=1776539445; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LPCBZIgMpZdjyF6123ihZ+k6S7UbApuUK4u6pzDSw+I=; b=V/Opd7+1s7sCQ4P4Ukj7NPPh97p6ZM8FJRbCbopbLe49EU6nOCp8j1Sv8PgTivooyN WSzH5veBtCoQbBLOf6AlnTIAKAIV3dRFPYTvJVIhNT4eU6wY0/dgtM+4uM1vRxu6AZ8M XHE7KRfXnxRn9+xEUJAew+w7BjcQBS3I3CA08vCnZMVbAbFlIbGJ+mMEWqGMvAQqUyNF 8RywxkFK1xOuBt+JdB+Hl+m0Zvx7jbWo3l30f2CkLH5o9XSi0onFIjYj9M1ssCW1oy6J 4JNR+6NwCo7nk6Crf3vwkzatZKgoLVOcP2vhtKTvC/yvQsuK3MBb7utm7hmEWvfKEBcT F3eQ== X-Forwarded-Encrypted: i=1; AFNElJ8R6ptkFTQtIKpDKmBVf8yYvOf8lcLa57rUGLwKfptwvqjUdshPBuY8PvuPXlYoy+e38FAlx4zPoAd9ZkU=@vger.kernel.org X-Gm-Message-State: AOJu0YyIjEiwFjsRXXfRjYDzbBLzb0sgyQ1D8zuV6jcrvaitU5l5MzFi tqhrDb2HN/7vdfvvxjVD/IdGKizDAoFtCsZJkJKdKaUTmoxvmEt6m4ti X-Gm-Gg: AeBDiesxMgXZMGWZgc7ndhoQJ/kTmXdHvZ3o59SWmKmWzLnTV0lqT3TU+0I3bp9ifne WaEGJnrnnQy21iz9+y4Ip0TXf8JnbvQDHg+xFLRuPLiL5lMW/khM68v5Ba4Yn8lJqwX3/s9rXKL fmuGI8JA23NkIfcbn944GLd2193CEap7ZC1BHqs94RZiSuAUknpVOaYDbQ79D/NQjyEqZVsrVEl TkB1JVGYUp8BD2bZVTfOAY+f4og8jOlC2ISWQP9JHB/9g70FVw9HWZ47qq3A0vJsYbs4GApo246 0XONNArAoWRmBXXg4jUy4RI3Y0J6hoQzB+4Y7P6oPLFEsOXv1QUxLxiQ2QkeKlHqjx96+l0uCNl 4FTeaTwIr8uUY60G3GdT6RWGzTyz4/q79jeokPRAjz/JlWmjKX0JIsVxnBXQAPBAgJvxc+j5MQk 9VZxHgMrq8WMo3F55vkF8euguI21AZKg== X-Received: by 2002:a5d:64c6:0:b0:43c:edaa:f5e7 with SMTP id ffacd0b85a97d-43d64974247mr11812635f8f.14.1775934644764; Sat, 11 Apr 2026 12:10:44 -0700 (PDT) Received: from gmail.com ([2a00:f41:1c39:2cef:2a0c:50ff:fe2f:36f4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d63de2a69sm18093849f8f.4.2026.04.11.12.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Apr 2026 12:10:44 -0700 (PDT) Date: Sat, 11 Apr 2026 21:10:40 +0200 From: "Jose A. Perez de Azpillaga" To: Alexei Starovoitov Cc: bpf , Madalin Bucur , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Simon Horman , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , Network Development , LKML Subject: Re: [RFC PATCH] bpf: cpumap: report queue_index to xdp_rxq_info Message-ID: References: <20260411175134.771552-1-azpijr@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Sat, Apr 11, 2026 at 11:09:56AM -0700, Alexei Starovoitov wrote: > On Sat, Apr 11, 2026 at 10:51 AM Jose A. Perez de Azpillaga > wrote: > > > > When a packet is redirected to a CPU map entry, > > cpu_map_bpf_prog_run_xdp() reconstructs a minimal xdp_rxq_info from > > xdp_frame fields (dev_rx and mem_type) before re-running the BPF program > > on the target CPU. However, queue_index was never preserved across the > > CPU boundary, so BPF programs running in cpumap context always observe > > ctx->rx_queue_index == 0, regardless of which hardware queue originally > > received the packet. > > > > Fix this by storing the originating queue_index in struct xdp_frame, > > following the same pattern already established for dev_rx and mem_type. > > The field is populated from rxq->queue_index in > > xdp_convert_buff_to_frame() during NAPI context, when the rxq_info is > > still valid, and restored into the reconstructed rxq_info in > > cpu_map_bpf_prog_run_xdp(). > > > > Also use xdpf->queue_index in __xdp_build_skb_from_frame() to call > > skb_record_rx_queue(), which was previously listed as missing > > information in that function's comment. > > > > Also propagate queue_index in dpaa_a050385_wa_xdpf(), which manually > > constructs a new xdp_frame from an uninitialized page. Without this, > > queue_index would contain stale data from the page allocator. > > > > Signed-off-by: Jose A. Perez de Azpillaga > > --- > > Note: this patch was only compiled, not tested. > > > > drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 1 + > > include/net/xdp.h | 4 +++- > > kernel/bpf/cpumap.c | 2 +- > > net/core/xdp.c | 2 +- > > 4 files changed, 6 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c > > index 3edc8d142dd5..00e36b0ac74d 100644 > > --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c > > +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c > > @@ -2281,6 +2281,7 @@ static int dpaa_a050385_wa_xdpf(struct dpaa_priv *priv, > > new_xdpf->headroom = priv->tx_headroom; > > new_xdpf->frame_sz = DPAA_BP_RAW_SIZE; > > new_xdpf->mem_type = MEM_TYPE_PAGE_ORDER0; > > + new_xdpf->queue_index = xdpf->queue_index; > > > > /* Release the initial buffer */ > > xdp_return_frame_rx_napi(xdpf); > > diff --git a/include/net/xdp.h b/include/net/xdp.h > > index aa742f413c35..6db10e6a8864 100644 > > --- a/include/net/xdp.h > > +++ b/include/net/xdp.h > > @@ -297,10 +297,11 @@ struct xdp_frame { > > u32 headroom; > > u32 metasize; /* uses lower 8-bits */ > > /* Lifetime of xdp_rxq_info is limited to NAPI/enqueue time, > > - * while mem_type is valid on remote CPU. > > + * while mem_type and queue_index are valid on remote CPU. > > */ > > enum xdp_mem_type mem_type:32; > > struct net_device *dev_rx; /* used by cpumap */ > > + u32 queue_index; /* used by cpumap */ > > u32 frame_sz; > > u32 flags; /* supported values defined in xdp_buff_flags */ > > }; > > @@ -441,6 +442,7 @@ struct xdp_frame *xdp_convert_buff_to_frame(struct xdp_buff *xdp) > > > > /* rxq only valid until napi_schedule ends, convert to xdp_mem_type */ > > xdp_frame->mem_type = xdp->rxq->mem.type; > > + xdp_frame->queue_index = xdp->rxq->queue_index; > > > > return xdp_frame; > > } > > diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c > > index 5e59ab896f05..448da572de9a 100644 > > --- a/kernel/bpf/cpumap.c > > +++ b/kernel/bpf/cpumap.c > > @@ -197,7 +197,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu, > > > > rxq.dev = xdpf->dev_rx; > > rxq.mem.type = xdpf->mem_type; > > - /* TODO: report queue_index to xdp_rxq_info */ > > + rxq.queue_index = xdpf->queue_index; > > This is like 5th time people attempt to address this TODO. > > Just remove that comment. Don't send broken patches. oh... okay. but I have a question, since the bot detected something I didn't and queue_index should be propagated in xdp_convert_zc_to_xdp_frame(), or maybe intentional? is it better to do as you said, removing the comment, or doing what the bot said with proper test? -- regards, jose a. p-a