All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libmlx4] Add IP and TCP/UDP TX checksum offload support
@ 2015-01-06  8:30 Or Gerlitz
  0 siblings, 0 replies; only message in thread
From: Or Gerlitz @ 2015-01-06  8:30 UTC (permalink / raw)
  To: Yishai Hadas
  Cc: Roland Dreier, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Tal Alon,
	Moshe Lazer, Eyal Perry, Or Gerlitz

From: Moshe Lazer <moshel-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Add support for IBV_SEND_IP_CSUM for posted send work-requests.

When this flag is set, enable the HW checksum calculation by setting
MLX4_WQE_CTRL_IP_CSUM and MLX4_WQE_CTRL_TCP_UDP_CSUM flags in the WQE
control segment.

Signed-off-by: Eyal Perry <eyalpe-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Moshe Lazer <moshel-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 src/qp.c  |   11 ++++++++++-
 src/wqe.h |    2 ++
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/qp.c b/src/qp.c
index 721bed4..5b800e7 100644
--- a/src/qp.c
+++ b/src/qp.c
@@ -286,6 +286,10 @@ int mlx4_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
 			break;
 
 		case IBV_QPT_UD:
+			ctrl->srcrb_flags |=
+				wr->send_flags & IBV_SEND_IP_CSUM ?
+				htonl(MLX4_WQE_CTRL_IP_CSUM |
+				      MLX4_WQE_CTRL_TCP_UDP_CSUM) : 0;
 			set_datagram_seg(wqe, wr);
 			wqe  += sizeof (struct mlx4_wqe_datagram_seg);
 			size += sizeof (struct mlx4_wqe_datagram_seg) / 16;
@@ -294,7 +298,12 @@ int mlx4_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
 		case IBV_QPT_RAW_PACKET:
 			/* For raw eth, the MLX4_WQE_CTRL_SOLICIT flag is used
 			 * to indicate that no icrc should be calculated */
-			ctrl->srcrb_flags |= htonl(MLX4_WQE_CTRL_SOLICIT);
+			ctrl->srcrb_flags |=
+				wr->send_flags & IBV_SEND_IP_CSUM ?
+				htonl(MLX4_WQE_CTRL_IP_CSUM |
+				      MLX4_WQE_CTRL_TCP_UDP_CSUM |
+				      MLX4_WQE_CTRL_SOLICIT) :
+				htonl(MLX4_WQE_CTRL_SOLICIT);
 			break;
 
 		default:
diff --git a/src/wqe.h b/src/wqe.h
index bbd22ba..ebd5167 100644
--- a/src/wqe.h
+++ b/src/wqe.h
@@ -41,6 +41,8 @@ enum {
 	MLX4_WQE_CTRL_FENCE	= 1 << 6,
 	MLX4_WQE_CTRL_CQ_UPDATE	= 3 << 2,
 	MLX4_WQE_CTRL_SOLICIT	= 1 << 1,
+	MLX4_WQE_CTRL_IP_CSUM	= 1 << 4,
+	MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5
 };
 
 enum {
-- 
1.7.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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-06  8:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-06  8:30 [PATCH libmlx4] Add IP and TCP/UDP TX checksum offload support Or Gerlitz

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.