From patchwork Tue Aug 20 21:56:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13770603 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 78BB014B097 for ; Tue, 20 Aug 2024 21:56:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724190991; cv=none; b=uGUFwdKb0U1nCL/G2aCmapzW5PGwSOYRrqRCPpGLRVQIp48Iyp0YH8FDCpWeEtXaxBtPwwo2yKF71sjKh1RmJdkAHeGFXlesV+aRFe2W4E3PdIc8eaH+pI4P3YBwH20N551AkmGu3WaMVTn5jbxl4LYyPreLY59iu5uoHIUCSaM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724190991; c=relaxed/simple; bh=4AYFULdqWid0C0iMbMROdh5dwLQWttJFADbXMg87PoE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sWNaZzstsHC3KPWtWRYGypQzhoIg0yuQr9ijkv1I5HCKF8NYAzj4i4VL9Di5fcYY7uIiDMxV54djkKeZ7/VIvMde6p+GOPK+ug+3D+mnDaGhqNXazPktWxriNM5BELI4PK8BZRcXplj2Zc/+0KqLqmcUuyWfCU/++097/iQDBOM= 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=NQN0OjLm; arc=none smtp.client-ip=198.175.65.10 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="NQN0OjLm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724190988; x=1755726988; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4AYFULdqWid0C0iMbMROdh5dwLQWttJFADbXMg87PoE=; b=NQN0OjLmlzyUqs6XUemJ+J90xnnE3b/DRNJwHCkFgZQ1J/5zokyR3M0G Lh4+iuDC6nHLWu2swOxPxb+LBg59/fU/RBjuhfd8fRYKLJw6NLbS3ljXB SRROIv4/bkCuq2rUOnxTP07QQaEGEt/oMpybT0l8AV21d1rqF6kjZw05k E+yCvSNwNHilNMQRvZZiOcrX9zXGb2awRs4iWcu8iC2oEosyHuAxMmITW EsK8+daUguvEsgpQ8EptTlwqX5ChcuAUSQaxEkXPj/M9bc/mGUEPv9Du+ hgn4fOJ3Z1cNNDThNmiqI3zw/z5u38+UDEQRiHjsymSvZq6Rzeg34aYss w==; X-CSE-ConnectionGUID: ZskaNYDgRISaiMsi+wbWbw== X-CSE-MsgGUID: nJSu1nWCTV6brNBlVOh9Qg== X-IronPort-AV: E=McAfee;i="6700,10204,11170"; a="39979347" X-IronPort-AV: E=Sophos;i="6.10,162,1719903600"; d="scan'208";a="39979347" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2024 14:56:27 -0700 X-CSE-ConnectionGUID: WPjgt2mxQfe1yEgBE75HMg== X-CSE-MsgGUID: 5GWa06zzRCiM23R3HN31Qg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,162,1719903600"; d="scan'208";a="65833192" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa004.jf.intel.com with ESMTP; 20 Aug 2024 14:56:27 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Maciej Fijalkowski , anthony.l.nguyen@intel.com, Chandan Kumar Rout Subject: [PATCH net 1/4] ice: fix page reuse when PAGE_SIZE is over 8k Date: Tue, 20 Aug 2024 14:56:15 -0700 Message-ID: <20240820215620.1245310-2-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240820215620.1245310-1-anthony.l.nguyen@intel.com> References: <20240820215620.1245310-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Maciej Fijalkowski Architectures that have PAGE_SIZE >= 8192 such as arm64 should act the same as x86 currently, meaning reuse of a page should only take place when no one else is busy with it. Do two things independently of underlying PAGE_SIZE: - store the page count under ice_rx_buf::pgcnt - then act upon its value vs ice_rx_buf::pagecnt_bias when making the decision regarding page reuse Fixes: 2b245cb29421 ("ice: Implement transmit and NAPI support") Signed-off-by: Maciej Fijalkowski Tested-by: Chandan Kumar Rout (A Contingent Worker at Intel) Signed-off-by: Tony Nguyen Reviewed-by: Jacob Keller --- drivers/net/ethernet/intel/ice/ice_txrx.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c index 8d25b6981269..50211188c1a7 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c @@ -837,16 +837,15 @@ ice_can_reuse_rx_page(struct ice_rx_buf *rx_buf) if (!dev_page_is_reusable(page)) return false; -#if (PAGE_SIZE < 8192) /* if we are only owner of page we can reuse it */ if (unlikely(rx_buf->pgcnt - pagecnt_bias > 1)) return false; -#else +#if (PAGE_SIZE >= 8192) #define ICE_LAST_OFFSET \ (SKB_WITH_OVERHEAD(PAGE_SIZE) - ICE_RXBUF_2048) if (rx_buf->page_offset > ICE_LAST_OFFSET) return false; -#endif /* PAGE_SIZE < 8192) */ +#endif /* PAGE_SIZE >= 8192) */ /* If we have drained the page fragment pool we need to update * the pagecnt_bias and page count so that we fully restock the @@ -949,12 +948,7 @@ ice_get_rx_buf(struct ice_rx_ring *rx_ring, const unsigned int size, struct ice_rx_buf *rx_buf; rx_buf = &rx_ring->rx_buf[ntc]; - rx_buf->pgcnt = -#if (PAGE_SIZE < 8192) - page_count(rx_buf->page); -#else - 0; -#endif + rx_buf->pgcnt = page_count(rx_buf->page); prefetchw(rx_buf->page); if (!size) From patchwork Tue Aug 20 21:56:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13770602 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 067901C57B2 for ; Tue, 20 Aug 2024 21:56:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724190990; cv=none; b=e8ejMokZFUJgP46ro8M4VZCM8VyguIwSAwYfCWIY3NGwUD7tt7daitPeQLJNw7CxQphHpXopdsoGX1l92HQI1HVbpOAFySxxnCntS8qnMJuFFyZPy5T8tff9nJGwiKgbvBgvyMtDS6QuTM6tdj81xB4Pvw/OfxVLKflf2XIKNN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724190990; c=relaxed/simple; bh=wsKf9eE9kJGkLbzW/JeheBQsVn5U8J67ATi0Kasp2kA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LDWse1UjSDFGL7OV8uVZAWtnZXq/CMPgCB9sETW8Ptn8jQ1xYJgoY+fEPN9neUA3IJQDafK7jBz0NfQFEprr6Pzml7Lxd9WQtadxHO/Gd5hFmRIuYe6zjqpcK9bELQR5ou7XY4OytulYz4V2x5G/yxMHHQxotisu+q9ID8SMbJI= 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=iuWgsOZy; arc=none smtp.client-ip=198.175.65.10 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="iuWgsOZy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724190989; x=1755726989; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wsKf9eE9kJGkLbzW/JeheBQsVn5U8J67ATi0Kasp2kA=; b=iuWgsOZyIDPCIymQx7iuvyhkMk72K1TDFCaIcZ+LtOhs2BDGK8uLYSeJ 2oota+hivfY9vecruFBhnrBsNt5B92jvD+NKs10MYdz7ueRHyJCgZ/cRN QFp8gzoApaoL2Re44UBiegq2txvsILIapu5MP/H8ofMdnTwErmAGZZUkM GK0N7AqINJ09CMgVCQSl1ARhXwBikMxJc0qnrOGM8YDKbK5uThJfPZPxD cTtCH1bu9ahXVAmKjBJh296yGydIiRNkwHj3dpE5zu1Y16D8j2cmKH1xs ZnBsdkbcP7/XGcW73C3oeVDnooyWeooUYoO7dDX7Fjj/S3gyLdzkbALWM A==; X-CSE-ConnectionGUID: aaBI0hGaQqC4Aaa/hwznuQ== X-CSE-MsgGUID: N+3vvny6SkCdxwL03aJDsw== X-IronPort-AV: E=McAfee;i="6700,10204,11170"; a="39979352" X-IronPort-AV: E=Sophos;i="6.10,162,1719903600"; d="scan'208";a="39979352" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2024 14:56:27 -0700 X-CSE-ConnectionGUID: hiFpdIwLRqmJdxOmOsKJKg== X-CSE-MsgGUID: vOcB/TNqRJW+AUD6MTjDTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,162,1719903600"; d="scan'208";a="65833195" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa004.jf.intel.com with ESMTP; 20 Aug 2024 14:56:27 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Maciej Fijalkowski , anthony.l.nguyen@intel.com, Luiz Capitulino , Chandan Kumar Rout Subject: [PATCH net 2/4] ice: fix ICE_LAST_OFFSET formula Date: Tue, 20 Aug 2024 14:56:16 -0700 Message-ID: <20240820215620.1245310-3-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240820215620.1245310-1-anthony.l.nguyen@intel.com> References: <20240820215620.1245310-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Maciej Fijalkowski For bigger PAGE_SIZE archs, ice driver works on 3k Rx buffers. Therefore, ICE_LAST_OFFSET should take into account ICE_RXBUF_3072, not ICE_RXBUF_2048. Fixes: 7237f5b0dba4 ("ice: introduce legacy Rx flag") Suggested-by: Luiz Capitulino Signed-off-by: Maciej Fijalkowski Tested-by: Chandan Kumar Rout (A Contingent Worker at Intel) Signed-off-by: Tony Nguyen Reviewed-by: Jacob Keller --- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c index 50211188c1a7..4b690952bb40 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c @@ -842,7 +842,7 @@ ice_can_reuse_rx_page(struct ice_rx_buf *rx_buf) return false; #if (PAGE_SIZE >= 8192) #define ICE_LAST_OFFSET \ - (SKB_WITH_OVERHEAD(PAGE_SIZE) - ICE_RXBUF_2048) + (SKB_WITH_OVERHEAD(PAGE_SIZE) - ICE_RXBUF_3072) if (rx_buf->page_offset > ICE_LAST_OFFSET) return false; #endif /* PAGE_SIZE >= 8192) */ From patchwork Tue Aug 20 21:56:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13770599 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 85E861C68B8; Tue, 20 Aug 2024 21:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724190992; cv=none; b=Qg8Ng6MdvtoYUsQExfylR5lbRDKicda3xzowNGzKvayheaHIcscYZwggel9rDnoGCkzH414LWPAIeSTc7Q4FrK/lVnTRbcVXq2BdizAsyO/+FmW0HsQWTf11RgrMNLL8Q5vE1FO6b+QomOlnof/0FjGepPYNdsUlxQdL1nEXvQE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724190992; c=relaxed/simple; bh=Lb/Ehf65q7tsiYxP3mnqhYBxjHJUzbXChgkfsw1N1GQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HHG4IY1gij+oANUyI16l2L31jeRDOGsNAqfOd6F76BDA2NilYN61u9y+hWASxn/kHUsmDKTBiNLUFytwj52K9voW9+v0YSRot+GPwWQ/oK/hxUpBgL1f2HEt6m3bafGpFXF8UTsUuDVVoefiXazdAHrlVBWZnwYxyB/OYOzJqY4= 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=Il6KrC8G; arc=none smtp.client-ip=198.175.65.10 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="Il6KrC8G" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724190990; x=1755726990; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Lb/Ehf65q7tsiYxP3mnqhYBxjHJUzbXChgkfsw1N1GQ=; b=Il6KrC8G9uIoCvT2e3ah2rljN3iz7vs3DyFUK/J4FiSG+bJxRrJdMdCD U94IwhpQ+1QRf4eLtYuXYRCPHFsfdk3bWoa1ell0cmMyRItIalfUBFJGj vaP7sxHOqAVv1ig1q8B9i3YxSQLybnVsyfXBkTboHANMHvcpS/uUdWt0E vRrAjIijt8dg0xu95MBjLAgXAMt4SFe+lZgO3Z3C8rZCMI0SLHqmXzKHT +/tb0xQEhP1ajafTCYvpwzYDwLa5JyOepGmUrRgtQjQPn46IKVzfEHLp+ gWUtpTTcYkBPzvJdh6dVsF3PYPqdUqmhcdvqcYGW5p2ymKJgwImQHeEZL w==; X-CSE-ConnectionGUID: Pw+0EjOdTseD4wkHABknxg== X-CSE-MsgGUID: FL7xxhKGScOdg9t7ZWBOKA== X-IronPort-AV: E=McAfee;i="6700,10204,11170"; a="39979354" X-IronPort-AV: E=Sophos;i="6.10,162,1719903600"; d="scan'208";a="39979354" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2024 14:56:27 -0700 X-CSE-ConnectionGUID: mBJTlRScQtGVJldGZ+160A== X-CSE-MsgGUID: TGIdQL88R36zgnCVxF1d2g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,162,1719903600"; d="scan'208";a="65833199" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa004.jf.intel.com with ESMTP; 20 Aug 2024 14:56:27 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Maciej Fijalkowski , anthony.l.nguyen@intel.com, magnus.karlsson@intel.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, bpf@vger.kernel.org, Luiz Capitulino , Chandan Kumar Rout Subject: [PATCH net 3/4] ice: fix truesize operations for PAGE_SIZE >= 8192 Date: Tue, 20 Aug 2024 14:56:17 -0700 Message-ID: <20240820215620.1245310-4-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240820215620.1245310-1-anthony.l.nguyen@intel.com> References: <20240820215620.1245310-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Maciej Fijalkowski When working on multi-buffer packet on arch that has PAGE_SIZE >= 8192, truesize is calculated and stored in xdp_buff::frame_sz per each processed Rx buffer. This means that frame_sz will contain the truesize based on last received buffer, but commit 1dc1a7e7f410 ("ice: Centrallize Rx buffer recycling") assumed this value will be constant for each buffer, which breaks the page recycling scheme and mess up the way we update the page::page_offset. To fix this, let us work on constant truesize when PAGE_SIZE >= 8192 instead of basing this on size of a packet read from Rx descriptor. This way we can simplify the code and avoid calculating truesize per each received frame and on top of that when using xdp_update_skb_shared_info(), current formula for truesize update will be valid. This means ice_rx_frame_truesize() can be removed altogether. Furthermore, first call to it within ice_clean_rx_irq() for 4k PAGE_SIZE was redundant as xdp_buff::frame_sz is initialized via xdp_init_buff() in ice_vsi_cfg_rxq(). This should have been removed at the point where xdp_buff struct started to be a member of ice_rx_ring and it was no longer a stack based variable. There are two fixes tags as my understanding is that the first one exposed us to broken truesize and page_offset handling and then second introduced broken skb_shared_info update in ice_{construct,build}_skb(). Reported-and-tested-by: Luiz Capitulino Closes: https://lore.kernel.org/netdev/8f9e2a5c-fd30-4206-9311-946a06d031bb@redhat.com/ Fixes: 1dc1a7e7f410 ("ice: Centrallize Rx buffer recycling") Fixes: 2fba7dc5157b ("ice: Add support for XDP multi-buffer on Rx side") Signed-off-by: Maciej Fijalkowski Tested-by: Chandan Kumar Rout (A Contingent Worker at Intel) Signed-off-by: Tony Nguyen Reviewed-by: Jacob Keller --- drivers/net/ethernet/intel/ice/ice_base.c | 21 ++++++++++++++- drivers/net/ethernet/intel/ice/ice_txrx.c | 33 ----------------------- 2 files changed, 20 insertions(+), 34 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_base.c b/drivers/net/ethernet/intel/ice/ice_base.c index 1facf179a96f..f448d3a84564 100644 --- a/drivers/net/ethernet/intel/ice/ice_base.c +++ b/drivers/net/ethernet/intel/ice/ice_base.c @@ -512,6 +512,25 @@ static void ice_xsk_pool_fill_cb(struct ice_rx_ring *ring) xsk_pool_fill_cb(ring->xsk_pool, &desc); } +/** + * ice_get_frame_sz - calculate xdp_buff::frame_sz + * @rx_ring: the ring being configured + * + * Return frame size based on underlying PAGE_SIZE + */ +static unsigned int ice_get_frame_sz(struct ice_rx_ring *rx_ring) +{ + unsigned int frame_sz; + +#if (PAGE_SIZE >= 8192) + frame_sz = rx_ring->rx_buf_len; +#else + frame_sz = ice_rx_pg_size(rx_ring) / 2; +#endif + + return frame_sz; +} + /** * ice_vsi_cfg_rxq - Configure an Rx queue * @ring: the ring being configured @@ -576,7 +595,7 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring) } } - xdp_init_buff(&ring->xdp, ice_rx_pg_size(ring) / 2, &ring->xdp_rxq); + xdp_init_buff(&ring->xdp, ice_get_frame_sz(ring), &ring->xdp_rxq); ring->xdp.data = NULL; ring->xdp_ext.pkt_ctx = &ring->pkt_ctx; err = ice_setup_rx_ctx(ring); diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c index 4b690952bb40..c9bc3f1add5d 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c @@ -521,30 +521,6 @@ int ice_setup_rx_ring(struct ice_rx_ring *rx_ring) return -ENOMEM; } -/** - * ice_rx_frame_truesize - * @rx_ring: ptr to Rx ring - * @size: size - * - * calculate the truesize with taking into the account PAGE_SIZE of - * underlying arch - */ -static unsigned int -ice_rx_frame_truesize(struct ice_rx_ring *rx_ring, const unsigned int size) -{ - unsigned int truesize; - -#if (PAGE_SIZE < 8192) - truesize = ice_rx_pg_size(rx_ring) / 2; /* Must be power-of-2 */ -#else - truesize = rx_ring->rx_offset ? - SKB_DATA_ALIGN(rx_ring->rx_offset + size) + - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) : - SKB_DATA_ALIGN(size); -#endif - return truesize; -} - /** * ice_run_xdp - Executes an XDP program on initialized xdp_buff * @rx_ring: Rx ring @@ -1154,11 +1130,6 @@ int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget) bool failure; u32 first; - /* Frame size depend on rx_ring setup when PAGE_SIZE=4K */ -#if (PAGE_SIZE < 8192) - xdp->frame_sz = ice_rx_frame_truesize(rx_ring, 0); -#endif - xdp_prog = READ_ONCE(rx_ring->xdp_prog); if (xdp_prog) { xdp_ring = rx_ring->xdp_ring; @@ -1217,10 +1188,6 @@ int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget) hard_start = page_address(rx_buf->page) + rx_buf->page_offset - offset; xdp_prepare_buff(xdp, hard_start, offset, size, !!offset); -#if (PAGE_SIZE > 4096) - /* At larger PAGE_SIZE, frame_sz depend on len size */ - xdp->frame_sz = ice_rx_frame_truesize(rx_ring, size); -#endif xdp_buff_clear_frags_flag(xdp); } else if (ice_add_xdp_frag(rx_ring, xdp, rx_buf, size)) { break; From patchwork Tue Aug 20 21:56:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Nguyen X-Patchwork-Id: 13770604 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 A8E421C7B6E for ; Tue, 20 Aug 2024 21:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724190993; cv=none; b=nGUKg5auH3GNAYPXW7SFrwTCX0bVSHUQB+zb7xS0zYUjda3Q7uTGjZ8beokpoElv38retsLQq6s5f+n2KuBGyEDgbj6f7G06d0apNmnmpszDFqNqEandwics3skq1T/9XqHlK9NzcQa8Hu0ikLiwDsFFvtFLD1RN5N/pFu9fb64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724190993; c=relaxed/simple; bh=+2RQnSPwcfiNm6wDwozdIESBZgkBc3OG6qciaOVbNQA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KdnssDs4/Bbdr0+z5u5p6/8NM/IXNIcemxetojOh/VxR2CJLGOshNE1aYw3pYk2irE6pj9myE1eLCVsj6FNiwm41Xiq4PlO3nTZok6X74taLE9iuXHECWLneBZa2S0jutgxspfVsACSVyPhe0rNxppsKds36z8oxWJgHf5yfABA= 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=QRvtc80K; arc=none smtp.client-ip=198.175.65.10 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="QRvtc80K" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724190992; x=1755726992; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+2RQnSPwcfiNm6wDwozdIESBZgkBc3OG6qciaOVbNQA=; b=QRvtc80KrQzeXopUUSLADrflPOVoCSkh+NE2qBFZYDQEY/nQLoaYk71w IT4UML48b8nrZZWenGOWTUZ1VHSLYigyBjM1f/iYwZ0NAqK/Mdr0GLN5R 7iozoUNTqSSZAee/R97qu5DXCm8hltyVTfNsoUIGVJpgXGMnlKBvKmEah +L94FRJkK0gfJorbCrrCRJ4FzffLVqJqNeVsWcDCuI3dFhRtjSyTMUYSo uE2oExVqQmqrefBlnrurgzgW2YCg1dM0NThBtbQDwAPiJ60bQkmrOSs2q AtbO547p+UB/sk1p51rjyy6xMZhcTK1u4lQ0OR0FfIXcSC4NMr8cduHi7 g==; X-CSE-ConnectionGUID: bskJ2bMzR7+SncqiRaCasw== X-CSE-MsgGUID: PpPiJWJSSkCOcQtbXk5OeQ== X-IronPort-AV: E=McAfee;i="6700,10204,11170"; a="39979360" X-IronPort-AV: E=Sophos;i="6.10,162,1719903600"; d="scan'208";a="39979360" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Aug 2024 14:56:27 -0700 X-CSE-ConnectionGUID: vQjNn8odTE29jrqVrw+6RA== X-CSE-MsgGUID: LKwWbPf8R4uekdoyIUQGKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,162,1719903600"; d="scan'208";a="65833202" Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa004.jf.intel.com with ESMTP; 20 Aug 2024 14:56:27 -0700 From: Tony Nguyen To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: Michal Swiatkowski , anthony.l.nguyen@intel.com, horms@kernel.org, ksundara@redhat.com, Wojciech Drewek , Jiri Pirko Subject: [PATCH net 4/4] ice: use internal pf id instead of function number Date: Tue, 20 Aug 2024 14:56:18 -0700 Message-ID: <20240820215620.1245310-5-anthony.l.nguyen@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240820215620.1245310-1-anthony.l.nguyen@intel.com> References: <20240820215620.1245310-1-anthony.l.nguyen@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Michal Swiatkowski Use always the same pf id in devlink port number. When doing pass-through the PF to VM bus info func number can be any value. Fixes: 2ae0aa4758b0 ("ice: Move devlink port to PF/VF struct") Reviewed-by: Wojciech Drewek Suggested-by: Jiri Pirko Signed-off-by: Michal Swiatkowski Signed-off-by: Tony Nguyen Reviewed-by: Jacob Keller --- drivers/net/ethernet/intel/ice/devlink/devlink_port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink_port.c b/drivers/net/ethernet/intel/ice/devlink/devlink_port.c index 00fed5a61d62..62ef8e2fb5f1 100644 --- a/drivers/net/ethernet/intel/ice/devlink/devlink_port.c +++ b/drivers/net/ethernet/intel/ice/devlink/devlink_port.c @@ -337,7 +337,7 @@ int ice_devlink_create_pf_port(struct ice_pf *pf) return -EIO; attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL; - attrs.phys.port_number = pf->hw.bus.func; + attrs.phys.port_number = pf->hw.pf_id; /* As FW supports only port split options for whole device, * set port split options only for first PF. @@ -455,7 +455,7 @@ int ice_devlink_create_vf_port(struct ice_vf *vf) return -EINVAL; attrs.flavour = DEVLINK_PORT_FLAVOUR_PCI_VF; - attrs.pci_vf.pf = pf->hw.bus.func; + attrs.pci_vf.pf = pf->hw.pf_id; attrs.pci_vf.vf = vf->vf_id; ice_devlink_set_switch_id(pf, &attrs.switch_id);