Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4690384rwb; Tue, 20 Sep 2022 18:47:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oeIEBFq0cS18TI62oJ6wQmanHJFAMEN/IpS81R3PQfhV1LcRGZTiP4dK7yqC6Fw4UZPNs X-Received: by 2002:a05:6402:351:b0:44e:1cd2:bd53 with SMTP id r17-20020a056402035100b0044e1cd2bd53mr22239711edw.364.1663724833860; Tue, 20 Sep 2022 18:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663724833; cv=none; d=google.com; s=arc-20160816; b=hVJUm7zhxr2KvWaVa8FL7Td8w4IrZkXF2FVSm6EB7Q23v3jnLiIXY8wllojKdqXex2 +j82abqXU+ODymi9bZCfOV4gjgdMLK3v001DfLrC4gqucOTytWbe8wsU88pcZcBugNrM f9z63DfP3PdQodghCtd9uCNHJDiNW/s4speinEAVxEr+YvxendLieh17uK5j5KJUaYZR oCqhe5ajRhJ2lhPQcJ51/jzDbEG9gjezEMsmownFM37SksjigX3/OhSsSwX+YEhSUKQ8 cL2y1c4KD9+S5y0nuhdLOWcq8Nn8yEjjaNmxgakS25kFOg8Z87F6AP6q8q+Jv5oC+FDu JqbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:reply-to:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=QNQ2kMKcBQ3ac6DkwMqfexPpkCIXQJx8HpTaO+Enzvo=; b=C7rEbDXBX80fLaqykBQzTxQd3WAbT53oXlGydlys5oUGK1bhLg/5PBn5jka3MtakLn 9fx5upXSE4i0/KuWIlHjlmvTHixEsJQaxoro8r4ky2yp5+V2n9ZoTS0LvuPXwSqVBJ+J yxyRrq353/iSHQ7Tk2s3TPkZXiZ7JYgsUnH612PARNqgPthoa2P5fQ7tB8XlF3W1SmWo pw0g5B+XVIx1w/scIhkboj84tCwxHlFZOi5QbMPvRa9aZrF32Z4uFBRotiA4Nd94nRaf WKQuXkWsVF2nQ3AveAbxxZfFKBn0QdN1r1+TyWt5X9ZuJPsvdERs6yQAGeBInHQL9T3U A8dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxonhyperv.com header.s=default header.b=rtimWkTW; 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=linuxonhyperv.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp21-20020a170906c15500b007809246a12dsi1144115ejc.709.2022.09.20.18.46.48; Tue, 20 Sep 2022 18:47:13 -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=@linuxonhyperv.com header.s=default header.b=rtimWkTW; 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=linuxonhyperv.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231478AbiIUBXw (ORCPT + 99 others); Tue, 20 Sep 2022 21:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231379AbiIUBXF (ORCPT ); Tue, 20 Sep 2022 21:23:05 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DF19D7B291; Tue, 20 Sep 2022 18:23:02 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1004) id C3997205DC56; Tue, 20 Sep 2022 18:23:02 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C3997205DC56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1663723382; bh=QNQ2kMKcBQ3ac6DkwMqfexPpkCIXQJx8HpTaO+Enzvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:Reply-To:From; b=rtimWkTW3vXuev2SofrOM7yqxqO8LGugZ58kUKVXvq4yDf6yBKRh5m4HW9xMaRbem Hk9KRziqv9BHAYVic216py+l8VfJbarV5TSYMKxN96dVnodwiP48YJvEMvAqUWgxB4 oQtVzoaoxZssbNYBP03cJV5FHfvqlcPRKNyfcDlA= From: longli@linuxonhyperv.com To: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Jason Gunthorpe , Leon Romanovsky , edumazet@google.com, shiraz.saleem@intel.com, Ajay Sharma Cc: linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Long Li Subject: [Patch v6 09/12] net: mana: Define max values for SGL entries Date: Tue, 20 Sep 2022 18:22:29 -0700 Message-Id: <1663723352-598-10-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1663723352-598-1-git-send-email-longli@linuxonhyperv.com> References: <1663723352-598-1-git-send-email-longli@linuxonhyperv.com> Reply-To: longli@microsoft.com X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_SPF_WL 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: Long Li The number of maximum SGl entries should be computed from the maximum WQE size for the intended queue type and the corresponding OOB data size. This guarantees the hardware queue can successfully queue requests up to the queue depth exposed to the upper layer. Reviewed-by: Dexuan Cui Signed-off-by: Long Li Acked-by: Haiyang Zhang --- drivers/net/ethernet/microsoft/mana/mana_en.c | 2 +- include/net/mana/gdma.h | 7 +++++++ include/net/mana/mana.h | 4 +--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index a79a57644ec3..08d15effc824 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -189,7 +189,7 @@ int mana_start_xmit(struct sk_buff *skb, struct net_device *ndev) pkg.wqe_req.client_data_unit = 0; pkg.wqe_req.num_sge = 1 + skb_shinfo(skb)->nr_frags; - WARN_ON_ONCE(pkg.wqe_req.num_sge > 30); + WARN_ON_ONCE(pkg.wqe_req.num_sge > MAX_TX_WQE_SGL_ENTRIES); if (pkg.wqe_req.num_sge <= ARRAY_SIZE(pkg.sgl_array)) { pkg.wqe_req.sgl = pkg.sgl_array; diff --git a/include/net/mana/gdma.h b/include/net/mana/gdma.h index 0ee3615152b8..9b050aabf76e 100644 --- a/include/net/mana/gdma.h +++ b/include/net/mana/gdma.h @@ -431,6 +431,13 @@ struct gdma_wqe { #define MAX_TX_WQE_SIZE 512 #define MAX_RX_WQE_SIZE 256 +#define MAX_TX_WQE_SGL_ENTRIES ((GDMA_MAX_SQE_SIZE - \ + sizeof(struct gdma_sge) - INLINE_OOB_SMALL_SIZE) / \ + sizeof(struct gdma_sge)) + +#define MAX_RX_WQE_SGL_ENTRIES ((GDMA_MAX_RQE_SIZE - \ + sizeof(struct gdma_sge)) / sizeof(struct gdma_sge)) + struct gdma_cqe { u32 cqe_data[GDMA_COMP_DATA_SIZE / 4]; diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h index 6e9e86fb4c02..713a8f8cca9a 100644 --- a/include/net/mana/mana.h +++ b/include/net/mana/mana.h @@ -265,8 +265,6 @@ struct mana_cq { int budget; }; -#define GDMA_MAX_RQE_SGES 15 - struct mana_recv_buf_oob { /* A valid GDMA work request representing the data buffer. */ struct gdma_wqe_request wqe_req; @@ -276,7 +274,7 @@ struct mana_recv_buf_oob { /* SGL of the buffer going to be sent has part of the work request. */ u32 num_sge; - struct gdma_sge sgl[GDMA_MAX_RQE_SGES]; + struct gdma_sge sgl[MAX_RX_WQE_SGL_ENTRIES]; /* Required to store the result of mana_gd_post_work_request. * gdma_posted_wqe_info.wqe_size_in_bu is required for progressing the -- 2.17.1