NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/48568: return value handling of xxx_encap() and IFF_OACTIVE.



>Number:         48568
>Category:       kern
>Synopsis:       return value handling of xxx_encap() and IFF_OACTIVE.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 03 05:30:00 +0000 2014
>Originator:     msaitoh%execsw.org@localhost
>Release:        
>Organization:
>Environment:
all
Architecture: all
Machine: all
>Description:

>How-To-Repeat:
        A lot of Ethernet driver have the following code in xxx_start():

                /*
                 * Pack the data into the transmit ring. If we
                 * don't have room, set the OACTIVE flag and wait
                 * for the NIC to drain the ring.
                 */
                if (xxx_encap(sc, m_head, &prodidx)) {
                        ifp->if_flags |= IFF_OACTIVE;
                        break;
                }

        For some drivers, it's incorrect because xxx_encap() may return
        error when the TX ring ISN'T full. If the TX ring is empty,
        no one disable IFF_OACTIVE because the driver don't get any
        TX complete interrupt.
>Fix:
        Check all network driver's code.

        Patch for mvgbe(4):

--- if_mvgbe.c  23 Dec 2013 02:23:25 -0000      1.35
+++ if_mvgbe.c  3 Feb 2014 05:25:01 -0000
@@ -1059,7 +1059,8 @@
                 * for the NIC to drain the ring.
                 */
                if (mvgbe_encap(sc, m_head, &idx)) {
-                       ifp->if_flags |= IFF_OACTIVE;
+                       if (sc->sc_cdata.mvgbe_tx_cnt > 0)
+                               ifp->if_flags |= IFF_OACTIVE;
                        break;
                }
 



Home | Main Index | Thread Index | Old Index