PERFORCE change 129181 for review
Kip Macy
kmacy at FreeBSD.org
Sat Nov 17 15:11:42 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=129181
Change 129181 by kmacy at 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 <vm/vm.h>
#include <vm/pmap.h>
#include <dev/cxgb/sys/mvec.h>
-#include <dev/cxgb/ulp/toecore/toedev.h>
+#include <dev/cxgb/ulp/toecore/cxgb_toedev.h>
#include <dev/cxgb/ulp/tom/cxgb_defs.h>
#include <dev/cxgb/ulp/tom/cxgb_tom.h>
#include <dev/cxgb/ulp/tom/cxgb_t3_ddp.h>
@@ -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 <sys/param.h>
#include <sys/systm.h>
+#include <sys/types.h>
#include <sys/fcntl.h>
#include <sys/kernel.h>
#include <sys/limits.h>
@@ -41,6 +42,7 @@
#include <sys/socket.h>
#include <sys/syslog.h>
#include <sys/socketvar.h>
+#include <sys/uio.h>
#include <net/if.h>
#include <net/route.h>
@@ -70,14 +72,61 @@
#include <vm/vm.h>
#include <vm/pmap.h>
#include <dev/cxgb/sys/mvec.h>
-#include <dev/cxgb/ulp/toecore/toedev.h>
+#include <dev/cxgb/ulp/toecore/cxgb_toedev.h>
#include <dev/cxgb/ulp/tom/cxgb_defs.h>
#include <dev/cxgb/ulp/tom/cxgb_tom.h>
#include <dev/cxgb/ulp/tom/cxgb_t3_ddp.h>
+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 <dev/cxgb/common/cxgb_t3_cpl.h>
#include <dev/cxgb/cxgb_offload.h>
#include <dev/cxgb/cxgb_l2t.h>
-#include <dev/cxgb/ulp/toecore/toedev.h>
+#include <dev/cxgb/ulp/toecore/cxgb_toedev.h>
#include <dev/cxgb/ulp/tom/cxgb_tom.h>
#include <dev/cxgb/ulp/tom/cxgb_defs.h>
#include <dev/cxgb/ulp/tom/cxgb_t3_ddp.h>
@@ -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. */
More information about the p4-projects
mailing list