Date: Thu, 11 Mar 2010 22:01:48 +0000 (UTC) From: Juli Mallett <jmallett@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r205041 - user/jmallett/octeon/sys/mips/cavium/dev/rgmii Message-ID: <201003112201.o2BM1m1H076003@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jmallett Date: Thu Mar 11 22:01:48 2010 New Revision: 205041 URL: http://svn.freebsd.org/changeset/base/205041 Log: Inline a function only referenced once and remove a comment about not calling that function from some place in the code. Make the ifinit function set the link status. This fixes rgmx with the recent routing changes. Modified: user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.c Modified: user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.c Thu Mar 11 21:57:01 2010 (r205040) +++ user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.c Thu Mar 11 22:01:48 2010 (r205041) @@ -184,7 +184,6 @@ static u_int get_rgmx_port_ordinal(u_int static void octeon_rgmx_set_mac(u_int port); static void octeon_rgmx_init_sc(struct rgmx_softc_dev *sc, device_t dev, u_int port, u_int num_devices); static int octeon_rgmx_init_ifnet(struct rgmx_softc_dev *sc); -static void octeon_rgmx_mark_ready(struct rgmx_softc_dev *sc); static void octeon_rgmx_stop(struct rgmx_softc_dev *sc); static void octeon_rgmx_config_speed(u_int port, u_int); #ifdef DEBUG_RGMX_DUMP @@ -451,12 +450,6 @@ static int rgmii_attach (device_t dev) device_printf(dev, " ifinit failed for rgmx port %u\n", port); return (ENOSPC); } -/* - * Don't call octeon_rgmx_mark_ready() - * ifnet will call it indirectly via octeon_rgmx_init() - * - * octeon_rgmx_mark_ready(sc); - */ num_devices++; } } @@ -1770,17 +1763,16 @@ static int octeon_rgmx_ioctl (struct ifn return (error); } - - - -/* - * octeon_rgmx_mark_ready - * - * Initialize the rgmx driver for this instance - * Initialize device. - */ -static void octeon_rgmx_mark_ready (struct rgmx_softc_dev *sc) +static void octeon_rgmx_init (void *xsc) { + struct rgmx_softc_dev *sc = xsc; + octeon_rgmx_rxx_rx_inbnd_t link_status; + + /* + * Called mostly from ifnet interface ifp->if_init(); + * I think we can anchor most of our iniialization here and + * not do it in different places from driver_attach(). + */ /* Enable interrupts. */ /* For RGMX they are already enabled earlier */ @@ -1799,21 +1791,22 @@ static void octeon_rgmx_mark_ready (stru /* Kick start the output */ /* Hopefully PKO is running and will pick up packets via the timer or receive loop */ -} + /* Set link status. */ + octeon_rgmx_config_speed(sc->port, 0); -static void octeon_rgmx_init (void *xsc) -{ + RGMX_LOCK(sc); + /* + * Parse link status. + */ + link_status.word64 = sc->link_status; - /* - * Called mostly from ifnet interface ifp->if_init(); - * I think we can anchor most of our iniialization here and - * not do it in different places from driver_attach(). - */ - /* - * For now, we only mark the interface ready - */ - octeon_rgmx_mark_ready((struct rgmx_softc_dev *) xsc); + if (link_status.bits.status) { + if_link_state_change(sc->ifp, LINK_STATE_UP); + } else { + if_link_state_change(sc->ifp, LINK_STATE_DOWN); + } + RGMX_UNLOCK(sc); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003112201.o2BM1m1H076003>