linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarod Wilson <jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Jarod Wilson <jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH libmlx5 7/6] combine inline_hdr and inline_hdr_start
Date: Wed, 27 Jul 2016 21:32:34 -0400	[thread overview]
Message-ID: <1469669554-23782-1-git-send-email-jarod@redhat.com> (raw)
In-Reply-To: <1469647047-7544-1-git-send-email-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

I can't see any good reason why inline_hdr and inline_hdr_start should be
two separate arrays in struct mlx5_wqe_eth_seg. The only time I see
anything actually accessed by dereferencing either inline_hdr or
inline_hdr_start is when the MLX5_ETH_L2_INLINE_HEADER_SIZE or less bytes
are copied into inline_hdr_start. By default, it's 18 bytes, copied to
what is a 2-byte and a 16-byte array back to back in the struct, and
coverity and clang both sound alarms because the code says "just write 18
bytes into that 2-byte array", which in practice is ultimately fine, but
again, why?...

I propose to just add two bytes to inline_hdr and drop inline_hdr_start.

CC: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Jarod Wilson <jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 src/qp.c  | 4 ++--
 src/wqe.h | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/qp.c b/src/qp.c
index 8bb66be..f4a22be 100644
--- a/src/qp.c
+++ b/src/qp.c
@@ -369,14 +369,14 @@ static inline int copy_eth_inline_headers(struct ibv_qp *ibqp,
 
 	if (likely(wr->sg_list[0].length >= MLX5_ETH_L2_INLINE_HEADER_SIZE)) {
 		inl_hdr_copy_size = MLX5_ETH_L2_INLINE_HEADER_SIZE;
-		memcpy(eseg->inline_hdr_start,
+		memcpy(eseg->inline_hdr,
 		       (void *)(uintptr_t)wr->sg_list[0].addr,
 		       inl_hdr_copy_size);
 	} else {
 		for (j = 0; j < wr->num_sge && inl_hdr_size > 0; ++j) {
 			inl_hdr_copy_size = min(wr->sg_list[j].length,
 						inl_hdr_size);
-			memcpy(eseg->inline_hdr_start +
+			memcpy(eseg->inline_hdr +
 			       (MLX5_ETH_L2_INLINE_HEADER_SIZE - inl_hdr_size),
 			       (void *)(uintptr_t)wr->sg_list[j].addr,
 			       inl_hdr_copy_size);
diff --git a/src/wqe.h b/src/wqe.h
index c2622d5..d979232 100644
--- a/src/wqe.h
+++ b/src/wqe.h
@@ -92,8 +92,7 @@ struct mlx5_wqe_eth_seg {
 	uint16_t	mss;
 	uint32_t	rsvd2;
 	uint16_t	inline_hdr_sz;
-	uint8_t		inline_hdr_start[2];
-	uint8_t		inline_hdr[16];
+	uint8_t		inline_hdr[MLX5_ETH_L2_INLINE_HEADER_SIZE];
 };
 
 struct mlx5_wqe_ctrl_seg {
-- 
1.8.3.1

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

  parent reply	other threads:[~2016-07-28  1:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 19:17 [PATCH libmlx5 0/6] libmlx5: fix various coverity/clang issues Jarod Wilson
     [not found] ` <1469647047-7544-1-git-send-email-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-27 19:17   ` [PATCH libmlx5 1/6] fix size in malloc of qp->sq.wr_data Jarod Wilson
     [not found]     ` <1469647047-7544-2-git-send-email-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-28 14:42       ` Yishai Hadas
2016-07-27 19:17   ` [PATCH libmlx5 2/6] fix coverity buffer overrun warning Jarod Wilson
     [not found]     ` <1469647047-7544-3-git-send-email-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-28 14:46       ` Yishai Hadas
     [not found]         ` <9ee81879-93c4-97ee-eebf-3300533e4efe-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-07-28 16:37           ` Jarod Wilson
     [not found]             ` <20160728163714.GP36313-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-28 20:12               ` Jarod Wilson
2016-07-27 19:17   ` [PATCH libmlx5 3/6] fix buffer overrun copying inline header Jarod Wilson
     [not found]     ` <1469647047-7544-4-git-send-email-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-27 21:26       ` Jarod Wilson
     [not found]         ` <20160727212610.GJ36313-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-28  1:29           ` Jarod Wilson
2016-07-27 19:17   ` [PATCH libmlx5 4/6] fix check of mlx5_store_uidx return Jarod Wilson
     [not found]     ` <1469647047-7544-5-git-send-email-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-28 15:04       ` Yishai Hadas
2016-07-27 19:17   ` [PATCH libmlx5 5/6] fix alloc of mlx5_resource table Jarod Wilson
     [not found]     ` <1469647047-7544-6-git-send-email-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-28 15:25       ` Yishai Hadas
2016-07-27 19:17   ` [PATCH libmlx5 6/6] fix undefined uuar_index value assignment Jarod Wilson
     [not found]     ` <1469647047-7544-7-git-send-email-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-27 21:27       ` Jarod Wilson
2016-07-28  1:31       ` [PATCH v2 " Jarod Wilson
     [not found]         ` <1469669515-23720-1-git-send-email-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-28 15:53           ` Yishai Hadas
     [not found]             ` <828fc991-56e5-91e4-72e1-f10ca7c05aef-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-07-28 16:40               ` Jarod Wilson
2016-07-28  1:32   ` Jarod Wilson [this message]
     [not found]     ` <1469669554-23782-1-git-send-email-jarod-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-28 14:27       ` [PATCH libmlx5 7/6] combine inline_hdr and inline_hdr_start Jarod Wilson
     [not found]         ` <20160728142717.GO36313-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-28 16:39           ` Yishai Hadas

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=1469669554-23782-1-git-send-email-jarod@redhat.com \
    --to=jarod-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@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).