From: Shawn Bohrer <sbohrer-EgGFQ3RFNTIP7C3xziwOQw@public.gmane.org>
To: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Eli Cohen <eli-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>,
Or Gerlitz <or.gerlitz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] Add multicast IBoE support
Date: Wed, 25 Jan 2012 17:21:06 -0600 [thread overview]
Message-ID: <20120125232106.GA2444@BohrerMBP.rgmadvisors.com> (raw)
In-Reply-To: <1327532208-5463-1-git-send-email-sbohrer-EgGFQ3RFNTIP7C3xziwOQw@public.gmane.org>
Sorry, probably should have mentioned this is a patch for libmlx4.
On Wed, Jan 25, 2012 at 04:56:48PM -0600, Shawn Bohrer wrote:
> Add multicast support for IBoE to the address handle creation flow.
> Derived from work by Eli Cohen <eli-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
>
> Signed-off-by: Shawn Bohrer <sbohrer-EgGFQ3RFNTIP7C3xziwOQw@public.gmane.org>
> ---
> src/verbs.c | 38 +++++++++++++++++++++++++++++++-------
> 1 files changed, 31 insertions(+), 7 deletions(-)
>
> diff --git a/src/verbs.c b/src/verbs.c
> index 199d107..2772de5 100644
> --- a/src/verbs.c
> +++ b/src/verbs.c
> @@ -624,6 +624,11 @@ static int link_local_gid(const union ibv_gid *gid)
> return 0;
> }
>
> +static int is_multicast_gid(const union ibv_gid *gid)
> +{
> + return gid->raw[0] == 0xff;
> +}
> +
> static uint16_t get_vlan_id(union ibv_gid *gid)
> {
> uint16_t vid;
> @@ -631,9 +636,12 @@ static uint16_t get_vlan_id(union ibv_gid *gid)
> return vid < 0x1000 ? vid : 0xffff;
> }
>
> -static int mlx4_resolve_grh_to_l2(struct mlx4_ah *ah, struct ibv_ah_attr *attr)
> +static int mlx4_resolve_grh_to_l2(struct ibv_pd *pd, struct mlx4_ah *ah,
> + struct ibv_ah_attr *attr)
> {
> + int err, i;
> uint16_t vid;
> + union ibv_gid sgid;
>
> if (link_local_gid(&attr->grh.dgid)) {
> memcpy(ah->mac, &attr->grh.dgid.raw[8], 3);
> @@ -641,13 +649,29 @@ static int mlx4_resolve_grh_to_l2(struct mlx4_ah *ah, struct ibv_ah_attr *attr)
> ah->mac[0] ^= 2;
>
> vid = get_vlan_id(&attr->grh.dgid);
> - if (vid != 0xffff) {
> - ah->av.port_pd |= htonl(1 << 29);
> - ah->vlan = vid | ((attr->sl & 7) << 13);
> - }
> - return 0;
> + } else if (is_multicast_gid(&attr->grh.dgid)) {
> + ah->mac[0] = 0x33;
> + ah->mac[1] = 0x33;
> + for (i = 2; i < 6; ++i)
> + ah->mac[i] = attr->grh.dgid.raw[i + 10];
> +
> + err = ibv_query_gid(pd->context, attr->port_num,
> + attr->grh.sgid_index, &sgid);
> + if (err)
> + return err;
> +
> + ah->av.dlid = htons(0xc0000);
> + ah->av.port_pd |= htonl(1 << 31);
> +
> + vid = get_vlan_id(&sgid);
> } else
> return 1;
> +
> + if (vid != 0xFFFF) {
> + ah->av.port_pd |= htonl(1 << 29);
> + ah->vlan = vid | ((attr->sl & 7) << 13);
> + }
> + return 0;
> }
>
> struct ibv_ah *mlx4_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr)
> @@ -687,7 +711,7 @@ struct ibv_ah *mlx4_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr)
> }
>
> if (port_attr.link_layer == IBV_LINK_LAYER_ETHERNET)
> - if (mlx4_resolve_grh_to_l2(ah, attr)) {
> + if (mlx4_resolve_grh_to_l2(pd, ah, attr)) {
> free(ah);
> return NULL;
> }
> --
> 1.7.7.5
>
--
---------------------------------------------------------------
This email, along with any attachments, is confidential. If you
believe you received this message in error, please contact the
sender immediately and delete all copies of the message.
Thank you.
--
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
prev parent reply other threads:[~2012-01-25 23:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 22:38 Upstream support for multicast IBoE Shawn Bohrer
[not found] ` <20111122223812.GB2131-uiVi7NQFpn/F3E+8IioSZGvqpqeGGIMLAL8bYrjMMd8@public.gmane.org>
2011-11-22 23:44 ` Roland Dreier
[not found] ` <CAL1RGDVF5FuVuToN56pmue1cUvHRw9kjaKC9xLOt51zeDJwMag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-11-23 0:07 ` Jason Gunthorpe
[not found] ` <20111123000735.GF11469-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-11-23 7:03 ` Roland Dreier
2011-11-23 21:17 ` Or Gerlitz
[not found] ` <CAJZOPZ+mdMYqMZKYNmVas=cAUYiQRw_r=8ty7j5wB2mXJSs5bw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-11-23 21:17 ` Or Gerlitz
2012-01-11 14:59 ` Shawn Bohrer
[not found] ` <20120111145924.GA2296-uiVi7NQFpn/F3E+8IioSZGvqpqeGGIMLAL8bYrjMMd8@public.gmane.org>
2012-01-11 19:49 ` Or Gerlitz
[not found] ` <CAJZOPZJL11-psmSEwUz2xa4eK4sFEkuYA5D9oEKD7m6P+O6Ffw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-12 17:01 ` Shawn Bohrer
[not found] ` <20120112170157.GA2324-uiVi7NQFpn/F3E+8IioSZGvqpqeGGIMLAL8bYrjMMd8@public.gmane.org>
2012-01-24 15:11 ` Shawn Bohrer
[not found] ` <20120124151105.GA2178-uiVi7NQFpn/F3E+8IioSZGvqpqeGGIMLAL8bYrjMMd8@public.gmane.org>
2012-01-25 22:56 ` [PATCH] Add multicast IBoE support Shawn Bohrer
[not found] ` <1327532208-5463-1-git-send-email-sbohrer-EgGFQ3RFNTIP7C3xziwOQw@public.gmane.org>
2012-01-25 23:21 ` Shawn Bohrer [this message]
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=20120125232106.GA2444@BohrerMBP.rgmadvisors.com \
--to=sbohrer-eggfq3rfntip7c3xziwoqw@public.gmane.org \
--cc=eli-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=or.gerlitz-Re5JQEeQqe8AvxtiuMwx3w@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