Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3023172rwb; Mon, 15 Aug 2022 16:20:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR5nVs/FCQLEcrttD4YXPXYAwwkKgCSkyZ84EXANydBWjTV84MpZ/GGj1bwbbcloNPf+692p X-Received: by 2002:a05:6402:3687:b0:43c:e5d3:d50d with SMTP id ej7-20020a056402368700b0043ce5d3d50dmr16786741edb.174.1660605641512; Mon, 15 Aug 2022 16:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605641; cv=none; d=google.com; s=arc-20160816; b=B7sfWFnbIafDmb1ReV8K7n22YjBU5xtYr4OgodSbq0TCRr986yxbRSjaA+231BKflR MHenngK0iwd7wzNEg3aidhcPMLWF9oHpY6HsdBCJ2Gk16AE68bJTQiev4teUpWBwK1lb WVOO50tLybUNTrAwr/86eKcNp1yXlbesDRGt23DAVI/mEX93VnXwtnkLDKTossz7XqTU nvWNMrjBvR8YQxTr4v79MdNAiOr6Tja80RdRVLoNPoqNtFDrohdpQfYwIXAm4/NbsOox l3mMaeO9nXvYWxjQCna13uf7vNIwSAKxrbHd4HV8WXiz5pm79YEbj78CZVT05UOlYNm0 DeMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dDpUtWHcx2g0o7kNKMak2jAS1NsReUDMtXhUx8RHTxk=; b=wIFUE64zymr8Y+olDcFJx2nRePvJwCuleCqLU1kSqBskTyyi8H2loBomjSewvUPdr9 X+VwcjFj0JhTZOtT6BJz7uy6g1r1pE+eueIg4ZWhjpNidS5ZfzKmqKI3xRmgqF74LhIY 5HZTm0KIudZb+F9Hxk0xKIy9oCtsWBT4uwoGtC465rVeNafjhmxydOgl63d3XdFI9Rt7 uNx9FWTRYDkh8OybyOIHTlDdqUwJccioubZedOvkEB0zyscxhMHxdJJFbmbF4U8FDxCc 2uGaooPwpAFXuRiSRVHrSR79aAaw5L4Kpu7CVxfvj6xLC1AqyIYKZBJC5BMeGzY0uqX2 5SzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sQMS38i4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a17090668c300b0073139f82da3si7392709ejr.184.2022.08.15.16.20.16; Mon, 15 Aug 2022 16:20:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sQMS38i4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347625AbiHOVZ7 (ORCPT + 99 others); Mon, 15 Aug 2022 17:25:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343941AbiHOVRR (ORCPT ); Mon, 15 Aug 2022 17:17:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23B1529829; Mon, 15 Aug 2022 12:20:34 -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 ams.source.kernel.org (Postfix) with ESMTPS id A3550B810A3; Mon, 15 Aug 2022 19:20:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFAD8C433C1; Mon, 15 Aug 2022 19:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591231; bh=77p0F+fhXx8FwC7ansFUH3g5OXXvP6hKPXv1B2Jh3cc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sQMS38i4JHbgM7Qhdn68Z63JifgT9mUqkSmb930Ur4aWVzTtCnk4usiX76eUXAptt IUuMbpZsu9TemAaC1+MaeCIHRMaBqIlmN/bOsOtTpdZtnB066jxDuwbNFr2S9ZbkbR WUosSeb1VwkCKiu1PgKkWdwvFFlsu5BESIhQ3YxU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.18 0514/1095] net/mlx5e: xsk: Account for XSK RQ UMRs when calculating ICOSQ size Date: Mon, 15 Aug 2022 19:58:33 +0200 Message-Id: <20220815180450.804339679@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Mikityanskiy [ Upstream commit 52586d2f56b3e4f528ca7268d65074e92c936681 ] ICOSQ is used to post UMR WQEs for both regular RQ and XSK RQ. However, space in ICOSQ is reserved only for the regular RQ, which may cause ICOSQ overflows when using XSK (the most risk is on activating channels). This commit fixes the issue by reserving space for XSK UMR WQEs as well. As XSK may be enabled without restarting the channel and recreating the ICOSQ, this space is reserved unconditionally. Fixes: db05815b36cb ("net/mlx5e: Add XSK zero-copy support") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/en/params.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c index 08fd1370a8b0..75da12e1b0c7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c @@ -797,8 +797,20 @@ static u8 mlx5e_build_icosq_log_wq_sz(struct mlx5_core_dev *mdev, return MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE; wqebbs = MLX5E_UMR_WQEBBS * BIT(mlx5e_get_rq_log_wq_sz(rqp->rqc)); + + /* If XDP program is attached, XSK may be turned on at any time without + * restarting the channel. ICOSQ must be big enough to fit UMR WQEs of + * both regular RQ and XSK RQ. + * Although mlx5e_mpwqe_get_log_rq_size accepts mlx5e_xsk_param, it + * doesn't affect its return value, as long as params->xdp_prog != NULL, + * so we can just multiply by 2. + */ + if (params->xdp_prog) + wqebbs *= 2; + if (params->packet_merge.type == MLX5E_PACKET_MERGE_SHAMPO) wqebbs += mlx5e_shampo_icosq_sz(mdev, params, rqp); + return max_t(u8, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE, order_base_2(wqebbs)); } -- 2.35.1