summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Straumann <strauman@slac.stanford.edu>2009-10-14 00:14:08 +0000
committerTill Straumann <strauman@slac.stanford.edu>2009-10-14 00:14:08 +0000
commitb7a6078a990c5b609880d5c96272ba898a64d7a7 (patch)
tree0efa84010e1001683d9af83b49f77e7cff629f8d
parentc4ad6185c60de3cdb93cd9b6ce90508001a08ea8 (diff)
downloadrtems-b7a6078a990c5b609880d5c96272ba898a64d7a7.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.
-rw-r--r--c/src/lib/libbsp/powerpc/mvme3100/ChangeLog9
-rw-r--r--c/src/lib/libbsp/powerpc/mvme3100/network/tsec.c20
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 cdeba66908..9a864bfd6f 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-08-17 Till Straumann <strauman@slac.stanford.edu>
* network/tsec.c, network/if_tsec_pub.h:
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;