[openib-general] [PATCH] MAD: rename 'multipacket' to 'rmpp'

Sean Hefty sean.hefty at intel.com
Mon Feb 27 15:44:01 PST 2006


The following renames 'multipacket' to 'rmpp' for consistency.
The most notable name changes are:

	ib_mad_multipacket_seg --> ib_rmpp_segment
	ib_mad_get_multipacket_seg() --> ib_get_rmpp_segment()

Signed-off-by: Sean Hefty <sean.hefty at intel.com>

---

Index: include/rdma/ib_mad.h
===================================================================
--- include/rdma/ib_mad.h	(revision 5455)
+++ include/rdma/ib_mad.h	(working copy)
@@ -141,7 +141,7 @@ struct ib_rmpp_hdr {
 	__be32	paylen_newwin;
 };
 
-struct ib_mad_multipacket_seg {
+struct ib_rmpp_segment {
 	struct list_head list;
 	u32 num;
 	u16 size;
@@ -597,14 +597,14 @@ struct ib_mad_send_buf * ib_create_send_
 					    gfp_t gfp_mask);
 
 /**
- * *ib_mad_get_multipacket_seg - returns a given RMPP segment.
+ * *ib_get_rmpp_segment - returns a given RMPP segment.
  * @send_buf: Previously allocated send data buffer.
  * @seg_num: number of segment to return
  *
- * This routine returns a pointer to a segment of a multipacket RMPP message.
+ * This routine returns a pointer to a segment of an RMPP message.
  */
-struct ib_mad_multipacket_seg
-*ib_mad_get_multipacket_seg(struct ib_mad_send_buf *send_buf, int seg_num);
+struct ib_rmpp_segment *ib_get_rmpp_segment(struct ib_mad_send_buf *send_buf,
+					    int seg_num);
 
 /**
  * ib_free_send_mad - Returns data buffers used to send a MAD.
Index: core/mad_rmpp.c
===================================================================
--- core/mad_rmpp.c	(revision 5455)
+++ core/mad_rmpp.c	(working copy)
@@ -535,7 +535,7 @@ start_rmpp(struct ib_mad_agent_private *
 static int send_next_seg(struct ib_mad_send_wr_private *mad_send_wr)
 {
 	struct ib_rmpp_mad *rmpp_mad;
-	struct ib_mad_multipacket_seg *seg;
+	struct ib_rmpp_segment *seg;
 	int timeout;
 	u32 paylen;
 
@@ -549,8 +549,7 @@ static int send_next_seg(struct ib_mad_s
 			 mad_send_wr->pad;
 		rmpp_mad->rmpp_hdr.paylen_newwin = cpu_to_be32(paylen);
 	} else {
-		seg = ib_rmpp_get_multipacket_seg(mad_send_wr,
-						  mad_send_wr->seg_num);
+		seg = ib_get_segment(mad_send_wr, mad_send_wr->seg_num);
 		if (!seg) {
 			printk(KERN_ERR PFX "send_next_seg: "
 			       "could not find segment %d\n",
@@ -605,12 +604,12 @@ out:
 
 static inline void adjust_last_ack(struct ib_mad_send_wr_private *wr)
 {
-	struct ib_mad_multipacket_seg *seg;
+	struct ib_rmpp_segment *seg;
 
 	if (wr->last_ack < 2)
 		return;
 	else if (!wr->last_ack_seg)
-		list_for_each_entry(seg, &wr->multipacket_list, list) {
+		list_for_each_entry(seg, &wr->rmpp_list, list) {
 			if (wr->last_ack == seg->num) {
 				wr->last_ack_seg = seg;
 				break;
@@ -902,7 +901,7 @@ int ib_retry_rmpp(struct ib_mad_send_wr_
 		return IB_RMPP_RESULT_PROCESSED;
 
 	mad_send_wr->seg_num = mad_send_wr->last_ack + 1;
-	mad_send_wr->seg_num_seg = mad_send_wr->last_ack_seg;
+	mad_send_wr->cur_seg = mad_send_wr->last_ack_seg;
 
 	ret = send_next_seg(mad_send_wr);
 	if (ret)
Index: core/user_mad.c
===================================================================
--- core/user_mad.c	(revision 5455)
+++ core/user_mad.c	(working copy)
@@ -194,7 +194,7 @@ static int copy_recv_mad(struct ib_mad_r
 	struct ib_mad_recv_buf *seg_buf;
 	struct ib_rmpp_mad *rmpp_mad;
 	void *data;
-	struct ib_mad_multipacket_seg *seg;
+	struct ib_rmpp_segment *seg;
 	int size, len, offset;
 	u8 flags;
 
@@ -220,7 +220,7 @@ static int copy_recv_mad(struct ib_mad_r
 				size = len;
 			else
 				size = sizeof(*rmpp_mad) - offset;
-			seg = kmalloc(sizeof(struct ib_mad_multipacket_seg) +
+			seg = kmalloc(sizeof(struct ib_rmpp_segment) +
 				      sizeof(struct ib_rmpp_mad) - offset,
 				      GFP_KERNEL);
 			if (!seg)
@@ -235,7 +235,7 @@ static int copy_recv_mad(struct ib_mad_r
 
 static void free_packet(struct ib_umad_packet *packet)
 {
-	struct ib_mad_multipacket_seg *seg, *tmp;
+	struct ib_rmpp_segment *seg, *tmp;
 
 	list_for_each_entry_safe(seg, tmp, &packet->seg_list, list) {
 		list_del(&seg->list);
@@ -322,7 +322,7 @@ static ssize_t ib_umad_read(struct file 
 			    size_t count, loff_t *pos)
 {
 	struct ib_umad_file *file = filp->private_data;
-	struct ib_mad_multipacket_seg *seg;
+	struct ib_rmpp_segment *seg;
 	struct ib_umad_packet *packet;
 	ssize_t ret;
 
@@ -411,7 +411,7 @@ static ssize_t ib_umad_write(struct file
 	int ret, length, hdr_len, copy_offset;
 	int rmpp_active, has_rmpp_header;
 	int s, seg_num;
-	struct ib_mad_multipacket_seg *seg;
+	struct ib_rmpp_segment *seg;
 
 	if (count < sizeof (struct ib_user_mad) + IB_MGMT_RMPP_HDR)
 		return -EINVAL;
@@ -523,7 +523,7 @@ static ssize_t ib_umad_write(struct file
 	if (length > 0) {
 		buf +=  sizeof (struct ib_user_mad) + sizeof(struct ib_mad);
 		for (seg_num = 2; length > 0; ++seg_num, buf += s, length -= s) {
-			seg = ib_mad_get_multipacket_seg(packet->msg, seg_num);
+			seg = ib_get_rmpp_segment(packet->msg, seg_num);
 			BUG_ON(!seg);
 			s = min_t(int, length, seg->size);
 			if (copy_from_user(seg->data, buf, s)) {
Index: core/mad.c
===================================================================
--- core/mad.c	(revision 5455)
+++ core/mad.c	(working copy)
@@ -779,23 +779,22 @@ static int get_buf_length(int hdr_len, i
 	return hdr_len + data_len + pad;
 }
 
-static void free_send_multipacket_list(struct ib_mad_send_wr_private *
-				       mad_send_wr)
+static void free_send_rmpp_list(struct ib_mad_send_wr_private *mad_send_wr)
 {
-	struct ib_mad_multipacket_seg *s, *t;
+	struct ib_rmpp_segment *s, *t;
 
-	list_for_each_entry_safe(s, t, &mad_send_wr->multipacket_list, list) {
+	list_for_each_entry_safe(s, t, &mad_send_wr->rmpp_list, list) {
 		list_del(&s->list);
 		kfree(s);
 	}
 }
 
-static inline int alloc_send_rmpp_segs(struct ib_mad_send_wr_private *send_wr,
+static inline int alloc_send_rmpp_list(struct ib_mad_send_wr_private *send_wr,
 				       int message_size, int hdr_len,
 				       int data_len, u8 rmpp_version,
 				       gfp_t gfp_mask)
 {
-	struct ib_mad_multipacket_seg *seg;
+	struct ib_rmpp_segment *seg;
 	struct ib_rmpp_mad *rmpp_mad = send_wr->send_buf.mad;
 	int seg_size, i = 2;
 
@@ -809,19 +808,19 @@ static inline int alloc_send_rmpp_segs(s
 	message_size -= sizeof(struct ib_mad);
 	seg_size = sizeof(struct ib_mad) - hdr_len;
 	while (message_size > 0) {
-		seg = kmalloc(sizeof(struct ib_mad_multipacket_seg) + seg_size,
+		seg = kmalloc(sizeof(struct ib_rmpp_segment) + seg_size,
 				     gfp_mask);
 		if (!seg) {
 			printk(KERN_ERR "ib_create_send_mad: RMPP mem "
 			       "alloc failed for len %zd, gfp %#x\n",
-			       sizeof(struct ib_mad_multipacket_seg) + seg_size,
+			       sizeof(struct ib_rmpp_segment) + seg_size,
 			       gfp_mask);
-			free_send_multipacket_list(send_wr);
+			free_send_rmpp_list(send_wr);
 			return -ENOMEM;
 		}
 		seg->size = seg_size;
 		seg->num = i++;
-		list_add_tail(&seg->list, &send_wr->multipacket_list);
+		list_add_tail(&seg->list, &send_wr->rmpp_list);
 		message_size -= seg_size;
 	}
 	return 0;
@@ -854,7 +853,7 @@ struct ib_mad_send_buf * ib_create_send_
 		return ERR_PTR(-ENOMEM);
 
 	mad_send_wr = buf + sizeof(struct ib_mad);
-	INIT_LIST_HEAD(&mad_send_wr->multipacket_list);
+	INIT_LIST_HEAD(&mad_send_wr->rmpp_list);
 	mad_send_wr->send_buf.mad = buf;
 	mad_send_wr->mad_payload = buf + hdr_len;
 
@@ -873,10 +872,10 @@ struct ib_mad_send_buf * ib_create_send_
 	mad_send_wr->send_wr.wr.ud.remote_qkey = IB_QP_SET_QKEY;
 	mad_send_wr->send_wr.wr.ud.pkey_index = pkey_index;
 	mad_send_wr->last_ack_seg = NULL;
-	mad_send_wr->seg_num_seg = NULL;
+	mad_send_wr->cur_seg = NULL;
 
 	if (rmpp_active) {
-		ret = alloc_send_rmpp_segs(mad_send_wr, message_size, hdr_len,
+		ret = alloc_send_rmpp_list(mad_send_wr, message_size, hdr_len,
 					   data_len, mad_agent->rmpp_version,
 					   gfp_mask);
 		if (ret) {
@@ -891,48 +890,45 @@ struct ib_mad_send_buf * ib_create_send_
 }
 EXPORT_SYMBOL(ib_create_send_mad);
 
-struct ib_mad_multipacket_seg
-*ib_rmpp_get_multipacket_seg(struct ib_mad_send_wr_private *wr, int seg_num)
+struct ib_rmpp_segment *ib_get_segment(struct ib_mad_send_wr_private *mad_send_wr,
+				       int seg_num)
 {
-	struct ib_mad_multipacket_seg *seg;
+	struct ib_rmpp_segment *seg;
 
 	if (seg_num == 2) {
-		wr->seg_num_seg =
-			container_of(wr->multipacket_list.next,
-				     struct ib_mad_multipacket_seg, list);
-		return wr->seg_num_seg;
+		mad_send_wr->cur_seg = container_of(mad_send_wr->rmpp_list.next,
+						    struct ib_rmpp_segment, list);
+		return mad_send_wr->cur_seg;
 	}
 
 	/* get first list entry if was not already done */
-	if (!wr->seg_num_seg)
-		wr->seg_num_seg =
-			container_of(wr->multipacket_list.next,
-				     struct ib_mad_multipacket_seg, list);
-
-	if (wr->seg_num_seg->num == seg_num)
-		return wr->seg_num_seg;
-	else if (wr->seg_num_seg->num < seg_num) {
-		list_for_each_entry(seg, &wr->seg_num_seg->list, list) {
+	if (!mad_send_wr->cur_seg)
+		mad_send_wr->cur_seg = container_of(mad_send_wr->rmpp_list.next,
+						    struct ib_rmpp_segment, list);
+
+	if (mad_send_wr->cur_seg->num == seg_num)
+		return mad_send_wr->cur_seg;
+	else if (mad_send_wr->cur_seg->num < seg_num) {
+		list_for_each_entry(seg, &mad_send_wr->cur_seg->list, list) {
 			if (seg->num == seg_num) {
-				wr->seg_num_seg = seg;
-				return wr->seg_num_seg;
+				mad_send_wr->cur_seg = seg;
+				return mad_send_wr->cur_seg;
 			}
 		}
-		return NULL;
 	} else {
-		list_for_each_entry_reverse(seg, &wr->seg_num_seg->list, list) {
+		list_for_each_entry_reverse(seg, &mad_send_wr->cur_seg->list,
+					    list) {
 			if (seg->num == seg_num) {
-				wr->seg_num_seg = seg;
-				return wr->seg_num_seg;
+				mad_send_wr->cur_seg = seg;
+				return mad_send_wr->cur_seg;
 			}
 		}
-		return NULL;
 	}
 	return NULL;
 }
 
-struct ib_mad_multipacket_seg
-*ib_mad_get_multipacket_seg(struct ib_mad_send_buf *send_buf, int seg_num)
+struct ib_rmpp_segment *ib_get_rmpp_segment(struct ib_mad_send_buf *send_buf,
+					    int seg_num)
 {
 	struct ib_mad_send_wr_private *wr;
 
@@ -940,9 +936,9 @@ struct ib_mad_multipacket_seg
 		return NULL;
 
 	wr = container_of(send_buf, struct ib_mad_send_wr_private, send_buf);
-	return ib_rmpp_get_multipacket_seg(wr, seg_num);
+	return ib_get_segment(wr, seg_num);
 }
-EXPORT_SYMBOL(ib_mad_get_multipacket_seg);
+EXPORT_SYMBOL(ib_get_rmpp_segment);
 
 void ib_free_send_mad(struct ib_mad_send_buf *send_buf)
 {
@@ -954,7 +950,7 @@ void ib_free_send_mad(struct ib_mad_send
 	mad_send_wr = container_of(send_buf, struct ib_mad_send_wr_private,
 				   send_buf);
 
-	free_send_multipacket_list(mad_send_wr);
+	free_send_rmpp_list(mad_send_wr);
 	kfree(send_buf->mad);
 	if (atomic_dec_and_test(&mad_agent_priv->refcount))
 		wake_up(&mad_agent_priv->wait);
Index: core/mad_priv.h
===================================================================
--- core/mad_priv.h	(revision 5455)
+++ core/mad_priv.h	(working copy)
@@ -132,9 +132,9 @@ struct ib_mad_send_wr_private {
 	enum ib_wc_status status;
 
 	/* RMPP control */
-	struct list_head multipacket_list;
-	struct ib_mad_multipacket_seg *last_ack_seg;
-	struct ib_mad_multipacket_seg *seg_num_seg;
+	struct list_head rmpp_list;
+	struct ib_rmpp_segment *last_ack_seg;
+	struct ib_rmpp_segment *cur_seg;
 	int last_ack;
 	int seg_num;
 	int newwin;
@@ -224,7 +224,7 @@ void ib_mark_mad_done(struct ib_mad_send
 void ib_reset_mad_timeout(struct ib_mad_send_wr_private *mad_send_wr,
 			  int timeout_ms);
 
-struct ib_mad_multipacket_seg
-*ib_rmpp_get_multipacket_seg(struct ib_mad_send_wr_private *wr, int seg_num);
+struct ib_rmpp_segment *ib_get_segment(struct ib_mad_send_wr_private *mad_send_wr,
+				       int seg_num);
 
 #endif	/* __IB_MAD_PRIV_H__ */






More information about the general mailing list