All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Haakon Bugge <haakon.bugge@oracle.com>
Cc: OFED mailing list <linux-rdma@vger.kernel.org>,
	Leon Romanovsky <leon@kernel.org>
Subject: Re: cm_process_routed_req() does not resonate well with RoCE systems
Date: Tue, 23 Mar 2021 15:08:56 -0300	[thread overview]
Message-ID: <20210323180856.GL2356281@nvidia.com> (raw)
In-Reply-To: <D96DEBF5-042B-4B92-A512-EA6757020960@oracle.com>

On Fri, Mar 19, 2021 at 03:07:07PM +0000, Haakon Bugge wrote:
> 
> 
> > On 18 Mar 2021, at 20:21, Haakon Bugge <haakon.bugge@oracle.com> wrote:
> > 
> > With the introduction of RoCE systems, a CM REQ message will contain (pasted from Wireshark):
> > 
> > Primary Hop Limit: 0x40
> > .... 0... = Primary Subnet Local: 0x0
> > 
> > This because cma_resolve_iboe_route() has:
> > 
> >        if (((struct sockaddr *)&id_priv->id.route.addr.dst_addr)->sa_family != AF_IB)
> >                /* TODO: get the hoplimit from the inet/inet6 device */
> >                route->path_rec->hop_limit = addr->dev_addr.hoplimit;
> >        else
> >                route->path_rec->hop_limit = 1;
> > 
> > The addr->dev_addr.hoplimit is coming from addr4_resolve(), which has:
> > 
> > 	addr->hoplimit = ip4_dst_hoplimit(&rt->dst);
> > 
> > ip4_dst_hoplimit() returns the value of the sysctl net.ipv4.ip_default_ttl in this case (64).
> > 
> > For the purpose of this case, consider the CM REQ to have the Primary SL != 0.
> > 
> > When this REQ gets processed by cm_req_handler(), the cm_process_routed_req() function is called.
> > 
> > Since the Primary Subnet Local value is zero in the request, and since this is RoCE (Primary Local LID is permissive), the following statement will be executed:
> > 
> > 	IBA_SET(CM_REQ_PRIMARY_SL, req_msg, wc->sl);
> > 
> > At least on the system I ran on, which was equipped with a
> > Mellanox CX-5 HCA, the wc->sl is zero. Hence, the request to setup
> > a connection using an SL != zero, will not be honoured, and a
> > connection using SL zero will be created instead.
> > 
> > As a side note, in cm_process_routed_req(), we have:
> > 
> > 	IBA_SET(CM_REQ_PRIMARY_REMOTE_PORT_LID, req_msg, wc->dlid_path_bits);
> > 
> > which is strange, since a LID is 16 bits, whereas dlid_path_bits is only eight.
> > 
> > I am uncertain about the correct fix here. Any input appreciated.
> 
> I intend to send a patch doing:
> 
> +++ b/drivers/infiniband/core/cm.c
> @@ -2138,7 +2138,8 @@ static int cm_req_handler(struct cm_work *work)
>                 goto destroy;
>         }
>  
> -       cm_process_routed_req(req_msg, work->mad_recv_wc->wc);
> +       if (cm_id_priv->av.ah_attr.type != RDMA_AH_ATTR_TYPE_ROCE)
> +               cm_process_routed_req(req_msg, work->mad_recv_wc->wc);
>  
>         memset(&work->path[0], 0, sizeof(work->path[0]));
>         if (cm_req_has_alt_path(req_msg))
> > 
> if I do not get a push back.

This does seem reasonable, but I don't understand the underlying
issue, why is anything in roce land touching the SL? Are you trying to
use the SL as a proxy for the TOS bits?

Jason

  reply	other threads:[~2021-03-23 18:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 19:21 cm_process_routed_req() does not resonate well with RoCE systems Haakon Bugge
2021-03-19 15:07 ` Haakon Bugge
2021-03-23 18:08   ` Jason Gunthorpe [this message]
2021-03-23 18:38     ` Haakon Bugge

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=20210323180856.GL2356281@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=haakon.bugge@oracle.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.