aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOr Gerlitz <ogerlitz@mellanox.com>2012-09-23 06:58:27 +0000
committerRoland Dreier <roland@purestorage.com>2013-04-03 11:40:53 -0700
commitd37c5ba83e77e6d0699fdbd11cb283d2dbd4e88b (patch)
treee77a59d61d9a07d306ea09b79f77b9ee4241aa72
parent5fb42246f2b68f981b3facf97279dd93cdefc2f8 (diff)
downloadlibmlx4-d37c5ba83e77e6d0699fdbd11cb283d2dbd4e88b.tar.gz
Add raw packet QP support
Implement raw packet QPs for Ethernet ports. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> [ Fix to build against old libibverbs without IBV_QPT_RAW_PACKET. - Roland ] Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r--configure.in11
-rw-r--r--src/mlx4.h4
-rw-r--r--src/qp.c6
3 files changed, 21 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index 8aad5ff..30ffed9 100644
--- a/configure.in
+++ b/configure.in
@@ -26,6 +26,7 @@ fi
dnl Checks for programs
AC_PROG_CC
+AC_LANG([C])
dnl Checks for libraries
AC_CHECK_LIB(ibverbs, ibv_get_device_list, [],
@@ -46,6 +47,16 @@ dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_CHECK_SIZEOF(long)
+AC_CACHE_CHECK([for IBV_QPT_RAW_PACKET],
+ [ac_cv_ibv_qpt_raw_packet],
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
+ [enum ibv_qp_type qpt = IBV_QPT_RAW_PACKET;])],
+ [ac_cv_ibv_qpt_raw_packet=yes],
+ [ac_cv_ibv_qpt_raw_packet=no])])
+if test $ac_cv_ibv_qpt_raw_packet = yes; then
+ AC_DEFINE([HAVE_IBV_QPT_RAW_PACKET], 1, [libibverbs has raw packet QP support])
+fi
+
dnl Checks for library functions
AC_CHECK_FUNC(ibv_read_sysfs_file, [],
AC_MSG_ERROR([ibv_read_sysfs_file() not found. libmlx4 requires libibverbs >= 1.0.3.]))
diff --git a/src/mlx4.h b/src/mlx4.h
index a4e9b32..be7a632 100644
--- a/src/mlx4.h
+++ b/src/mlx4.h
@@ -83,6 +83,10 @@
#define PFX "mlx4: "
+#ifndef HAVE_IBV_QPT_RAW_PACKET
+#define IBV_QPT_RAW_PACKET 8
+#endif
+
enum {
MLX4_STAT_RATE_OFFSET = 5
};
diff --git a/src/qp.c b/src/qp.c
index 67da6a4..11c750b 100644
--- a/src/qp.c
+++ b/src/qp.c
@@ -288,6 +288,12 @@ int mlx4_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
size += sizeof (struct mlx4_wqe_datagram_seg) / 16;
break;
+ 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);
+ break;
+
default:
break;
}