For all controllers but type SK_YUKON_FE, set the jumbo frames
capability, ETHERCAP_JUMBO_MTU. Rely on ether_ioctl() to enforce the MTU range implied by the ethernet capabilities. Should fix kern/38748. While I'm here, use some standard ethernet constants instead of msk-specific constants.
This commit is contained in:
parent
975e7d5e74
commit
25b52967a3
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_msk.c,v 1.18 2008/04/10 19:13:37 cegger Exp $ */
|
||||
/* $NetBSD: if_msk.c,v 1.19 2008/05/27 20:14:28 dyoung Exp $ */
|
||||
/* $OpenBSD: if_msk.c,v 1.42 2007/01/17 02:43:02 krw Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -52,7 +52,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.18 2008/04/10 19:13:37 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.19 2008/05/27 20:14:28 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
|
@ -687,40 +687,27 @@ msk_jfree(struct mbuf *m, void *buf, size_t size, void *arg)
|
|||
}
|
||||
|
||||
int
|
||||
msk_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
msk_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
{
|
||||
struct sk_if_softc *sc_if = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *) data;
|
||||
int s, error = 0;
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch(command) {
|
||||
case SIOCSIFMTU:
|
||||
if (ifr->ifr_mtu < ETHERMIN)
|
||||
return EINVAL;
|
||||
else if (sc_if->sk_softc->sk_type != SK_YUKON_FE) {
|
||||
if (ifr->ifr_mtu > SK_JUMBO_MTU)
|
||||
error = EINVAL;
|
||||
} else if (ifr->ifr_mtu > ETHERMTU)
|
||||
error = EINVAL;
|
||||
else if ((error = ifioctl_common(ifp, command, data)) == ENETRESET)
|
||||
error = 0;
|
||||
break;
|
||||
default:
|
||||
DPRINTFN(2, ("msk_ioctl ETHER\n"));
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
DPRINTFN(2, ("msk_ioctl ETHER\n"));
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
|
||||
if (error == ENETRESET) {
|
||||
if (error == ENETRESET) {
|
||||
error = 0;
|
||||
if (cmd != SIOCADDMULTI && cmd != SIOCDELMULTI)
|
||||
;
|
||||
else if (ifp->if_flags & IFF_RUNNING) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware
|
||||
* filter accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
msk_setmulti(sc_if);
|
||||
error = 0;
|
||||
msk_setmulti(sc_if);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
splx(s);
|
||||
|
@ -1046,8 +1033,9 @@ msk_attach(struct device *parent, struct device *self, void *aux)
|
|||
aprint_error(": jumbo buffer allocation failed\n");
|
||||
goto fail_3;
|
||||
}
|
||||
sc_if->sk_ethercom.ec_capabilities = ETHERCAP_VLAN_MTU
|
||||
| ETHERCAP_JUMBO_MTU;
|
||||
sc_if->sk_ethercom.ec_capabilities = ETHERCAP_VLAN_MTU;
|
||||
if (sc->sk_type != SK_YUKON_FE)
|
||||
sc_if->sk_ethercom.ec_capabilities |= ETHERCAP_JUMBO_MTU;
|
||||
|
||||
ifp->if_softc = sc_if;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
|
@ -1676,7 +1664,7 @@ msk_rxeof(struct sk_if_softc *sc_if, u_int16_t len, u_int32_t rxstat)
|
|||
cur_rx->sk_mbuf = NULL;
|
||||
|
||||
if (total_len < SK_MIN_FRAMELEN ||
|
||||
total_len > SK_JUMBO_FRAMELEN ||
|
||||
total_len > ETHER_MAX_LEN_JUMBO ||
|
||||
msk_rxvalid(sc, rxstat, total_len) == 0) {
|
||||
ifp->if_ierrors++;
|
||||
msk_newbuf(sc_if, cur, m, dmamap);
|
||||
|
|
Loading…
Reference in New Issue