linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Eli Cohen <eli-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Cc: Roland Dreier <rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>,
	RDMA list <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCHv9 09/12] ib_core: Add VLAN support to IBoE
Date: Fri, 6 Aug 2010 10:49:15 -0600	[thread overview]
Message-ID: <20100806164915.GL11306@obsidianresearch.com> (raw)
In-Reply-To: <20100806144153.GJ20588@mtldesk30>

On Fri, Aug 06, 2010 at 05:41:53PM +0300, Eli Cohen wrote:
> -static inline void iboe_mac_to_ll(union ib_gid *gid, u8 *mac)
> +static inline void iboe_mac_vlan_to_ll(union ib_gid *gid, u8 *mac, u16 vid)
>  {
>  	memset(gid->raw, 0, 16);
>  	*((u32 *)gid->raw) = cpu_to_be32(0xfe800000);
> -	gid->raw[12] = 0xfe;
> -	gid->raw[11] = 0xff;
> +	if (vid) {
> +		gid->raw[12] = vid & 0xff;
> +		gid->raw[11] = vid >> 8;
> +	} else {
> +		gid->raw[12] = 0xfe;
> +		gid->raw[11] = 0xff;
> +	}
>  	memcpy(gid->raw + 13, mac + 3, 3);
>  	memcpy(gid->raw + 8, mac, 3);
>  	gid->raw[8] ^= 2;

My general comment on this would be the same I made for userspace:
Don't assume VID == 0 means no vlan tag. Use 0xFFFF or something that
is actually invalid.

Jason
--
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

  reply	other threads:[~2010-08-06 16:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-06 14:41 [PATCHv9 09/12] ib_core: Add VLAN support to IBoE Eli Cohen
2010-08-06 16:49 ` Jason Gunthorpe [this message]
     [not found]   ` <20100806164915.GL11306-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2010-08-16 12:51     ` Eli Cohen
2010-08-16 22:17       ` Roland Dreier
     [not found]         ` <adaeidyw6bd.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-08-17 14:36           ` Eli Cohen
2010-08-17 16:43             ` Roland Dreier
     [not found]               ` <adatymtur55.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-08-17 18:29                 ` Eli Cohen

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=20100806164915.GL11306@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=eli-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rdreier-FYB4Gu1CFyUAvxtiuMwx3w@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;
as well as URLs for NNTP newsgroup(s).