From owner-p4-projects@FreeBSD.ORG Sat Nov 17 23:11:42 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0288716A418; Sat, 17 Nov 2007 23:11:42 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 807BC16A468 for ; Sat, 17 Nov 2007 23:11:41 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 7320A13C513 for ; Sat, 17 Nov 2007 23:11:41 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lAHNBfCk046176 for ; Sat, 17 Nov 2007 23:11:41 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lAHNBe7o046173 for perforce@freebsd.org; Sat, 17 Nov 2007 23:11:40 GMT (envelope-from kmacy@freebsd.org) Date: Sat, 17 Nov 2007 23:11:40 GMT Message-Id: <200711172311.lAHNBe7o046173@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 129181 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Nov 2007 23:11:42 -0000 http://perforce.freebsd.org/chv.cgi?CH=129181 Change 129181 by kmacy@kmacy:storage:toestack on 2007/11/17 23:11:15 add socket interfaces for sosend/soreceive for DMA direct to / from userspace also fix remaining toedev.h references Affected files ... .. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#22 edit .. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c#2 edit .. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_defs.h#11 edit .. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_tom.c#11 edit Differences ... ==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c#22 (text+ko) ==== @@ -76,7 +76,7 @@ #include #include #include -#include +#include #include #include #include @@ -264,7 +264,7 @@ cdev = d->cdev; last = tail = so->so_snd.sb_sndptr ? so->so_snd.sb_sndptr : so->so_snd.sb_mb; total_bytes = 0; - printf("tail=%p snd.cc=%d tp_last=%4\n", tail, so->so_snd.sb_cc, + printf("tail=%p snd.cc=%d tp_last=%p\n", tail, so->so_snd.sb_cc, toep->tp_m_last); if (last && toep->tp_m_last == last) { @@ -868,6 +868,7 @@ { struct tcpcb *tp = sototcpcb(so); + t3_install_socket_ops(so); tp->t_flags |= TF_TOE; tp->t_tu = &cxgb_toe_usrreqs; } ==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c#2 (text+ko) ==== @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -41,6 +42,7 @@ #include #include #include +#include #include #include @@ -70,14 +72,61 @@ #include #include #include -#include +#include #include #include #include +static int (*pru_sosend)(struct socket *so, struct sockaddr *addr, + struct uio *uio, struct mbuf *top, struct mbuf *control, + int flags, struct thread *td); + +static int (*pru_soreceive)(struct socket *so, struct sockaddr **paddr, + struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, + int *flagsp); + void -t3_init_offload_ops(void) +t3_init_socket_ops(void) +{ + struct protosw *prp; + + prp = pffindtype(AF_INET, SOCK_STREAM); + pru_sosend = prp->pr_usrreqs->pru_sosend; + pru_soreceive = prp->pr_usrreqs->pru_soreceive; +} + +static int +cxgb_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, + struct mbuf *top, struct mbuf *control, int flags, struct thread *td) { + /* + * punt it back to the stack if the overhead of copying is thought to + * be less than the VM and DMA overhead of setting up page pods + */ +#ifdef notyet + if (uio->uio_resid < (40 << 10) /* XXX use tunable */) +#endif + return pru_sosend(so, addr, uio, top, control, flags, td); + } + +static int +cxgb_soreceive(struct socket *so, struct sockaddr **psa, struct uio *uio, + struct mbuf **mp0, struct mbuf **controlp, int *flagsp) +{ +#ifdef notyet + if (uio->uio_resid < (40 << 10) /* XXX use tunable */) +#endif + return pru_soreceive(so, psa, uio, mp0, controlp, flagsp); +} + + +void +t3_install_socket_ops(struct socket *so) +{ + so->so_proto->pr_usrreqs->pru_sosend = cxgb_sosend; + so->so_proto->pr_usrreqs->pru_soreceive = cxgb_soreceive; +} + ==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_defs.h#11 (text+ko) ==== @@ -49,11 +49,14 @@ int t3_connect(struct toedev *tdev, struct socket *so, struct ifnet *egress_ifp); void t3_init_listen_cpl_handlers(void); int t3_init_cpl_io(void); -void t3_init_offload_ops(void); void t3_init_wr_tab(unsigned int wr_len); uint32_t t3_send_rx_credits(struct tcpcb *tp, uint32_t credits, uint32_t dack, int nofail); void t3_cleanup_rbuf(struct tcpcb *tp); +void t3_init_socket_ops(void); +void t3_install_socket_ops(struct socket *so); + + void t3_disconnect_acceptq(struct socket *listen_so); void t3_reset_synq(struct socket *listen_so); void t3_defer_reply(struct mbuf *m, struct toedev *dev, defer_handler_t handler); ==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_tom.c#11 (text+ko) ==== @@ -73,7 +73,7 @@ #include #include #include -#include +#include #include #include #include @@ -445,7 +445,7 @@ init_cpl_handlers(); if (t3_init_cpl_io() < 0) return -1; - t3_init_offload_ops(); + t3_init_socket_ops(); /* Register with the TOE device layer. */