From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 0FFAD36C0DD; Tue, 17 Feb 2026 13:54:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771336479; cv=none; b=a3xgnts8Fx0RI64m/kKzOINh2zOYBMgbrXfyU0j8qu7nk8RYfbyJ/JvdD6dZQ1KgffPl5nDbWIhqKifDMb1VHv7OnL40hQS1ACoTCm7UCALTw30UeMWXVOoBy7ml0J6vm5LVv0147DQCBdMsSSZSMNnZ4V4sZCuttRwxIcgHKMk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771336479; c=relaxed/simple; bh=Pr5awygYQuh7iIYR86mN2Hg8u0umXUaK380MImSUGhc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZVvdjgTisQXlzIPmgNlSEN2NoLPw8TsKXHaqyF3VLhS5Z/Xv4aZ+z+WNgGhaWJoKlpNRe22MygHNzUWIV8Is52hClb7zzrbiVCVN/y+lGBS1ehHLjM0FJ4Q9GOUsTQbTHA8iQTmKkHeQXlx0EbZ2g1EwJgG9YCTQHw3Z/UHkdiI= 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=TbdicJoi; arc=none smtp.client-ip=198.175.65.21 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="TbdicJoi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1771336479; x=1802872479; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Pr5awygYQuh7iIYR86mN2Hg8u0umXUaK380MImSUGhc=; b=TbdicJoiD6UuxB2UyeRACln/D8QK+X1qKvyM6E7KlbU5K3UfRUA8Srbi zmfamxCcVAluDAsXNbA5gKAcyuUQXCM3vomMNNWf94wro0QlkVWKwp7vv qYZ+NPjpljwzK3i8RoapARIB7qxFnw3APQbmHPxLi/efDZRXCZhzwLEQ/ VtBCo34u64dZF5bJeSOLXKKFnZG1aiwtIhXFD2XA2eRY2jkw+GXLj/9p0 ZpQJH3K6gHK3tGPMZcZH7dsam3UkdkAeNov/dZ+kySuXOUINVZkuS341Q QroxxiPEElS/4Wxah4sCvFpKJAjp5y36OAwnd8tY4ezGRiZ6M2U7+KMou Q==; X-CSE-ConnectionGUID: aDsDQaEsTc2cg3nBRlM2kQ== X-CSE-MsgGUID: 7lmo3mp6Raqmmx0Sjy7N9Q== X-IronPort-AV: E=McAfee;i="6800,10657,11703"; a="72292091" X-IronPort-AV: E=Sophos;i="6.21,296,1763452800"; d="scan'208";a="72292091" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2026 05:54:38 -0800 X-CSE-ConnectionGUID: QvCnT4lATxuWcPafI9z0ng== X-CSE-MsgGUID: RsN5tqERQBCTRUqxEnvzHA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,296,1763452800"; d="scan'208";a="218421153" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa005.fm.intel.com with ESMTP; 17 Feb 2026 05:54:30 -0800 Received: from lincoln.igk.intel.com (lincoln.igk.intel.com [10.102.21.235]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 7127B28795; Tue, 17 Feb 2026 13:54:27 +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 v3 2/9] xsk: introduce helper to determine rxq->frag_size Date: Tue, 17 Feb 2026 14:24:40 +0100 Message-ID: <20260217132450.1936200-3-larysa.zaremba@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260217132450.1936200-1-larysa.zaremba@intel.com> References: <20260217132450.1936200-1-larysa.zaremba@intel.com> Precedence: bulk X-Mailing-List: netdev@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") 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