---
 drivers/infiniband/ulp/sdp/sdp_bcopy.c |    6 +++---
 drivers/infiniband/ulp/sdp/sdp_main.c  |   29 +++++++++++++++--------------
 drivers/infiniband/ulp/sdp/sdp_rx.c    |   14 +++++++-------
 drivers/infiniband/ulp/sdp/sdp_tx.c    |   12 ++++++------
 drivers/infiniband/ulp/sdp/sdp_zcopy.c |   12 ++++++------
 drivers/infiniband/util/madeye.c       |    1 +
 6 files changed, 38 insertions(+), 36 deletions(-)

--- ofa_kernel-1.5.2.orig/drivers/infiniband/ulp/sdp/sdp_main.c
+++ ofa_kernel-1.5.2/drivers/infiniband/ulp/sdp/sdp_main.c
@@ -155,8 +155,8 @@ static int sdp_get_port(struct sock *sk,
 		.sin_addr.s_addr = inet_sk(sk)->rcv_saddr,
 	};
 
-	sdp_dbg(sk, "%s: %u.%u.%u.%u:%hu\n", __func__,
-		NIPQUAD(addr.sin_addr.s_addr), ntohs(addr.sin_port));
+	sdp_dbg(sk, "%s: %pI4:%hu\n", __func__,
+		addr.sin_addr.s_addr, ntohs(addr.sin_port));
 
 	if (!ssk->id)
 		ssk->id = rdma_create_id(sdp_cma_handler, sk, RDMA_PS_SDP);
@@ -777,10 +777,10 @@ static int sdp_connect(struct sock *sk,
 		inet_sk(sk)->sport = htons(inet_sk(sk)->num);
 	}
 
-	sdp_dbg(sk, "%s %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", __func__,
-		NIPQUAD(src_addr.sin_addr.s_addr),
+	sdp_dbg(sk, "%s %pI4:%hu -> %pI4:%hu\n", __func__,
+		src_addr.sin_addr.s_addr,
 		ntohs(src_addr.sin_port),
-		NIPQUAD(((struct sockaddr_in *)uaddr)->sin_addr.s_addr),
+		((struct sockaddr_in *)uaddr)->sin_addr.s_addr,
 		ntohs(((struct sockaddr_in *)uaddr)->sin_port));
 
 	if (!ssk->id) {
@@ -861,7 +861,7 @@ static int sdp_wait_for_connect(struct s
 	 * having to remove and re-insert us on the wait queue.
 	 */
 	for (;;) {
-		prepare_to_wait_exclusive(sk->sk_sleep, &wait,
+		prepare_to_wait_exclusive(sk_sleep(sk), &wait,
 					  TASK_INTERRUPTIBLE);
 		release_sock(sk);
 		if (list_empty(&ssk->accept_queue)) {
@@ -881,7 +881,7 @@ static int sdp_wait_for_connect(struct s
 		if (!timeo)
 			break;
 	}
-	finish_wait(sk->sk_sleep, &wait);
+	finish_wait(sk_sleep(sk), &wait);
 	sdp_dbg(sk, "%s returns %d\n", __func__, err);
 	return err;
 }
@@ -1181,7 +1181,7 @@ static void sdp_shutdown(struct sock *sk
 
 static void sdp_mark_push(struct sdp_sock *ssk, struct sk_buff *skb)
 {
-	SDP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
+	SDP_SKB_CB(skb)->flags |= TCPHDR_PSH;
 	sdp_do_posts(ssk);
 }
 
@@ -1469,7 +1469,7 @@ static inline void sdp_mark_urg(struct s
 {
 	if (unlikely(flags & MSG_OOB)) {
 		struct sk_buff *skb = sk->sk_write_queue.prev;
-		SDP_SKB_CB(skb)->flags |= TCPCB_FLAG_URG;
+		SDP_SKB_CB(skb)->flags |= TCPHDR_URG;
 	}
 }
 
@@ -1827,7 +1827,7 @@ int sdp_tx_wait_memory(struct sdp_sock *
 	while (1) {
 		set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
 
-		prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
+		prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
 
 		if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))
 			goto do_error;
@@ -1895,7 +1895,7 @@ int sdp_tx_wait_memory(struct sdp_sock *
 		*timeo_p = current_timeo;
 	}
 out:
-	finish_wait(sk->sk_sleep, &wait);
+	finish_wait(sk_sleep(sk), &wait);
 	return err;
 
 do_error:
@@ -2063,7 +2063,7 @@ new_segment:
 			}
 
 			if (!copied)
-				SDP_SKB_CB(skb)->flags &= ~TCPCB_FLAG_PSH;
+				SDP_SKB_CB(skb)->flags &= ~TCPHDR_PSH;
 
 			ssk->write_seq += copy;
 			SDP_SKB_CB(skb)->end_seq += copy;
@@ -2675,7 +2675,7 @@ void sdp_urg(struct sdp_sock *ssk, struc
 }
 
 static struct percpu_counter *sockets_allocated;
-static atomic_t memory_allocated;
+static atomic_long_t memory_allocated;
 static struct percpu_counter *orphan_count;
 static int memory_pressure;
 struct proto sdp_proto = {
@@ -2728,7 +2728,8 @@ static struct proto_ops sdp_proto_ops =
 	.sendpage   = sock_no_sendpage,
 };
 
-static int sdp_create_socket(struct net *net, struct socket *sock, int protocol)
+static int sdp_create_socket(struct net *net, struct socket *sock, int protocol,
+                             int kern)
 {
 	struct sock *sk;
 	int rc;
--- ofa_kernel-1.5.2.orig/drivers/infiniband/ulp/sdp/sdp_bcopy.c
+++ ofa_kernel-1.5.2/drivers/infiniband/ulp/sdp/sdp_bcopy.c
@@ -124,8 +124,8 @@ static inline int sdp_nagle_off(struct s
 		!ssk->nagle_last_unacked ||
 		skb->next != (struct sk_buff *)&ssk->isk.sk.sk_write_queue ||
 		skb->len + sizeof(struct sdp_bsdh) >= ssk->xmit_size_goal ||
-		(SDP_SKB_CB(skb)->flags & TCPCB_FLAG_PSH) ||
-		(SDP_SKB_CB(skb)->flags & TCPCB_FLAG_URG);
+		(SDP_SKB_CB(skb)->flags & TCPHDR_PSH) ||
+		(SDP_SKB_CB(skb)->flags & TCPHDR_URG);
 
 	if (send_now) {
 		unsigned long mseq = ring_head(ssk->tx_ring);
@@ -169,7 +169,7 @@ void sdp_nagle_timeout(unsigned long dat
 	ssk->nagle_last_unacked = 0;
 	sdp_post_sends(ssk, GFP_ATOMIC);
 
-	if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
+	if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk)))
 		sk_stream_write_space(&ssk->isk.sk);
 out:
 	bh_unlock_sock(sk);
--- ofa_kernel-1.5.2.orig/drivers/infiniband/ulp/sdp/sdp_tx.c
+++ ofa_kernel-1.5.2/drivers/infiniband/ulp/sdp/sdp_tx.c
@@ -99,7 +99,7 @@ void sdp_post_send(struct sdp_sock *ssk,
 		TX_SRCAVAIL_STATE(skb)->mseq = mseq;
 	}
 
-	if (unlikely(SDP_SKB_CB(skb)->flags & TCPCB_FLAG_URG))
+	if (unlikely(SDP_SKB_CB(skb)->flags & TCPHDR_URG))
 		h->flags = SDP_OOB_PRES | SDP_OOB_PEND;
 	else
 		h->flags = 0;
@@ -148,7 +148,7 @@ void sdp_post_send(struct sdp_sock *ssk,
 	tx_wr.num_sge = frags + 1;
 	tx_wr.opcode = IB_WR_SEND;
 	tx_wr.send_flags = IB_SEND_SIGNALED;
-	if (unlikely(SDP_SKB_CB(skb)->flags & TCPCB_FLAG_URG))
+	if (unlikely(SDP_SKB_CB(skb)->flags & TCPHDR_URG))
 		tx_wr.send_flags |= IB_SEND_SOLICITED;
 
 	rc = ib_post_send(ssk->qp, &tx_wr, &bad_wr);
@@ -265,7 +265,7 @@ static inline void sdp_process_tx_wc(str
 		 * therefore if Last RDMA read WR is completed - all other
 		 * have, too */
 		ssk->tx_ring.rdma_inflight->busy = 0;
-		wake_up(ssk->isk.sk.sk_sleep);
+		wake_up(sk_sleep(&ssk->isk.sk));
 		sdp_dbg_data(&ssk->isk.sk, "woke up sleepers\n");
 		return;
 	}
@@ -335,14 +335,14 @@ static int sdp_tx_handler_select(struct
 
 	if (sk->sk_write_pending) {
 		/* Do the TX posts from sender context */
-		if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) {
+		if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk))) {
 			sdp_prf1(sk, NULL, "Waking up pending sendmsg");
-			wake_up_interruptible(sk->sk_sleep);
+			wake_up_interruptible(sk_sleep(sk));
 			return 0;
 		} else
 			sdp_prf1(sk, NULL, "Unexpected: sk_sleep=%p, "
 				"waitqueue_active: %d\n",
-				sk->sk_sleep, waitqueue_active(sk->sk_sleep));
+				sk_sleep(sk), waitqueue_active(sk_sleep(sk)));
 	}
 
 	if (posts_handler(ssk)) {
--- ofa_kernel-1.5.2.orig/drivers/infiniband/ulp/sdp/sdp_rx.c
+++ ofa_kernel-1.5.2/drivers/infiniband/ulp/sdp/sdp_rx.c
@@ -347,7 +347,7 @@ static inline struct sk_buff *sdp_sock_q
 			sdp_dbg_data(&ssk->isk.sk, "got RX SrcAvail while waiting "
 					"for TX SrcAvail. waking up TX SrcAvail"
 					"to be aborted\n");
-			wake_up(sk->sk_sleep);
+			wake_up(sk_sleep(sk));
 		}
 
 		atomic_add(skb->len, &ssk->rcv_nxt);
@@ -599,7 +599,7 @@ static int sdp_process_rx_skb(struct sdp
 			ssk->sa_cancel_mseq = ntohl(h->mseq);
 			ssk->sa_cancel_arrived = 1;
 			if (ssk->rx_sa && ssk->rx_sa->is_treated)
-				wake_up(sk->sk_sleep);
+				wake_up(sk_sleep(sk));
 
 			skb_queue_tail(&ssk->rx_ctl_q, skb);
 		} else if (h->mid == SDP_MID_RDMARDCOMPL) {
@@ -697,9 +697,9 @@ static void sdp_bzcopy_write_space(struc
 	clear_bit(SOCK_NOSPACE, &sock->flags);
 	sdp_prf1(sk, NULL, "Waking up sleepers");
 
-	if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
-		wake_up_interruptible(sk->sk_sleep);
-	if (sock->fasync_list && !(sk->sk_shutdown & SEND_SHUTDOWN))
+	if (sk_sleep(sk) && waitqueue_active(sk_sleep(sk)))
+		wake_up_interruptible(sk_sleep(sk));
+	if (sock->wq->fasync_list && !(sk->sk_shutdown & SEND_SHUTDOWN))
 		sock_wake_async(sock, 2, POLL_OUT);
 }
 
@@ -815,7 +815,7 @@ void sdp_do_posts(struct sdp_sock *ssk)
 
 static inline int should_wake_up(struct sock *sk)
 {
-	return sk->sk_sleep && waitqueue_active(sk->sk_sleep) &&
+	return sk_sleep(sk) && waitqueue_active(sk_sleep(sk)) &&
 		(posts_handler(sdp_sk(sk)) || somebody_is_waiting(sk));
 }
 
@@ -834,7 +834,7 @@ static void sdp_rx_irq(struct ib_cq *cq,
 	sdp_prf(sk, NULL, "rx irq");
 
 	if (should_wake_up(sk)) {
-		wake_up_interruptible(sk->sk_sleep);
+		wake_up_interruptible(sk_sleep(sk));
 		SDPSTATS_COUNTER_INC(rx_int_wake_up);
 	} else {
 		if (queue_work_on(ssk->cpu, rx_comp_wq, &ssk->rx_comp_work))
--- ofa_kernel-1.5.2.orig/drivers/infiniband/ulp/sdp/sdp_zcopy.c
+++ ofa_kernel-1.5.2/drivers/infiniband/ulp/sdp/sdp_zcopy.c
@@ -139,7 +139,7 @@ static int sdp_wait_rdmardcompl(struct s
 	sdp_dbg_data(sk, "sleep till RdmaRdCompl. timeo = %ld.\n", *timeo_p);
 	sdp_prf1(sk, NULL, "Going to sleep");
 	while (ssk->qp_active) {
-		prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
+		prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
 
 		if (unlikely(!*timeo_p)) {
 			err = -ETIME;
@@ -196,7 +196,7 @@ static int sdp_wait_rdmardcompl(struct s
 		*timeo_p = current_timeo;
 	}
 
-	finish_wait(sk->sk_sleep, &wait);
+	finish_wait(sk_sleep(sk), &wait);
 
 	sdp_dbg_data(sk, "Finished waiting - RdmaRdCompl: %d/%d bytes, flags: 0x%x\n",
 			tx_sa->bytes_acked, tx_sa->bytes_sent, tx_sa->abort_flags);
@@ -218,7 +218,7 @@ static int sdp_wait_rdma_wr_finished(str
 
 	sdp_dbg_data(sk, "Sleep till RDMA wr finished.\n");
 	while (1) {
-		prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(sk_sleep(sk), &wait, TASK_UNINTERRUPTIBLE);
 
 		if (!ssk->tx_ring.rdma_inflight->busy) {
 			sdp_dbg_data(sk, "got rdma cqe\n");
@@ -256,7 +256,7 @@ static int sdp_wait_rdma_wr_finished(str
 		posts_handler_get(ssk);
 	}
 
-	finish_wait(sk->sk_sleep, &wait);
+	finish_wait(sk_sleep(sk), &wait);
 
 	sdp_dbg_data(sk, "Finished waiting\n");
 	return rc;
@@ -348,7 +348,7 @@ void sdp_handle_sendsm(struct sdp_sock *
 	sdp_dbg_data(sk, "Got SendSM - aborting SrcAvail\n");
 
 	ssk->tx_sa->abort_flags |= TX_SA_SENDSM;
-	wake_up(sk->sk_sleep);
+	wake_up(sk_sleep(sk));
 	sdp_dbg_data(sk, "woke up sleepers\n");
 
 out:
@@ -380,7 +380,7 @@ void sdp_handle_rdma_read_compl(struct s
 
 	ssk->tx_sa->bytes_acked += bytes_completed;
 
-	wake_up(sk->sk_sleep);
+	wake_up(sk_sleep(sk));
 	sdp_dbg_data(sk, "woke up sleepers\n");
 
 out:
--- ofa_kernel-1.5.2.orig/drivers/infiniband/util/madeye.c
+++ ofa_kernel-1.5.2/drivers/infiniband/util/madeye.c
@@ -35,6 +35,7 @@
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/err.h>
+#include <linux/slab.h>
 
 #include <rdma/ib_mad.h>
 #include <rdma/ib_smi.h>
