From: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>,
"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: Is ib_mtu iboe_get_mtu() slightly off?
Date: Mon, 09 Oct 2017 09:34:33 -0400 [thread overview]
Message-ID: <1507556073.46071.27.camel@redhat.com> (raw)
In-Reply-To: <VI1PR0502MB300886CB47BB3DFDE098A26AD1660-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
On Thu, 2017-09-21 at 02:20 +0000, Parav Pandit wrote:
> > From: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-rdma-
> > owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Roland Dreier
> > Sent: Wednesday, September 20, 2017 7:39 PM
> > To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > Subject: Is ib_mtu iboe_get_mtu() slightly off?
> >
> > We have:
> >
> > static inline enum ib_mtu iboe_get_mtu(int mtu) {
> > /*
> > * reduce IB headers from effective IBoE MTU. 28 stands for
> > * atomic header which is the biggest possible header after
> > BTH
> > */
> > mtu = mtu - IB_GRH_BYTES - IB_BTH_BYTES - 28;
> > ...
> >
> > 28 bytes is the size of the AtomicETH header. But couldn't we have
> > a packet
> > with both AtomicETH and XRCETH (4 more bytes)?
>
> XRCETH + AtomicETH is possible.
> Additionally I guess 4 bytes of ICRC is missing too in calculation.
Since no one rolled a patch for this, I did.
commit 7107ee2ea38fb52ffe81be054657e90863ebe8ab (HEAD -> k.o/for-next)
Author: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Date: Mon Oct 9 09:26:47 2017 -0400
RDMA/core: Fix iboe_get_mtu size calculation
We mistakenly used the size of the largest header possible after
BTH_BYTES without considering that this largest header might actually be
in combination with a few select other headers. So, increase the size
of the largest header number to be the size of the largest possible
combination of headers instead of just the single largest header.
Fixes: 3c86aa70bf67 (RDMA/cm: Add RDMA CM support for IBoE devices)
Reported-by: Roland Drier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
Reported-by: Parav Pandit <parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index ec5008cf5d51..45a03c514437 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -245,10 +245,11 @@ static inline void rdma_addr_set_dgid(struct rdma_dev_addr *dev_addr, union ib_g
static inline enum ib_mtu iboe_get_mtu(int mtu)
{
/*
- * reduce IB headers from effective IBoE MTU. 28 stands for
- * atomic header which is the biggest possible header after BTH
+ * reduce IB headers from effective IBoE MTU. 36 stands for
+ * AtomicETH + XRCETH + ICRC, which is the biggest header
+ * combination possible after BTH
*/
- mtu = mtu - IB_GRH_BYTES - IB_BTH_BYTES - 28;
+ mtu = mtu - IB_GRH_BYTES - IB_BTH_BYTES - 36;
if (mtu >= ib_mtu_enum_to_int(IB_MTU_4096))
return IB_MTU_4096;
--
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
GPG KeyID: B826A3330E572FDD
Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-10-09 13:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-21 0:38 Is ib_mtu iboe_get_mtu() slightly off? Roland Dreier
[not found] ` <CAL1RGDX33tBR=x2sOp_F1605SY5nu_6YALr-XYE_LiuvsHQ1ng-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-09-21 2:20 ` Parav Pandit
[not found] ` <VI1PR0502MB300886CB47BB3DFDE098A26AD1660-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-10-09 13:34 ` Doug Ledford [this message]
[not found] ` <1507556073.46071.27.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-10-09 13:41 ` Leon Romanovsky
[not found] ` <20171009134131.GB1252-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-09 16:14 ` Doug Ledford
[not found] ` <1507565652.46071.33.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-10-09 20:47 ` Parav Pandit
[not found] ` <VI1PR0502MB3008900E038DEF6EEAB719DFD1740-o1MPJYiShExKsLr+rGaxW8DSnupUy6xnnBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-10-10 14:48 ` Doug Ledford
[not found] ` <c27ee8b9-a011-9b0b-b20a-433d9f74d4b1-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-10-10 15:27 ` Parav Pandit
2017-10-10 15:33 ` Leon Romanovsky
[not found] ` <20171010153312.GD2106-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-10 16:13 ` Doug Ledford
2017-10-10 10:29 ` Amrani, Ram
[not found] ` <BN3PR07MB25781502CA573FB383805E48F8750-EldUQEzkDQfpW3VS/XPqkOFPX92sqiQdvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-10 15:26 ` Parav Pandit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1507556073.46071.27.camel@redhat.com \
--to=dledford-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=parav-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox