From patchwork Wed Jun 14 09:00:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Mikityanskiy X-Patchwork-Id: 13279745 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 41B455681; Wed, 14 Jun 2023 09:01:14 +0000 (UTC) Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8F5410E9; Wed, 14 Jun 2023 02:01:12 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4f649db9b25so8077789e87.0; Wed, 14 Jun 2023 02:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686733270; x=1689325270; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=16nsX0+9N3hRh738OBEyt4yBOSc7ZXuiX6hwR3DgKkk=; b=beD1yzLP/Zxi0B+E4FAM41gdyriLUS8Ue+MbUfsxbGewuiu2TeeZ2jG5ynRPdZjlqM BJ3uFI/tilPioj5m953DDJ5BWLToL/GRB4FCc8H1tZaiec5hDap+gqm1+kzGUcmgEkT2 HPncxRxBWHim+aIkPiq4++v8JarRsgTnbGMA+xyq4RPVkE8UOYTiEOJhrGcUgq8kuhN7 XgHper3O89ck8mIG47vKIL3Mgl4kvMeqXTH7o8PBX/Kh0R2wN9xbDLhVIlJ8fy6MdZ8l RmwimY/wetE8d63f2W2SEMRnMwCfxDCutC4wr4dZFcglucz01Uxj4CIVr25N6CGwQChG U3ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686733270; x=1689325270; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=16nsX0+9N3hRh738OBEyt4yBOSc7ZXuiX6hwR3DgKkk=; b=mIGCIxz+OFdyh5O6hugilV5/78MfzTtAsZaOk4mWZkJK8/4QK3BPjlRW41SRArN2MI /N11ehN7lG3+/AbJr3ZrKAEeBumrnS2VNjt5c5TXQ3aStjxlvpvCRJMKaeVFKN+4d6LD xFVeJHUZqPeBV4+Bso/+dHYLFis4b1MxkD7ysfQHyjQc6sKfem2aHeZBn6yEAr8MXQ6j jmHm8m6uFPvkCGGgIswNHtlcRhdcSU6OTUdPZrLkHtV5EAtrIeVhyT4ETPMk8m1YogKu 1PHXxssFQ9rvqVfvd3oSSCL2nQ/9TArRlbPrFUspDCKVYC0NeCvMQBYFMtD/mLg+5oKO VRAg== X-Gm-Message-State: AC+VfDzjXZzXX39NKleqwZ9Cz/yMWTaSY6EM0vn/xLTy7h5uV06cR8Tz pgRz5Ev5kfqm870yuOvhFS2//IzsnEg56QcF X-Google-Smtp-Source: ACHHUZ5xdQKq8pO+87nB+XkUsNYT5BVWdaf8OGpbPq/ce+CHTDp8Xcp5UVou/kk8qKZsTYb9TY9BVw== X-Received: by 2002:a19:7101:0:b0:4f3:b61a:a94b with SMTP id m1-20020a197101000000b004f3b61aa94bmr6943226lfc.53.1686733270436; Wed, 14 Jun 2023 02:01:10 -0700 (PDT) Received: from localhost (tor-project-exit5.dotsrc.org. [185.129.61.5]) by smtp.gmail.com with ESMTPSA id u7-20020ac243c7000000b004f42718cbb1sm2036467lfl.292.2023.06.14.02.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jun 2023 02:01:10 -0700 (PDT) From: Maxim Mikityanskiy To: netdev@vger.kernel.org, Saeed Mahameed Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Gal Pressman , Tariq Toukan , bpf@vger.kernel.org, Maxim Mikityanskiy Subject: [PATCH net-next v4 1/2] net/mlx5e: XDP, Allow growing tail for XDP multi buffer Date: Wed, 14 Jun 2023 12:00:05 +0300 Message-ID: <20230614090006.594909-2-maxtram95@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230614090006.594909-1-maxtram95@gmail.com> References: <20230614090006.594909-1-maxtram95@gmail.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The cited commits missed passing frag_size to __xdp_rxq_info_reg, which is required by bpf_xdp_adjust_tail to support growing the tail pointer in fragmented packets. Pass the missing parameter when the current RQ mode allows XDP multi buffer. Fixes: ea5d49bdae8b ("net/mlx5e: Add XDP multi buffer support to the non-linear legacy RQ") Fixes: 9cb9482ef10e ("net/mlx5e: Use fragments of the same size in non-linear legacy RQ with XDP") Signed-off-by: Maxim Mikityanskiy Cc: Tariq Toukan Reviewed-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/en/params.c | 8 ++++++-- drivers/net/ethernet/mellanox/mlx5/core/en/params.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 ++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c index 9c94807097cb..5ce28ff7685f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c @@ -732,7 +732,8 @@ static void mlx5e_rx_compute_wqe_bulk_params(struct mlx5e_params *params, static int mlx5e_build_rq_frags_info(struct mlx5_core_dev *mdev, struct mlx5e_params *params, struct mlx5e_xsk_param *xsk, - struct mlx5e_rq_frags_info *info) + struct mlx5e_rq_frags_info *info, + u32 *xdp_frag_size) { u32 byte_count = MLX5E_SW2HW_MTU(params, params->sw_mtu); int frag_size_max = DEFAULT_FRAG_SIZE; @@ -845,6 +846,8 @@ static int mlx5e_build_rq_frags_info(struct mlx5_core_dev *mdev, info->log_num_frags = order_base_2(info->num_frags); + *xdp_frag_size = info->num_frags > 1 && params->xdp_prog ? PAGE_SIZE : 0; + return 0; } @@ -989,7 +992,8 @@ int mlx5e_build_rq_param(struct mlx5_core_dev *mdev, } default: /* MLX5_WQ_TYPE_CYCLIC */ MLX5_SET(wq, wq, log_wq_sz, params->log_rq_mtu_frames); - err = mlx5e_build_rq_frags_info(mdev, params, xsk, ¶m->frags_info); + err = mlx5e_build_rq_frags_info(mdev, params, xsk, ¶m->frags_info, + ¶m->xdp_frag_size); if (err) return err; ndsegs = param->frags_info.num_frags; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/params.h b/drivers/net/ethernet/mellanox/mlx5/core/en/params.h index a5d20f6d6d9c..6800949dafbc 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/params.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/params.h @@ -24,6 +24,7 @@ struct mlx5e_rq_param { u32 rqc[MLX5_ST_SZ_DW(rqc)]; struct mlx5_wq_param wq; struct mlx5e_rq_frags_info frags_info; + u32 xdp_frag_size; }; struct mlx5e_sq_param { diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index a7c526ee5024..a5bdf78955d7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -641,7 +641,7 @@ static void mlx5e_free_mpwqe_rq_drop_page(struct mlx5e_rq *rq) } static int mlx5e_init_rxq_rq(struct mlx5e_channel *c, struct mlx5e_params *params, - struct mlx5e_rq *rq) + u32 xdp_frag_size, struct mlx5e_rq *rq) { struct mlx5_core_dev *mdev = c->mdev; int err; @@ -665,7 +665,8 @@ static int mlx5e_init_rxq_rq(struct mlx5e_channel *c, struct mlx5e_params *param if (err) return err; - return xdp_rxq_info_reg(&rq->xdp_rxq, rq->netdev, rq->ix, c->napi.napi_id); + return __xdp_rxq_info_reg(&rq->xdp_rxq, rq->netdev, rq->ix, c->napi.napi_id, + xdp_frag_size); } static int mlx5_rq_shampo_alloc(struct mlx5_core_dev *mdev, @@ -2240,7 +2241,7 @@ static int mlx5e_open_rxq_rq(struct mlx5e_channel *c, struct mlx5e_params *param { int err; - err = mlx5e_init_rxq_rq(c, params, &c->rq); + err = mlx5e_init_rxq_rq(c, params, rq_params->xdp_frag_size, &c->rq); if (err) return err; From patchwork Wed Jun 14 09:00:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Mikityanskiy X-Patchwork-Id: 13279746 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 7C5265681; Wed, 14 Jun 2023 09:01:18 +0000 (UTC) Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C75571BE3; Wed, 14 Jun 2023 02:01:16 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2b1acd41ad2so5275021fa.3; Wed, 14 Jun 2023 02:01:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686733275; x=1689325275; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hdbmDAjyIdavit0Ud8BynopPjAykxFuTm+oqG8KfGUU=; b=H4OL3sFwX4A1zeSBAwsfuTy5oyOVFcxQRoIbJ8VQ/lCA6CXdRNGJ0yFCkUN42MZlCG cOLayfWvLGmFoAtbJvU2lXEwEo+VVTkwAMJ/YUqADnFGVi61BskB5qOEYkrKDW+M4AZX 65v6Gl1nBrAeCxIeXyRFPLyDU4DtBLvX09Zjf2IpK9vo18b+DRoC6Tts34XUzd+YKXNg pS4E7uJW9G/FEsJUwwpEOCmJId2r2js7RXnPzN42WLgsuCvibbx4TnDEx4+8anEQ3MJ/ Y6LNp7w5URrHI2oIn1MBTGmvCb44gu8HIW9hGfPcxMEqLsKJ8uUNMyy5OwCdGRhnG5Xd TUzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686733275; x=1689325275; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hdbmDAjyIdavit0Ud8BynopPjAykxFuTm+oqG8KfGUU=; b=JAsV/9IomP1/NhZOUzh/zRecXzAHKE2JRTpJbmC2rUf2JiwuH8e1hPHyeX8r15s6Cb qh/QVDJA8kMFVQYuqUiPu111RLJjrtTugv6bqQXgecYR6M5JJ+OLq8pkzoN66ujRhudn hzsLkqD0w4a9rsAoDSvYbJm6GL26HfqS/mE1zFIlquXlPs1NHfBYU/UBTfOJ8rS9rht8 S4RRuLwIWmM4MZ8Hgq+UX4u0wyInetDDpQIQc7P0pv3GSGhEKwiIstP/qMdWhWUnYqd5 Lhj+nUyPfdXXWndPxYupQoNmIeDG52Q8ykJhrQmyXn8ycJIdrat/L9URdj562mED9OqR zSNA== X-Gm-Message-State: AC+VfDyUv8AEM9UMgT3cAnLjTXxTmBZt3J18+sXgs/OZu+KAzs5CSCgI 6q0xtVGnFobuhGsWXqUMtq8HjG9NC/T9XabN X-Google-Smtp-Source: ACHHUZ7nFUaCkEnxV03Os0dohxWzIRD8T8/u80nOHmsoEmbQoU9pzV/B3lNx2SzsrKuBNRtkvJTUHQ== X-Received: by 2002:a2e:990d:0:b0:2af:bf0d:e1c8 with SMTP id v13-20020a2e990d000000b002afbf0de1c8mr6447306lji.12.1686733274582; Wed, 14 Jun 2023 02:01:14 -0700 (PDT) Received: from localhost (tor-project-exit5.dotsrc.org. [185.129.61.5]) by smtp.gmail.com with ESMTPSA id j15-20020a2e850f000000b002ab3ea4e566sm2483799lji.58.2023.06.14.02.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jun 2023 02:01:14 -0700 (PDT) From: Maxim Mikityanskiy To: netdev@vger.kernel.org, Saeed Mahameed Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Gal Pressman , Tariq Toukan , bpf@vger.kernel.org, Maxim Mikityanskiy Subject: [PATCH net-next v4 2/2] net/mlx5e: xsk: Set napi_id to support busy polling on XSK RQ Date: Wed, 14 Jun 2023 12:00:06 +0300 Message-ID: <20230614090006.594909-3-maxtram95@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230614090006.594909-1-maxtram95@gmail.com> References: <20230614090006.594909-1-maxtram95@gmail.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The cited commit missed setting napi_id on XSK RQs, it only affected regular RQs. Add the missing part to support socket busy polling on XSK RQs. Fixes: a2740f529da2 ("net/mlx5e: xsk: Set napi_id to support busy polling") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c index ed279f450976..36826b582484 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c @@ -86,7 +86,7 @@ static int mlx5e_init_xsk_rq(struct mlx5e_channel *c, if (err) return err; - return xdp_rxq_info_reg(&rq->xdp_rxq, rq->netdev, rq_xdp_ix, 0); + return xdp_rxq_info_reg(&rq->xdp_rxq, rq->netdev, rq_xdp_ix, c->napi.napi_id); } static int mlx5e_open_xsk_rq(struct mlx5e_channel *c, struct mlx5e_params *params,