Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Add a capability bit that indicates support for Giga...
details: https://anonhg.NetBSD.org/src/rev/7ee1d7a2eba8
branches: trunk
changeset: 510635:7ee1d7a2eba8
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun Jun 03 03:07:39 2001 +0000
description:
Add a capability bit that indicates support for Gigabit Ethernet
jumbo frames, and use it in SIOCSIFMTU.
diffstat:
sys/net/if_ether.h | 5 ++++-
sys/net/if_ethersubr.c | 13 +++++++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
diffs (64 lines):
diff -r d7b6a302ff0e -r 7ee1d7a2eba8 sys/net/if_ether.h
--- a/sys/net/if_ether.h Sun Jun 03 02:48:45 2001 +0000
+++ b/sys/net/if_ether.h Sun Jun 03 03:07:39 2001 +0000
@@ -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 @@
#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 @@
#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];
diff -r d7b6a302ff0e -r 7ee1d7a2eba8 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c Sun Jun 03 02:48:45 2001 +0000
+++ b/sys/net/if_ethersubr.c Sun Jun 03 03:07:39 2001 +0000
@@ -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 @@
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) {
Home |
Main Index |
Thread Index |
Old Index