Author: yongari
Date: Sat May 21 00:38:43 2011
New Revision: 222155
URL: http://svn.freebsd.org/changeset/base/222155

Log:
  MFC r221548,221552:
  r221548:
    Do not increment collision counter if transmit have failed.
    Transmission error in tun(4) is queueing error(i.e. ENOBUFS) and it
    has nothing to do with collision.
  r221552:
    Fix white space nits and style

Modified:
  stable/8/sys/net/if_tun.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/net/if_tun.c
==============================================================================
--- stable/8/sys/net/if_tun.c   Fri May 20 22:55:18 2011        (r222154)
+++ stable/8/sys/net/if_tun.c   Sat May 21 00:38:43 2011        (r222155)
@@ -228,8 +228,8 @@ tunclone(void *arg, struct ucred *cred, 
        i = clone_create(&tunclones, &tun_cdevsw, &u, dev, 0);
        if (i) {
                if (append_unit) {
-                       namelen = snprintf(devname, sizeof(devname), "%s%d", 
name,
-                           u);
+                       namelen = snprintf(devname, sizeof(devname), "%s%d",
+                           name, u);
                        name = devname;
                }
                /* No preexisting struct cdev *, create one */
@@ -577,11 +577,8 @@ tunifioctl(struct ifnet *ifp, u_long cmd
  * tunoutput - queue packets from higher level ready to put out.
  */
 static int
-tunoutput(
-       struct ifnet *ifp,
-       struct mbuf *m0,
-       struct sockaddr *dst,
-       struct route *ro)
+tunoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
+    struct route *ro)
 {
        struct tun_softc *tp = ifp->if_softc;
        u_short cached_tun_flags;
@@ -661,10 +658,8 @@ tunoutput(
        }
 
        error = (ifp->if_transmit)(ifp, m0);
-       if (error) {
-               ifp->if_collisions++;
+       if (error)
                return (ENOBUFS);
-       }
        ifp->if_opackets++;
        return (0);
 }
@@ -673,7 +668,8 @@ tunoutput(
  * the cdevsw interface is now pretty minimal.
  */
 static int
-tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread 
*td)
+tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag,
+    struct thread *td)
 {
        int             error;
        struct tun_softc *tp = dev->si_drv1;
@@ -995,7 +991,7 @@ tunkqfilter(struct cdev *dev, struct kno
                    ifp->if_xname, dev2unit(dev));
                kn->kn_fop = &tun_write_filterops;
                break;
-       
+
        default:
                TUNDEBUG(ifp, "%s kqfilter: invalid filter, minor = %#x\n",
                    ifp->if_xname, dev2unit(dev));
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to