From: Eli Cohen <eli-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Roland Dreier <rdreier-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
Cc: RDMA list <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCHv10 03/12] ib_core: IBoE UD packet packing support
Date: Thu, 14 Oct 2010 23:57:58 +0200 [thread overview]
Message-ID: <20101014215758.GA15089@mtldesk30> (raw)
In-Reply-To: <adapqvcih6l.fsf-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
On Thu, Oct 14, 2010 at 02:43:30PM -0700, Roland Dreier wrote:
>
> void ib_ud_header_init(int payload_bytes,
> int lrh_present,
> int eth_present,
> int grh_present,
> int immediate_present,
> struct ib_ud_header *header)
> {
> memset(header, 0, sizeof *header);
>
> if (lrh_present) {
> u16 packet_length;
>
> header->lrh.link_version = 0;
> header->lrh.link_next_header =
> grh_present ? IB_LNH_IBA_GLOBAL : IB_LNH_IBA_LOCAL;
> packet_length = (IB_LRH_BYTES +
> IB_BTH_BYTES +
> IB_DETH_BYTES +
> grh_present ? IB_GRH_BYTES : 0 +
> payload_bytes +
> 4 + /* ICRC */
> 3) / 4; /* round up */
> header->lrh.packet_length = cpu_to_be16(packet_length);
> }
>
> if (grh_present) {
> header->grh.ip_version = 6;
> header->grh.payload_length =
> cpu_to_be16((IB_BTH_BYTES +
> IB_DETH_BYTES +
> payload_bytes +
> 4 + /* ICRC */
> 3) & ~3); /* round up */
> header->grh.next_header = 0x1b;
> }
>
> if (header->immediate_present)
> header->bth.opcode = IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE;
> else
> header->bth.opcode = IB_OPCODE_UD_SEND_ONLY;
> header->bth.pad_count = (4 - payload_bytes) & 3;
> header->bth.transport_header_version = 0;
>
> header->lrh_present = lrh_present;
> header->eth_present = eth_present;
> header->grh_present = grh_present;
> header->immediate_present = immediate_present;
> }
>
> which I think is reasonably clean for now.
Looks good.
--
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:[~2010-10-14 21:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-26 14:17 [PATCHv10 03/12] ib_core: IBoE UD packet packing support Eli Cohen
2010-10-14 20:12 ` Roland Dreier
[not found] ` <adazkugildn.fsf-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2010-10-14 21:26 ` Eli Cohen
2010-10-14 21:43 ` Roland Dreier
[not found] ` <adapqvcih6l.fsf-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2010-10-14 21:57 ` Eli Cohen [this message]
2010-10-14 22:34 ` Ralph Campbell
[not found] ` <35AAF1E4A771E142979F27B51793A488873ABE0767-HolNjIBXvBOXx9kJd3VG2h2eb7JE58TQ@public.gmane.org>
2010-10-15 4:27 ` Roland Dreier
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=20101014215758.GA15089@mtldesk30 \
--to=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