From: Leon Romanovsky <leon@kernel.org>
To: Dennis Dalessandro <dennis.dalessandro@intel.com>
Cc: jgg@ziepe.ca, dledford@redhat.com,
Mike Marciniszyn <mike.marcinisyzn@intel.com>,
linux-rdma@vger.kernel.org,
Sadanand Warrier <sadanand.warrier@intel.com>,
Kaike Wan <kaike.wan@intel.com>
Subject: Re: [PATCH v2 for-next 07/16] IB/ipoib: Increase ipoib Datagram mode MTU's upper limit
Date: Tue, 24 Mar 2020 07:45:36 +0200 [thread overview]
Message-ID: <20200324054536.GR650439@unreal> (raw)
In-Reply-To: <20200323231511.64035.16923.stgit@awfm-01.aw.intel.com>
On Mon, Mar 23, 2020 at 07:15:12PM -0400, Dennis Dalessandro wrote:
> From: Kaike Wan <kaike.wan@intel.com>
>
> Currently the ipoib UD mtu is restricted to 4K bytes. Remove this
> limitation so that the IPOIB module can potentially use an MTU (in UD
> mode) that is bounded by the MTU of the underlying device. A field is
> added to the ib_port_attr structure to indicate the maximum physical
> MTU the underlying device supports.
>
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> Reviewed-by: Mike Marciniszyn <mike.marcinisyzn@intel.com>
> Signed-off-by: Sadanand Warrier <sadanand.warrier@intel.com>
> Signed-off-by: Kaike Wan <kaike.wan@intel.com>
> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
> ---
> drivers/infiniband/hw/hfi1/qp.c | 18 +-----
> drivers/infiniband/hw/hfi1/verbs.c | 2 +
> drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 -
> drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 11 ++-
> include/rdma/ib_verbs.h | 77 ++++++++++++++++++++++++
> include/rdma/opa_port_info.h | 10 ---
> 6 files changed, 88 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/infiniband/hw/hfi1/qp.c b/drivers/infiniband/hw/hfi1/qp.c
> index f8e733a..0c2ae9f 100644
> --- a/drivers/infiniband/hw/hfi1/qp.c
> +++ b/drivers/infiniband/hw/hfi1/qp.c
> @@ -1,5 +1,5 @@
> /*
> - * Copyright(c) 2015 - 2019 Intel Corporation.
> + * Copyright(c) 2015 - 2020 Intel Corporation.
> *
> * This file is provided under a dual BSD/GPLv2 license. When using or
> * redistributing this file, you may do so under either license.
> @@ -186,15 +186,6 @@ static void flush_iowait(struct rvt_qp *qp)
> write_sequnlock_irqrestore(lock, flags);
> }
>
> -static inline int opa_mtu_enum_to_int(int mtu)
> -{
> - switch (mtu) {
> - case OPA_MTU_8192: return 8192;
> - case OPA_MTU_10240: return 10240;
> - default: return -1;
> - }
> -}
> -
> /**
> * This function is what we would push to the core layer if we wanted to be a
> * "first class citizen". Instead we hide this here and rely on Verbs ULPs
> @@ -202,15 +193,10 @@ static inline int opa_mtu_enum_to_int(int mtu)
> */
> static inline int verbs_mtu_enum_to_int(struct ib_device *dev, enum ib_mtu mtu)
> {
> - int val;
> -
> /* Constraining 10KB packets to 8KB packets */
> if (mtu == (enum ib_mtu)OPA_MTU_10240)
> mtu = OPA_MTU_8192;
> - val = opa_mtu_enum_to_int((int)mtu);
> - if (val > 0)
> - return val;
> - return ib_mtu_enum_to_int(mtu);
> + return opa_mtu_enum_to_int((enum opa_mtu)mtu);
> }
>
> int hfi1_check_modify_qp(struct rvt_qp *qp, struct ib_qp_attr *attr,
> diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c
> index c61b291..19d5d00 100644
> --- a/drivers/infiniband/hw/hfi1/verbs.c
> +++ b/drivers/infiniband/hw/hfi1/verbs.c
> @@ -1439,6 +1439,8 @@ static int query_port(struct rvt_dev_info *rdi, u8 port_num,
> 4096 : hfi1_max_mtu), IB_MTU_4096);
> props->active_mtu = !valid_ib_mtu(ppd->ibmtu) ? props->max_mtu :
> mtu_to_enum(ppd->ibmtu, IB_MTU_4096);
> + props->phys_mtu = HFI1_CAP_IS_KSET(AIP) ? hfi1_max_mtu :
> + ib_mtu_enum_to_int(props->max_mtu);
>
> return 0;
> }
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> index 81b8227..c8018e0 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> @@ -1858,7 +1858,7 @@ static int ipoib_parent_init(struct net_device *ndev)
> priv->port);
> return result;
> }
> - priv->max_ib_mtu = ib_mtu_enum_to_int(attr.max_mtu);
> + priv->max_ib_mtu = rdma_mtu_from_attr(priv->ca, priv->port, &attr);
>
> result = ib_query_pkey(priv->ca, priv->port, 0, &priv->pkey);
> if (result) {
> diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
> index b9e9562..7166ee9b 100644
> --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
> @@ -218,6 +218,7 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
> struct rdma_ah_attr av;
> int ret;
> int set_qkey = 0;
> + int mtu;
>
> mcast->mcmember = *mcmember;
>
> @@ -240,13 +241,11 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast,
> priv->broadcast->mcmember.flow_label = mcmember->flow_label;
> priv->broadcast->mcmember.hop_limit = mcmember->hop_limit;
> /* assume if the admin and the mcast are the same both can be changed */
> + mtu = rdma_mtu_enum_to_int(priv->ca, priv->port,
> + priv->broadcast->mcmember.mtu);
> if (priv->mcast_mtu == priv->admin_mtu)
> - priv->admin_mtu =
> - priv->mcast_mtu =
> - IPOIB_UD_MTU(ib_mtu_enum_to_int(priv->broadcast->mcmember.mtu));
> - else
> - priv->mcast_mtu =
> - IPOIB_UD_MTU(ib_mtu_enum_to_int(priv->broadcast->mcmember.mtu));
> + priv->admin_mtu = IPOIB_UD_MTU(mtu);
> + priv->mcast_mtu = IPOIB_UD_MTU(mtu);
>
> priv->qkey = be32_to_cpu(priv->broadcast->mcmember.qkey);
> spin_unlock_irq(&priv->lock);
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index babfdb0..da8d0d6 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -462,6 +462,11 @@ enum ib_mtu {
> IB_MTU_4096 = 5
> };
>
> +enum opa_mtu {
> + OPA_MTU_8192 = 6,
> + OPA_MTU_10240 = 7
> +};
> +
> static inline int ib_mtu_enum_to_int(enum ib_mtu mtu)
> {
> switch (mtu) {
> @@ -488,6 +493,28 @@ static inline enum ib_mtu ib_mtu_int_to_enum(int mtu)
> return IB_MTU_256;
> }
>
> +static inline int opa_mtu_enum_to_int(enum opa_mtu mtu)
> +{
> + switch (mtu) {
> + case OPA_MTU_8192:
> + return 8192;
> + case OPA_MTU_10240:
> + return 10240;
> + default:
> + return(ib_mtu_enum_to_int((enum ib_mtu)mtu));
> + }
> +}
> +
> +static inline enum opa_mtu opa_mtu_int_to_enum(int mtu)
> +{
> + if (mtu >= 10240)
> + return OPA_MTU_10240;
> + else if (mtu >= 8192)
> + return OPA_MTU_8192;
> + else
> + return ((enum opa_mtu)ib_mtu_int_to_enum(mtu));
> +}
Is it possible to include opa_port_info.h in the ib_verbs.h and leave all
those functions there?
Thanks
next prev parent reply other threads:[~2020-03-24 5:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 23:14 [PATCH v2 for-next 00/16] New hfi1 feature: Accelerated IP Dennis Dalessandro
2020-03-23 23:14 ` [PATCH v2 for-next 01/16] IB/hfi1: Add accelerated IP capability bit Dennis Dalessandro
2020-03-23 23:14 ` [PATCH v2 for-next 02/16] IB/hfi1: Add functions to transmit datagram ipoib packets Dennis Dalessandro
2020-03-23 23:14 ` [PATCH v2 for-next 03/16] IB/hfi1: Add the transmit side of a datagram ipoib RDMA netdev Dennis Dalessandro
2020-03-23 23:14 ` [PATCH v2 for-next 04/16] IB/hfi1: Remove module parameter for KDETH qpns Dennis Dalessandro
2020-03-23 23:14 ` [PATCH v2 for-next 05/16] IB/{rdmavt, hfi1}: Implement creation of accelerated UD QPs Dennis Dalessandro
2020-03-23 23:15 ` [PATCH v2 for-next 06/16] IB/hfi1: RSM rules for AIP Dennis Dalessandro
2020-03-23 23:15 ` [PATCH v2 for-next 07/16] IB/ipoib: Increase ipoib Datagram mode MTU's upper limit Dennis Dalessandro
2020-03-24 5:45 ` Leon Romanovsky [this message]
2020-03-24 13:46 ` Dennis Dalessandro
2020-05-11 16:00 ` Dennis Dalessandro
2020-03-27 16:49 ` Jason Gunthorpe
2020-05-11 16:04 ` Dennis Dalessandro
2020-05-11 17:11 ` Jason Gunthorpe
2020-05-11 17:23 ` Dennis Dalessandro
2020-03-23 23:15 ` [PATCH v2 for-next 08/16] IB/hfi1: Rename num_vnic_contexts as num_netdev_contexts Dennis Dalessandro
2020-03-23 23:15 ` [PATCH v2 for-next 09/16] IB/hfi1: Add functions to receive accelerated ipoib packets Dennis Dalessandro
2020-03-23 23:15 ` [PATCH v2 for-next 10/16] IB/hfi1: Add interrupt handler functions for accelerated ipoib Dennis Dalessandro
2020-03-23 23:15 ` [PATCH v2 for-next 11/16] IB/hfi1: Add rx functions for dummy netdev Dennis Dalessandro
2020-03-23 23:15 ` [PATCH v2 for-next 12/16] IB/hfi1: Activate the " Dennis Dalessandro
2020-03-23 23:15 ` [PATCH v2 for-next 13/16] IB/{hfi1, ipoib, rdma}: Broadcast ping sent packets which exceeded mtu size Dennis Dalessandro
2020-03-23 23:15 ` [PATCH v2 for-next 14/16] IB/hfi1: Add packet histogram trace event Dennis Dalessandro
2020-03-23 23:16 ` [PATCH v2 for-next 15/16] IB/ipoib: Add capability to switch between datagram and connected mode Dennis Dalessandro
2020-03-23 23:16 ` [PATCH v2 for-next 16/16] IB/hfi1: Enable the transmit side of the datagram ipoib netdev Dennis Dalessandro
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=20200324054536.GR650439@unreal \
--to=leon@kernel.org \
--cc=dennis.dalessandro@intel.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=kaike.wan@intel.com \
--cc=linux-rdma@vger.kernel.org \
--cc=mike.marcinisyzn@intel.com \
--cc=sadanand.warrier@intel.com \
/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