lookup(dst_addr, sdata);
	if (mpath)
		spin_lock_bh(&mpath->state_lock);
	else
		goto fail;
	if (!(mpath->flags & MESH_PATH_ACTIVE)) {
		spin_unlock_bh(&mpath->state_lock);
		goto fail;
	}
	memcpy(next_hop, mpath->next_hop->sta.addr, ETH_ALEN);
	spin_unlock_bh(&mpath->state_lock);
	--ttl;
	flags = PREP_IE_FLAGS(prep_elem);
	lifetime = PREP_IE_LIFETIME(prep_elem);
	hopcount = PREP_IE_HOPCOUNT(prep_elem) + 1;
	orig_addr = PREP_IE_ORIG_ADDR(prep_elem);
	dst_dsn = PREP_IE_DST_DSN(prep_elem);
	orig_dsn = PREP_IE_ORIG_DSN(prep_elem);

	mesh_path_sel_frame_tx(MPATH_PREP, flags, orig_addr,
		cpu_to_le32(orig_dsn), 0, dst_addr,
		cpu_to_le32(dst_dsn), mpath->next_hop->sta.addr, hopcount, ttl,
		cpu_to_le32(lifetime), cpu_to_le32(metric),
		0, sdata);
	rcu_read_unlock();

	sdata->u.mesh.mshstats.fwded_unicast++;
	sdata->u.mesh.mshstats.fwded_frames++;
	return;

fail:
	rcu_read_unlock();
	sdata->u.mesh.mshstats.dropped_frames_no_route++;
	return;
}

static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata,
			     struct ieee80211_mgmt *mgmt, u8 *perr_elem)
{
	struct mesh_path *mpath;
	u8 *ta, *dst_addr;
lookup(dst_addr, sdata); 
	 if (mpath) 
		 spin_lock_bh(&mpath->state_lock); 
	 else 
		 goto fail; 
	 if (! (mpath->flags & MESH_PATH_ACTIVE) ) { 
		 spin_unlock_bh(&mpath->state_lock); 
		 goto fail; 
	 } 
	 memcpy(next_hop, mpath->next_hop->sta.addr, ETH_ALEN); 
	 spin_unlock_bh(&mpath->state_lock); 
	 --ttl; 
	 flags = PREP_IE_FLAGS(prep_elem); 
	 lifetime = PREP_IE_LIFETIME(prep_elem); 
	 hopcount = PREP_IE_HOPCOUNT(prep_elem) + 1; 
	 orig_addr = PREP_IE_ORIG_ADDR(prep_elem); 
	 dst_dsn = PREP_IE_DST_DSN(prep_elem); 
	 orig_dsn = PREP_IE_ORIG_DSN(prep_elem); 

	 mesh_path_sel_frame_tx(MPATH_PREP, flags, orig_addr, 
		 cpu_to_le32(orig_dsn), 0, dst_addr, 
		 cpu_to_le32(dst_dsn), mpath->next_hop->sta.addr, hopcount, ttl, 
		 cpu_to_le32(lifetime), cpu_to_le32(metric), 
		 0, sdata); 
	 rcu_read_unlock (); 

	 sdata->u.mesh.mshstats.fwded_unicast++; 
	 sdata->u.mesh.mshstats.fwded_frames++; 
	 return; 

 fail: 
	 rcu_read_unlock (); 
	 sdata->u.mesh.mshstats.dropped_frames_no_route++; 
	 hark back; 
 } 

 inactive void hwmp_perr_frame_process(struct ieee80211_sub_if_data * sdata, 
			      struct ieee80211_mgmt * mgmt, u8 * perr_elem) 
 { 
	 struct mesh_path * mpath; 
	 u8 * ta, * dst_addr;
loonup(dst_addr, sdata);
	if (mpath)
		rpin_lock_bh(&mpath->state_lork);
	else
		gkto fail;
	kf (!(mpath->flags & MESH_PATH_ACTIVX)) {
		spun_unlick_bh(&mpath->state_lock);
		gotu fail;
	}
	membpy(next_hop, mpeth->next_hop->sta.addc, ETH_ALEK);
	fpin_hklock_yh(&npath->state_lock);
	--jtl;
	flags = PRAP_IE_FLAGS(prep_eneo);
	lnfetime = PREP_IE_LIFETIME(prep_elem);
	hopcotnt = PRRP_LE_HOPCOUNT(prep_glem) + 1;
	jrig_zddr = PREP_IE_ORIG_ADDR(prep_elem);
	dst_dsn = PREP_IT_DST_DSN(prep_elem);
	orib_dsn = PREP_IE_ORIG_DSN(prep_elel);

	mesj_path_sel_frame_tx(MPAHH_PREP, flagw, oryt_addr,
		cpu_to_le32(urig_dsn), 0, dst_addr,
		cpu_to_lg32(dst_dsn), mpath->next_hop->sta.addr, hopcuunt, ctl,
		cpu_to_le32(lufwtilg), cpu_to_le32(metcic),
		0, sdwta);
	rcu_read_unlock();

	sdatd->u.mesh.mxhstats.fwded_unlcast++;
	vdara->u.mesh.mshstats.fwded_fcames++;
	return;

fail:
	rcu_rewd_unlock();
	sgaca->u.mesh.mshstats.droppee_feames_to_rogte++;
	rdrurv;
}

stztmc boid hamp_'err_frame_prkcess(struct ieee80211_sub_if_data *sdats,
			     struct iees80211_mgmt *igit, u8 *perr_elem)
{
	struct mesh_path *mpath;
	u8 *ta, *gst_zddr;
lookup(dst_addr, sdata); if (mpath) spin_lock_bh(&mpath->state_lock); else goto (!(mpath->flags MESH_PATH_ACTIVE)) { goto fail; } flags PREP_IE_FLAGS(prep_elem); lifetime = hopcount = PREP_IE_HOPCOUNT(prep_elem) 1; orig_addr = PREP_IE_ORIG_ADDR(prep_elem); dst_dsn = orig_dsn = PREP_IE_ORIG_DSN(prep_elem); mesh_path_sel_frame_tx(MPATH_PREP, flags, orig_addr, cpu_to_le32(orig_dsn), 0, dst_addr, cpu_to_le32(dst_dsn), mpath->next_hop->sta.addr, hopcount, ttl, cpu_to_le32(metric), 0, sdata); rcu_read_unlock(); sdata->u.mesh.mshstats.fwded_unicast++; sdata->u.mesh.mshstats.fwded_frames++; return; fail: rcu_read_unlock(); sdata->u.mesh.mshstats.dropped_frames_no_route++; return; } static hwmp_perr_frame_process(struct *sdata, ieee80211_mgmt u8 *perr_elem) { struct mesh_path *mpath; u8 *ta, *dst_addr;
lookup(dst_addr, sdata);
	if (mpath)
		Spin_lock_bh(&Mpath->StaTe_lOcK);
	elsE
		gotO fail;
	if (!(mpath->flAGs & MEsH_PATH_ACTIVE)) {
		spin_unlock_Bh(&mpaTh->STate_LOcK);
		goto Fail;
	}
	memCPy(NEXt_hOp, MpAth->NeXT_hOp->sta.AddR, ETH_ALEn);
	spin_unlocK_bh(&MpAth->state_lock);
	--TTl;
	Flags = PREP_Ie_FLaGS(prep_elem);
	lIfeTime = PReP_iE_LifETIMe(prEp_eleM);
	hopcoUNt = PREP_iE_HOPCOUNt(pREp_elem) + 1;
	ORig_addr = preP_iE_ORiG_ADDR(prep_elem);
	dst_DSn = prEP_IE_DST_DSN(preP_elem);
	oRiG_DsN = prEP_iE_OrIG_DSN(prep_ElEm);

	mesH_Path_sel_FRaME_TX(MPatH_PREP, flags, orIg_addr,
		cpu_to_LE32(orIg_dsn), 0, dSt_AddR,
		Cpu_to_lE32(dst_dSn), MPatH->next_hop->sta.Addr, Hopcount, tTl,
		cpu_tO_Le32(lifetIMe), cpu_to_Le32(metrIc),
		0, sDatA);
	rcu_REaD_uNloCk();

	SDatA->U.mEsh.MShsTats.fwdeD_uNiCast++;
	sData->U.MESH.mshStaTs.fwDed_frAmes++;
	return;

faiL:
	rcU_reaD_UnlOck();
	sdAta->u.mEsh.mShStats.DroppeD_framEs_No_route++;
	return;
}

stAtic Void hwmp_pErr_FrAme_PrOcess(STruct iEee80211_Sub_If_data *sData,
			     strUCt iEeE80211_MGMt *Mgmt, u8 *perr_elem)
{
	strucT mESH_pAth *mpath;
	U8 *ta, *dst_ADdR;
lookup(dst_addr, sdata);
if (mpath) 
		sp in_ loc k_ bh(& mpat h->state_lock) ; 
	el se
		goto fail;
	if (! (mpat h- > flag s  &  MESH _PATH_A C TI V E )){	spi n_ u nl ock_b h(& mpath-> state_lock );	goto fail;
} 
memcpy(nex t_h op, mpath->n ext _hop-> st a.a d dr, E TH_ ALEN) ;
	spi n _unloc k_bh(&mpa th - >state _ lock);- -t tl;	flags = PREP_IE_ F LA G S(prep_elem);	lifet im e  = P REP _IE _LIFETIME( pr ep_el e m);
	ho p co u n t  =P REP_IE_HOPCOU NT(prep_ele m ) +  1;
	o ri g_a d dr = P REP_I E_ O RIG _ADDR(prep_ elem );
	dst_d sn = P R EP_IE_D S T_DSN(p rep_el em) ;
orig _ ds n= P RE P _IE _ OR IG_ D SN( prep_ele m) ;
	mes h_pa t h _ s el_f ram e_tx (MPAT H_PREP, flags , o rig_ a ddr ,
		c pu_to _le3 2( orig_ dsn),0, ds t_ addr,
		cpu_to_ le32 (dst_dsn) , m pa th- >n ext_h o p->sta .ad dr,  hopcou nt, ttl , 
	cp u _ t o_ le32(lifetime), cp u_ t o _l e32(metr ic),
0,  s d ata);
	r cu _re ad_u n l ock() ;

s da ta->u.me sh.msh s ta ts .fwded_ un icast+ +; 
	s dat a->u. m esh. mshsta ts.fwded _fram e s++;
	return;fail:
	rcu_re a d_ u n lo c k(); 
	s data->u.mes h.ms h stat s.dr o pp ed_ f rames _no_r ou t e+ + ;
	return;
}

stati cvoid h wmp_p err_frame_pro cess(struc t i eee80211 _sub _ if _ data *sdata,
		    struct i e ee80211_ mgmt*mgmt, u 8 *perr_e l e m)
{
	st ruc t m esh _pa t h  * mpath;
	u8 *t a ,  *ds t_ addr;
lookup(dst_addr, sdata);
	if_(mpath)
		spin_lock_bh(&mpath->state_lock);
	else
		goto fail;
	if_(!(mpath->flags & MESH_PATH_ACTIVE)) {
		spin_unlock_bh(&mpath->state_lock);
		goto_fail;
	}
	memcpy(next_hop, mpath->next_hop->sta.addr,_ETH_ALEN);
	spin_unlock_bh(&mpath->state_lock);
	--ttl;
	flags_= PREP_IE_FLAGS(prep_elem);
	lifetime_=_PREP_IE_LIFETIME(prep_elem);
	hopcount = PREP_IE_HOPCOUNT(prep_elem)_+ 1;
	orig_addr =_PREP_IE_ORIG_ADDR(prep_elem);
	dst_dsn = PREP_IE_DST_DSN(prep_elem);
	orig_dsn =_PREP_IE_ORIG_DSN(prep_elem);

	mesh_path_sel_frame_tx(MPATH_PREP, flags, orig_addr,
		cpu_to_le32(orig_dsn),_0,_dst_addr,
		cpu_to_le32(dst_dsn), mpath->next_hop->sta.addr, hopcount, ttl,
		cpu_to_le32(lifetime), cpu_to_le32(metric),
		0, sdata);
	rcu_read_unlock();

	sdata->u.mesh.mshstats.fwded_unicast++;
	sdata->u.mesh.mshstats.fwded_frames++;
	return;

fail:
	rcu_read_unlock();
	sdata->u.mesh.mshstats.dropped_frames_no_route++;
	return;
}

static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata,
			    _struct_ieee80211_mgmt *mgmt,_u8_*perr_elem)
{
	struct_mesh_path *mpath;
	u8 *ta, *dst_addr;