From owner-svn-src-all@FreeBSD.ORG Thu Feb 7 21:31:38 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7C445E7C; Thu, 7 Feb 2013 21:31:38 +0000 (UTC) (envelope-from monthadar@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 6C401FB9; Thu, 7 Feb 2013 21:31:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r17LVcao014349; Thu, 7 Feb 2013 21:31:38 GMT (envelope-from monthadar@svn.freebsd.org) Received: (from monthadar@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r17LVcHu014348; Thu, 7 Feb 2013 21:31:38 GMT (envelope-from monthadar@svn.freebsd.org) Message-Id: <201302072131.r17LVcHu014348@svn.freebsd.org> From: Monthadar Al Jaberi Date: Thu, 7 Feb 2013 21:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r246519 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Feb 2013 21:31:38 -0000 Author: monthadar Date: Thu Feb 7 21:31:37 2013 New Revision: 246519 URL: http://svnweb.freebsd.org/changeset/base/246519 Log: Mesh HWMP forwarding information: updating FI for transmitter. * Added hwmp_update_transmitter function that checks if the metric to the transmitter have improved. If old FI is invalid or metric is larger the FI to the transmitter is updated occurdingly. This is a recommendation from the 802.11 2012 standard, table 13-9; Approved by: adrian (mentor) Modified: head/sys/net80211/ieee80211_hwmp.c Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:30:58 2013 (r246518) +++ head/sys/net80211/ieee80211_hwmp.c Thu Feb 7 21:31:37 2013 (r246519) @@ -896,6 +896,45 @@ hwmp_rootmode_rann_cb(void *arg) hwmp_rootmode_setup(vap); } +/* + * Update forwarding information to TA if metric improves. + */ +static void +hwmp_update_transmitter(struct ieee80211vap *vap, struct ieee80211_node *ni, + const char *hwmp_frame) +{ + struct ieee80211_mesh_state *ms = vap->iv_mesh; + struct ieee80211_mesh_route *rttran = NULL; /* Transmitter */ + int metric = 0; + + rttran = ieee80211_mesh_rt_find(vap, ni->ni_macaddr); + if (rttran == NULL) { + rttran = ieee80211_mesh_rt_add(vap, ni->ni_macaddr); + if (rttran == NULL) { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "unable to add path to transmitter %6D of %s", + ni->ni_macaddr, ":", hwmp_frame); + vap->iv_stats.is_mesh_rtaddfailed++; + return; + } + } + metric = ms->ms_pmetric->mpm_metric(ni); + if (!(rttran->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) || + rttran->rt_metric > metric) + { + IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, + "%s path to transmiter %6D of %s, metric %d:%d", + rttran->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ? + "prefer" : "update", ni->ni_macaddr, ":", hwmp_frame, + rttran->rt_metric, metric); + IEEE80211_ADDR_COPY(rttran->rt_nexthop, ni->ni_macaddr); + rttran->rt_metric = metric; + rttran->rt_nhops = 1; + ieee80211_mesh_rt_update(rttran, ms->ms_ppath->mpp_inact); + rttran->rt_flags = IEEE80211_MESHRT_FLAGS_VALID; + } +} + #define PREQ_TFLAGS(n) preq->preq_targets[n].target_flags #define PREQ_TADDR(n) preq->preq_targets[n].target_addr #define PREQ_TSEQ(n) preq->preq_targets[n].target_seq @@ -1010,10 +1049,8 @@ hwmp_recv_preq(struct ieee80211vap *vap, return; } - /* - * Forwarding information for transmitter mesh STA - * [OPTIONAL: if metric improved] - */ + /* Update forwarding information to TA if metric improves. */ + hwmp_update_transmitter(vap, ni, "PREQ"); /* * Check if the PREQ is addressed to us. @@ -1268,7 +1305,6 @@ hwmp_recv_prep(struct ieee80211vap *vap, * rules defined in 13.10.8.4). If the conditions for creating or * updating the forwarding information have not been met in those * rules, no further steps are applied to the PREP. - * [OPTIONAL]: update forwarding information to TA if metric improves. */ rt = ieee80211_mesh_rt_find(vap, prep->prep_targetaddr); if (rt == NULL) { @@ -1323,6 +1359,9 @@ hwmp_recv_prep(struct ieee80211vap *vap, } rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */ + /* Update forwarding information to TA if metric improves */ + hwmp_update_transmitter(vap, ni, "PREP"); + /* * If it's NOT for us, propagate the PREP */