From owner-svn-src-projects@FreeBSD.ORG Fri Oct 29 01:33:44 2010 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABB36106566C; Fri, 29 Oct 2010 01:33:44 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 996948FC19; Fri, 29 Oct 2010 01:33:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9T1Ximu051251; Fri, 29 Oct 2010 01:33:44 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9T1Xi9q051244; Fri, 29 Oct 2010 01:33:44 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201010290133.o9T1Xi9q051244@svn.freebsd.org> From: Jeff Roberson Date: Fri, 29 Oct 2010 01:33:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214498 - projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 01:33:44 -0000 Author: jeff Date: Fri Oct 29 01:33:44 2010 New Revision: 214498 URL: http://svn.freebsd.org/changeset/base/214498 Log: - Initial mechanical changes to sdp sources to begin the porting effort. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_cma.c projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_dbg.h projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_proc.c projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_rx.c projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_tx.c projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_zcopy.c Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h Fri Oct 29 01:08:33 2010 (r214497) +++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp.h Fri Oct 29 01:33:44 2010 (r214498) @@ -39,7 +39,7 @@ #define SDP_MAX_RECV_SGES 9 /* 1 for sdp header + 8 for payload */ #define SDP_MAX_SEND_SGES 9 /* same as above */ -/* skb inlined data len - rest will be rx'ed into frags */ +/* mb inlined data len - rest will be rx'ed into frags */ #define SDP_SKB_HEAD_SIZE (0x500 + sizeof(struct sdp_bsdh)) /* limit tx payload len, if the sink supports bigger buffers than the source @@ -64,7 +64,7 @@ #define SDP_AUTO_CONF 0xffff #define AUTO_MOD_DELAY (HZ / 4) -struct sdp_skb_cb { +struct sdp_mb_cb { __u32 seq; /* Starting sequence number */ __u32 end_seq; /* SEQ + FIN + SYN + datalen */ __u8 flags; /* TCP header flags. */ @@ -73,10 +73,10 @@ struct sdp_skb_cb { struct tx_srcavail_state *tx_sa; }; -#define SDP_SKB_CB(__skb) ((struct sdp_skb_cb *)&((__skb)->cb[0])) -#define BZCOPY_STATE(skb) (SDP_SKB_CB(skb)->bz) -#define RX_SRCAVAIL_STATE(skb) (SDP_SKB_CB(skb)->rx_sa) -#define TX_SRCAVAIL_STATE(skb) (SDP_SKB_CB(skb)->tx_sa) +#define SDP_SKB_CB(__mb) ((struct sdp_mb_cb *)&((__mb)->cb[0])) +#define BZCOPY_STATE(mb) (SDP_SKB_CB(mb)->bz) +#define RX_SRCAVAIL_STATE(mb) (SDP_SKB_CB(mb)->rx_sa) +#define TX_SRCAVAIL_STATE(mb) (SDP_SKB_CB(mb)->tx_sa) #ifndef MIN #define MIN(a, b) (a < b ? a : b) @@ -196,7 +196,7 @@ struct sdp_srcah { } __attribute__((__packed__)); struct sdp_buf { - struct sk_buff *skb; + struct mbuf *mb; u64 mapping[SDP_MAX_SEND_SGES]; } __attribute__((__packed__)); @@ -324,8 +324,8 @@ struct sdp_sock { struct list_head sock_list; struct list_head accept_queue; struct list_head backlog_queue; - struct sk_buff_head rx_ctl_q; - struct sock *parent; + struct mbuf_head rx_ctl_q; + struct socket *parent; struct sdp_device *sdp_dev; int qp_active; @@ -406,8 +406,8 @@ struct sdp_sock { int recv_request_head; /* mark the rx_head when the resize request was recieved */ int recv_request; /* flag if request to resize was recieved */ - int recv_frags; /* max skb frags in recv packets */ - int send_frags; /* max skb frags in send packets */ + int recv_frags; /* max mb frags in recv packets */ + int send_frags; /* max mb frags in send packets */ unsigned long tx_packets; unsigned long rx_packets; @@ -449,12 +449,12 @@ static inline void rx_ring_destroy_lock( write_unlock_bh(&rx_ring->destroyed_lock); } -static inline struct sdp_sock *sdp_sk(const struct sock *sk) +static inline struct sdp_sock *sdp_sk(const struct socket *sk) { return (struct sdp_sock *)sk; } -static inline int _sdp_exch_state(const char *func, int line, struct sock *sk, +static inline int _sdp_exch_state(const char *func, int line, struct socket *sk, int from_states, int state) { unsigned long flags; @@ -483,7 +483,7 @@ static inline int _sdp_exch_state(const #define sdp_exch_state(sk, from_states, state) \ _sdp_exch_state(__func__, __LINE__, sk, from_states, state) -static inline void sdp_set_error(struct sock *sk, int err) +static inline void sdp_set_error(struct socket *sk, int err) { int ib_teardown_states = TCPF_FIN_WAIT1 | TCPF_CLOSE_WAIT | TCPF_LAST_ACK; @@ -499,7 +499,7 @@ static inline void sdp_set_error(struct sk->sk_error_report(sk); } -static inline void sdp_arm_rx_cq(struct sock *sk) +static inline void sdp_arm_rx_cq(struct socket *sk) { sdp_prf(sk, NULL, "Arming RX cq"); sdp_dbg_data(sk, "Arming RX cq\n"); @@ -507,7 +507,7 @@ static inline void sdp_arm_rx_cq(struct ib_req_notify_cq(sdp_sk(sk)->rx_ring.cq, IB_CQ_NEXT_COMP); } -static inline void sdp_arm_tx_cq(struct sock *sk) +static inline void sdp_arm_tx_cq(struct socket *sk) { sdp_prf(sk, NULL, "Arming TX cq"); sdp_dbg_data(sk, "Arming TX cq. credits: %d, posted: %d\n", @@ -557,25 +557,25 @@ static inline char *mid2str(int mid) return mid2str[mid]; } -static inline struct sk_buff *sdp_stream_alloc_skb(struct sock *sk, int size, +static inline struct mbuf *sdp_stream_alloc_mb(struct socket *sk, int size, gfp_t gfp) { - struct sk_buff *skb; + struct mbuf *mb; /* The TCP header must be at least 32-bit aligned. */ size = ALIGN(size, 4); - skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); - if (skb) { - if (sk_wmem_schedule(sk, skb->truesize)) { + mb = alloc_mb_fclone(size + sk->sk_prot->max_header, gfp); + if (mb) { + if (sk_wmem_schedule(sk, mb->truesize)) { /* * Make sure that we have exactly size bytes * available to the caller, no more, no less. */ - skb_reserve(skb, skb_tailroom(skb) - size); - return skb; + mb_reserve(mb, mb_tailroom(mb) - size); + return mb; } - __kfree_skb(skb); + m_freem(mb); } else { sk->sk_prot->enter_memory_pressure(sk); sk_stream_moderate_sndbuf(sk); @@ -583,11 +583,11 @@ static inline struct sk_buff *sdp_stream return NULL; } -static inline struct sk_buff *sdp_alloc_skb(struct sock *sk, u8 mid, int size, +static inline struct mbuf *sdp_alloc_mb(struct socket *sk, u8 mid, int size, gfp_t gfp) { struct sdp_bsdh *h; - struct sk_buff *skb; + struct mbuf *mb; if (!gfp) { if (unlikely(sk->sk_allocation)) @@ -596,82 +596,82 @@ static inline struct sk_buff *sdp_alloc_ gfp = GFP_KERNEL; } - skb = sdp_stream_alloc_skb(sk, sizeof(struct sdp_bsdh) + size, gfp); - BUG_ON(!skb); + mb = sdp_stream_alloc_mb(sk, sizeof(struct sdp_bsdh) + size, gfp); + BUG_ON(!mb); - skb_header_release(skb); + mb_header_release(mb); - h = (struct sdp_bsdh *)skb_push(skb, sizeof *h); + h = (struct sdp_bsdh *)mb_push(mb, sizeof *h); h->mid = mid; - skb_reset_transport_header(skb); + mb_reset_transport_header(mb); - return skb; + return mb; } -static inline struct sk_buff *sdp_alloc_skb_data(struct sock *sk, gfp_t gfp) +static inline struct mbuf *sdp_alloc_mb_data(struct socket *sk, gfp_t gfp) { - return sdp_alloc_skb(sk, SDP_MID_DATA, 0, gfp); + return sdp_alloc_mb(sk, SDP_MID_DATA, 0, gfp); } -static inline struct sk_buff *sdp_alloc_skb_disconnect(struct sock *sk, +static inline struct mbuf *sdp_alloc_mb_disconnect(struct socket *sk, gfp_t gfp) { - return sdp_alloc_skb(sk, SDP_MID_DISCONN, 0, gfp); + return sdp_alloc_mb(sk, SDP_MID_DISCONN, 0, gfp); } -static inline struct sk_buff *sdp_alloc_skb_chrcvbuf_ack(struct sock *sk, +static inline struct mbuf *sdp_alloc_mb_chrcvbuf_ack(struct socket *sk, int size, gfp_t gfp) { - struct sk_buff *skb; + struct mbuf *mb; struct sdp_chrecvbuf *resp_size; - skb = sdp_alloc_skb(sk, SDP_MID_CHRCVBUF_ACK, sizeof(*resp_size), gfp); + mb = sdp_alloc_mb(sk, SDP_MID_CHRCVBUF_ACK, sizeof(*resp_size), gfp); - resp_size = (struct sdp_chrecvbuf *)skb_put(skb, sizeof *resp_size); + resp_size = (struct sdp_chrecvbuf *)mb_put(mb, sizeof *resp_size); resp_size->size = htonl(size); - return skb; + return mb; } -static inline struct sk_buff *sdp_alloc_skb_srcavail(struct sock *sk, +static inline struct mbuf *sdp_alloc_mb_srcavail(struct socket *sk, u32 len, u32 rkey, u64 vaddr, gfp_t gfp) { - struct sk_buff *skb; + struct mbuf *mb; struct sdp_srcah *srcah; - skb = sdp_alloc_skb(sk, SDP_MID_SRCAVAIL, sizeof(*srcah), gfp); + mb = sdp_alloc_mb(sk, SDP_MID_SRCAVAIL, sizeof(*srcah), gfp); - srcah = (struct sdp_srcah *)skb_put(skb, sizeof(*srcah)); + srcah = (struct sdp_srcah *)mb_put(mb, sizeof(*srcah)); srcah->len = htonl(len); srcah->rkey = htonl(rkey); srcah->vaddr = cpu_to_be64(vaddr); - return skb; + return mb; } -static inline struct sk_buff *sdp_alloc_skb_srcavail_cancel(struct sock *sk, +static inline struct mbuf *sdp_alloc_mb_srcavail_cancel(struct socket *sk, gfp_t gfp) { - return sdp_alloc_skb(sk, SDP_MID_SRCAVAIL_CANCEL, 0, gfp); + return sdp_alloc_mb(sk, SDP_MID_SRCAVAIL_CANCEL, 0, gfp); } -static inline struct sk_buff *sdp_alloc_skb_rdmardcompl(struct sock *sk, +static inline struct mbuf *sdp_alloc_mb_rdmardcompl(struct socket *sk, u32 len, gfp_t gfp) { - struct sk_buff *skb; + struct mbuf *mb; struct sdp_rrch *rrch; - skb = sdp_alloc_skb(sk, SDP_MID_RDMARDCOMPL, sizeof(*rrch), gfp); + mb = sdp_alloc_mb(sk, SDP_MID_RDMARDCOMPL, sizeof(*rrch), gfp); - rrch = (struct sdp_rrch *)skb_put(skb, sizeof(*rrch)); + rrch = (struct sdp_rrch *)mb_put(mb, sizeof(*rrch)); rrch->len = htonl(len); - return skb; + return mb; } -static inline struct sk_buff *sdp_alloc_skb_sendsm(struct sock *sk, gfp_t gfp) +static inline struct mbuf *sdp_alloc_mb_sendsm(struct socket *sk, gfp_t gfp) { - return sdp_alloc_skb(sk, SDP_MID_SENDSM, 0, gfp); + return sdp_alloc_mb(sk, SDP_MID_SENDSM, 0, gfp); } static inline int sdp_tx_ring_slots_left(struct sdp_sock *ssk) { @@ -753,32 +753,32 @@ static inline void sdp_cleanup_sdp_buf(s size_t head_size, enum dma_data_direction dir) { int i; - struct sk_buff *skb; + struct mbuf *mb; struct ib_device *dev = ssk->ib_device; - skb = sbuf->skb; + mb = sbuf->mb; ib_dma_unmap_single(dev, sbuf->mapping[0], head_size, dir); - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { + for (i = 0; i < mb_shinfo(mb)->nr_frags; i++) { ib_dma_unmap_page(dev, sbuf->mapping[i + 1], - skb_shinfo(skb)->frags[i].size, + mb_shinfo(mb)->frags[i].size, dir); } } /* sdp_main.c */ void sdp_set_default_moderation(struct sdp_sock *ssk); -int sdp_init_sock(struct sock *sk); -void sdp_start_keepalive_timer(struct sock *sk); +int sdp_init_sock(struct socket *sk); +void sdp_start_keepalive_timer(struct socket *sk); void sdp_remove_sock(struct sdp_sock *ssk); void sdp_add_sock(struct sdp_sock *ssk); -void sdp_urg(struct sdp_sock *ssk, struct sk_buff *skb); +void sdp_urg(struct sdp_sock *ssk, struct mbuf *mb); void sdp_cancel_dreq_wait_timeout(struct sdp_sock *ssk); -void sdp_reset_sk(struct sock *sk, int rc); -void sdp_reset(struct sock *sk); +void sdp_reset_sk(struct socket *sk, int rc); +void sdp_reset(struct socket *sk); int sdp_tx_wait_memory(struct sdp_sock *ssk, long *timeo_p, int *credits_needed); -void skb_entail(struct sock *sk, struct sdp_sock *ssk, struct sk_buff *skb); +void mb_entail(struct socket *sk, struct sdp_sock *ssk, struct mbuf *mb); /* sdp_proc.c */ int __init sdp_proc_init(void); @@ -791,7 +791,7 @@ int sdp_cma_handler(struct rdma_cm_id *, int sdp_tx_ring_create(struct sdp_sock *ssk, struct ib_device *device); void sdp_tx_ring_destroy(struct sdp_sock *ssk); int sdp_xmit_poll(struct sdp_sock *ssk, int force); -void sdp_post_send(struct sdp_sock *ssk, struct sk_buff *skb); +void sdp_post_send(struct sdp_sock *ssk, struct mbuf *mb); void sdp_post_sends(struct sdp_sock *ssk, gfp_t gfp); void sdp_nagle_timeout(unsigned long data); void sdp_post_keepalive(struct sdp_sock *ssk); @@ -805,22 +805,22 @@ int sdp_init_buffers(struct sdp_sock *ss void sdp_do_posts(struct sdp_sock *ssk); void sdp_rx_comp_full(struct sdp_sock *ssk); void sdp_remove_large_sock(struct sdp_sock *ssk); -void sdp_handle_disconn(struct sock *sk); +void sdp_handle_disconn(struct socket *sk); /* sdp_zcopy.c */ -int sdp_sendmsg_zcopy(struct kiocb *iocb, struct sock *sk, struct iovec *iov); +int sdp_sendmsg_zcopy(struct kiocb *iocb, struct socket *sk, struct iovec *iov); int sdp_handle_srcavail(struct sdp_sock *ssk, struct sdp_srcah *srcah); void sdp_handle_sendsm(struct sdp_sock *ssk, u32 mseq_ack); void sdp_handle_rdma_read_compl(struct sdp_sock *ssk, u32 mseq_ack, u32 bytes_completed); int sdp_handle_rdma_read_cqe(struct sdp_sock *ssk); -int sdp_rdma_to_iovec(struct sock *sk, struct iovec *iov, struct sk_buff *skb, +int sdp_rdma_to_iovec(struct socket *sk, struct iovec *iov, struct mbuf *mb, unsigned long *used); int sdp_post_rdma_rd_compl(struct sdp_sock *ssk, struct rx_srcavail_state *rx_sa); -int sdp_post_sendsm(struct sock *sk); +int sdp_post_sendsm(struct socket *sk); void srcavail_cancel_timeout(struct work_struct *work); -void sdp_abort_srcavail(struct sock *sk); -void sdp_abort_rdma_read(struct sock *sk); +void sdp_abort_srcavail(struct socket *sk); +void sdp_abort_rdma_read(struct socket *sk); #endif Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c Fri Oct 29 01:08:33 2010 (r214497) +++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c Fri Oct 29 01:33:44 2010 (r214498) @@ -34,8 +34,8 @@ #include "sdp.h" #ifdef CONFIG_INFINIBAND_SDP_DEBUG_DATA -void _dump_packet(const char *func, int line, struct sock *sk, char *str, - struct sk_buff *skb, const struct sdp_bsdh *h) +void _dump_packet(const char *func, int line, struct socket *sk, char *str, + struct mbuf *mb, const struct sdp_bsdh *h) { struct sdp_hh *hh; struct sdp_hah *hah; @@ -44,9 +44,9 @@ void _dump_packet(const char *func, int struct sdp_srcah *srcah; int len = 0; char buf[256]; - len += snprintf(buf, 255-len, "%s skb: %p mid: %2x:%-20s flags: 0x%x " + len += snprintf(buf, 255-len, "%s mb: %p mid: %2x:%-20s flags: 0x%x " "bufs: 0x%x len: 0x%x mseq: 0x%x mseq_ack: 0x%x | ", - str, skb, h->mid, mid2str(h->mid), h->flags, + str, mb, h->mid, mid2str(h->mid), h->flags, ntohs(h->bufs), ntohl(h->len), ntohl(h->mseq), ntohl(h->mseq_ack)); @@ -99,11 +99,11 @@ void _dump_packet(const char *func, int } #endif -static inline void update_send_head(struct sock *sk, struct sk_buff *skb) +static inline void update_send_head(struct socket *sk, struct mbuf *mb) { struct page *page; - sk->sk_send_head = skb->next; - if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue) { + sk->sk_send_head = mb->next; + if (sk->sk_send_head == (struct mbuf *)&sk->sk_write_queue) { sk->sk_send_head = NULL; page = sk->sk_sndmsg_page; if (page) { @@ -113,17 +113,17 @@ static inline void update_send_head(stru } } -static inline int sdp_nagle_off(struct sdp_sock *ssk, struct sk_buff *skb) +static inline int sdp_nagle_off(struct sdp_sock *ssk, struct mbuf *mb) { - struct sdp_bsdh *h = (struct sdp_bsdh *)skb_transport_header(skb); + struct sdp_bsdh *h = (struct sdp_bsdh *)mb_transport_header(mb); int send_now = - BZCOPY_STATE(skb) || + BZCOPY_STATE(mb) || unlikely(h->mid != SDP_MID_DATA) || (ssk->nonagle & TCP_NAGLE_OFF) || !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); + mb->next != (struct mbuf *)&ssk->isk.sk.sk_write_queue || + mb->len + sizeof(struct sdp_bsdh) >= ssk->xmit_size_goal || + (SDP_SKB_CB(mb)->flags & TCPCB_FLAG_PSH); if (send_now) { unsigned long mseq = ring_head(ssk->tx_ring); @@ -144,7 +144,7 @@ static inline int sdp_nagle_off(struct s void sdp_nagle_timeout(unsigned long data) { struct sdp_sock *ssk = (struct sdp_sock *)data; - struct sock *sk = &ssk->isk.sk; + struct socket *sk = &ssk->isk.sk; sdp_dbg_data(sk, "last_unacked = %ld\n", ssk->nagle_last_unacked); @@ -178,9 +178,9 @@ out2: void sdp_post_sends(struct sdp_sock *ssk, gfp_t gfp) { /* TODO: nonagle? */ - struct sk_buff *skb; + struct mbuf *mb; int post_count = 0; - struct sock *sk = &ssk->isk.sk; + struct socket *sk = &ssk->isk.sk; if (unlikely(!ssk->id)) { if (ssk->isk.sk.sk_send_head) { @@ -201,10 +201,10 @@ void sdp_post_sends(struct sdp_sock *ssk sdp_tx_ring_slots_left(ssk)) { ssk->recv_request = 0; - skb = sdp_alloc_skb_chrcvbuf_ack(sk, + mb = sdp_alloc_mb_chrcvbuf_ack(sk, ssk->recv_frags * PAGE_SIZE, gfp); - sdp_post_send(ssk, skb); + sdp_post_send(ssk, mb); post_count++; } @@ -217,12 +217,12 @@ void sdp_post_sends(struct sdp_sock *ssk while (tx_credits(ssk) > SDP_MIN_TX_CREDITS && sdp_tx_ring_slots_left(ssk) && - (skb = ssk->isk.sk.sk_send_head) && - sdp_nagle_off(ssk, skb)) { - update_send_head(&ssk->isk.sk, skb); - __skb_dequeue(&ssk->isk.sk.sk_write_queue); + (mb = ssk->isk.sk.sk_send_head) && + sdp_nagle_off(ssk, mb)) { + update_send_head(&ssk->isk.sk, mb); + __mb_dequeue(&ssk->isk.sk.sk_write_queue); - sdp_post_send(ssk, skb); + sdp_post_send(ssk, mb); post_count++; } @@ -231,8 +231,8 @@ void sdp_post_sends(struct sdp_sock *ssk likely((1 << ssk->isk.sk.sk_state) & (TCPF_ESTABLISHED | TCPF_FIN_WAIT1))) { - skb = sdp_alloc_skb_data(&ssk->isk.sk, gfp); - sdp_post_send(ssk, skb); + mb = sdp_alloc_mb_data(&ssk->isk.sk, gfp); + sdp_post_send(ssk, mb); SDPSTATS_COUNTER_INC(post_send_credits); post_count++; @@ -248,8 +248,8 @@ void sdp_post_sends(struct sdp_sock *ssk tx_credits(ssk) > 1) { ssk->sdp_disconnect = 0; - skb = sdp_alloc_skb_disconnect(sk, gfp); - sdp_post_send(ssk, skb); + mb = sdp_alloc_mb_disconnect(sk, gfp); + sdp_post_send(ssk, mb); post_count++; } Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_cma.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_cma.c Fri Oct 29 01:08:33 2010 (r214497) +++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_cma.c Fri Oct 29 01:33:44 2010 (r214498) @@ -76,7 +76,7 @@ out: return max_sges; } -static int sdp_init_qp(struct sock *sk, struct rdma_cm_id *id) +static int sdp_init_qp(struct socket *sk, struct rdma_cm_id *id) { struct ib_qp_init_attr qp_init_attr = { .event_handler = sdp_qp_event_handler, @@ -148,11 +148,11 @@ static int sdp_get_max_send_frags(u32 bu SDP_MAX_SEND_SGES - 1); } -static int sdp_connect_handler(struct sock *sk, struct rdma_cm_id *id, +static int sdp_connect_handler(struct socket *sk, struct rdma_cm_id *id, struct rdma_cm_event *event) { - struct sockaddr_in *dst_addr; - struct sock *child; + struct socketaddr_in *dst_addr; + struct socket *child; const struct sdp_hh *h; int rc; @@ -170,7 +170,7 @@ static int sdp_connect_handler(struct so sdp_init_sock(child); - dst_addr = (struct sockaddr_in *)&id->route.addr.dst_addr; + dst_addr = (struct socketaddr_in *)&id->route.addr.dst_addr; inet_sk(child)->dport = dst_addr->sin_port; inet_sk(child)->daddr = dst_addr->sin_addr.s_addr; @@ -212,11 +212,11 @@ static int sdp_connect_handler(struct so return 0; } -static int sdp_response_handler(struct sock *sk, struct rdma_cm_id *id, +static int sdp_response_handler(struct socket *sk, struct rdma_cm_id *id, struct rdma_cm_event *event) { const struct sdp_hah *h; - struct sockaddr_in *dst_addr; + struct socketaddr_in *dst_addr; sdp_dbg(sk, "%s\n", __func__); sdp_exch_state(sk, TCPF_SYN_SENT, TCP_ESTABLISHED); @@ -244,16 +244,16 @@ static int sdp_response_handler(struct s sk->sk_state_change(sk); sk_wake_async(sk, 0, POLL_OUT); - dst_addr = (struct sockaddr_in *)&id->route.addr.dst_addr; + dst_addr = (struct socketaddr_in *)&id->route.addr.dst_addr; inet_sk(sk)->dport = dst_addr->sin_port; inet_sk(sk)->daddr = dst_addr->sin_addr.s_addr; return 0; } -static int sdp_connected_handler(struct sock *sk, struct rdma_cm_event *event) +static int sdp_connected_handler(struct socket *sk, struct rdma_cm_event *event) { - struct sock *parent; + struct socket *parent; sdp_dbg(sk, "%s\n", __func__); parent = sdp_sk(sk)->parent; @@ -289,7 +289,7 @@ done: return 0; } -static int sdp_disconnected_handler(struct sock *sk) +static int sdp_disconnected_handler(struct socket *sk) { struct sdp_sock *ssk = sdp_sk(sk); @@ -311,9 +311,9 @@ static int sdp_disconnected_handler(stru int sdp_cma_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) { struct rdma_conn_param conn_param; - struct sock *parent = NULL; - struct sock *child = NULL; - struct sock *sk; + struct socket *parent = NULL; + struct socket *child = NULL; + struct socket *sk; struct sdp_hah hah; struct sdp_hh hh; @@ -378,7 +378,7 @@ int sdp_cma_handler(struct rdma_cm_id *i PAGE_SIZE + sizeof(struct sdp_bsdh)); hh.max_adverts = 0x1; inet_sk(sk)->saddr = inet_sk(sk)->rcv_saddr = - ((struct sockaddr_in *)&id->route.addr.src_addr)->sin_addr.s_addr; + ((struct socketaddr_in *)&id->route.addr.src_addr)->sin_addr.s_addr; memset(&conn_param, 0, sizeof conn_param); conn_param.private_data_len = sizeof hh; conn_param.private_data = &hh; @@ -451,7 +451,7 @@ int sdp_cma_handler(struct rdma_cm_id *i case RDMA_CM_EVENT_ESTABLISHED: sdp_dbg(sk, "RDMA_CM_EVENT_ESTABLISHED\n"); inet_sk(sk)->saddr = inet_sk(sk)->rcv_saddr = - ((struct sockaddr_in *)&id->route.addr.src_addr)->sin_addr.s_addr; + ((struct socketaddr_in *)&id->route.addr.src_addr)->sin_addr.s_addr; rc = sdp_connected_handler(sk, event); break; case RDMA_CM_EVENT_DISCONNECTED: /* This means DREQ/DREP received */ Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_dbg.h ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_dbg.h Fri Oct 29 01:08:33 2010 (r214497) +++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_dbg.h Fri Oct 29 01:33:44 2010 (r214498) @@ -33,14 +33,14 @@ MODULE_PARM_DESC(var, msg " [" #def_val "]"); \ #ifdef SDP_PROFILING -struct sk_buff; +struct mbuf; struct sdpprf_log { int idx; int pid; int cpu; int sk_num; int sk_dport; - struct sk_buff *skb; + struct mbuf *mb; char msg[256]; unsigned long long time; @@ -74,7 +74,7 @@ static inline unsigned long long current l->sk_num = (sk) ? inet_sk(sk)->num : -1; \ l->sk_dport = (sk) ? ntohs(inet_sk(sk)->dport) : -1; \ l->cpu = smp_processor_id(); \ - l->skb = s; \ + l->mb = s; \ snprintf(l->msg, sizeof(l->msg) - 1, format, ## arg); \ l->time = current_nsec(); \ l->func = __func__; \ @@ -132,14 +132,14 @@ extern int sdp_data_debug_level; if (sdp_data_debug_level & 0x2) \ sdp_printk(KERN_WARNING, sk, format , ## arg); \ } while (0) -#define SDP_DUMP_PACKET(sk, str, skb, h) \ +#define SDP_DUMP_PACKET(sk, str, mb, h) \ do { \ if (sdp_data_debug_level & 0x1) \ - dump_packet(sk, str, skb, h); \ + dump_packet(sk, str, mb, h); \ } while (0) #else #define sdp_dbg_data(priv, format, arg...) -#define SDP_DUMP_PACKET(sk, str, skb, h) +#define SDP_DUMP_PACKET(sk, str, mb, h) #endif #define SOCK_REF_RESET "RESET" @@ -181,10 +181,10 @@ static inline char *sdp_state_str(int st struct sdp_bsdh; #ifdef CONFIG_INFINIBAND_SDP_DEBUG_DATA -void _dump_packet(const char *func, int line, struct sock *sk, char *str, - struct sk_buff *skb, const struct sdp_bsdh *h); -#define dump_packet(sk, str, skb, h) \ - _dump_packet(__func__, __LINE__, sk, str, skb, h) +void _dump_packet(const char *func, int line, struct socket *sk, char *str, + struct mbuf *mb, const struct sdp_bsdh *h); +#define dump_packet(sk, str, mb, h) \ + _dump_packet(__func__, __LINE__, sk, str, mb, h) #endif #endif Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c ============================================================================== --- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Oct 29 01:08:33 2010 (r214497) +++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Oct 29 01:33:44 2010 (r214498) @@ -41,7 +41,7 @@ #if defined(__ia64__) /* csum_partial_copy_from_user is not exported on ia64. - We don't really need it for SDP - skb_copy_to_page happens to call it + We don't really need it for SDP - mb_copy_to_page happens to call it but for SDP HW checksum is always set, so ... */ #include @@ -140,13 +140,13 @@ inline void sdp_remove_sock(struct sdp_s spin_unlock_irq(&sock_list_lock); } -static int sdp_get_port(struct sock *sk, unsigned short snum) +static int sdp_get_port(struct socket *sk, unsigned short snum) { struct sdp_sock *ssk = sdp_sk(sk); - struct sockaddr_in *src_addr; + struct socketaddr_in *src_addr; int rc; - struct sockaddr_in addr = { + struct socketaddr_in addr = { .sin_family = AF_INET, .sin_port = htons(snum), .sin_addr.s_addr = inet_sk(sk)->rcv_saddr, @@ -166,7 +166,7 @@ static int sdp_get_port(struct sock *sk, if (!memcmp(&addr, &ssk->id->route.addr.src_addr, sizeof addr)) return 0; - rc = ssk->last_bind_err = rdma_bind_addr(ssk->id, (struct sockaddr *)&addr); + rc = ssk->last_bind_err = rdma_bind_addr(ssk->id, (struct socketaddr *)&addr); if (rc) { sdp_dbg(sk, "Destroying qp\n"); rdma_destroy_id(ssk->id); @@ -174,7 +174,7 @@ static int sdp_get_port(struct sock *sk, return rc; } - src_addr = (struct sockaddr_in *)&(ssk->id->route.addr.src_addr); + src_addr = (struct socketaddr_in *)&(ssk->id->route.addr.src_addr); inet_sk(sk)->num = ntohs(src_addr->sin_port); return 0; } @@ -199,7 +199,7 @@ static void sdp_destroy_qp(struct sdp_so sdp_remove_large_sock(ssk); } -static void sdp_reset_keepalive_timer(struct sock *sk, unsigned long len) +static void sdp_reset_keepalive_timer(struct socket *sk, unsigned long len) { struct sdp_sock *ssk = sdp_sk(sk); @@ -211,7 +211,7 @@ static void sdp_reset_keepalive_timer(st sk_reset_timer(sk, &sk->sk_timer, jiffies + len); } -static void sdp_delete_keepalive_timer(struct sock *sk) +static void sdp_delete_keepalive_timer(struct socket *sk) { struct sdp_sock *ssk = sdp_sk(sk); @@ -225,7 +225,7 @@ static void sdp_delete_keepalive_timer(s static void sdp_keepalive_timer(unsigned long data) { - struct sock *sk = (struct sock *)data; + struct socket *sk = (struct socket *)data; struct sdp_sock *ssk = sdp_sk(sk); sdp_dbg(sk, "%s\n", __func__); @@ -252,13 +252,13 @@ out: sock_put(sk, SOCK_REF_ALIVE); } -static void sdp_init_keepalive_timer(struct sock *sk) +static void sdp_init_keepalive_timer(struct socket *sk) { sk->sk_timer.function = sdp_keepalive_timer; sk->sk_timer.data = (unsigned long)sk; } -static void sdp_set_keepalive(struct sock *sk, int val) +static void sdp_set_keepalive(struct socket *sk, int val) { sdp_dbg(sk, "%s %d\n", __func__, val); @@ -271,14 +271,14 @@ static void sdp_set_keepalive(struct soc sdp_delete_keepalive_timer(sk); } -void sdp_start_keepalive_timer(struct sock *sk) +void sdp_start_keepalive_timer(struct socket *sk) { sdp_reset_keepalive_timer(sk, sdp_keepalive_time_when(sdp_sk(sk))); } void sdp_set_default_moderation(struct sdp_sock *ssk) { - struct sock *sk = &ssk->isk.sk; + struct socket *sk = &ssk->isk.sk; struct sdp_moderation *mod = &ssk->auto_mod; int rx_buf_size; @@ -420,7 +420,7 @@ out: mod->last_moder_jiffies = jiffies; } -void sdp_reset_sk(struct sock *sk, int rc) +void sdp_reset_sk(struct socket *sk, int rc) { struct sdp_sock *ssk = sdp_sk(sk); @@ -451,7 +451,7 @@ void sdp_reset_sk(struct sock *sk, int r /* Like tcp_reset */ /* When we get a reset (completion with error) we do this. */ -void sdp_reset(struct sock *sk) +void sdp_reset(struct socket *sk) { int err; @@ -471,7 +471,7 @@ void sdp_reset(struct sock *sk) } /* TODO: linger? */ -static void sdp_close_sk(struct sock *sk) +static void sdp_close_sk(struct socket *sk) { struct sdp_sock *ssk = sdp_sk(sk); struct rdma_cm_id *id = NULL; @@ -480,7 +480,7 @@ static void sdp_close_sk(struct sock *sk lock_sock(sk); sk->sk_send_head = NULL; - skb_queue_purge(&sk->sk_write_queue); + mb_queue_purge(&sk->sk_write_queue); /* * If sendmsg cached page exists, toss it. */ @@ -498,7 +498,7 @@ static void sdp_close_sk(struct sock *sk lock_sock(sk); } - skb_queue_purge(&sk->sk_receive_queue); + mb_queue_purge(&sk->sk_receive_queue); sdp_destroy_qp(ssk); @@ -508,7 +508,7 @@ static void sdp_close_sk(struct sock *sk flush_scheduled_work(); } -static void sdp_destruct(struct sock *sk) +static void sdp_destruct(struct socket *sk) { struct sdp_sock *ssk = sdp_sk(sk); struct sdp_sock *s, *t; @@ -549,7 +549,7 @@ static inline void sdp_start_dreq_wait_t ssk->dreq_wait_timeout = 1; } -static void sdp_send_disconnect(struct sock *sk) +static void sdp_send_disconnect(struct socket *sk) { sock_hold(sk, SOCK_REF_DREQ_TO); sdp_start_dreq_wait_timeout(sdp_sk(sk), SDP_FIN_WAIT_TIMEOUT); @@ -562,7 +562,7 @@ static void sdp_send_disconnect(struct s * State processing on a close. * TCP_ESTABLISHED -> TCP_FIN_WAIT1 -> TCP_CLOSE */ -static int sdp_close_state(struct sock *sk) +static int sdp_close_state(struct socket *sk) { switch (sk->sk_state) { case TCP_ESTABLISHED: @@ -583,7 +583,7 @@ static int sdp_close_state(struct sock * * count removed, we destroy rdma_id so cma_handler() won't be invoked. * This function should be called under lock_sock(sk). */ -static inline void disable_cma_handler(struct sock *sk) +static inline void disable_cma_handler(struct socket *sk) { if (sdp_sk(sk)->id) { struct rdma_cm_id *id = sdp_sk(sk)->id; @@ -595,9 +595,9 @@ static inline void disable_cma_handler(s } /* Like tcp_close */ -static void sdp_close(struct sock *sk, long timeout) +static void sdp_close(struct socket *sk, long timeout) { - struct sk_buff *skb; + struct mbuf *mb; int data_was_unread = 0; lock_sock(sk); @@ -631,15 +631,15 @@ static void sdp_close(struct sock *sk, l * descriptor close, not protocol-sourced closes, because the * reader process may not have drained the data yet! */ - while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { - struct sdp_bsdh *h = (struct sdp_bsdh *)skb_transport_header(skb); + while ((mb = mb_dequeue(&sk->sk_receive_queue)) != NULL) { + struct sdp_bsdh *h = (struct sdp_bsdh *)mb_transport_header(mb); if (h->mid == SDP_MID_DISCONN) { sdp_handle_disconn(sk); } else { - sdp_dbg(sk, "Data was unread. skb: %p\n", skb); + sdp_dbg(sk, "Data was unread. mb: %p\n", mb); data_was_unread = 1; } - __kfree_skb(skb); + m_freem(mb); } sk_mem_reclaim(sk); @@ -719,10 +719,10 @@ out: sk_common_release(sk); } -static int sdp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) +static int sdp_connect(struct socket *sk, struct socketaddr *uaddr, int addr_len) { struct sdp_sock *ssk = sdp_sk(sk); - struct sockaddr_in src_addr = { + struct socketaddr_in src_addr = { .sin_family = AF_INET, .sin_port = htons(inet_sk(sk)->sport), .sin_addr.s_addr = inet_sk(sk)->saddr, @@ -730,7 +730,7 @@ static int sdp_connect(struct sock *sk, int rc; flush_workqueue(sdp_wq); - if (addr_len < sizeof(struct sockaddr_in)) + if (addr_len < sizeof(struct socketaddr_in)) return -EINVAL; if (uaddr->sa_family != AF_INET && uaddr->sa_family != AF_INET_SDP) @@ -746,15 +746,15 @@ static int sdp_connect(struct sock *sk, sdp_dbg(sk, "%s %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", __func__, NIPQUAD(src_addr.sin_addr.s_addr), ntohs(src_addr.sin_port), - NIPQUAD(((struct sockaddr_in *)uaddr)->sin_addr.s_addr), - ntohs(((struct sockaddr_in *)uaddr)->sin_port)); + NIPQUAD(((struct socketaddr_in *)uaddr)->sin_addr.s_addr), + ntohs(((struct socketaddr_in *)uaddr)->sin_port)); if (!ssk->id) { printk("??? ssk->id == NULL. Ohh\n"); return -EINVAL; } - rc = rdma_resolve_addr(ssk->id, (struct sockaddr *)&src_addr, + rc = rdma_resolve_addr(ssk->id, (struct socketaddr *)&src_addr, uaddr, SDP_RESOLVE_TIMEOUT); if (rc) { sdp_dbg(sk, "rdma_resolve_addr failed: %d\n", rc); @@ -765,7 +765,7 @@ static int sdp_connect(struct sock *sk, return 0; } -static int sdp_disconnect(struct sock *sk, int flags) +static int sdp_disconnect(struct socket *sk, int flags) { struct sdp_sock *ssk = sdp_sk(sk); int rc = 0; @@ -804,7 +804,7 @@ static int sdp_disconnect(struct sock *s } /* Like inet_csk_wait_for_connect */ -static int sdp_wait_for_connect(struct sock *sk, long timeo) +static int sdp_wait_for_connect(struct socket *sk, long timeo) { struct sdp_sock *ssk = sdp_sk(sk); DEFINE_WAIT(wait); @@ -853,10 +853,10 @@ static int sdp_wait_for_connect(struct s /* Consider using request_sock_queue instead of duplicating all this */ /* Like inet_csk_accept */ -static struct sock *sdp_accept(struct sock *sk, int flags, int *err) +static struct socket *sdp_accept(struct socket *sk, int flags, int *err) { struct sdp_sock *newssk = NULL, *ssk; - struct sock *newsk; + struct socket *newsk; int error; sdp_dbg(sk, "%s state %d expected %d *err %d\n", __func__, @@ -913,7 +913,7 @@ out_err: } /* Like tcp_ioctl */ -static int sdp_ioctl(struct sock *sk, int cmd, unsigned long arg) +static int sdp_ioctl(struct socket *sk, int cmd, unsigned long arg) { struct sdp_sock *ssk = sdp_sk(sk); int answ; @@ -935,9 +935,9 @@ static int sdp_ioctl(struct sock *sk, in answ = rcv_nxt(ssk) - ssk->copied_seq; /* Subtract 1, if FIN is in queue. */ - if (answ && !skb_queue_empty(&sk->sk_receive_queue)) + if (answ && !mb_queue_empty(&sk->sk_receive_queue)) answ -= - (skb_transport_header(sk->sk_receive_queue.prev))[0] + (mb_transport_header(sk->sk_receive_queue.prev))[0] == SDP_MID_DISCONN ? 1 : 0; } else answ = ssk->urg_seq - ssk->copied_seq; @@ -984,7 +984,7 @@ static void sdp_destroy_work(struct work { struct sdp_sock *ssk = container_of(work, struct sdp_sock, destroy_work); - struct sock *sk = &ssk->isk.sk; + struct socket *sk = &ssk->isk.sk; sdp_dbg(sk, "%s: refcnt %d\n", __func__, atomic_read(&sk->sk_refcnt)); sdp_destroy_qp(ssk); @@ -1014,7 +1014,7 @@ static void sdp_dreq_wait_timeout_work(s { struct sdp_sock *ssk = container_of(work, struct sdp_sock, dreq_wait_work.work); - struct sock *sk = &ssk->isk.sk; + struct socket *sk = &ssk->isk.sk; if (!ssk->dreq_wait_timeout) goto out; @@ -1061,7 +1061,7 @@ static struct lock_class_key ib_sdp_sk_c static void sdp_destroy_work(struct work_struct *work); static void sdp_dreq_wait_timeout_work(struct work_struct *work); -int sdp_init_sock(struct sock *sk) +int sdp_init_sock(struct socket *sk) { struct sdp_sock *ssk = sdp_sk(sk); @@ -1081,7 +1081,7 @@ int sdp_init_sock(struct sock *sk) sk->sk_route_caps |= NETIF_F_SG | NETIF_F_NO_CSUM; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***