[openib-general] [PATCH] update my branch's AH API

Roland Dreier roland at topspin.com
Mon Aug 9 10:34:43 PDT 2004


The AH API on my branch is now updated...

 - R.

Index: src/linux-kernel/infiniband/ulp/ipoib/ipoib_arp.c
===================================================================
--- src/linux-kernel/infiniband/ulp/ipoib/ipoib_arp.c	(revision 592)
+++ src/linux-kernel/infiniband/ulp/ipoib/ipoib_arp.c	(working copy)
@@ -50,7 +50,7 @@
 	u32        qpn;
 	u16        lid;
 	tTS_IB_SL  sl;
-	struct ib_address *address_handle;
+	struct ib_ah *address_handle;
 	tTS_IB_CLIENT_QUERY_TID tid;
 
 	unsigned long created;
@@ -174,10 +174,10 @@
 			 entry->hash[3], entry->hash[4], entry->hash[5]);
 
 		if (entry->address_handle != NULL) {
-			int ret = ib_address_destroy(entry->address_handle);
+			int ret = ib_destroy_ah(entry->address_handle);
 			if (ret < 0)
 				TS_REPORT_WARN(MOD_IB_NET,
-					       "ib_address_destroy failed (ret = %d)",
+					       "ib_destroy_ah failed (ret = %d)",
 					       ret);
 		}
 
@@ -406,18 +406,19 @@
 	entry->tid = TS_IB_CLIENT_QUERY_TID_INVALID;
 
 	if (!status) {
-		struct ib_address_vector av = {
-			.dlid = path->dlid,
-			.service_level = path->sl,
-			.port = priv->port,
-			.source_path_bits = 0,
-			.use_grh = 0,
-			.static_rate = 0
+		struct ib_ah_attr av = {
+			.dlid 	       = path->dlid,
+			.sl 	       = path->sl,
+			.src_path_bits = 0,
+			.static_rate   = 0,
+			.grh_flag      = 0,
+			.port 	       = priv->port
 		};
 
-		if (ib_address_create(priv->pd, &av, &entry->address_handle)) {
+		entry->address_handle = ib_create_ah(priv->pd, &av);
+		if (IS_ERR(entry->address_handle)) {
 			TS_REPORT_WARN(MOD_IB_NET,
-				       "%s: ib_address_create failed",
+				       "%s: ib_create_ah failed",
 				       dev->name);
 		} else {
 			TS_TRACE(MOD_IB_NET, T_VERY_VERBOSE, TRACE_IB_NET_ARP,
Index: src/linux-kernel/infiniband/ulp/ipoib/ipoib.h
===================================================================
--- src/linux-kernel/infiniband/ulp/ipoib/ipoib.h	(revision 576)
+++ src/linux-kernel/infiniband/ulp/ipoib/ipoib.h	(working copy)
@@ -169,7 +169,7 @@
 
 int ipoib_dev_send(struct net_device *dev, struct sk_buff *skb,
 		   ipoib_tx_callback_t callback,
-		   void *ptr, struct ib_address *address, u32 qpn);
+		   void *ptr, struct ib_ah *address, u32 qpn);
 
 struct ipoib_dev_priv *ipoib_intf_alloc(void);
 
Index: src/linux-kernel/infiniband/ulp/ipoib/ipoib_ib.c
===================================================================
--- src/linux-kernel/infiniband/ulp/ipoib/ipoib_ib.c	(revision 576)
+++ src/linux-kernel/infiniband/ulp/ipoib/ipoib_ib.c	(working copy)
@@ -288,7 +288,7 @@
 
 static int _ipoib_ib_send(struct ipoib_dev_priv *priv,
 			  u64 work_request_id,
-			  struct ib_address *address, u32 qpn,
+			  struct ib_ah *address, u32 qpn,
 			  dma_addr_t addr, int len)
 {
 	struct ib_gather_scatter list = {
@@ -314,7 +314,7 @@
 /*..ipoib_dev_send -- schedule an IB send work request             */
 int ipoib_dev_send(struct net_device *dev, struct sk_buff *skb,
 		   ipoib_tx_callback_t callback, void *ptr,
-		   struct ib_address *address, u32 qpn)
+		   struct ib_ah *address, u32 qpn)
 {
 	struct ipoib_dev_priv *priv = dev->priv;
 	struct ipoib_tx_buf *tx_req;
Index: src/linux-kernel/infiniband/ulp/ipoib/ipoib_multicast.c
===================================================================
--- src/linux-kernel/infiniband/ulp/ipoib/ipoib_multicast.c	(revision 576)
+++ src/linux-kernel/infiniband/ulp/ipoib/ipoib_multicast.c	(working copy)
@@ -43,7 +43,7 @@
 	unsigned long created;
 
 	struct ib_multicast_member mcast_member;
-	struct ib_address *address_handle;
+	struct ib_ah *address_handle;
 	tTS_IB_CLIENT_QUERY_TID tid;
 
 	tTS_IB_GID mgid;
@@ -85,10 +85,10 @@
 			 dev->name, IPOIB_GID_ARG(mcast->mgid));
 
 		if (mcast->address_handle != NULL) {
-			int ret = ib_address_destroy(mcast->address_handle);
+			int ret = ib_destroy_ah(mcast->address_handle);
 			if (ret < 0)
 				TS_REPORT_WARN(MOD_IB_NET,
-					       "%s: ib_address_destroy failed (ret = %d)",
+					       "%s: ib_destroy_ah failed (ret = %d)",
 					       dev->name, ret);
 		}
 
@@ -241,22 +241,25 @@
 	}
 
 	{
-		struct ib_address_vector av = {
-			.dlid = mcast->mcast_member.mlid,
-			.port = priv->port,
-			.service_level = mcast->mcast_member.sl,
-			.source_path_bits = 0,
-			.use_grh = 1,
-			.flow_label = mcast->mcast_member.flowlabel,
-			.hop_limit = mcast->mcast_member.hoplmt,
-			.source_gid_index = 0,
-			.static_rate = 0,
-			.traffic_class = mcast->mcast_member.tclass,
+		struct ib_ah_attr av = {
+			.dlid	       = mcast->mcast_member.mlid,
+			.port	       = priv->port,
+			.sl	       = mcast->mcast_member.sl,
+			.src_path_bits = 0,
+			.static_rate   = 0,
+			.grh_flag      = 1,
+			.grh	       = {
+				.flow_label    = mcast->mcast_member.flowlabel,
+				.hop_limit     = mcast->mcast_member.hoplmt,
+				.sgid_index    = 0,
+				.traffic_class = mcast->mcast_member.tclass
+			}
 		};
 
-		memcpy(av.dgid, mcast->mcast_member.mgid, sizeof(av.dgid));
+		memcpy(av.grh.dgid.raw, mcast->mcast_member.mgid, sizeof av.grh.dgid);
 
-		if (ib_address_create(priv->pd, &av, &mcast->address_handle)) {
+		mcast->address_handle = ib_create_ah(priv->pd, &av);
+		if (IS_ERR(mcast->address_handle)) {
 			TS_REPORT_WARN(MOD_IB_NET,
 				       "%s: ib_address_create failed",
 				       dev->name);
Index: src/linux-kernel/infiniband/include/ib_verbs.h
===================================================================
--- src/linux-kernel/infiniband/include/ib_verbs.h	(revision 589)
+++ src/linux-kernel/infiniband/include/ib_verbs.h	(working copy)
@@ -39,6 +39,32 @@
 
 #ifdef __KERNEL__
 
+union ib_gid {
+	u8	raw[16];
+	struct {
+		u64	subnet_prefix;
+		u64	interface_id;
+	} global;
+};
+
+struct ib_global_route {
+	union ib_gid	dgid;
+	u32		flow_label;
+	u8		sgid_index;
+	u8		hop_limit;
+	u8		traffic_class;
+};
+
+struct ib_ah_attr {
+	struct ib_global_route	grh;
+	u16			dlid;
+	u8			sl;
+	u8			src_path_bits;
+	u8			static_rate;
+	u8			grh_flag;
+	u8			port;
+};
+
 enum ib_wc_status {
 	IB_WC_SUCCESS,
 	IB_WC_LOC_LEN_ERR,
@@ -132,6 +158,11 @@
 	atomic_t          usecnt; /* count all resources */
 };
 
+struct ib_ah {
+	struct ib_device	*device;
+	struct ib_pd		*pd;
+};
+
 typedef void (*ib_comp_handler)(struct ib_cq *cq, void *cq_context);
 
 struct ib_cq {
@@ -172,9 +203,13 @@
 	ib_gid_query_func            gid_query;
 	struct ib_pd *             (*alloc_pd)(struct ib_device *device);
 	int                        (*dealloc_pd)(struct ib_pd *pd);
-	ib_address_create_func       address_create;
-	ib_address_query_func        address_query;
-	ib_address_destroy_func      address_destroy;
+	struct ib_ah *             (*create_ah)(struct ib_pd *pd,
+						struct ib_ah_attr *ah_attr);
+	int                        (*modify_ah)(struct ib_ah *ah,
+						struct ib_ah_attr *ah_attr);
+	int                        (*query_ah)(struct ib_ah *ah,
+					       struct ib_ah_attr *ah_attr);
+	int                        (*destroy_ah)(struct ib_ah *ah);
 	ib_qp_create_func            qp_create;
 	ib_special_qp_create_func    special_qp_create;
 	ib_qp_modify_func            qp_modify;
@@ -225,6 +260,11 @@
 struct ib_pd *ib_alloc_pd(struct ib_device *device);
 int ib_dealloc_pd(struct ib_pd *pd);
 
+struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);
+int ib_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
+int ib_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
+int ib_destroy_ah(struct ib_ah *ah);
+
 struct ib_cq *ib_create_cq(struct ib_device *device,
 			   ib_comp_handler comp_handler,
 			   void *cq_context, int cqe);
Index: src/linux-kernel/infiniband/include/ts_ib_core_types.h
===================================================================
--- src/linux-kernel/infiniband/include/ts_ib_core_types.h	(revision 576)
+++ src/linux-kernel/infiniband/include/ts_ib_core_types.h	(working copy)
@@ -230,12 +230,6 @@
 	IB_PKEY_CHANGE,
 };
 
-struct ib_address {
-	IB_DECLARE_MAGIC
-	struct ib_device *device;
-	void             *private;
-};
-
 struct ib_async_obj {
 	void *           free_ptr;
 	spinlock_t       lock;
@@ -513,7 +507,7 @@
 	u32                   	  rkey;
 	u32             	  dest_qpn;
 	u32                  	  dest_qkey;
-	struct ib_address        *dest_address;
+	struct ib_ah             *dest_address;
 	u32                   	  immediate_data;
 	u64                   	  compare_add;
 	u64                   	  swap;
@@ -586,12 +580,6 @@
 				 tTS_IB_PORT       port,
 				 int           	   index,
 				 tTS_IB_GID    	   gid);
-typedef int (*ib_address_create_func)(struct ib_pd             *pd,
-				      struct ib_address_vector *address_vector,
-				      struct ib_address        *address);
-typedef int (*ib_address_query_func)(struct ib_address        *address,
-				     struct ib_address_vector *address_vector);
-typedef int (*ib_address_destroy_func)(struct ib_address *address);
 typedef int (*ib_qp_create_func)(struct ib_pd              *pd,
 				 struct ib_qp_create_param *param,
 				 struct ib_qp              *qp);
Index: src/linux-kernel/infiniband/include/ts_ib_core.h
===================================================================
--- src/linux-kernel/infiniband/include/ts_ib_core.h	(revision 576)
+++ src/linux-kernel/infiniband/include/ts_ib_core.h	(working copy)
@@ -63,13 +63,6 @@
 		     int                  index,
 		     tTS_IB_GID           gid);
 
-int ib_address_create(struct ib_pd             *pd,
-                      struct ib_address_vector *address,
-                      struct ib_address       **address_handle);
-int ib_address_query(struct ib_address        *address_handle,
-		     struct ib_address_vector *address);
-int ib_address_destroy(struct ib_address *address_handle);
-
 int ib_qp_create(struct ib_qp_create_param *param,
                  struct ib_qp             **qp,
                  u32                       *qpn);
Index: src/linux-kernel/infiniband/core/mad_ib.c
===================================================================
--- src/linux-kernel/infiniband/core/mad_ib.c	(revision 576)
+++ src/linux-kernel/infiniband/core/mad_ib.c	(working copy)
@@ -51,8 +51,8 @@
 	struct ib_mad_private       *priv = device->mad;
 	struct ib_gather_scatter     gather_list;
 	struct ib_send_param         send_param;
-	struct ib_address_vector     av;
-	struct ib_address           *addr;
+	struct ib_ah_attr            av;
+	struct ib_ah                *addr;
 
 	gather_list.address = pci_map_single(priv->ib_dev->dma_device,
 					     mad, IB_MAD_PACKET_SIZE,
@@ -68,22 +68,23 @@
 	send_param.solicited_event    = 1;
 	send_param.signaled           = 1;
 
-	av.dlid             = mad->dlid;
-	av.port             = mad->port;
-	av.source_path_bits = 0;
-	av.use_grh          = mad->has_grh;
-	av.service_level    = mad->sl;
-	av.static_rate      = 0;
+	av.dlid          = mad->dlid;
+	av.port          = mad->port;
+	av.src_path_bits = 0;
+	av.grh_flag      = mad->has_grh;
+	av.sl            = mad->sl;
+	av.static_rate   = 0;
 
-	if (av.use_grh) {
-		av.source_gid_index = mad->gid_index;
-		av.flow_label       = mad->flow_label;
-		av.hop_limit        = mad->hop_limit;
-		av.traffic_class    = mad->traffic_class;
-		memcpy(av.dgid, mad->gid, sizeof (tTS_IB_GID));
+	if (av.grh_flag) {
+		av.grh.sgid_index       = mad->gid_index;
+		av.grh.flow_label       = mad->flow_label;
+		av.grh.hop_limit        = mad->hop_limit;
+		av.grh.traffic_class    = mad->traffic_class;
+		memcpy(av.grh.dgid.raw, mad->gid, sizeof av.grh.dgid);
 	}
 
-	if (ib_address_create(priv->pd, &av, &addr))
+	addr = ib_create_ah(priv->pd, &av);
+	if (IS_ERR(addr))
 		return -EINVAL;
 
 	{
@@ -112,11 +113,11 @@
 						mapping),
 				 IB_MAD_PACKET_SIZE,
 				 PCI_DMA_TODEVICE);
-		ib_address_destroy(addr);
+		ib_destroy_ah(addr);
 		return -EINVAL;
 	}
 
-	ib_address_destroy(addr);
+	ib_destroy_ah(addr);
 	return 0;
 }
 
Index: src/linux-kernel/infiniband/core/core_ah.c
===================================================================
--- src/linux-kernel/infiniband/core/core_ah.c	(revision 576)
+++ src/linux-kernel/infiniband/core/core_ah.c	(working copy)
@@ -32,66 +32,51 @@
 #include <linux/errno.h>
 #include <linux/slab.h>
 
-int ib_address_create(struct ib_pd             *pd,
-                      struct ib_address_vector *address_vector,
-                      struct ib_address       **address_handle)
+struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr)
 {
-	struct ib_address *address;
-	int                ret;
+	struct ib_ah *ah;
 
-	if (!pd->device->address_create) {
-		return -ENOSYS;
-	}
+	ah = pd->device->create_ah(pd, ah_attr);
 
-	address = kmalloc(sizeof *address, GFP_KERNEL);
-	if (!address) {
-		return -ENOMEM;
+	if (!IS_ERR(ah)) {
+		ah->device = pd->device;
+		ah->pd     = pd;
+		atomic_inc(&pd->usecnt);
 	}
 
-	ret = pd->device->address_create(pd, address_vector, address);
-
-	if (!ret) {
-		IB_SET_MAGIC(address, ADDRESS);
-		address->device = pd->device;
-		*address_handle = address;
-	} else {
-		kfree(address);
-	}
-
-	return ret;
+	return ah;
 }
-EXPORT_SYMBOL(ib_address_create);
+EXPORT_SYMBOL(ib_create_ah);
 
-int ib_address_query(struct ib_address        *address,
-		     struct ib_address_vector *address_vector)
+int ib_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr)
 {
-	IB_CHECK_MAGIC(address, ADDRESS);
+	return ah->device->modify_ah ?
+		ah->device->modify_ah(ah, ah_attr) :
+		-ENOSYS;
+}
+EXPORT_SYMBOL(ib_modify_ah);
 
-	return address->device->address_query ?
-		address->device->address_query(address, address_vector) : -ENOSYS;
+int ib_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr)
+{
+	return ah->device->query_ah ?
+		ah->device->query_ah(ah, ah_attr) :
+		-ENOSYS;
 }
-EXPORT_SYMBOL(ib_address_query);
+EXPORT_SYMBOL(ib_query_ah);
 
-int ib_address_destroy(struct ib_address *address_handle)
+int ib_destroy_ah(struct ib_ah *ah)
 {
-	struct ib_address *address = address_handle;
-	int                ret;
+	struct ib_pd *pd;
+	int ret;
 
-	IB_CHECK_MAGIC(address, ADDRESS);
+	pd = ah->pd;
+	ret = ah->device->destroy_ah(ah);
+	if (!ret)
+		atomic_inc(&pd->usecnt);
 
-	if (!address->device->address_destroy) {
-		return -ENOSYS;
-	}
-
-	ret = address->device->address_destroy(address);
-	if (!ret) {
-		IB_CLEAR_MAGIC(address);
-		kfree(address);
-	}
-
 	return ret;
 }
-EXPORT_SYMBOL(ib_address_destroy);
+EXPORT_SYMBOL(ib_destroy_ah);
 
 /*
   Local Variables:
Index: src/linux-kernel/infiniband/core/core_device.c
===================================================================
--- src/linux-kernel/infiniband/core/core_device.c	(revision 576)
+++ src/linux-kernel/infiniband/core/core_device.c	(working copy)
@@ -50,8 +50,8 @@
 		IB_MANDATORY_FUNC(gid_query),
 		IB_MANDATORY_FUNC(alloc_pd),
 		IB_MANDATORY_FUNC(dealloc_pd),
-		IB_MANDATORY_FUNC(address_create),
-		IB_MANDATORY_FUNC(address_destroy),
+		IB_MANDATORY_FUNC(create_ah),
+		IB_MANDATORY_FUNC(destroy_ah),
 		IB_MANDATORY_FUNC(special_qp_create),
 		IB_MANDATORY_FUNC(qp_modify),
 		IB_MANDATORY_FUNC(qp_destroy),
Index: src/linux-kernel/infiniband/hw/mthca/mthca_dev.h
===================================================================
--- src/linux-kernel/infiniband/hw/mthca/mthca_dev.h	(revision 576)
+++ src/linux-kernel/infiniband/hw/mthca/mthca_dev.h	(working copy)
@@ -334,7 +334,7 @@
 void mthca_free_qp(struct mthca_dev *dev, struct mthca_qp *qp);
 int mthca_create_ah(struct mthca_dev *dev,
 		    struct mthca_pd *pd,
-		    struct ib_address_vector *address,
+		    struct ib_ah_attr *ah_attr,
 		    struct mthca_ah *ah);
 int mthca_destroy_ah(struct mthca_dev *dev, struct mthca_ah *ah);
 int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah,
Index: src/linux-kernel/infiniband/hw/mthca/mthca_provider.c
===================================================================
--- src/linux-kernel/infiniband/hw/mthca/mthca_provider.c	(revision 576)
+++ src/linux-kernel/infiniband/hw/mthca/mthca_provider.c	(working copy)
@@ -266,29 +266,31 @@
 	return 0;
 }
 
-static int mthca_address_create(struct ib_pd *pd,
-				struct ib_address_vector *av,
-				struct ib_address *address)
+static struct ib_ah *mthca_ah_create(struct ib_pd *pd,
+				     struct ib_ah_attr *ah_attr)
 {
 	int err;
+	struct mthca_ah *ah;
 
-	address->private = kmalloc(sizeof (struct mthca_ah), GFP_KERNEL);
-	if (!address->private)
-		return -ENOMEM;
+	ah = kmalloc(sizeof *ah, GFP_KERNEL);
+	if (!ah)
+		return ERR_PTR(-ENOMEM);
 
 	err = mthca_create_ah(to_mdev(pd->device),
 			      (struct mthca_pd *) pd,
-			      av, address->private);
-	if (err)
-		kfree(address->private);
+			      ah_attr, ah);
+	if (err) {
+		kfree(ah);
+		return ERR_PTR(err);
+	}
 
-	return err;
+	return (struct ib_ah *) ah;
 }
 
-static int mthca_address_destroy(struct ib_address *address)
+static int mthca_ah_destroy(struct ib_ah *ah)
 {
-	mthca_destroy_ah(to_mdev(address->device), address->private);
-	kfree(address->private);
+	mthca_destroy_ah(to_mdev(ah->device), ah);
+	kfree(ah);
 
 	return 0;
 }
@@ -543,8 +545,8 @@
 	dev->ib_dev.gid_query            = mthca_gid_query;
 	dev->ib_dev.alloc_pd             = mthca_alloc_pd;
 	dev->ib_dev.dealloc_pd           = mthca_dealloc_pd;
-	dev->ib_dev.address_create       = mthca_address_create;
-	dev->ib_dev.address_destroy      = mthca_address_destroy;
+	dev->ib_dev.create_ah            = mthca_ah_create;
+	dev->ib_dev.destroy_ah           = mthca_ah_destroy;
 	dev->ib_dev.qp_create            = mthca_qp_create;
 	dev->ib_dev.special_qp_create    = mthca_special_qp_create;
 	dev->ib_dev.qp_modify            = mthca_modify_qp;
Index: src/linux-kernel/infiniband/hw/mthca/mthca_provider.h
===================================================================
--- src/linux-kernel/infiniband/hw/mthca/mthca_provider.h	(revision 576)
+++ src/linux-kernel/infiniband/hw/mthca/mthca_provider.h	(working copy)
@@ -67,6 +67,7 @@
 struct mthca_av;
 
 struct mthca_ah {
+	struct ib_ah     ibah;
 	int              on_hca;
 	u32              key;
 	struct mthca_av *av;
Index: src/linux-kernel/infiniband/hw/mthca/mthca_av.c
===================================================================
--- src/linux-kernel/infiniband/hw/mthca/mthca_av.c	(revision 576)
+++ src/linux-kernel/infiniband/hw/mthca/mthca_av.c	(working copy)
@@ -42,7 +42,7 @@
 
 int mthca_create_ah(struct mthca_dev *dev,
 		    struct mthca_pd *pd,
-		    struct ib_address_vector *address,
+		    struct ib_ah_attr *ah_attr,
 		    struct mthca_ah *ah)
 {
 	u32 index = -1;
@@ -81,20 +81,20 @@
 
 	memset(av, 0, MTHCA_AV_SIZE);
 
-	av->port_pd = cpu_to_be32(pd->pd_num | (address->port << 24));
-	av->g_slid  = (!!address->use_grh << 7) | address->source_path_bits;
-	av->dlid       = cpu_to_be16(address->dlid);
+	av->port_pd = cpu_to_be32(pd->pd_num | (ah_attr->port << 24));
+	av->g_slid  = (!!ah_attr->grh_flag << 7) | ah_attr->src_path_bits;
+	av->dlid       = cpu_to_be16(ah_attr->dlid);
 	av->msg_sr     = (3 << 4) | /* 2K message */
-		address->static_rate;
-	av->sl_tclass_flowlabel = cpu_to_be32(address->service_level << 28);
-	if (address->use_grh) {
-		av->gid_index = (address->port - 1) * dev->limits.gid_table_len +
-			address->source_gid_index;
-		av->hop_limit = address->hop_limit;
+		ah_attr->static_rate;
+	av->sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28);
+	if (ah_attr->grh_flag) {
+		av->gid_index = (ah_attr->port - 1) * dev->limits.gid_table_len +
+			ah_attr->grh.sgid_index;
+		av->hop_limit = ah_attr->grh.hop_limit;
 		av->sl_tclass_flowlabel |=
-			cpu_to_be32((address->traffic_class << 20) |
-				    address->flow_label);
-		memcpy(av->dgid, address->dgid, 16);
+			cpu_to_be32((ah_attr->grh.traffic_class << 20) |
+				    ah_attr->grh.flow_label);
+		memcpy(av->dgid, ah_attr->grh.dgid.raw, 16);
 	}
 
 	if (0) {
Index: src/linux-kernel/infiniband/hw/mthca/mthca_qp.c
===================================================================
--- src/linux-kernel/infiniband/hw/mthca/mthca_qp.c	(revision 576)
+++ src/linux-kernel/infiniband/hw/mthca/mthca_qp.c	(working copy)
@@ -226,11 +226,6 @@
 	u16 vcrc;
 } __attribute__((packed));
 
-static struct mthca_ah *to_mah(struct ib_address *ah)
-{
-	return (struct mthca_ah *) ah->private;
-}
-
 static int is_sqp(struct mthca_dev *dev, struct mthca_qp *qp)
 {
 	return qp->qpn >= dev->qp_table.sqp_start &&
@@ -1034,7 +1029,8 @@
 	int header_size;
 	int err;
 
-	err = mthca_read_ah(dev, to_mah(param->dest_address), &sqp->ud_header);
+	err = mthca_read_ah(dev, (struct mthca_ah *) param->dest_address,
+			    &sqp->ud_header);
 	if (err)
 		return err;
 	mlx->flags &= ~cpu_to_be32(MTHCA_NEXT_SOLICIT | 1);
@@ -1165,9 +1161,9 @@
 
 		if (qp->transport == UD) {
 			((struct mthca_ud_seg *) wqe)->lkey =
-				cpu_to_be32(to_mah(param->dest_address)->key);
+				cpu_to_be32(((struct mthca_ah *) param->dest_address)->key);
 			((struct mthca_ud_seg *) wqe)->av_addr =
-				cpu_to_be64(to_mah(param->dest_address)->avdma);
+				cpu_to_be64(((struct mthca_ah *) param->dest_address)->avdma);
 			((struct mthca_ud_seg *) wqe)->dqpn =
 				cpu_to_be32(param->dest_qpn);
 			((struct mthca_ud_seg *) wqe)->qkey =



More information about the general mailing list