Add a capability bit that indicates support for Gigabit Ethernet

jumbo frames, and use it in SIOCSIFMTU.
This commit is contained in:
thorpej 2001-06-03 03:07:39 +00:00
parent 70b2367cfd
commit 597194532e
2 changed files with 15 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ether.h,v 1.23 2001/04/07 18:01:48 thorpej Exp $ */
/* $NetBSD: if_ether.h,v 1.24 2001/06/03 03:07:40 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -47,6 +47,7 @@
#define ETHER_HDR_LEN ((ETHER_ADDR_LEN * 2) + ETHER_TYPE_LEN)
#define ETHER_MIN_LEN 64 /* minimum frame length, including CRC */
#define ETHER_MAX_LEN 1518 /* maximum frame length, including CRC */
#define ETHER_MAX_LEN_JUMBO 9018 /* maximum jumbo frame len, including CRC */
/*
* Some Ethernet extensions.
@ -74,6 +75,7 @@ struct ether_header {
#define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
#define ETHERMTU_JUMBO (ETHER_MAX_LEN_JUMBO - ETHER_HDR_LEN - ETHER_CRC_LEN)
#define ETHERMTU (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
@ -155,6 +157,7 @@ struct ethercom {
#define ETHERCAP_VLAN_MTU 0x00000001 /* VLAN-compatible MTU */
#define ETHERCAP_VLAN_HWTAGGING 0x00000002 /* hardware VLAN tag support */
#define ETHERCAP_JUMBO_MTU 0x00000004 /* 9000 byte MTU supported */
#ifdef _KERNEL
extern u_int8_t etherbroadcastaddr[ETHER_ADDR_LEN];

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ethersubr.c,v 1.81 2001/04/29 09:50:37 martin Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.82 2001/06/03 03:07:39 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -1385,11 +1385,20 @@ ether_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
case SIOCSIFMTU:
if (ifr->ifr_mtu > ETHERMTU)
{
int maxmtu;
if (ec->ec_capabilities & ETHERCAP_JUMBO_MTU)
maxmtu = ETHERMTU_JUMBO;
else
maxmtu = ETHERMTU;
if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > maxmtu)
error = EINVAL;
else
ifp->if_mtu = ifr->ifr_mtu;
break;
}
case SIOCSIFFLAGS:
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) == IFF_RUNNING) {