Fix promiscuous mode with if_octm:
o) The MAC set must occur before the multicast list is set up as the former will enable the CAM unconditionally, while promiscuous mode disables it, so if promiscuous mode is to be set this must occur after the MAC is programmed. o) The multicast list must be set up unconditionally as even if flags have not changed, if the interface has gone through a reinitialization, the state of the CAM as changed by the MAC initialization could be incorrect. o) Call octm_init when flags change, even if the interface is already running.
This commit is contained in:
parent
86ce6e9fda
commit
ecdb6b0261
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=232803
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user