* When adding/deleting multicast addresses, only whack the address filter

if the interface is marked RUNNING.
Obtained from:	NetBSD if_sk.c rev. 1.12

* Don't initialize the card (and start an autonegotiation) every time the IP
  address changes. Makes 'dhclient sk0' invocations way faster and more
  consistant. i.e. one DHCPREQUEST elicits the DHCPACK.
Obtained from:	OpenBSD if_sk.c rev. 1.56

* Additional locking changes in sk_ioctl.

PR:		kern/61296 should see improvements by the last two.
Approved by:	rwatson (mentor)
MFC after:	5 days
This commit is contained in:
Bjoern A. Zeeb 2005-03-17 14:18:58 +00:00
parent 60c38bde75
commit d34019b31e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143751
2 changed files with 30 additions and 12 deletions

View file

@ -1178,18 +1178,18 @@ sk_ioctl(ifp, command, data)
int error = 0;
struct mii_data *mii;
SK_IF_LOCK(sc_if);
switch(command) {
case SIOCSIFMTU:
if (ifr->ifr_mtu > SK_JUMBO_MTU)
error = EINVAL;
else {
ifp->if_mtu = ifr->ifr_mtu;
ifp->if_flags &= ~IFF_RUNNING;
sk_init(sc_if);
}
break;
case SIOCSIFFLAGS:
SK_IF_LOCK(sc_if);
if (ifp->if_flags & IFF_UP) {
if (ifp->if_flags & IFF_RUNNING) {
if ((ifp->if_flags ^ sc_if->sk_if_flags)
@ -1204,12 +1204,17 @@ sk_ioctl(ifp, command, data)
sk_stop(sc_if);
}
sc_if->sk_if_flags = ifp->if_flags;
SK_IF_UNLOCK(sc_if);
error = 0;
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
sk_setmulti(sc_if);
error = 0;
if (ifp->if_flags & IFF_RUNNING) {
SK_IF_LOCK(sc_if);
sk_setmulti(sc_if);
SK_IF_UNLOCK(sc_if);
error = 0;
}
break;
case SIOCGIFMEDIA:
case SIOCSIFMEDIA:
@ -1221,8 +1226,6 @@ sk_ioctl(ifp, command, data)
break;
}
SK_IF_UNLOCK(sc_if);
return(error);
}
@ -1892,6 +1895,7 @@ sk_watchdog(ifp)
sc_if = ifp->if_softc;
printf("sk%d: watchdog timeout\n", sc_if->sk_unit);
ifp->if_flags &= ~IFF_RUNNING;
sk_init(sc_if);
return;
@ -2557,6 +2561,11 @@ sk_init(xsc)
sc = sc_if->sk_softc;
mii = device_get_softc(sc_if->sk_miibus);
if (ifp->if_flags & IFF_RUNNING) {
SK_IF_UNLOCK(sc_if);
return;
}
/* Cancel pending I/O and free all RX/TX buffers. */
sk_stop(sc_if);

View file

@ -1178,18 +1178,18 @@ sk_ioctl(ifp, command, data)
int error = 0;
struct mii_data *mii;
SK_IF_LOCK(sc_if);
switch(command) {
case SIOCSIFMTU:
if (ifr->ifr_mtu > SK_JUMBO_MTU)
error = EINVAL;
else {
ifp->if_mtu = ifr->ifr_mtu;
ifp->if_flags &= ~IFF_RUNNING;
sk_init(sc_if);
}
break;
case SIOCSIFFLAGS:
SK_IF_LOCK(sc_if);
if (ifp->if_flags & IFF_UP) {
if (ifp->if_flags & IFF_RUNNING) {
if ((ifp->if_flags ^ sc_if->sk_if_flags)
@ -1204,12 +1204,17 @@ sk_ioctl(ifp, command, data)
sk_stop(sc_if);
}
sc_if->sk_if_flags = ifp->if_flags;
SK_IF_UNLOCK(sc_if);
error = 0;
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
sk_setmulti(sc_if);
error = 0;
if (ifp->if_flags & IFF_RUNNING) {
SK_IF_LOCK(sc_if);
sk_setmulti(sc_if);
SK_IF_UNLOCK(sc_if);
error = 0;
}
break;
case SIOCGIFMEDIA:
case SIOCSIFMEDIA:
@ -1221,8 +1226,6 @@ sk_ioctl(ifp, command, data)
break;
}
SK_IF_UNLOCK(sc_if);
return(error);
}
@ -1892,6 +1895,7 @@ sk_watchdog(ifp)
sc_if = ifp->if_softc;
printf("sk%d: watchdog timeout\n", sc_if->sk_unit);
ifp->if_flags &= ~IFF_RUNNING;
sk_init(sc_if);
return;
@ -2557,6 +2561,11 @@ sk_init(xsc)
sc = sc_if->sk_softc;
mii = device_get_softc(sc_if->sk_miibus);
if (ifp->if_flags & IFF_RUNNING) {
SK_IF_UNLOCK(sc_if);
return;
}
/* Cancel pending I/O and free all RX/TX buffers. */
sk_stop(sc_if);