From patchwork Mon Jul 25 10:56:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 12927964 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F3A0C43334 for ; Mon, 25 Jul 2022 10:56:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233755AbiGYK4b (ORCPT ); Mon, 25 Jul 2022 06:56:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231635AbiGYK4a (ORCPT ); Mon, 25 Jul 2022 06:56:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 129A818E23; Mon, 25 Jul 2022 03:56:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B3C4AB80E4D; Mon, 25 Jul 2022 10:56:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19A3BC341C8; Mon, 25 Jul 2022 10:56:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658746587; bh=K5DIL+xxLusnURdb8tLNll8g6Jaq2ufLifV4EGhaUsc=; h=From:To:Cc:Subject:Date:From; b=LxTJBLhCS7zGFrYRDQlycCmQdzrLsPN19al44cnaHbCqSVB68atvts4abdZY2kQv8 duxFIo39G8LzpwmUDRplt97Hyzjh9B8lwU/IGxnE8BzuqGnuTZhnkWyUYctCSWhwsh x5FW91n4rHqV3NKrXw6O3dNTZBK9P03hnrj1JpcBeTBGYCZ3AxvFEJbXCNWCiemVNG cLyYiYS9hynp1A97v04az7SkI/6eHzTMbpoH9Z5bXx1va6TOooQUrudi3TPEF37zxc rE1CtUyidzKQoJbr1KQZXbDpIRhqgSaLVG2lA4YHYbKukX7+//wmsQz9VJK8vuMVE9 udhbpwJ7UqiIA== From: Lorenzo Bianconi To: bpf@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, hawk@kernel.org, john.fastabend@gmail.com, lorenzo.bianconi@redhat.com Subject: [PATCH bpf-next] xdp: report rx queue index in xdp_frame Date: Mon, 25 Jul 2022 12:56:19 +0200 Message-Id: <181f994e13c816116fa69a1e92c2f69e6330f749.1658746417.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net Report rx queue index in xdp_frame according to the xdp_buff xdp_rxq_info pointer. xdp_frame queue_index is currently used in cpumap code to covert the xdp_frame into a xdp_buff. xdp_frame size is not increased adding queue_index since an alignment padding in the structure is used to insert queue_index field. Signed-off-by: Lorenzo Bianconi --- include/net/xdp.h | 2 ++ kernel/bpf/cpumap.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/net/xdp.h b/include/net/xdp.h index 04c852c7a77f..3567866b0af5 100644 --- a/include/net/xdp.h +++ b/include/net/xdp.h @@ -172,6 +172,7 @@ struct xdp_frame { struct xdp_mem_info mem; struct net_device *dev_rx; /* used by cpumap */ u32 flags; /* supported values defined in xdp_buff_flags */ + u32 queue_index; }; static __always_inline bool xdp_frame_has_frags(struct xdp_frame *frame) @@ -301,6 +302,7 @@ struct xdp_frame *xdp_convert_buff_to_frame(struct xdp_buff *xdp) /* rxq only valid until napi_schedule ends, convert to xdp_mem_info */ xdp_frame->mem = xdp->rxq->mem; + xdp_frame->queue_index = xdp->rxq->queue_index; return xdp_frame; } diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c index f4860ac756cd..09a792d088b3 100644 --- a/kernel/bpf/cpumap.c +++ b/kernel/bpf/cpumap.c @@ -228,7 +228,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu, rxq.dev = xdpf->dev_rx; rxq.mem = xdpf->mem; - /* TODO: report queue_index to xdp_rxq_info */ + rxq.queue_index = xdpf->queue_index; xdp_convert_frame_to_buff(xdpf, &xdp);