[ofa-general] [PATCH 1 of 2 for 2.6.28] core: Fix Raw Ethertype QP support

Jack Morgenstein jackm at dev.mellanox.co.il
Tue Aug 12 07:20:11 PDT 2008


From: Igor Yarovinsky <igory at mellanox.com>

core: Fix Raw Ethertype QP support.

Fix Raw Ethertype qp support:
a. Need a new struct in the wr union in struct ib_send_wr
b. Need new helper pack and unpack functions in ud_header.c

Signed-off-by: Igor Yarovinsky <igory at mellanox.com>
Signed-off-by: Jack Morgenstein <jackm at dev.mellanox.co.il>
---
Raw Ethertype packets on the wire contain only LRH,
Raw Header (Ethernet Type), payload, and VCRC.

Index: infiniband/include/rdma/ib_verbs.h
===================================================================
--- infiniband.orig/include/rdma/ib_verbs.h	2008-08-11 10:37:01.000000000 +0300
+++ infiniband/include/rdma/ib_verbs.h	2008-08-12 16:29:49.000000000 +0300
@@ -752,6 +752,11 @@ struct ib_send_wr {
 			int				access_flags;
 			u32				rkey;
 		} fast_reg;
+		struct {
+			struct ib_unpacked_lrh	*lrh;
+			u32			eth_type;
+			u8			static_rate;
+		} raw_ety;
 	} wr;
 };
 
Index: infiniband/drivers/infiniband/core/ud_header.c
===================================================================
--- infiniband.orig/drivers/infiniband/core/ud_header.c	2008-07-28 18:20:11.000000000 +0300
+++ infiniband/drivers/infiniband/core/ud_header.c	2008-08-12 10:55:10.000000000 +0300
@@ -241,6 +241,36 @@ void ib_ud_header_init(int     		    pay
 EXPORT_SYMBOL(ib_ud_header_init);
 
 /**
+ * ib_lrh_header_pack - Pack LRH header struct into wire format
+ * @lrh:unpacked LRH header struct
+ * @buf:Buffer to pack into
+ *
+ * ib_lrh_header_pack() packs the LRH header structure @lrh into
+ * wire format in the buffer @buf.
+ */
+int ib_lrh_header_pack(struct ib_unpacked_lrh *lrh, void *buf)
+{
+	ib_pack(lrh_table, ARRAY_SIZE(lrh_table), lrh, buf);
+	return 0;
+}
+EXPORT_SYMBOL(ib_lrh_header_pack);
+
+/**
+ * ib_lrh_header_unpack - Unpack LRH structure from wire format
+ * @lrh:unpacked LRH header struct
+ * @buf:Buffer to pack into
+ *
+ * ib_lrh_header_unpack() unpacks the LRH header structure from
+ * wire format (in buf) into @lrh.
+ */
+int ib_lrh_header_unpack(void *buf, struct ib_unpacked_lrh *lrh)
+{
+	ib_unpack(lrh_table, ARRAY_SIZE(lrh_table), buf, lrh);
+	return 0;
+}
+EXPORT_SYMBOL(ib_lrh_header_unpack);
+
+/**
  * ib_ud_header_pack - Pack UD header struct into wire format
  * @header:UD header struct
  * @buf:Buffer to pack into
Index: infiniband/include/rdma/ib_pack.h
===================================================================
--- infiniband.orig/include/rdma/ib_pack.h	2008-07-28 18:20:15.000000000 +0300
+++ infiniband/include/rdma/ib_pack.h	2008-08-12 10:55:10.000000000 +0300
@@ -240,4 +240,7 @@ int ib_ud_header_pack(struct ib_ud_heade
 int ib_ud_header_unpack(void                *buf,
 			struct ib_ud_header *header);
 
+int ib_lrh_header_pack(struct ib_unpacked_lrh *lrh, void *buf);
+int ib_lrh_header_unpack(void *buf, struct ib_unpacked_lrh *lrh);
+
 #endif /* IB_PACK_H */



More information about the general mailing list