Message ID | 1655345240-26411-11-git-send-email-longli@linuxonhyperv.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Jason Gunthorpe |
Headers | show |
Series | Introduce Microsoft Azure Network Adapter (MANA) RDMA driver | expand |
> From: longli@linuxonhyperv.com <longli@linuxonhyperv.com> > Sent: Wednesday, June 15, 2022 7:07 PM > ... > The number of maximum SGl entries should be computed from the maximum s/SGl/SGL > @@ -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)) Can we make these '\' chars aligned? :-) Please refer to the definiton of "lock_requestor" in include/linux/hyperv.h. Reviewed-by: Dexuan Cui <decui@microsoft.com>
> Subject: RE: [Patch v4 10/12] net: mana: Define max values for SGL entries > > > From: longli@linuxonhyperv.com <longli@linuxonhyperv.com> > > Sent: Wednesday, June 15, 2022 7:07 PM ... > > The number of maximum SGl entries should be computed from the maximum > s/SGl/SGL > > > @@ -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)) > > Can we make these '\' chars aligned? :-) Please refer to the definiton of > "lock_requestor" in include/linux/hyperv.h. Will fix this. > > Reviewed-by: Dexuan Cui <decui@microsoft.com>
diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index 5aab7afc9143..9a976d9b6b6f 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/net/mana/gdma.h b/include/net/mana/gdma.h index b1bec8ab5695..ef5de92dd98d 100644 --- a/include/net/mana/gdma.h +++ b/include/net/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/net/mana/mana.h b/include/net/mana/mana.h index aca95c6ba8b3..3a0bc6e0b730 100644 --- a/include/net/mana/mana.h +++ b/include/net/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