diff options
author | Till Straumann <strauman@slac.stanford.edu> | 2009-10-14 00:12:54 +0000 |
---|---|---|
committer | Till Straumann <strauman@slac.stanford.edu> | 2009-10-14 00:12:54 +0000 |
commit | d38038df348a983acc189caee380b9f95a88e176 (patch) | |
tree | 7fb2a2b822439262b2b9bdf4e225d97eeddac08b /c | |
parent | 2009-10-13 Ralf Corsépius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-d38038df348a983acc189caee380b9f95a88e176.tar.bz2 |
2009-10-13 Till Straumann <strauman@slac.stanford.edu>
PR 1451/bsps
* network/tsec.c: Fix mbuf leak when watchdog expires. The
re-initialization algorithm failed to release mbuf chains
held in the TX ring.
Also, during initialization the initial link status is determined
and IFF_OACTIVE set if no active link was detected.
Diffstat (limited to 'c')
-rw-r--r-- | c/src/lib/libbsp/powerpc/mvme3100/ChangeLog | 9 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c | 20 |
2 files changed, 26 insertions, 3 deletions
diff --git a/c/src/lib/libbsp/powerpc/mvme3100/ChangeLog b/c/src/lib/libbsp/powerpc/mvme3100/ChangeLog index db61cb004b..4afe4b9032 100644 --- a/c/src/lib/libbsp/powerpc/mvme3100/ChangeLog +++ b/c/src/lib/libbsp/powerpc/mvme3100/ChangeLog @@ -1,3 +1,12 @@ +2009-10-13 Till Straumann <strauman@slac.stanford.edu> + + PR 1451/bsps + * network/tsec.c: Fix mbuf leak when watchdog expires. The + re-initialization algorithm failed to release mbuf chains + held in the TX ring. + Also, during initialization the initial link status is determined + and IFF_OACTIVE set if no active link was detected. + 2009-09-15 Ralf Corsépius <ralf.corsepius@rtems.org> * configure.ac: Remove RTEMS_BSP_BOOTCARD_OPTIONS. diff --git a/c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c b/c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c index 5d6fff773f..48b45c1550 100644 --- a/c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c +++ b/c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c @@ -1219,7 +1219,7 @@ int i; static int mac_set_duplex(struct tsec_private *mp) { -int media = 0; +int media = IFM_MAKEWORD(0, 0, 0, 0); if ( 0 == BSP_tsec_media_ioctl(mp, SIOCGIFMEDIA, &media)) { if ( IFM_LINK_OK & media ) { @@ -2329,15 +2329,17 @@ unsigned long l,o; static void consume_rx_mbuf(void *buf, void *arg, int len) { struct ifnet *ifp = arg; +struct mbuf *m = buf; + if ( len <= 0 ) { ifp->if_iqdrops++; if ( len < 0 ) { ifp->if_ierrors++; } - /* caller recycles mbuf */ + if ( m ) + m_freem(m); } else { struct ether_header *eh; - struct mbuf *m = buf; eh = (struct ether_header *)(mtod(m, unsigned long) + ETH_RX_OFFSET); m->m_len = m->m_pkthdr.len = len - sizeof(struct ether_header) - ETH_RX_OFFSET - ETH_CRC_LEN; @@ -2391,8 +2393,20 @@ tsec_init(void *arg) { struct tsec_softc *sc = arg; struct ifnet *ifp = &sc->arpcom.ac_if; +int media; + BSP_tsec_init_hw(&sc->pvt, ifp->if_flags & IFF_PROMISC, sc->arpcom.ac_enaddr); + /* Determine initial link status and block sender if there is no link */ + media = IFM_MAKEWORD(0, 0, 0, 0); + if ( 0 == BSP_tsec_media_ioctl(&sc->pvt, SIOCGIFMEDIA, &media) ) { + if ( (IFM_LINK_OK & media) ) { + ifp->if_flags &= ~IFF_OACTIVE; + } else { + ifp->if_flags |= IFF_OACTIVE; + } + } + tsec_update_mcast(ifp); ifp->if_flags |= IFF_RUNNING; sc->arpcom.ac_if.if_timer = 0; |