socsvn commit: r307994 - in soc2016/yuanxunzhang/head: sys/net usr.sbin/eaps
yuanxunzhang at FreeBSD.org
yuanxunzhang at FreeBSD.org
Fri Aug 19 07:45:07 UTC 2016
Author: yuanxunzhang
Date: Fri Aug 19 07:45:04 2016
New Revision: 307994
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307994
Log:
EAPS: get eaps mode priority interface
Modified:
soc2016/yuanxunzhang/head/sys/net/eaps.c
soc2016/yuanxunzhang/head/sys/net/eaps.h
soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c
soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h
Modified: soc2016/yuanxunzhang/head/sys/net/eaps.c
==============================================================================
--- soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Aug 19 05:43:28 2016 (r307993)
+++ soc2016/yuanxunzhang/head/sys/net/eaps.c Fri Aug 19 07:45:04 2016 (r307994)
@@ -246,8 +246,9 @@
EAPS_RLOCK(sc, &tracker);
es->state = sc->sc_eaps.state;
es->status = sc->sc_eaps.status;
+ es->mode = sc->sc_eaps.mode;
+ es->priority = sc->sc_eaps.priority;
(void) strlcpy(es->ifname, sc->sc_ifp->if_xname, sizeof(sc->sc_ifp->if_xname));
- printf("EAPS status: interface: %s, state: %d\n.", sc->sc_ifp->if_xname, es->state);
EAPS_RUNLOCK(sc, &tracker);
}
@@ -258,6 +259,8 @@
EAPS_WLOCK(sc);
sc->sc_eaps.state = EAPS_S_IDLE;
sc->sc_eaps.status = EAPS_STATUS_NOT_ACTIVE;
+ sc->sc_eaps.mode = EAPS_MODE_TRANSIT;
+ sc->sc_eaps.priority = EAPS_PRIORITY_NORMAL;
EAPS_WUNLOCK(sc);
}
Modified: soc2016/yuanxunzhang/head/sys/net/eaps.h
==============================================================================
--- soc2016/yuanxunzhang/head/sys/net/eaps.h Fri Aug 19 05:43:28 2016 (r307993)
+++ soc2016/yuanxunzhang/head/sys/net/eaps.h Fri Aug 19 07:45:04 2016 (r307994)
@@ -38,6 +38,8 @@
char ifname[IFNAMSIZ]; /* name of the eaps */
uint8_t state; /* state of eaps */
uint8_t status; /* enable or disable eaps */
+ uint8_t mode; /* switch mode for a node: transit or master, default transit */
+ uint8_t priority; /* EAPS domain priority high or normal */
};
/*
@@ -156,6 +158,12 @@
#define EAPS_STATUS_ACTIVE 0x00 /* Eaps is active */
#define EAPS_STATUS_NOT_ACTIVE 0x01 /* Eaps is not active */
+#define EAPS_MODE_TRANSIT 0x00 /* EAPS swith mode - transit (default) */
+#define EAPS_MODE_MASTER 0x01 /* EAPS swith mode - master */
+
+#define EAPS_PRIORITY_NORMAL 0x00 /* EAPS domain priority - normal */
+#define EAPS_PRIORITY_HIGH 0x01 /* EAPS domain priority - high (default) */
+
#define EAPS_LOCK_INIT(_sc) rm_init(&(_sc)->sc_mtx, "eaps rmlock")
#define EAPS_LOCK_DESTROY(_sc) rm_destroy(&(_sc)->sc_mtx)
#define EAPS_RLOCK(_sc, _p) rm_rlock(&(_sc)->sc_mtx, (_p))
Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c
==============================================================================
--- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 05:43:28 2016 (r307993)
+++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.c Fri Aug 19 07:45:04 2016 (r307994)
@@ -67,12 +67,22 @@
static const char *eaps_state_message[] = {
"idle", /* EAPS_S_IDLE */
- "complete" /* EAPS_S_COMPLETE */
- "failed" /* EAPS_S_FAILED */
- "link up" /* EAPS_S_LINKS_UP */
- "link down" /* EAPS_S_LINK_DOWN */
- "preforward" /* EAPS_S_PREFORWARD */
- "init" /* EAPS_S_INIT */
+ "complete", /* EAPS_S_COMPLETE */
+ "failed", /* EAPS_S_FAILED */
+ "link up", /* EAPS_S_LINKS_UP */
+ "link down", /* EAPS_S_LINK_DOWN */
+ "preforward", /* EAPS_S_PREFORWARD */
+ "init", /* EAPS_S_INIT */
+};
+
+static const char *eaps_mode_message[] = {
+ "transit", /* EAPS_MODE_TRANSIT */
+ "master", /* EAPS_MODE_MASTER */
+};
+
+static const char *eaps_priority_message[] = {
+ "normal", /* EAPS_PRIORITY_NORMAL */
+ "high", /* EAPS_PRIORITY_HIGH */
};
static struct keytab {
@@ -202,8 +212,9 @@
if (ioctl(s, SIOCSEAPSDOMAIN, &es) == 0) {
printf("%s: ", domain_name);
printf("status: %s, ", eaps_status_message[es.status]);
- printf("state: %s, ", eaps_state_message[es.state]);
- putchar('\n');
+ printf("state: %s\n", eaps_state_message[es.state]);
+ printf("\tswitch mode: %s\n", eaps_mode_message[es.mode]);
+ printf("\tpriority: %s\n", eaps_priority_message[es.priority]);
} else {
err(1, "SIOCSEAPSDOMAIN");
}
Modified: soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h
==============================================================================
--- soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Fri Aug 19 05:43:28 2016 (r307993)
+++ soc2016/yuanxunzhang/head/usr.sbin/eaps/eaps.h Fri Aug 19 07:45:04 2016 (r307994)
@@ -45,8 +45,9 @@
char ifname[IFNAMSIZ]; /* name of the eaps */
uint8_t state; /* state of eaps */
uint8_t status; /* enable or disable eaps */
+ uint8_t mode; /* switch mode for a node: transit or master, default transit */
+ uint8_t priority; /* EAPS domain priority high or normal */
};
-
/*
* EAPS ring node states
*/
More information about the svn-soc-all
mailing list