From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (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 5233E425CD8; Mon, 2 Mar 2026 16:49:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772470170; cv=none; b=dWVFCLzzLbwHo7i3ubT3wLP5l5dQZxVeoK48FCN+K668c0Fa8lmaoTQvhhAsEHTYxt9Pv4XosQH8apDsn8Np+8uPcXBw7AKP5F7dncenbV/gY/KlRr33yFHG/LQNNXgrU39EbhEjqV66TorHxDGCys/JoU9sKyPSKfjKmcLlQR8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772470170; c=relaxed/simple; bh=VyI9tznp8tu429E89NaR4hulwef2E9ypuAT+OFDs/OQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e/d3TO+ZAg8NGXB03l6781+H4LL6Dq3Tv4IetxFO2JfL2KMaP1H+9Yn3BTvBeJkzmvPBSYsz5p/rCEmskUSNjuPYFM4i+GmhvHBX7QiCuuuLG1E4ydvmBwAZNW/UcCjLei83A37rcknOhbdeqdH7xfeJo5JORs4sSrQY6gfaB+s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gwKQEsCt; arc=none smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gwKQEsCt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772470168; x=1804006168; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VyI9tznp8tu429E89NaR4hulwef2E9ypuAT+OFDs/OQ=; b=gwKQEsCtja1fA1ruyFcbORriT2qSLY71EZ6Mse+gfbuCINM0v9KM9lrA yjlsgGjuy+K+/ekU+zIv0+MBIsWWKGQjiuk8p8NBetIhrhi7JgGdZBXql eej0dqnAyLYTXlEHDgieDK32i3z2xqXlsnZB8GHJ8QN9+U5+KhLzt/LkA /Tif95kaftvgpxTzGgRrCwv9bjhBeTtNi2nHB2GdPLGuY/c3z/b5cen3w oWRWpGjGZMOsWqgagttorstsaNgbSdkoexdy26ayC6uopEaSXUMC0bLPs r5mXoX/avom8h8GvbDbIiSzO8+h+0qehJsX4UJNqd5E28Lz5XOAn/9xu2 Q==; X-CSE-ConnectionGUID: DUYAVQMDSam+WWB3jZXTZw== X-CSE-MsgGUID: U7+UWcXHRjmR3ck7S/w2Nw== X-IronPort-AV: E=McAfee;i="6800,10657,11717"; a="73450722" X-IronPort-AV: E=Sophos;i="6.21,320,1763452800"; d="scan'208";a="73450722" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2026 08:49:28 -0800 X-CSE-ConnectionGUID: 8Um5qbDhQWCds9WkdWLs/w== X-CSE-MsgGUID: i7JfX0AiSneiW+a0K69bAw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,320,1763452800"; d="scan'208";a="217620805" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orviesa009.jf.intel.com with ESMTP; 02 Mar 2026 08:49:20 -0800 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id EE9FD312CB; Mon, 2 Mar 2026 16:49:16 +0000 (GMT) From: Larysa Zaremba To: bpf@vger.kernel.org Cc: Larysa Zaremba , Claudiu Manoil , Vladimir Oltean , Wei Fang , Clark Wang , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Tony Nguyen , Przemek Kitszel , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Hao Luo , Jiri Olsa , Simon Horman , Shuah Khan , Alexander Lobakin , Maciej Fijalkowski , "Bastien Curutchet (eBPF Foundation)" , Tushar Vyavahare , Jason Xing , =?UTF-8?q?Ricardo=20B=2E=20Marli=C3=A8re?= , Eelco Chaudron , Lorenzo Bianconi , Toke Hoiland-Jorgensen , imx@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kselftest@vger.kernel.org, Aleksandr Loktionov , Dragos Tatulea Subject: [PATCH bpf v4 2/9] xsk: introduce helper to determine rxq->frag_size Date: Mon, 2 Mar 2026 17:17:15 +0100 Message-ID: <20260302161723.858616-3-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260302161723.858616-1-larysa.zaremba@intel.com> References: <20260302161723.858616-1-larysa.zaremba@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit rxq->frag_size is basically a step between consecutive strictly aligned frames. In ZC mode, chunk size fits exactly, but if chunks are unaligned, there is no safe way to determine accessible space to grow tailroom. Report frag_size to be zero, if chunks are unaligned, chunk_size otherwise. Fixes: 24ea50127ecf ("xsk: support mbuf on ZC RX") Reviewed-by: Aleksandr Loktionov Signed-off-by: Larysa Zaremba --- include/net/xdp_sock_drv.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/net/xdp_sock_drv.h b/include/net/xdp_sock_drv.h index 242e34f771cc..09d972f4bd60 100644 --- a/include/net/xdp_sock_drv.h +++ b/include/net/xdp_sock_drv.h @@ -51,6 +51,11 @@ static inline u32 xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool) return xsk_pool_get_chunk_size(pool) - xsk_pool_get_headroom(pool); } +static inline u32 xsk_pool_get_rx_frag_step(struct xsk_buff_pool *pool) +{ + return pool->unaligned ? 0 : xsk_pool_get_chunk_size(pool); +} + static inline void xsk_pool_set_rxq_info(struct xsk_buff_pool *pool, struct xdp_rxq_info *rxq) { @@ -337,6 +342,11 @@ static inline u32 xsk_pool_get_rx_frame_size(struct xsk_buff_pool *pool) return 0; } +static inline u32 xsk_pool_get_rx_frag_step(struct xsk_buff_pool *pool) +{ + return 0; +} + static inline void xsk_pool_set_rxq_info(struct xsk_buff_pool *pool, struct xdp_rxq_info *rxq) { -- 2.52.0