[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1652778276-2986-11-git-send-email-longli@linuxonhyperv.com>
Date: Tue, 17 May 2022 02:04:34 -0700
From: longli@...uxonhyperv.com
To: "K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Jason Gunthorpe <jgg@...pe.ca>,
Leon Romanovsky <leon@...nel.org>
Cc: linux-hyperv@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
Long Li <longli@...rosoft.com>
Subject: [PATCH 10/12] net: mana: Define max values for SGL entries
From: Long Li <longli@...rosoft.com>
The number of maximum SGl entries should be computed from the maximum
WQE size for the intended queue type, witj the corresponding OOB data
size. This guarantees the hardware queue can successfully queue requests
up to the queue depth exposed to the upper layer.
Signed-off-by: Long Li <longli@...rosoft.com>
---
drivers/net/ethernet/microsoft/mana/mana_en.c | 2 +-
include/linux/mana/gdma.h | 7 +++++++
include/linux/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 928b14a7ee1f..6eb5eca5524d 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -187,7 +187,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/linux/mana/gdma.h b/include/linux/mana/gdma.h
index bc8cd9528937..d6a970118f4c 100644
--- a/include/linux/mana/gdma.h
+++ b/include/linux/mana/gdma.h
@@ -436,6 +436,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/linux/mana/mana.h b/include/linux/mana/mana.h
index 29e14ad8b930..1cf77a03bff2 100644
--- a/include/linux/mana/mana.h
+++ b/include/linux/mana/mana.h
@@ -264,8 +264,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;
@@ -275,7 +273,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
Powered by blists - more mailing lists