Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3062126rwb; Mon, 15 Aug 2022 17:11:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR7wyvf4I5FRUNTDVnMVHNP/05d/00+qS+t1WFeFlDJnnUw3qZy6qp++kxMp9MqfWQxFIccm X-Received: by 2002:a05:6402:51d1:b0:43e:f2d2:fa25 with SMTP id r17-20020a05640251d100b0043ef2d2fa25mr16471939edd.31.1660608678535; Mon, 15 Aug 2022 17:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660608678; cv=none; d=google.com; s=arc-20160816; b=uSIRP+nez4inwMT6tlG6ZQD4lwNEMZfK01FVw6KPGldTWN2kzSr59prvfMN7VYqyyQ INPn9T4BbMUieqfK87QrYNOvQf9wTUIY2QcOMkQnw1LfvQWkzXRTdP6dt/WxBJ0zfEf9 VuJT06cLcfIwDZ9tzPGpkd23DIUvP+2wu3i8PlhFOcRZ3p6XHs5Jm6j+X/Uz5+7TFEeQ WoHoGHKBZwop8xxy6HJC1TI6s/alhTI5IfLjEmJV0uk2gOdoBC0vMN2TS+sWy4CuGZpK f8YR+3ebsIVJ/kqFCj445xdKcn4fbs7fBdqpnXZ4w3berDBKHK8RE7mnVxy+Ko93eIKn vR6Q== 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=99YPLeBe5dLHJW6G/mJvHT+GP6tupHog4dXBEUUSJNc=; b=wQWUPqaZB+rywUg6X2+7iXUZkGyUnbfHjZ/EcEAPPVSi4E5U61zrcLpYr8CXgJrAJJ YrJLMXsF8y1USSNcChwgo1S1lheW3JmTTWlm18a/mCJZPELeOI/kDeIXuGWQxiR+YWBd ZUIjTi+9MdvrPzD/WkNqo5wTCZWIa69ddsfejtc7YnJQhzjGwdIlRQ0HWkIpPQhgO4O/ kgrapbpcOcEfZRxlO/6yC1+gXuDWobTU9TcMGaaXZQj/fJ27OpPm0lRsgzTCf8RxGRYq Qv1cLaTUgknbItXmQZGRqraOdjfX20qZY5zL5ropjnS66Ww/Ve4MopGV5Y9duPKgD3l4 APgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XVewf33a; 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 m14-20020a1709062b8e00b00730cd8b838bsi8051579ejg.556.2022.08.15.17.10.36; Mon, 15 Aug 2022 17:11:18 -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=XVewf33a; 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 S1356315AbiHPAHW (ORCPT + 99 others); Mon, 15 Aug 2022 20:07:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354695AbiHOX7V (ORCPT ); Mon, 15 Aug 2022 19:59:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5209D165714; Mon, 15 Aug 2022 13:21:06 -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 E644060F71; Mon, 15 Aug 2022 20:21:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF938C433D6; Mon, 15 Aug 2022 20:21:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594865; bh=d81SpGm0M4TlfKgu5wg3zAROwFZkB0VCTAP0j0omRMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XVewf33auy5f6ZyRTLfd4C6Qfj4M/i3IsWksEgMv0nSL1Q8gD8rFrOCZ1UNRAaDIb 3bM7dNtRo47LIVeQjDaWYCjveySaY4d5mrz92OX/RkCN3ut0+1N2eENZAiV3PEzCsA cOkszZH33aOJtdSlFgDRG+Vr70YAk4ZLWUj9B4Dg= 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.19 0550/1157] net/mlx5e: xsk: Account for XSK RQ UMRs when calculating ICOSQ size Date: Mon, 15 Aug 2022 19:58:26 +0200 Message-Id: <20220815180501.640681325@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 3c1edfa33aa7..e025040350ba 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c @@ -790,8 +790,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