Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2018 16:27:31 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r330662 - head/sys/dev/mlx5/mlx5_ib
Message-ID:  <201803081627.w28GRVuN032340@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu Mar  8 16:27:31 2018
New Revision: 330662
URL: https://svnweb.freebsd.org/changeset/base/330662

Log:
  Set correct SL in completion for RoCE in mlx5ib(4).
  
  There is a difference when parsing a completion entry between Ethernet
  and IB ports. When link layer is Ethernet the bits describe the type of
  L3 header in the packet. In the case when link layer is Ethernet and VLAN
  header is present the value of SL is equal to the 3 UP bits in the VLAN
  header. If VLAN header is not present then the SL is undefined and consumer
  of the completion should check if IB_WC_WITH_VLAN is set.
  
  While that, this patch also fills the vlan_id field in the completion if
  present.
  
  linux commit 12f8fedef2ec94c783f929126b20440a01512c14
  
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c

Modified: head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c	Thu Mar  8 16:26:49 2018	(r330661)
+++ head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c	Thu Mar  8 16:27:31 2018	(r330662)
@@ -167,6 +167,8 @@ static void handle_responder(struct ib_wc *wc, struct 
 	struct mlx5_ib_srq *srq;
 	struct mlx5_ib_wq *wq;
 	u16 wqe_ctr;
+	u8  roce_packet_type;
+	bool vlan_present;
 	u8 g;
 
 	if (qp->ibqp.srq || qp->ibqp.xrcd) {
@@ -218,7 +220,6 @@ static void handle_responder(struct ib_wc *wc, struct 
 		break;
 	}
 	wc->slid	   = be16_to_cpu(cqe->slid);
-	wc->sl		   = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0xf;
 	wc->src_qp	   = be32_to_cpu(cqe->flags_rqpn) & 0xffffff;
 	wc->dlid_path_bits = cqe->ml_path;
 	g = (be32_to_cpu(cqe->flags_rqpn) >> 28) & 3;
@@ -232,10 +233,22 @@ static void handle_responder(struct ib_wc *wc, struct 
 		wc->pkey_index = 0;
 	}
 
-	if (ll != IB_LINK_LAYER_ETHERNET)
+	if (ll != IB_LINK_LAYER_ETHERNET) {
+		wc->sl = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0xf;
 		return;
+	}
 
-	switch (wc->sl & 0x3) {
+	vlan_present = cqe_has_vlan(cqe);
+	roce_packet_type   = (be32_to_cpu(cqe->flags_rqpn) >> 24) & 0x3;
+	if (vlan_present) {
+		wc->vlan_id = (be16_to_cpu(cqe->vlan_info)) & 0xfff;
+		wc->sl = (be16_to_cpu(cqe->vlan_info) >> 13) & 0x7;
+		wc->wc_flags |= IB_WC_WITH_VLAN;
+	} else {
+		wc->sl = 0;
+	}
+
+	switch (roce_packet_type) {
 	case MLX5_CQE_ROCE_L3_HEADER_TYPE_GRH:
 		wc->network_hdr_type = RDMA_NETWORK_IB;
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803081627.w28GRVuN032340>