aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJuli Mallett <jmallett@FreeBSD.org>2012-03-11 00:34:14 +0000
committerJuli Mallett <jmallett@FreeBSD.org>2012-03-11 00:34:14 +0000
commitecdb6b0261d9dcf358f031cc71b3cad6e93da888 (patch)
treef5a657c8abdab9208befe5d949114664d686f774 /sys
parent86ce6e9fdacde94574f6f89ad733d960329ffcc2 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/mips/cavium/if_octm.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/sys/mips/cavium/if_octm.c b/sys/mips/cavium/if_octm.c
index 380940473767..1b3c68f9a00b 100644
--- a/sys/mips/cavium/if_octm.c
+++ b/sys/mips/cavium/if_octm.c
@@ -298,19 +298,27 @@ octm_init(void *arg)
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
}
- if (((ifp->if_flags ^ sc->sc_flags) & (IFF_ALLMULTI | IFF_MULTICAST | IFF_PROMISC)) != 0) {
- flags = 0;
- if ((ifp->if_flags & IFF_ALLMULTI) != 0)
- flags |= CVMX_IFF_ALLMULTI;
- if ((ifp->if_flags & IFF_PROMISC) != 0)
- flags |= CVMX_IFF_PROMISC;
- cvmx_mgmt_port_set_multicast_list(sc->sc_port, flags);
- }
-
+ /*
+ * NB:
+ * MAC must be set before allmulti and promisc below, as
+ * cvmx_mgmt_port_set_mac will always enable the CAM, and turning on
+ * promiscuous mode only works with the CAM disabled.
+ */
mac = 0;
memcpy((u_int8_t *)&mac + 2, IF_LLADDR(ifp), 6);
cvmx_mgmt_port_set_mac(sc->sc_port, mac);
+ /*
+ * This is done unconditionally, rather than only if sc_flags have
+ * changed because of set_mac's effect on the CAM noted above.
+ */
+ flags = 0;
+ if ((ifp->if_flags & IFF_ALLMULTI) != 0)
+ flags |= CVMX_IFF_ALLMULTI;
+ if ((ifp->if_flags & IFF_PROMISC) != 0)
+ flags |= CVMX_IFF_PROMISC;
+ cvmx_mgmt_port_set_multicast_list(sc->sc_port, flags);
+
/* XXX link state? */
if ((ifp->if_flags & IFF_UP) != 0)
@@ -444,8 +452,7 @@ octm_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if (ifp->if_flags == sc->sc_flags)
return (0);
if ((ifp->if_flags & IFF_UP) != 0) {
- if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
- octm_init(sc);
+ octm_init(sc);
} else {
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
cvmx_mgmt_port_disable(sc->sc_port);