[ewg] [PATCH] IB/libmlx4: Copy VLAN tag if present to the completion
Moni Shoua
monis at Voltaire.COM
Wed Feb 2 07:39:20 PST 2011
Identify that VLAN is present in a completion and copy it along with the VLAN
ID to the user completion.
Signed-off-by: Aleksey Senin <alekseys at voltaire.com>
Reviewed-by: Moni Shoua <monis at voltaire.com>
--
--- a/src/cq.c 2010-02-08 17:33:45.000000000 +0200
+++ b/src/cq.c 2010-02-10 15:12:01.000000000 +0200
@@ -61,6 +61,10 @@
#define MLX4_CQ_DB_REQ_NOT (2 << 24)
enum {
+ MLX4_CQE_VLAN_PRESENT_MASK = 1 << 29,
+};
+
+enum {
MLX4_CQE_OWNER_MASK = 0x80,
MLX4_CQE_IS_SEND_MASK = 0x40,
MLX4_CQE_OPCODE_MASK = 0x1f
@@ -86,8 +90,7 @@
uint32_t my_qpn;
uint32_t immed_rss_invalid;
uint32_t g_mlpath_rqpn;
- uint8_t sl;
- uint8_t reserved1;
+ uint16_t sl_vid;
uint16_t rlid;
uint32_t reserved2;
uint32_t byte_cnt;
@@ -328,12 +331,19 @@
}
wc->slid = ntohs(cqe->rlid);
- wc->sl = cqe->sl >> 4;
+ wc->sl = ntohs(cqe->sl_vid) >> 12;
g_mlpath_rqpn = ntohl(cqe->g_mlpath_rqpn);
wc->src_qp = g_mlpath_rqpn & 0xffffff;
wc->dlid_path_bits = (g_mlpath_rqpn >> 24) & 0x7f;
wc->wc_flags |= g_mlpath_rqpn & 0x80000000 ? IBV_WC_GRH : 0;
- wc->pkey_index = ntohl(cqe->immed_rss_invalid) & 0x7f;
+
+ if (qpn & MLX4_CQE_VLAN_PRESENT_MASK) {
+ wc->sl = wc->sl & 0x0f;
+ wc->pkey_index = ntohs(cqe->sl_vid) & 0x0fff;
+ wc->wc_flags |= IBV_WC_WITH_VLAN;
+ }
+ else
+ wc->pkey_index = ntohl(cqe->immed_rss_invalid) & 0x7f;
}
return CQ_OK;
More information about the ewg
mailing list