Add media types and options for ATM. While on most ATM cards media cannot

be changed, it is very convenient to be able to toggle SDH/Sonet,
idle/unassigned cells and scrambled mode and to see the carrier
state.

Reviewed by:	-arch (if_media.h definitions)
This commit is contained in:
Hartmut Brandt 2003-04-29 17:23:23 +00:00
parent 667c974f0a
commit 2b75e097f1
3 changed files with 97 additions and 0 deletions

View File

@ -159,6 +159,14 @@ media_status(int s, struct rt_addrinfo *info __unused)
else
printf("no ring");
break;
case IFM_ATM:
if (ifmr.ifm_status & IFM_ACTIVE)
printf("active");
else
printf("no carrier");
break;
case IFM_IEEE80211:
/* XXX: Different value for adhoc? */
if (ifmr.ifm_status & IFM_ACTIVE)
@ -370,6 +378,15 @@ static struct ifmedia_description ifm_subtype_ieee80211_option_descriptions[] =
struct ifmedia_description ifm_subtype_ieee80211_mode_descriptions[] =
IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS;
static struct ifmedia_description ifm_subtype_atm_descriptions[] =
IFM_SUBTYPE_ATM_DESCRIPTIONS;
static struct ifmedia_description ifm_subtype_atm_aliases[] =
IFM_SUBTYPE_ATM_ALIASES;
static struct ifmedia_description ifm_subtype_atm_option_descriptions[] =
IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS;
static struct ifmedia_description ifm_subtype_shared_descriptions[] =
IFM_SUBTYPE_SHARED_DESCRIPTIONS;
@ -465,6 +482,23 @@ static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
{ NULL, 0 },
},
},
{
{
{ &ifm_subtype_shared_descriptions[0], 0 },
{ &ifm_subtype_shared_aliases[0], 1 },
{ &ifm_subtype_atm_descriptions[0], 0 },
{ &ifm_subtype_atm_aliases[0], 1 },
{ NULL, 0 },
},
{
{ &ifm_shared_option_descriptions[0], 0 },
{ &ifm_subtype_atm_option_descriptions[0], 0 },
{ NULL, 0 },
},
{
{ NULL, 0 },
},
},
};
static int

View File

@ -412,6 +412,12 @@ struct ifmedia_description ifm_subtype_ieee80211_option_descriptions[] =
struct ifmedia_description ifm_subtype_ieee80211_mode_descriptions[] =
IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS;
struct ifmedia_description ifm_subtype_atm_descriptions[] =
IFM_SUBTYPE_ATM_DESCRIPTIONS;
struct ifmedia_description ifm_subtype_atm_option_descriptions[] =
IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS;
struct ifmedia_description ifm_subtype_shared_descriptions[] =
IFM_SUBTYPE_SHARED_DESCRIPTIONS;
@ -446,6 +452,11 @@ struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
&ifm_subtype_ieee80211_option_descriptions[0],
&ifm_subtype_ieee80211_mode_descriptions[0]
},
{
&ifm_subtype_atm_descriptions[0],
&ifm_subtype_atm_option_descriptions[0],
NULL,
},
};
/*

View File

@ -199,6 +199,23 @@ int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr,
#define IFM_IEEE80211_11B 2 /* Direct Sequence mode */
#define IFM_IEEE80211_11G 3 /* 2Ghz, CCK mode */
/*
* ATM
*/
#define IFM_ATM 0x000000a0
#define IFM_ATM_UNKNOWN 3
#define IFM_ATM_UTP_25 4
#define IFM_ATM_TAXI_100 5
#define IFM_ATM_TAXI_140 6
#define IFM_ATM_MM_155 7
#define IFM_ATM_SM_155 8
#define IFM_ATM_UTP_155 9
#define IFM_ATM_MM_622 10
#define IFM_ATM_SM_622 11
#define IFM_ATM_SDH 0x00000100 /* SDH instead of SONET */
#define IFM_ATM_NOSCRAMB 0x00000200 /* no scrambling */
#define IFM_ATM_UNASSIGNED 0x00000400 /* unassigned cells */
/*
* Shared media sub-types
*/
@ -271,6 +288,7 @@ struct ifmedia_description {
{ IFM_TOKEN, "Token ring" }, \
{ IFM_FDDI, "FDDI" }, \
{ IFM_IEEE80211, "IEEE 802.11 Wireless Ethernet" }, \
{ IFM_ATM, "ATM" }, \
{ 0, NULL }, \
}
@ -435,6 +453,40 @@ struct ifmedia_description {
{ 0, NULL }, \
}
# define IFM_SUBTYPE_ATM_DESCRIPTIONS { \
{ IFM_ATM_UNKNOWN, "Unknown" }, \
{ IFM_ATM_UTP_25, "UTP/25.6MBit" }, \
{ IFM_ATM_TAXI_100, "Taxi/100MBit" }, \
{ IFM_ATM_TAXI_140, "Taxi/140MBit" }, \
{ IFM_ATM_MM_155, "Multi-mode/155MBit" }, \
{ IFM_ATM_SM_155, "Single-mode/155MBit" }, \
{ IFM_ATM_UTP_155, "UTP/155MBit" }, \
{ IFM_ATM_MM_622, "Mult-imode/622MBit" }, \
{ IFM_ATM_SM_622, "Single-mode/622MBit" }, \
{ 0, NULL }, \
}
# define IFM_SUBTYPE_ATM_ALIASES { \
{ IFM_ATM_UNKNOWN, "UNKNOWN" }, \
{ IFM_ATM_UTP_25, "UTP-25" }, \
{ IFM_ATM_TAXI_100, "TAXI-100" }, \
{ IFM_ATM_TAXI_140, "TAXI-140" }, \
{ IFM_ATM_MM_155, "MM-155" }, \
{ IFM_ATM_SM_155, "SM-155" }, \
{ IFM_ATM_UTP_155, "UTP-155" }, \
{ IFM_ATM_MM_622, "MM-622" }, \
{ IFM_ATM_SM_622, "SM-622" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS { \
{ IFM_ATM_SDH, "SDH" }, \
{ IFM_ATM_NOSCRAMB, "Noscramb" }, \
{ IFM_ATM_UNASSIGNED, "Unassigned" }, \
{ 0, NULL }, \
}
#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \
{ IFM_AUTO, "autoselect" }, \
{ IFM_MANUAL, "manual" }, \