PERFORCE change 129441 for review

Kip Macy kmacy at FreeBSD.org
Fri Nov 23 19:18:28 PST 2007


http://perforce.freebsd.org/chv.cgi?CH=129441

Change 129441 by kmacy at kmacy:storage:toestack on 2007/11/24 03:17:54

	make all zero copy check contingent on TF_TOE being set in t_flags

Affected files ...

.. //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c#4 edit

Differences ...

==== //depot/projects/toestack/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c#4 (text+ko) ====

@@ -311,11 +311,9 @@
 cxgb_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
     struct mbuf *top, struct mbuf *control, int flags, struct thread *td)
 {
-	struct toedev *tdev = TOE_DEV(so);
-	int zcopy_thres = TOM_TUNABLE(tdev, zcopy_sosend_partial_thres);
-	int zcopy_enabled = TOM_TUNABLE(tdev, zcopy_sosend_enabled);
-	int rv;
 	struct tcpcb *tp = sototcpcb(so);
+	struct toedev *tdev; 
+	int zcopy_thres, zcopy_enabled, rv;
 
 	/*
 	 * In order to use DMA direct from userspace the following
@@ -329,14 +327,19 @@
 	 *  - blocking socket XXX for now
 	 *
 	 */
-	if ((tp->t_flags & TF_TOE) && (uio->uio_resid > zcopy_thres) &&
-	    (uio->uio_iovcnt < TMP_IOV_MAX) &&  ((so->so_state & SS_NBIO) == 0)
-	    && zcopy_enabled) {
-		rv = t3_sosend(so, uio);
-		if (rv != EAGAIN)
-			return (rv);
+	if (tp->t_flags & TF_TOE) {
+		tdev = TOE_DEV(so);
+		zcopy_thres = TOM_TUNABLE(tdev, zcopy_sosend_partial_thres);
+		zcopy_enabled = TOM_TUNABLE(tdev, zcopy_sosend_enabled);
+
+		if ((uio->uio_resid > zcopy_thres) &&
+		    (uio->uio_iovcnt < TMP_IOV_MAX) &&  ((so->so_state & SS_NBIO) == 0)
+		    && zcopy_enabled) {
+			rv = t3_sosend(so, uio);
+			if (rv != EAGAIN)
+				return (rv);
+		}
 	}
-	
 	return pru_sosend(so, addr, uio, top, control, flags, td);
 }
 
@@ -376,10 +379,8 @@
 cxgb_soreceive(struct socket *so, struct sockaddr **psa, struct uio *uio,
     struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
 {
-	struct toedev *tdev = TOE_DEV(so);
-	int zcopy_thres = TOM_TUNABLE(tdev, ddp_thres);
-	int zcopy_enabled = TOM_TUNABLE(tdev, ddp);
-	int rv;
+	struct toedev *tdev;
+	int rv, zcopy_thres, zcopy_enabled;
 	struct tcpcb *tp = sototcpcb(so);
 
 	/*
@@ -395,14 +396,19 @@
 	 *  - iovcnt is 1
 	 *
 	 */
-	if ((tp->t_flags & TF_TOE) && (uio->uio_resid > zcopy_thres) &&
-	    (uio->uio_iovcnt == 1) &&  ((so->so_state & SS_NBIO) == 0)
-	    && zcopy_enabled) {
-		rv = t3_soreceive(so, uio);
-		if (rv != EAGAIN)
-			return (rv);
+	if (tp->t_flags & TF_TOE) {
+		tdev =  TOE_DEV(so);
+		zcopy_thres = TOM_TUNABLE(tdev, ddp_thres);
+		zcopy_enabled = TOM_TUNABLE(tdev, ddp);
+		if ((uio->uio_resid > zcopy_thres) &&
+		    (uio->uio_iovcnt == 1) &&  ((so->so_state & SS_NBIO) == 0)
+		    && zcopy_enabled) {
+			rv = t3_soreceive(so, uio);
+			if (rv != EAGAIN)
+				return (rv);
+		}
 	}
-
+	
 	return pru_soreceive(so, psa, uio, mp0, controlp, flagsp);
 }
 


More information about the p4-projects mailing list