summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-05-28 00:20:22 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-05-28 00:20:22 +0000
commitaf88527ffe750f4fc35af70bb81fbfd68e129ace (patch)
tree0ab28a440b9de954f9aed386febe09d2908b7f38 /sys
parentf32ef14b7e0390d427153634ede40cc7b15599a4 (diff)
- remove ETHER_MAX_LEN_JUMBO and ETHERMTU_JUMBO.
- use if_hardmtu for MTU ioctl handlers. ok reyk@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_bge.c20
-rw-r--r--sys/dev/pci/if_bgereg.h6
-rw-r--r--sys/dev/pci/if_lge.c8
-rw-r--r--sys/dev/pci/if_lgereg.h6
-rw-r--r--sys/dev/pci/if_nfe.c10
-rw-r--r--sys/dev/pci/if_nfereg.h7
-rw-r--r--sys/dev/pci/if_nge.c6
-rw-r--r--sys/dev/pci/if_ngereg.h6
-rw-r--r--sys/dev/pci/if_sk.c6
-rw-r--r--sys/dev/pci/if_skreg.h6
-rw-r--r--sys/dev/pci/if_stge.c4
-rw-r--r--sys/dev/pci/if_stgereg.h5
-rw-r--r--sys/dev/pci/if_ti.c18
-rw-r--r--sys/dev/pci/if_tireg.h6
-rw-r--r--sys/dev/pci/if_vge.c6
-rw-r--r--sys/dev/pci/if_vgevar.h4
-rw-r--r--sys/dev/pci/if_vic.c5
-rw-r--r--sys/dev/pci/if_vicreg.h6
-rw-r--r--sys/dev/pci/if_xge.c13
-rw-r--r--sys/netinet/if_ether.h4
20 files changed, 83 insertions, 69 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index cc74ac3d280..1bf854591ea 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bge.c,v 1.148 2006/05/28 00:04:24 jason Exp $ */
+/* $OpenBSD: if_bge.c,v 1.149 2006/05/28 00:20:21 brad Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -897,8 +897,8 @@ bge_newbuf_jumbo(struct bge_softc *sc, int i, struct mbuf *m)
}
/* Attach the buffer to the mbuf. */
- m_new->m_len = m_new->m_pkthdr.len = ETHER_MAX_LEN_JUMBO;
- MEXTADD(m_new, buf, ETHER_MAX_LEN_JUMBO, 0, bge_jfree, sc);
+ m_new->m_len = m_new->m_pkthdr.len = BGE_JUMBO_FRAMELEN;
+ MEXTADD(m_new, buf, BGE_JUMBO_FRAMELEN, 0, bge_jfree, sc);
} else {
/*
* We're re-using a previously allocated mbuf;
@@ -907,7 +907,7 @@ bge_newbuf_jumbo(struct bge_softc *sc, int i, struct mbuf *m)
*/
m_new = m;
m_new->m_data = m_new->m_ext.ext_buf;
- m_new->m_ext.ext_size = ETHER_MAX_LEN_JUMBO;
+ m_new->m_ext.ext_size = BGE_JUMBO_FRAMELEN;
}
if (!sc->bge_rx_alignment_bug)
@@ -1407,7 +1407,7 @@ bge_blockinit(struct bge_softc *sc)
BGE_HOSTADDR(rcb->bge_hostaddr,
BGE_RING_DMA_ADDR(sc, bge_rx_jumbo_ring));
rcb->bge_maxlen_flags =
- BGE_RCB_MAXLEN_FLAGS(ETHER_MAX_LEN_JUMBO,
+ BGE_RCB_MAXLEN_FLAGS(BGE_JUMBO_FRAMELEN,
BGE_RCB_FLAG_RING_DISABLED);
if (sc->bge_extram)
rcb->bge_nicaddr = BGE_EXT_JUMBO_RX_RINGS;
@@ -1937,7 +1937,7 @@ bge_attach(struct device *parent, struct device *self, void *aux)
ifp->if_capabilities = IFCAP_VLAN_MTU;
if (BGE_IS_JUMBO_CAPABLE(sc))
- ifp->if_hardmtu = ETHERMTU_JUMBO;
+ ifp->if_hardmtu = BGE_JUMBO_MTU;
/*
* Do MII setup.
@@ -2890,7 +2890,7 @@ bge_init(void *xsc)
/* Specify MRU. */
if (BGE_IS_JUMBO_CAPABLE(sc))
CSR_WRITE_4(sc, BGE_RX_MTU,
- ETHER_MAX_LEN_JUMBO + ETHER_VLAN_ENCAP_LEN);
+ BGE_JUMBO_FRAMELEN + ETHER_VLAN_ENCAP_LEN);
else
CSR_WRITE_4(sc, BGE_RX_MTU,
ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN);
@@ -3089,11 +3089,7 @@ bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
#endif /* INET */
break;
case SIOCSIFMTU:
- if (ifr->ifr_mtu < ETHERMIN ||
- ((BGE_IS_JUMBO_CAPABLE(sc)) &&
- ifr->ifr_mtu > ETHERMTU_JUMBO) ||
- ((!BGE_IS_JUMBO_CAPABLE(sc)) &&
- ifr->ifr_mtu > ETHERMTU))
+ if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu)
error = EINVAL;
else if (ifp->if_mtu != ifr->ifr_mtu)
ifp->if_mtu = ifr->ifr_mtu;
diff --git a/sys/dev/pci/if_bgereg.h b/sys/dev/pci/if_bgereg.h
index e0d0be52899..e4aa3dc4e44 100644
--- a/sys/dev/pci/if_bgereg.h
+++ b/sys/dev/pci/if_bgereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bgereg.h,v 1.46 2006/04/21 03:22:18 brad Exp $ */
+/* $OpenBSD: if_bgereg.h,v 1.47 2006/05/28 00:20:21 brad Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -2191,6 +2191,8 @@ struct bge_gib {
* boundary.
*/
+#define BGE_JUMBO_FRAMELEN 9018
+#define BGE_JUMBO_MTU (BGE_JUMBO_FRAMELEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
#define BGE_PAGE_SIZE PAGE_SIZE
#define BGE_MIN_FRAMELEN 60
@@ -2244,7 +2246,7 @@ struct bge_gib {
#define BGE_JSLOTS 384
#endif
-#define BGE_JRAWLEN (ETHER_MAX_LEN_JUMBO + ETHER_ALIGN)
+#define BGE_JRAWLEN (BGE_JUMBO_FRAMELEN + ETHER_ALIGN)
#define BGE_JLEN (BGE_JRAWLEN + (sizeof(u_int64_t) - \
(BGE_JRAWLEN % sizeof(u_int64_t))))
#define BGE_JPAGESZ PAGE_SIZE
diff --git a/sys/dev/pci/if_lge.c b/sys/dev/pci/if_lge.c
index f8d6f8aad55..506e460df6c 100644
--- a/sys/dev/pci/if_lge.c
+++ b/sys/dev/pci/if_lge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_lge.c,v 1.43 2006/05/28 00:04:24 jason Exp $ */
+/* $OpenBSD: if_lge.c,v 1.44 2006/05/28 00:20:21 brad Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 1997, 1998, 1999, 2000, 2001
@@ -556,7 +556,7 @@ lge_attach(struct device *parent, struct device *self, void *aux)
ifp->if_start = lge_start;
ifp->if_watchdog = lge_watchdog;
ifp->if_baudrate = 1000000000;
- ifp->if_hardmtu = ETHERMTU_JUMBO;
+ ifp->if_hardmtu = LGE_JUMBO_MTU;
IFQ_SET_MAXLEN(&ifp->if_snd, LGE_TX_LIST_CNT - 1);
IFQ_SET_READY(&ifp->if_snd);
DPRINTFN(5, ("bcopy\n"));
@@ -708,7 +708,7 @@ lge_newbuf(struct lge_softc *sc, struct lge_rx_desc *c, struct mbuf *m)
* default values.
*/
m_new = m;
- m_new->m_len = m_new->m_pkthdr.len = ETHER_MAX_LEN_JUMBO;
+ m_new->m_len = m_new->m_pkthdr.len = LGE_JLEN;
m_new->m_data = m_new->m_ext.ext_buf;
}
@@ -1391,7 +1391,7 @@ lge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
#endif /* INET */
break;
case SIOCSIFMTU:
- if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU_JUMBO)
+ if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu)
error = EINVAL;
else if (ifp->if_mtu != ifr->ifr_mtu)
ifp->if_mtu = ifr->ifr_mtu;
diff --git a/sys/dev/pci/if_lgereg.h b/sys/dev/pci/if_lgereg.h
index 5a88edfcc52..a8ca1970886 100644
--- a/sys/dev/pci/if_lgereg.h
+++ b/sys/dev/pci/if_lgereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_lgereg.h,v 1.5 2005/12/17 07:31:27 miod Exp $ */
+/* $OpenBSD: if_lgereg.h,v 1.6 2006/05/28 00:20:21 brad Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 1997, 1998, 1999, 2000, 2001
@@ -486,9 +486,11 @@ struct lge_mii_frame {
#define LGE_MII_WRITEOP 0x01
#define LGE_MII_TURNAROUND 0x02
+#define LGE_JUMBO_FRAMELEN 9018
+#define LGE_JUMBO_MTU (LGE_JUMBO_FRAMELEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
#define LGE_JSLOTS 384
-#define LGE_JRAWLEN (ETHER_MAX_LEN_JUMBO + ETHER_ALIGN)
+#define LGE_JRAWLEN (LGE_JUMBO_FRAMELEN + ETHER_ALIGN)
#define LGE_JLEN (LGE_JRAWLEN + (sizeof(u_int64_t) - \
(LGE_JRAWLEN % sizeof(u_int64_t))))
#define LGE_JPAGESZ PAGE_SIZE
diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c
index 2a89b01762b..75d40236c49 100644
--- a/sys/dev/pci/if_nfe.c
+++ b/sys/dev/pci/if_nfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nfe.c,v 1.60 2006/05/28 00:04:24 jason Exp $ */
+/* $OpenBSD: if_nfe.c,v 1.61 2006/05/28 00:20:21 brad Exp $ */
/*-
* Copyright (c) 2006 Damien Bergamini <damien.bergamini@free.fr>
@@ -259,7 +259,7 @@ nfe_attach(struct device *parent, struct device *self, void *aux)
ifp->if_capabilities = IFCAP_VLAN_MTU;
if (sc->sc_flags & NFE_USE_JUMBO)
- ifp->if_hardmtu = ETHERMTU_JUMBO;
+ ifp->if_hardmtu = NFE_JUMBO_MTU;
#if NVLAN > 0
if (sc->sc_flags & NFE_HW_VLAN)
@@ -483,11 +483,7 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
#endif
break;
case SIOCSIFMTU:
- if (ifr->ifr_mtu < ETHERMIN ||
- ((sc->sc_flags & NFE_USE_JUMBO) &&
- ifr->ifr_mtu > ETHERMTU_JUMBO) ||
- (!(sc->sc_flags & NFE_USE_JUMBO) &&
- ifr->ifr_mtu > ETHERMTU))
+ if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu)
error = EINVAL;
else if (ifp->if_mtu != ifr->ifr_mtu)
ifp->if_mtu = ifr->ifr_mtu;
diff --git a/sys/dev/pci/if_nfereg.h b/sys/dev/pci/if_nfereg.h
index e1f4887a4b4..c7846ea9249 100644
--- a/sys/dev/pci/if_nfereg.h
+++ b/sys/dev/pci/if_nfereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nfereg.h,v 1.18 2006/05/01 15:59:31 brad Exp $ */
+/* $OpenBSD: if_nfereg.h,v 1.19 2006/05/28 00:20:21 brad Exp $ */
/*-
* Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org>
@@ -21,7 +21,10 @@
#define NFE_RX_RING_COUNT 128
#define NFE_TX_RING_COUNT 256
-#define NFE_JBYTES (ETHER_MAX_LEN_JUMBO + ETHER_ALIGN)
+#define NFE_JUMBO_FRAMELEN 9018
+#define NFE_JUMBO_MTU (NFE_JUMBO_FRAMELEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
+
+#define NFE_JBYTES (NFE_JUMBO_FRAMELEN + ETHER_ALIGN)
#define NFE_JPOOL_COUNT (NFE_RX_RING_COUNT + 64)
#define NFE_JPOOL_SIZE (NFE_JPOOL_COUNT * NFE_JBYTES)
diff --git a/sys/dev/pci/if_nge.c b/sys/dev/pci/if_nge.c
index bcb5094a51b..00d0375e46b 100644
--- a/sys/dev/pci/if_nge.c
+++ b/sys/dev/pci/if_nge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_nge.c,v 1.54 2006/05/28 00:04:24 jason Exp $ */
+/* $OpenBSD: if_nge.c,v 1.55 2006/05/28 00:20:21 brad Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 1997, 1998, 1999, 2000, 2001
@@ -885,7 +885,7 @@ nge_attach(parent, self, aux)
ifp->if_start = nge_start;
ifp->if_watchdog = nge_watchdog;
ifp->if_baudrate = 1000000000;
- ifp->if_hardmtu = ETHERMTU_JUMBO;
+ ifp->if_hardmtu = NGE_JUMBO_MTU;
IFQ_SET_MAXLEN(&ifp->if_snd, NGE_TX_LIST_CNT - 1);
IFQ_SET_READY(&ifp->if_snd);
DPRINTFN(5, ("%s: bcopy\n", sc->sc_dv.dv_xname));
@@ -2060,7 +2060,7 @@ nge_ioctl(ifp, command, data)
switch(command) {
case SIOCSIFMTU:
- if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU_JUMBO)
+ if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu)
error = EINVAL;
else if (ifp->if_mtu != ifr->ifr_mtu)
ifp->if_mtu = ifr->ifr_mtu;
diff --git a/sys/dev/pci/if_ngereg.h b/sys/dev/pci/if_ngereg.h
index a726a6cedd1..f878bb4cf78 100644
--- a/sys/dev/pci/if_ngereg.h
+++ b/sys/dev/pci/if_ngereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ngereg.h,v 1.7 2005/12/17 07:31:27 miod Exp $ */
+/* $OpenBSD: if_ngereg.h,v 1.8 2006/05/28 00:20:21 brad Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
* Copyright (c) 1997, 1998, 1999, 2000, 2001
@@ -613,9 +613,11 @@ struct nge_mii_frame {
#define NGE_MII_WRITEOP 0x01
#define NGE_MII_TURNAROUND 0x02
+#define NGE_JUMBO_FRAMELEN 9018
+#define NGE_JUMBO_MTU (NGE_JUMBO_FRAMELEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
#define NGE_JSLOTS 384
-#define NGE_JRAWLEN (ETHER_MAX_LEN_JUMBO + ETHER_ALIGN + sizeof(u_int64_t))
+#define NGE_JRAWLEN (NGE_JUMBO_FRAMELEN + ETHER_ALIGN + sizeof(u_int64_t))
#define NGE_JLEN (NGE_JRAWLEN + (sizeof(u_int64_t) - \
(NGE_JRAWLEN % sizeof(u_int64_t))))
#define NGE_MCLBYTES (NGE_JLEN - sizeof(u_int64_t))
diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c
index eb5164b1932..d3aad1102b4 100644
--- a/sys/dev/pci/if_sk.c
+++ b/sys/dev/pci/if_sk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sk.c,v 1.110 2006/05/28 00:04:24 jason Exp $ */
+/* $OpenBSD: if_sk.c,v 1.111 2006/05/28 00:20:21 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -908,7 +908,7 @@ sk_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
#endif /* INET */
break;
case SIOCSIFMTU:
- if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU_JUMBO)
+ if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu)
error = EINVAL;
else if (ifp->if_mtu != ifr->ifr_mtu)
ifp->if_mtu = ifr->ifr_mtu;
@@ -1266,7 +1266,7 @@ sk_attach(struct device *parent, struct device *self, void *aux)
ifp->if_start = sk_start;
ifp->if_watchdog = sk_watchdog;
ifp->if_baudrate = 1000000000;
- ifp->if_hardmtu = ETHERMTU_JUMBO;
+ ifp->if_hardmtu = SK_JUMBO_MTU;
IFQ_SET_MAXLEN(&ifp->if_snd, SK_TX_RING_CNT - 1);
IFQ_SET_READY(&ifp->if_snd);
bcopy(sc_if->sk_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
diff --git a/sys/dev/pci/if_skreg.h b/sys/dev/pci/if_skreg.h
index 0ff45135d0f..7e4afba3e1f 100644
--- a/sys/dev/pci/if_skreg.h
+++ b/sys/dev/pci/if_skreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_skreg.h,v 1.30 2006/04/30 04:17:48 brad Exp $ */
+/* $OpenBSD: if_skreg.h,v 1.31 2006/05/28 00:20:21 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -1482,13 +1482,15 @@ struct sk_tx_desc {
* layers. To be safe, we allocate 1.5 times the number of
* receive descriptors.
*/
+#define SK_JUMBO_FRAMELEN 9018
+#define SK_JUMBO_MTU (SK_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
#ifdef __sparc64__
#define SK_JSLOTS 54
#else
#define SK_JSLOTS 384
#endif
-#define SK_JRAWLEN (ETHER_MAX_LEN_JUMBO + ETHER_ALIGN)
+#define SK_JRAWLEN (SK_JUMBO_FRAMELEN + ETHER_ALIGN)
#define SK_JLEN SK_JRAWLEN
#define SK_MCLBYTES SK_JLEN
#define SK_JPAGESZ PAGE_SIZE
diff --git a/sys/dev/pci/if_stge.c b/sys/dev/pci/if_stge.c
index 2b33c5c10f0..8c1a1965728 100644
--- a/sys/dev/pci/if_stge.c
+++ b/sys/dev/pci/if_stge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_stge.c,v 1.24 2006/05/28 00:04:24 jason Exp $ */
+/* $OpenBSD: if_stge.c,v 1.25 2006/05/28 00:20:21 brad Exp $ */
/* $NetBSD: if_stge.c,v 1.27 2005/05/16 21:35:32 bouyer Exp $ */
/*-
@@ -450,7 +450,7 @@ stge_attach(struct device *parent, struct device *self, void *aux)
*/
for (i = 0; i < STGE_NTXDESC; i++) {
if ((error = bus_dmamap_create(sc->sc_dmat,
- ETHER_MAX_LEN_JUMBO, STGE_NTXFRAGS, MCLBYTES, 0, 0,
+ STGE_JUMBO_FRAMELEN, STGE_NTXFRAGS, MCLBYTES, 0, 0,
&sc->sc_txsoft[i].ds_dmamap)) != 0) {
printf("%s: unable to create tx DMA map %d, "
"error = %d\n", sc->sc_dev.dv_xname, i, error);
diff --git a/sys/dev/pci/if_stgereg.h b/sys/dev/pci/if_stgereg.h
index 55f2b820023..c3dff10c089 100644
--- a/sys/dev/pci/if_stgereg.h
+++ b/sys/dev/pci/if_stgereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_stgereg.h,v 1.4 2005/05/23 22:44:20 brad Exp $ */
+/* $OpenBSD: if_stgereg.h,v 1.5 2006/05/28 00:20:21 brad Exp $ */
/* $NetBSD: if_stgereg.h,v 1.3 2003/02/10 21:10:07 christos Exp $ */
/*-
@@ -40,6 +40,9 @@
#ifndef _DEV_PCI_IF_STGEREG_H_
#define _DEV_PCI_IF_STGEREG_H_
+#define STGE_JUMBO_FRAMELEN 9018
+#define STGE_JUMBO_MTU (STGE_JUMBO_FRAMELEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
+
/*
* Register description for the Sundance Tech. TC9021 10/100/1000
* Ethernet controller.
diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c
index 227c816e2d8..ea5e4e6abe6 100644
--- a/sys/dev/pci/if_ti.c
+++ b/sys/dev/pci/if_ti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ti.c,v 1.82 2006/05/28 00:04:24 jason Exp $ */
+/* $OpenBSD: if_ti.c,v 1.83 2006/05/28 00:20:21 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -881,8 +881,8 @@ ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *m)
}
/* Attach the buffer to the mbuf. */
- m_new->m_len = m_new->m_pkthdr.len = ETHER_MAX_LEN_JUMBO;
- MEXTADD(m_new, buf, ETHER_MAX_LEN_JUMBO, 0, ti_jfree, sc);
+ m_new->m_len = m_new->m_pkthdr.len = TI_JUMBO_FRAMELEN;
+ MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, 0, ti_jfree, sc);
} else {
/*
* We're re-using a previously allocated mbuf;
@@ -891,7 +891,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *m)
*/
m_new = m;
m_new->m_data = m_new->m_ext.ext_buf;
- m_new->m_ext.ext_size = ETHER_MAX_LEN_JUMBO;
+ m_new->m_ext.ext_size = TI_JUMBO_FRAMELEN;
}
m_adj(m_new, ETHER_ALIGN);
@@ -1056,7 +1056,7 @@ ti_init_tx_ring(struct ti_softc *sc)
SLIST_INIT(&sc->ti_tx_map_listhead);
for (i = 0; i < TI_TX_RING_CNT; i++) {
- if (bus_dmamap_create(sc->sc_dmatag, ETHER_MAX_LEN_JUMBO,
+ if (bus_dmamap_create(sc->sc_dmatag, TI_JUMBO_FRAMELEN,
TI_NTXSEG, MCLBYTES, 0, BUS_DMA_NOWAIT, &dmamap))
return (ENOBUFS);
@@ -1420,7 +1420,7 @@ ti_gibinit(struct ti_softc *sc)
/* Set up the jumbo receive ring. */
rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb;
TI_HOSTADDR(rcb->ti_hostaddr) = TI_RING_DMA_ADDR(sc, ti_rx_jumbo_ring);
- rcb->ti_max_len = ETHER_MAX_LEN_JUMBO;
+ rcb->ti_max_len = TI_JUMBO_FRAMELEN;
rcb->ti_flags = 0;
rcb->ti_flags |= TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM;
@@ -1648,7 +1648,7 @@ ti_attach(struct device *parent, struct device *self, void *aux)
ifp->if_ioctl = ti_ioctl;
ifp->if_start = ti_start;
ifp->if_watchdog = ti_watchdog;
- ifp->if_hardmtu = ETHERMTU_JUMBO;
+ ifp->if_hardmtu = TI_JUMBO_FRAMELEN - ETHER_HDR_LEN;
IFQ_SET_MAXLEN(&ifp->if_snd, TI_TX_RING_CNT - 1);
IFQ_SET_READY(&ifp->if_snd);
bcopy(sc->sc_dv.dv_xname, ifp->if_xname, IFNAMSIZ);
@@ -2257,7 +2257,7 @@ ti_init2(struct ti_softc *sc)
/* Specify MTU and interface index. */
CSR_WRITE_4(sc, TI_GCR_IFINDEX, sc->sc_dv.dv_unit);
CSR_WRITE_4(sc, TI_GCR_IFMTU,
- ETHER_MAX_LEN_JUMBO + ETHER_VLAN_ENCAP_LEN);
+ TI_JUMBO_FRAMELEN + ETHER_VLAN_ENCAP_LEN);
TI_DO_CMD(TI_CMD_UPDATE_GENCOM, 0, 0);
/* Load our MAC address. */
@@ -2467,7 +2467,7 @@ ti_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
#endif /* INET */
break;
case SIOCSIFMTU:
- if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU_JUMBO)
+ if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu)
error = EINVAL;
else if (ifp->if_mtu != ifr->ifr_mtu)
ifp->if_mtu = ifr->ifr_mtu;
diff --git a/sys/dev/pci/if_tireg.h b/sys/dev/pci/if_tireg.h
index 12bc121b0fc..5dc18a70ba5 100644
--- a/sys/dev/pci/if_tireg.h
+++ b/sys/dev/pci/if_tireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tireg.h,v 1.22 2006/03/16 02:23:53 brad Exp $ */
+/* $OpenBSD: if_tireg.h,v 1.23 2006/05/28 00:20:21 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -782,6 +782,8 @@ struct ti_tx_desc {
* boundary.
*/
+#define TI_JUMBO_FRAMELEN 9018
+#define TI_JUMBO_MTU (TI_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
#define TI_PAGE_SIZE PAGE_SIZE
#define TI_MIN_FRAMELEN 60
@@ -996,7 +998,7 @@ struct ti_event_desc {
#define TI_JSLOTS 384
#endif
-#define TI_JRAWLEN (ETHER_MAX_LEN_JUMBO + ETHER_ALIGN)
+#define TI_JRAWLEN (TI_JUMBO_FRAMELEN + ETHER_ALIGN)
#define TI_JLEN (TI_JRAWLEN + (sizeof(u_int64_t) - \
(TI_JRAWLEN % sizeof(u_int64_t))))
#define TI_JPAGESZ PAGE_SIZE
diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c
index 2561b094f24..52a4f13c67f 100644
--- a/sys/dev/pci/if_vge.c
+++ b/sys/dev/pci/if_vge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vge.c,v 1.23 2006/05/28 00:04:24 jason Exp $ */
+/* $OpenBSD: if_vge.c,v 1.24 2006/05/28 00:20:21 brad Exp $ */
/* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */
/*
* Copyright (c) 2004
@@ -782,7 +782,7 @@ vge_attach(struct device *parent, struct device *self, void *aux)
ifp->if_watchdog = vge_watchdog;
ifp->if_init = vge_init;
ifp->if_baudrate = 1000000000;
- ifp->if_hardmtu = ETHERMTU_JUMBO;
+ ifp->if_hardmtu = VGE_JUMBO_MTU;
IFQ_SET_MAXLEN(&ifp->if_snd, VGE_IFQ_MAXLEN);
IFQ_SET_READY(&ifp->if_snd);
@@ -1753,7 +1753,7 @@ vge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
}
break;
case SIOCSIFMTU:
- if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU_JUMBO)
+ if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu)
error = EINVAL;
else if (ifp->if_mtu != ifr->ifr_mtu)
ifp->if_mtu = ifr->ifr_mtu;
diff --git a/sys/dev/pci/if_vgevar.h b/sys/dev/pci/if_vgevar.h
index 5b26a137451..9073695cbaf 100644
--- a/sys/dev/pci/if_vgevar.h
+++ b/sys/dev/pci/if_vgevar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vgevar.h,v 1.2 2006/05/20 02:39:31 brad Exp $ */
+/* $OpenBSD: if_vgevar.h,v 1.3 2006/05/28 00:20:21 brad Exp $ */
/* $FreeBSD: if_vgevar.h,v 1.1 2004/09/10 20:57:45 wpaul Exp $ */
/*
* Copyright (c) 2004
@@ -32,6 +32,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define VGE_JUMBO_MTU 9000
+
#define VGE_IFQ_MAXLEN 64
#define VGE_TX_DESC_CNT 256
diff --git a/sys/dev/pci/if_vic.c b/sys/dev/pci/if_vic.c
index 48b5a3ceb68..1f795490bcf 100644
--- a/sys/dev/pci/if_vic.c
+++ b/sys/dev/pci/if_vic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vic.c,v 1.7 2006/05/28 00:04:24 jason Exp $ */
+/* $OpenBSD: if_vic.c,v 1.8 2006/05/28 00:20:21 brad Exp $ */
/*
* Copyright (c) 2006 Reyk Floeter <reyk@openbsd.org>
@@ -191,6 +191,7 @@ vic_attach(struct device *parent, struct device *self, void *aux)
ifp->if_ioctl = vic_ioctl;
ifp->if_start = vic_start;
ifp->if_watchdog = vic_watchdog;
+ ifp->if_hardmtu = VIC_JUMBO_MTU;
strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ);
IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
IFQ_SET_READY(&ifp->if_snd);
@@ -664,7 +665,7 @@ vic_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
case SIOCSIFMTU:
- if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU_JUMBO)
+ if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu)
error = EINVAL;
else if (ifp->if_mtu != ifr->ifr_mtu)
ifp->if_mtu = ifr->ifr_mtu;
diff --git a/sys/dev/pci/if_vicreg.h b/sys/dev/pci/if_vicreg.h
index 809aea43ac1..4cb676899cc 100644
--- a/sys/dev/pci/if_vicreg.h
+++ b/sys/dev/pci/if_vicreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vicreg.h,v 1.1 2006/02/25 23:49:04 reyk Exp $ */
+/* $OpenBSD: if_vicreg.h,v 1.2 2006/05/28 00:20:21 brad Exp $ */
/*
* Copyright (c) 2006 Reyk Floeter <reyk@openbsd.org>
@@ -192,4 +192,8 @@ struct vic_data {
#define VIC_OWNER_NIC 2
#define VIC_OWNER_NIC_PEND 3
+
+#define VIC_JUMBO_FRAMELEN 9018
+#define VIC_JUMBO_MTU (VIC_JUMBO_FRAMELEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
+
#endif /* _DEV_IC_VICREG_H */
diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c
index d6d6707d50b..5834c147c8d 100644
--- a/sys/dev/pci/if_xge.c
+++ b/sys/dev/pci/if_xge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_xge.c,v 1.16 2006/05/28 00:04:24 jason Exp $ */
+/* $OpenBSD: if_xge.c,v 1.17 2006/05/28 00:20:21 brad Exp $ */
/* $NetBSD: if_xge.c,v 1.1 2005/09/09 10:30:27 ragge Exp $ */
/*
@@ -272,7 +272,8 @@ struct cfdriver xge_cd = {
/*
* Non-tunable constants.
*/
-#define XGE_MAX_MTU 9600
+#define XGE_MAX_FRAMELEN 9600
+#define XGE_MAX_MTU (XGE_MAX_FRAMELEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
#define XGE_TYPE_XENA 1 /* Xframe-I */
#define XGE_TYPE_HERC 2 /* Xframe-II */
@@ -439,7 +440,7 @@ xge_attach(struct device *parent, struct device *self, void *aux)
/* Create transmit DMA maps */
for (i = 0; i < NTXDESCS; i++) {
- if (bus_dmamap_create(sc->sc_dmat, XGE_MAX_MTU,
+ if (bus_dmamap_create(sc->sc_dmat, XGE_MAX_FRAMELEN,
NTXFRAGS, MCLBYTES, 0, 0, &sc->sc_txm[i])) {
printf(": cannot create TX DMA maps\n");
return;
@@ -460,7 +461,7 @@ xge_attach(struct device *parent, struct device *self, void *aux)
/* Create receive buffer DMA maps */
for (i = 0; i < NRXREAL; i++) {
- if (bus_dmamap_create(sc->sc_dmat, XGE_MAX_MTU,
+ if (bus_dmamap_create(sc->sc_dmat, XGE_MAX_FRAMELEN,
NRXFRAGS, MCLBYTES, 0, 0, &sc->sc_rxm[i])) {
printf(": cannot create RX DMA maps\n");
return;
@@ -657,7 +658,7 @@ xge_init(struct ifnet *ifp)
}
/* set MRU */
- PIF_WCSR(RMAC_MAX_PYLD_LEN, RMAC_PYLD_LEN(XGE_MAX_MTU));
+ PIF_WCSR(RMAC_MAX_PYLD_LEN, RMAC_PYLD_LEN(XGE_MAX_FRAMELEN));
/* 56, enable the transmit laser */
val = PIF_RCSR(ADAPTER_CONTROL);
@@ -880,7 +881,7 @@ xge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
#endif /* INET */
break;
case SIOCSIFMTU:
- if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > XGE_MAX_MTU)
+ if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu)
error = EINVAL;
else if (ifp->if_mtu != ifr->ifr_mtu)
ifp->if_mtu = ifr->ifr_mtu;
diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h
index 83e7d110312..5ae6dacdb8a 100644
--- a/sys/netinet/if_ether.h
+++ b/sys/netinet/if_ether.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.h,v 1.36 2006/03/05 21:48:56 miod Exp $ */
+/* $OpenBSD: if_ether.h,v 1.37 2006/05/28 00:20:21 brad Exp $ */
/* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */
/*
@@ -45,7 +45,6 @@
#define ETHER_MIN_LEN 64 /* Minimum frame length, CRC included */
#define ETHER_MAX_LEN 1518 /* Maximum frame length, CRC included */
#define ETHER_MAX_DIX_LEN 1536 /* Maximum DIX frame length */
-#define ETHER_MAX_LEN_JUMBO 9018 /* max jumbo frame len, including CRC */
/*
* Some Ethernet extensions.
@@ -82,7 +81,6 @@ struct ether_header {
#define ETHERMTU (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
-#define ETHERMTU_JUMBO (ETHER_MAX_LEN_JUMBO - ETHER_HDR_LEN - ETHER_CRC_LEN)
/*
* Ethernet CRC32 polynomials (big- and little-endian verions).