From patchwork Thu Mar 17 18:54:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12784500 X-Patchwork-Delegate: kuba@kernel.org 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 E593AC433EF for ; Thu, 17 Mar 2022 18:54:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237528AbiCQSzr (ORCPT ); Thu, 17 Mar 2022 14:55:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237493AbiCQSzq (ORCPT ); Thu, 17 Mar 2022 14:55:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A0DADFDF7 for ; Thu, 17 Mar 2022 11:54: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 dfw.source.kernel.org (Postfix) with ESMTPS id D8A36617AE for ; Thu, 17 Mar 2022 18:54:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED5DDC340E9; Thu, 17 Mar 2022 18:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647543269; bh=L8brqgHgkfE3Vp7CWJ0SL8hKhSo70n894auJIB/S00s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p6V0Euu1t+PTJGOInCRU3fyJx9yOOmZQKBvOn30XSBXt4plnXlDMeEdZgs3H4ITgl /W9VS+gjyuvBG4JbFGHEAXrpzZG83H/52Jw4hjQKh4R1o85OTCTsLjEOkg0tCQvpj/ FinI/TY/I5iOZ9os5iDKuFDdz7FXglatw6xmDySFBn4uV26WUVdI4zgaU2FfG2cXel ZHpYohiqdRTJHhG0X343Ee4pb6PzCRU1kQhZRyGmxGsWNHLHMHwa0OqlJXtguNA8Xf XYXhjk1AsX/xDtBnTpowd25w4JnJ8n1TlSRUNnmEKP7c+mylDgGP3oLtcMk4XcxnZS Ylo1IeuNGdhUw== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed Subject: [net-next 02/15] net/mlx5e: Add headroom only to the first fragment in legacy RQ Date: Thu, 17 Mar 2022 11:54:11 -0700 Message-Id: <20220317185424.287982-3-saeed@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220317185424.287982-1-saeed@kernel.org> References: <20220317185424.287982-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Maxim Mikityanskiy Currently, rq->buff.headroom is applied to all fragments in legacy RQ. In the linear mode, there is a non-zero headroom, but there is only one fragment per packet. In the non-linear mode, the headroom is zero. This commit changes the logic to apply the headroom only to the first fragment. The current behavior remains the same for both linear and non-linear modes. However, it allows the next commit to enable headroom for the non-linear mode, which will be applied only to the first fragment. Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index 074a44b281b6..6eda906342c0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c @@ -373,12 +373,15 @@ static int mlx5e_alloc_rx_wqe(struct mlx5e_rq *rq, struct mlx5e_rx_wqe_cyc *wqe, int i; for (i = 0; i < rq->wqe.info.num_frags; i++, frag++) { + u16 headroom; + err = mlx5e_get_rx_frag(rq, frag); if (unlikely(err)) goto free_frags; + headroom = i == 0 ? rq->buff.headroom : 0; wqe->data[i].addr = cpu_to_be64(frag->di->addr + - frag->offset + rq->buff.headroom); + frag->offset + headroom); } return 0;