Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 May 2009 15:11:20 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r192439 - projects/mesh11s/sys/net80211
Message-ID:  <200905201511.n4KFBLVN034747@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Wed May 20 15:11:20 2009
New Revision: 192439
URL: http://svn.freebsd.org/changeset/base/192439

Log:
  * Rename mesh variables in node struct.
  * Use an enum for plink state.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  projects/mesh11s/sys/net80211/ieee80211_ioctl.c
  projects/mesh11s/sys/net80211/ieee80211_mesh.c
  projects/mesh11s/sys/net80211/ieee80211_node.c
  projects/mesh11s/sys/net80211/ieee80211_node.h

Modified: projects/mesh11s/sys/net80211/ieee80211_ioctl.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_ioctl.c	Wed May 20 12:26:36 2009	(r192438)
+++ projects/mesh11s/sys/net80211/ieee80211_ioctl.c	Wed May 20 15:11:20 2009	(r192439)
@@ -441,9 +441,9 @@ get_sta_info(void *arg, struct ieee80211
 	else
 		si->isi_inact = vap->iv_inact_init;
 	si->isi_inact = (si->isi_inact - ni->ni_inact) * IEEE80211_INACT_WAIT;
-	si->isi_peerstate = ni->ni_peerstate;
-	si->isi_localid = ni->ni_llid;
-	si->isi_peerid = ni->ni_plid;
+	si->isi_peerstate = ni->ni_mlstate;
+	si->isi_localid = ni->ni_mllid;
+	si->isi_peerid = ni->ni_mlpid;
 
 	if (ielen) {
 		cp = ((uint8_t *)si) + si->isi_ie_off;

Modified: projects/mesh11s/sys/net80211/ieee80211_mesh.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_mesh.c	Wed May 20 12:26:36 2009	(r192438)
+++ projects/mesh11s/sys/net80211/ieee80211_mesh.c	Wed May 20 15:11:20 2009	(r192439)
@@ -270,11 +270,11 @@ mesh_input(struct ieee80211_node *ni, st
 			goto out;
 		IEEE80211_NOTE(vap, IEEE80211_MSG_MESH, ni,
 		    "%s", "received data frame");
-		if (ni->ni_peerstate != IEEE80211_NODE_MESH_ESTABLISHED) {
+		if (ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) {
 			IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH,
 			    ni->ni_macaddr, NULL,
 			    "peer link not yet established (%s)",
-			    nodemeshstates[ni->ni_peerstate]);
+			    nodemeshstates[ni->ni_mlstate]);
 		}	
 		hdrspace = ieee80211_hdrspace(ic, wh)
 		    + sizeof(struct ieee80211_meshcntl);
@@ -503,17 +503,17 @@ mesh_recv_mgmt(struct ieee80211_node *ni
 			/*
 			 * Try to peer with this node.
 			 */
-			get_random_bytes(&ni->ni_plid, 2);
-			ni->ni_peerstate = IEEE80211_NODE_MESH_OPENSNT;
+			get_random_bytes(&ni->ni_mlpid, 2);
+			ni->ni_mlstate = IEEE80211_NODE_MESH_OPENSNT;
 			IEEE80211_NOTE(vap,
 			    IEEE80211_MSG_MESH,
 			    ni, "peer link: switching to state %s",
-			    nodemeshstates[ni->ni_peerstate]);
-			vargs.fixedarg[0] = ni->ni_plid;
+			    nodemeshstates[ni->ni_mlstate]);
+			vargs.fixedarg[0] = ni->ni_mlpid;
 			ieee80211_send_action(ni,
 			    IEEE80211_ACTION_CAT_MESHPEERING,
 			    IEEE80211_ACTION_MESHPEERING_OPEN, vargs);
-			ni->ni_mrcount = 0;
+			ni->ni_mlrcnt = 0;
 			mesh_peer_timeout_setup(ni);
 		}
 		if (ni != NULL) {
@@ -720,23 +720,23 @@ mesh_recv_action(struct ieee80211_node *
 			IEEE80211_NOTE(vap,
 			    IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, ni,
 			    "recv PEER OPEN, lid 0x%x", meshpeer->peer_llinkid);
-			switch (ni->ni_peerstate) {
+			switch (ni->ni_mlstate) {
 			case IEEE80211_NODE_MESH_IDLE:
-				ni->ni_peerstate = IEEE80211_NODE_MESH_OPENRCV;
+				ni->ni_mlstate = IEEE80211_NODE_MESH_OPENRCV;
 				IEEE80211_NOTE(vap,
 				    IEEE80211_MSG_MESH,
 				    ni, "peer link: switching to state %s",
-				    nodemeshstates[ni->ni_peerstate]);
-				ni->ni_llid = meshpeer->peer_llinkid;
-				get_random_bytes(&ni->ni_plid, 2);
-				vargs.fixedarg[0] = ni->ni_plid;
+				    nodemeshstates[ni->ni_mlstate]);
+				ni->ni_mllid = meshpeer->peer_llinkid;
+				get_random_bytes(&ni->ni_mlpid, 2);
+				vargs.fixedarg[0] = ni->ni_mlpid;
 				/* Announce we're open too... */
 				ieee80211_send_action(ni,
 				    IEEE80211_ACTION_CAT_MESHPEERING,
 				    IEEE80211_ACTION_MESHPEERING_OPEN, vargs);
 				/* ...and confirm the link. */
-				vargs.fixedarg[0] = ni->ni_plid;
-				vargs.fixedarg[1] = ni->ni_llid;
+				vargs.fixedarg[0] = ni->ni_mlpid;
+				vargs.fixedarg[1] = ni->ni_mllid;
 				ieee80211_send_action(ni,
 				    IEEE80211_ACTION_CAT_MESHPEERING,
 				    IEEE80211_ACTION_MESHPEERING_CONFIRM,
@@ -745,23 +745,23 @@ mesh_recv_action(struct ieee80211_node *
 				break;
 			case IEEE80211_NODE_MESH_OPENRCV:
 				/* Duplicate open, confirm again. */
-				ni->ni_llid = meshpeer->peer_llinkid;
-				vargs.fixedarg[0] = ni->ni_plid;
-				vargs.fixedarg[1] = ni->ni_llid;
+				ni->ni_mllid = meshpeer->peer_llinkid;
+				vargs.fixedarg[0] = ni->ni_mlpid;
+				vargs.fixedarg[1] = ni->ni_mllid;
 				ieee80211_send_action(ni,
 				    IEEE80211_ACTION_CAT_MESHPEERING,
 				    IEEE80211_ACTION_MESHPEERING_CONFIRM,
 				    vargs);
 				break;
 			case IEEE80211_NODE_MESH_OPENSNT:
-				ni->ni_peerstate = IEEE80211_NODE_MESH_OPENRCV;
-				ni->ni_llid = meshpeer->peer_llinkid;
+				ni->ni_mlstate = IEEE80211_NODE_MESH_OPENRCV;
+				ni->ni_mllid = meshpeer->peer_llinkid;
 				IEEE80211_NOTE(vap,
 				    IEEE80211_MSG_MESH,
 				    ni, "peer link: switching to state %s",
-				    nodemeshstates[ni->ni_peerstate]);
-				vargs.fixedarg[0] = ni->ni_plid;
-				vargs.fixedarg[1] = ni->ni_llid;
+				    nodemeshstates[ni->ni_mlstate]);
+				vargs.fixedarg[0] = ni->ni_mlpid;
+				vargs.fixedarg[1] = ni->ni_mllid;
 				ieee80211_send_action(ni,
 				    IEEE80211_ACTION_CAT_MESHPEERING,
 				    IEEE80211_ACTION_MESHPEERING_CONFIRM,
@@ -769,15 +769,15 @@ mesh_recv_action(struct ieee80211_node *
 				/* NB: don't setup/clear any timeout */
 				break;
 			case IEEE80211_NODE_MESH_CONFIRMRECV:
-				ni->ni_peerstate =
+				ni->ni_mlstate =
 				    IEEE80211_NODE_MESH_ESTABLISHED;
 				IEEE80211_NOTE(vap,
 				    IEEE80211_MSG_MESH,
 				    ni, "peer link: switching to state %s",
-				    nodemeshstates[ni->ni_peerstate]);
-				ni->ni_llid = meshpeer->peer_llinkid;
-				vargs.fixedarg[0] = ni->ni_plid;
-				vargs.fixedarg[1] = ni->ni_llid;
+				    nodemeshstates[ni->ni_mlstate]);
+				ni->ni_mllid = meshpeer->peer_llinkid;
+				vargs.fixedarg[0] = ni->ni_mlpid;
+				vargs.fixedarg[1] = ni->ni_mllid;
 				ieee80211_send_action(ni,
 				    IEEE80211_ACTION_CAT_MESHPEERING,
 				    IEEE80211_ACTION_MESHPEERING_CONFIRM,
@@ -785,16 +785,16 @@ mesh_recv_action(struct ieee80211_node *
 				mesh_peer_timeout_stop(ni);
 				break;
 			case IEEE80211_NODE_MESH_ESTABLISHED:
-				vargs.fixedarg[0] = ni->ni_plid;
-				vargs.fixedarg[1] = ni->ni_llid;
+				vargs.fixedarg[0] = ni->ni_mlpid;
+				vargs.fixedarg[1] = ni->ni_mllid;
 				ieee80211_send_action(ni,
 				    IEEE80211_ACTION_CAT_MESHPEERING,
 				    IEEE80211_ACTION_MESHPEERING_CONFIRM,
 				    vargs);
 				break;
 			case IEEE80211_NODE_MESH_HOLDING:
-				vargs.fixedarg[0] = ni->ni_llid;
-				vargs.fixedarg[1] = ni->ni_plid;
+				vargs.fixedarg[0] = ni->ni_mllid;
+				vargs.fixedarg[1] = ni->ni_mlpid;
 				vargs.fixedarg[2] =
 				    IEEE80211_REASON_MESH_MAX_RETRIES;
 				ieee80211_send_action(ni,
@@ -809,27 +809,27 @@ mesh_recv_action(struct ieee80211_node *
 			    IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, ni,
 			    "recv PEER CONFIRM, local id 0x%x, peer id 0x%x",
 			    meshpeer->peer_llinkid, meshpeer->peer_linkid);
-			switch (ni->ni_peerstate) {
+			switch (ni->ni_mlstate) {
 			case IEEE80211_NODE_MESH_OPENRCV:
-				ni->ni_peerstate =
+				ni->ni_mlstate =
 				    IEEE80211_NODE_MESH_ESTABLISHED;
 				IEEE80211_NOTE(vap,
 				    IEEE80211_MSG_MESH,
 				    ni, "peer link: switching to state %s",
-				    nodemeshstates[ni->ni_peerstate]);
+				    nodemeshstates[ni->ni_mlstate]);
 				mesh_peer_timeout_stop(ni);
 				break;
 			case IEEE80211_NODE_MESH_OPENSNT:
-				ni->ni_peerstate =
+				ni->ni_mlstate =
 				    IEEE80211_NODE_MESH_CONFIRMRECV;
 				IEEE80211_NOTE(vap,
 				    IEEE80211_MSG_MESH,
 				    ni, "peer link: switching to state %s",
-				    nodemeshstates[ni->ni_peerstate]);
+				    nodemeshstates[ni->ni_mlstate]);
 				break;
 			case IEEE80211_NODE_MESH_HOLDING:
-				vargs.fixedarg[0] = ni->ni_llid;
-				vargs.fixedarg[1] = ni->ni_plid;
+				vargs.fixedarg[0] = ni->ni_mllid;
+				vargs.fixedarg[1] = ni->ni_mlpid;
 				vargs.fixedarg[2] = IEEE80211_REASON_MESH_MAX_RETRIES;
 				ieee80211_send_action(ni,
 				    IEEE80211_ACTION_CAT_MESHPEERING,
@@ -840,7 +840,7 @@ mesh_recv_action(struct ieee80211_node *
 				IEEE80211_DISCARD(vap,
 				    IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH,
 				    wh, NULL, "received confirm in invalid "
-				    "state %d", ni->ni_peerstate);
+				    "state %d", ni->ni_mlstate);
 				vap->iv_stats.is_rx_mgtdiscard++;
 			}
 			break;
@@ -848,9 +848,13 @@ mesh_recv_action(struct ieee80211_node *
 			IEEE80211_NOTE(vap,
 			    IEEE80211_MSG_ACTION | IEEE80211_MSG_MESH, ni,
 			    "%s", "recv PEER CLOSE");
-			switch (ni->ni_peerstate) {
+			switch (ni->ni_mlstate) {
+			case IEEE80211_NODE_MESH_IDLE:
+			case IEEE80211_NODE_MESH_CONFIRMRECV:
+			case IEEE80211_NODE_MESH_ESTABLISHED:
+				break;
 			case IEEE80211_NODE_MESH_OPENRCV:
-				ni->ni_peerstate = IEEE80211_NODE_MESH_HOLDING;
+				ni->ni_mlstate = IEEE80211_NODE_MESH_HOLDING;
 				mesh_peer_timeout_setup(ni);
 				break;
 			case IEEE80211_NODE_MESH_OPENSNT:
@@ -939,17 +943,17 @@ mesh_recv_action(struct ieee80211_node *
 static inline void
 mesh_peer_timeout_setup(struct ieee80211_node *ni)
 {
-	switch (ni->ni_peerstate) {
+	switch (ni->ni_mlstate) {
 	case IEEE80211_NODE_MESH_HOLDING:
-		ni->ni_mtimerval = HOLDING_TIMEOUT;
+		ni->ni_mltval = HOLDING_TIMEOUT;
 		break;
 	case IEEE80211_NODE_MESH_CONFIRMRECV:
-		ni->ni_mtimerval = CONFIRM_TIMEOUT;
+		ni->ni_mltval = CONFIRM_TIMEOUT;
 		break;
 	default:
-		ni->ni_mtimerval = RETRY_TIMEOUT;
+		ni->ni_mltval = RETRY_TIMEOUT;
 	}
-	callout_reset(&ni->ni_mtimer, ni->ni_mtimerval, mesh_peer_timeout_cb,
+	callout_reset(&ni->ni_mltimer, ni->ni_mltval, mesh_peer_timeout_cb,
 	    ni);
 }
 
@@ -962,15 +966,15 @@ mesh_peer_timeout_backoff(struct ieee802
 	uint32_t r;
 	
 	r = arc4random();
-	ni->ni_mtimerval += r % ni->ni_mtimerval;
-	callout_reset(&ni->ni_mtimer, ni->ni_mtimerval, mesh_peer_timeout_cb,
+	ni->ni_mltval += r % ni->ni_mltval;
+	callout_reset(&ni->ni_mltimer, ni->ni_mltval, mesh_peer_timeout_cb,
 	    ni);
 }
 
 static inline void
 mesh_peer_timeout_stop(struct ieee80211_node *ni)
 {
-	callout_stop(&ni->ni_mtimer);
+	callout_stop(&ni->ni_mltimer);
 }
 
 /*
@@ -986,59 +990,62 @@ mesh_peer_timeout_cb(void *arg)
 	IEEE80211_NOTE(vap,
 	    IEEE80211_MSG_MESH,
 	    ni, "mesh link timeout, state %s, retry counter %d",
-	    nodemeshstates[ni->ni_peerstate], ni->ni_mrcount);
+	    nodemeshstates[ni->ni_mlstate], ni->ni_mlrcnt);
 	
-	switch (ni->ni_peerstate) {
+	switch (ni->ni_mlstate) {
+	case IEEE80211_NODE_MESH_IDLE:
+	case IEEE80211_NODE_MESH_ESTABLISHED:
+		break;
 	case IEEE80211_NODE_MESH_OPENSNT:
 	case IEEE80211_NODE_MESH_OPENRCV:
-		if (ni->ni_mrcount == ieee80211_mesh_maxretries) {
-			vargs.fixedarg[0] = ni->ni_plid;
+		if (ni->ni_mlrcnt == ieee80211_mesh_maxretries) {
+			vargs.fixedarg[0] = ni->ni_mlpid;
 			vargs.fixedarg[2] = IEEE80211_REASON_MESH_MAX_RETRIES;
 			ieee80211_send_action(ni,
 			    IEEE80211_ACTION_CAT_MESHPEERING,
 			    IEEE80211_ACTION_MESHPEERING_CLOSE, vargs);
-			ni->ni_mrcount = 0;
-			ni->ni_peerstate = IEEE80211_NODE_MESH_HOLDING;
+			ni->ni_mlrcnt = 0;
+			ni->ni_mlstate = IEEE80211_NODE_MESH_HOLDING;
 			IEEE80211_NOTE(vap,
 			    IEEE80211_MSG_MESH,
 			    ni, "peer link: switching to state %s",
-			    nodemeshstates[ni->ni_peerstate]);
+			    nodemeshstates[ni->ni_mlstate]);
 			mesh_peer_timeout_setup(ni);
 		} else {
-			vargs.fixedarg[0] = ni->ni_plid;
+			vargs.fixedarg[0] = ni->ni_mlpid;
 			ieee80211_send_action(ni,
 			    IEEE80211_ACTION_CAT_MESHPEERING,
 			    IEEE80211_ACTION_MESHPEERING_OPEN, vargs);
-			ni->ni_mrcount++;
+			ni->ni_mlrcnt++;
 			mesh_peer_timeout_backoff(ni);
 		}
 		break;
 	case IEEE80211_NODE_MESH_CONFIRMRECV:
-		if (ni->ni_mrcount == ieee80211_mesh_maxretries) {
-			vargs.fixedarg[0] = ni->ni_plid;
+		if (ni->ni_mlrcnt == ieee80211_mesh_maxretries) {
+			vargs.fixedarg[0] = ni->ni_mlpid;
 			vargs.fixedarg[2] =
 			    IEEE80211_REASON_MESH_CONFIRM_TIMEOUT;
 			ieee80211_send_action(ni,
 			    IEEE80211_ACTION_CAT_MESHPEERING,
 			    IEEE80211_ACTION_MESHPEERING_CLOSE, vargs);
-			ni->ni_mrcount = 0;
-			ni->ni_peerstate = IEEE80211_NODE_MESH_HOLDING;
+			ni->ni_mlrcnt = 0;
+			ni->ni_mlstate = IEEE80211_NODE_MESH_HOLDING;
 			IEEE80211_NOTE(vap,
 			    IEEE80211_MSG_MESH,
 			    ni, "peer link: switching to state %s",
-			    nodemeshstates[ni->ni_peerstate]);
+			    nodemeshstates[ni->ni_mlstate]);
 			mesh_peer_timeout_setup(ni);
 		} else {
-			ni->ni_mrcount++;
+			ni->ni_mlrcnt++;
 			mesh_peer_timeout_setup(ni);
 		}
 		break;
 	case IEEE80211_NODE_MESH_HOLDING:
-		ni->ni_peerstate = IEEE80211_NODE_MESH_IDLE;
+		ni->ni_mlstate = IEEE80211_NODE_MESH_IDLE;
 		IEEE80211_NOTE(vap,
 		    IEEE80211_MSG_MESH,
 		    ni, "peer link: switching to state %s",
-		    nodemeshstates[ni->ni_peerstate]);
+		    nodemeshstates[ni->ni_mlstate]);
 		break;
 	}
 }

Modified: projects/mesh11s/sys/net80211/ieee80211_node.c
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_node.c	Wed May 20 12:26:36 2009	(r192438)
+++ projects/mesh11s/sys/net80211/ieee80211_node.c	Wed May 20 15:11:20 2009	(r192439)
@@ -1399,7 +1399,7 @@ ieee80211_init_neighbor(struct ieee80211
 	if (vap->iv_opmode == IEEE80211_M_MBSS) {	
 		ni->ni_meshidlen = sp->meshid[1];
 		memcpy(ni->ni_meshid, sp->meshid + 2, sp->meshid[1]);
-		callout_init(&ni->ni_mtimer, CALLOUT_MPSAFE);
+		callout_init(&ni->ni_mltimer, CALLOUT_MPSAFE);
 	}
 
 	if (ieee80211_ies_init(&ni->ni_ies, sp->ies, sp->ies_len)) {

Modified: projects/mesh11s/sys/net80211/ieee80211_node.h
==============================================================================
--- projects/mesh11s/sys/net80211/ieee80211_node.h	Wed May 20 12:26:36 2009	(r192438)
+++ projects/mesh11s/sys/net80211/ieee80211_node.h	Wed May 20 15:11:20 2009	(r192439)
@@ -88,6 +88,15 @@ struct ieee80211_ies {
 	int	len;		/* data size in bytes */
 };
 
+enum ieee80211_mesh_state {
+	IEEE80211_NODE_MESH_IDLE	= 0,
+	IEEE80211_NODE_MESH_OPENSNT	= 1,	/* open frame received */
+	IEEE80211_NODE_MESH_OPENRCV	= 2,	/* open frame sent */
+	IEEE80211_NODE_MESH_CONFIRMRECV	= 3,	/* confirm Frame recvived */
+	IEEE80211_NODE_MESH_ESTABLISHED	= 4,	/* link established */
+	IEEE80211_NODE_MESH_HOLDING	= 5,	/* link closing */
+};
+
 /*
  * Node specific information.  Note that drivers are expected
  * to derive from this structure to add device-specific per-node
@@ -176,19 +185,15 @@ struct ieee80211_node {
 	uint8_t			ni_dtim_count;	/* DTIM count for last bcn */
 
 	/* 11s state */
-#define IEEE80211_NODE_MESH_IDLE	0
-#define IEEE80211_NODE_MESH_OPENSNT	1	/* Peer Open Frame Received */
-#define IEEE80211_NODE_MESH_OPENRCV	2	/* Peer Open Frame Sent */
-#define IEEE80211_NODE_MESH_CONFIRMRECV	3	/* Peer Confirm Frame Recvived */
-#define IEEE80211_NODE_MESH_ESTABLISHED	4	/* Peer Link Established */
-#define IEEE80211_NODE_MESH_HOLDING	5	/* Peer Link Closing */
-	int8_t			ni_peerstate;	/* Mesh Peering state */
-	uint16_t		ni_llid;	/* local link ID */
-	uint16_t		ni_plid;	/* peer link ID */
-	struct callout		ni_mtimer;	/* mesh timer */
-	uint8_t			ni_mrcount;	/* mesh retry counter */
-	uint8_t			ni_mtimerval;	/* mesh timer value */
+	enum ieee80211_mesh_state ni_mlstate;	/* peering management state */
+	uint16_t		ni_mllid;	/* link local ID */
+	uint16_t		ni_mlpid;	/* link peer ID */
+	struct callout		ni_mltimer;	/* link mesh timer */
+	uint8_t			ni_mlrcnt;	/* link mesh retry counter */
+	uint8_t			ni_mltval;	/* link mesh timer value */
 	uint8_t			ni_mnxthop[IEEE80211_ADDR_LEN];
+	uint32_t		ni_mpmetric;	/* path metric */
+	ieee80211_seq		ni_mhwmpseq;	/* HWMP path seq number */
 
 	/* 11n state */
 	uint16_t		ni_htcap;	/* HT capabilities */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905201511.n4KFBLVN034747>