Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions
mesh_hwmp.c File Reference
#include <linux/slab.h>
#include <linux/etherdevice.h>
#include <asm/unaligned.h>
#include "wme.h"
#include "mesh.h"

Go to the source code of this file.

Macros

#define TEST_FRAME_LEN   8192
 
#define MAX_METRIC   0xffffffff
 
#define ARITH_SHIFT   8
 
#define MAX_PREQ_QUEUE_LEN   64
 
#define MP_F_DO   0x1
 
#define MP_F_RF   0x2
 
#define MP_F_USN   0x01
 
#define MP_F_RCODE   0x02
 
#define AE_F   (1<<6)
 
#define AE_F_SET(x)   (*x & AE_F)
 
#define PREQ_IE_FLAGS(x)   (*(x))
 
#define PREQ_IE_HOPCOUNT(x)   (*(x + 1))
 
#define PREQ_IE_TTL(x)   (*(x + 2))
 
#define PREQ_IE_PREQ_ID(x)   u32_field_get(x, 3, 0)
 
#define PREQ_IE_ORIG_ADDR(x)   (x + 7)
 
#define PREQ_IE_ORIG_SN(x)   u32_field_get(x, 13, 0)
 
#define PREQ_IE_LIFETIME(x)   u32_field_get(x, 17, AE_F_SET(x))
 
#define PREQ_IE_METRIC(x)   u32_field_get(x, 21, AE_F_SET(x))
 
#define PREQ_IE_TARGET_F(x)   (*(AE_F_SET(x) ? x + 32 : x + 26))
 
#define PREQ_IE_TARGET_ADDR(x)   (AE_F_SET(x) ? x + 33 : x + 27)
 
#define PREQ_IE_TARGET_SN(x)   u32_field_get(x, 33, AE_F_SET(x))
 
#define PREP_IE_FLAGS(x)   PREQ_IE_FLAGS(x)
 
#define PREP_IE_HOPCOUNT(x)   PREQ_IE_HOPCOUNT(x)
 
#define PREP_IE_TTL(x)   PREQ_IE_TTL(x)
 
#define PREP_IE_ORIG_ADDR(x)   (AE_F_SET(x) ? x + 27 : x + 21)
 
#define PREP_IE_ORIG_SN(x)   u32_field_get(x, 27, AE_F_SET(x))
 
#define PREP_IE_LIFETIME(x)   u32_field_get(x, 13, AE_F_SET(x))
 
#define PREP_IE_METRIC(x)   u32_field_get(x, 17, AE_F_SET(x))
 
#define PREP_IE_TARGET_ADDR(x)   (x + 3)
 
#define PREP_IE_TARGET_SN(x)   u32_field_get(x, 9, 0)
 
#define PERR_IE_TTL(x)   (*(x))
 
#define PERR_IE_TARGET_FLAGS(x)   (*(x + 2))
 
#define PERR_IE_TARGET_ADDR(x)   (x + 3)
 
#define PERR_IE_TARGET_SN(x)   u32_field_get(x, 9, 0)
 
#define PERR_IE_TARGET_RCODE(x)   u16_field_get(x, 13, 0)
 
#define MSEC_TO_TU(x)   (x*1000/1024)
 
#define SN_GT(x, y)   ((s32)(y - x) < 0)
 
#define SN_LT(x, y)   ((s32)(x - y) < 0)
 
#define net_traversal_jiffies(s)   msecs_to_jiffies(s->u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime)
 
#define default_lifetime(s)   MSEC_TO_TU(s->u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout)
 
#define min_preq_int_jiff(s)   (msecs_to_jiffies(s->u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval))
 
#define max_preq_retries(s)   (s->u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries)
 
#define disc_timeout_jiff(s)   msecs_to_jiffies(sdata->u.mesh.mshcfg.min_discovery_timeout)
 
#define root_path_confirmation_jiffies(s)   msecs_to_jiffies(sdata->u.mesh.mshcfg.dot11MeshHWMPconfirmationInterval)
 

Enumerations

enum  mpath_frame_type { MPATH_PREQ = 0, MPATH_PREP, MPATH_PERR, MPATH_RANN }
 

Functions

int mesh_path_error_tx (u8 ttl, u8 *target, __le32 target_sn, __le16 target_rcode, const u8 *ra, struct ieee80211_sub_if_data *sdata)
 
void ieee80211s_update_metric (struct ieee80211_local *local, struct sta_info *sta, struct sk_buff *skb)
 
void mesh_rx_path_sel_frame (struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt, size_t len)
 
void mesh_path_start_discovery (struct ieee80211_sub_if_data *sdata)
 
int mesh_nexthop_resolve (struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
 
int mesh_nexthop_lookup (struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
 
void mesh_path_timer (unsigned long data)
 
void mesh_path_tx_root_frame (struct ieee80211_sub_if_data *sdata)
 

Macro Definition Documentation

#define AE_F   (1<<6)

Definition at line 48 of file mesh_hwmp.c.

#define AE_F_SET (   x)    (*x & AE_F)

Definition at line 49 of file mesh_hwmp.c.

#define ARITH_SHIFT   8

Definition at line 18 of file mesh_hwmp.c.

#define default_lifetime (   s)    MSEC_TO_TU(s->u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout)

Definition at line 85 of file mesh_hwmp.c.

#define disc_timeout_jiff (   s)    msecs_to_jiffies(sdata->u.mesh.mshcfg.min_discovery_timeout)

Definition at line 90 of file mesh_hwmp.c.

#define MAX_METRIC   0xffffffff

Definition at line 17 of file mesh_hwmp.c.

#define MAX_PREQ_QUEUE_LEN   64

Definition at line 20 of file mesh_hwmp.c.

#define max_preq_retries (   s)    (s->u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries)

Definition at line 89 of file mesh_hwmp.c.

#define min_preq_int_jiff (   s)    (msecs_to_jiffies(s->u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval))

Definition at line 87 of file mesh_hwmp.c.

#define MP_F_DO   0x1

Definition at line 23 of file mesh_hwmp.c.

#define MP_F_RCODE   0x02

Definition at line 29 of file mesh_hwmp.c.

#define MP_F_RF   0x2

Definition at line 25 of file mesh_hwmp.c.

#define MP_F_USN   0x01

Definition at line 27 of file mesh_hwmp.c.

#define MSEC_TO_TU (   x)    (x*1000/1024)

Definition at line 79 of file mesh_hwmp.c.

#define net_traversal_jiffies (   s)    msecs_to_jiffies(s->u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime)

Definition at line 83 of file mesh_hwmp.c.

#define PERR_IE_TARGET_ADDR (   x)    (x + 3)

Definition at line 75 of file mesh_hwmp.c.

#define PERR_IE_TARGET_FLAGS (   x)    (*(x + 2))

Definition at line 74 of file mesh_hwmp.c.

#define PERR_IE_TARGET_RCODE (   x)    u16_field_get(x, 13, 0)

Definition at line 77 of file mesh_hwmp.c.

#define PERR_IE_TARGET_SN (   x)    u32_field_get(x, 9, 0)

Definition at line 76 of file mesh_hwmp.c.

#define PERR_IE_TTL (   x)    (*(x))

Definition at line 73 of file mesh_hwmp.c.

#define PREP_IE_FLAGS (   x)    PREQ_IE_FLAGS(x)

Definition at line 63 of file mesh_hwmp.c.

#define PREP_IE_HOPCOUNT (   x)    PREQ_IE_HOPCOUNT(x)

Definition at line 64 of file mesh_hwmp.c.

#define PREP_IE_LIFETIME (   x)    u32_field_get(x, 13, AE_F_SET(x))

Definition at line 68 of file mesh_hwmp.c.

#define PREP_IE_METRIC (   x)    u32_field_get(x, 17, AE_F_SET(x))

Definition at line 69 of file mesh_hwmp.c.

#define PREP_IE_ORIG_ADDR (   x)    (AE_F_SET(x) ? x + 27 : x + 21)

Definition at line 66 of file mesh_hwmp.c.

#define PREP_IE_ORIG_SN (   x)    u32_field_get(x, 27, AE_F_SET(x))

Definition at line 67 of file mesh_hwmp.c.

#define PREP_IE_TARGET_ADDR (   x)    (x + 3)

Definition at line 70 of file mesh_hwmp.c.

#define PREP_IE_TARGET_SN (   x)    u32_field_get(x, 9, 0)

Definition at line 71 of file mesh_hwmp.c.

#define PREP_IE_TTL (   x)    PREQ_IE_TTL(x)

Definition at line 65 of file mesh_hwmp.c.

#define PREQ_IE_FLAGS (   x)    (*(x))

Definition at line 50 of file mesh_hwmp.c.

#define PREQ_IE_HOPCOUNT (   x)    (*(x + 1))

Definition at line 51 of file mesh_hwmp.c.

#define PREQ_IE_LIFETIME (   x)    u32_field_get(x, 17, AE_F_SET(x))

Definition at line 56 of file mesh_hwmp.c.

#define PREQ_IE_METRIC (   x)    u32_field_get(x, 21, AE_F_SET(x))

Definition at line 57 of file mesh_hwmp.c.

#define PREQ_IE_ORIG_ADDR (   x)    (x + 7)

Definition at line 54 of file mesh_hwmp.c.

#define PREQ_IE_ORIG_SN (   x)    u32_field_get(x, 13, 0)

Definition at line 55 of file mesh_hwmp.c.

#define PREQ_IE_PREQ_ID (   x)    u32_field_get(x, 3, 0)

Definition at line 53 of file mesh_hwmp.c.

#define PREQ_IE_TARGET_ADDR (   x)    (AE_F_SET(x) ? x + 33 : x + 27)

Definition at line 59 of file mesh_hwmp.c.

#define PREQ_IE_TARGET_F (   x)    (*(AE_F_SET(x) ? x + 32 : x + 26))

Definition at line 58 of file mesh_hwmp.c.

#define PREQ_IE_TARGET_SN (   x)    u32_field_get(x, 33, AE_F_SET(x))

Definition at line 60 of file mesh_hwmp.c.

#define PREQ_IE_TTL (   x)    (*(x + 2))

Definition at line 52 of file mesh_hwmp.c.

#define root_path_confirmation_jiffies (   s)    msecs_to_jiffies(sdata->u.mesh.mshcfg.dot11MeshHWMPconfirmationInterval)

Definition at line 92 of file mesh_hwmp.c.

#define SN_GT (   x,
  y 
)    ((s32)(y - x) < 0)

Definition at line 80 of file mesh_hwmp.c.

#define SN_LT (   x,
  y 
)    ((s32)(x - y) < 0)

Definition at line 81 of file mesh_hwmp.c.

#define TEST_FRAME_LEN   8192

Definition at line 16 of file mesh_hwmp.c.

Enumeration Type Documentation

Enumerator:
MPATH_PREQ 
MPATH_PREP 
MPATH_PERR 
MPATH_RANN 

Definition at line 95 of file mesh_hwmp.c.

Function Documentation

void ieee80211s_update_metric ( struct ieee80211_local local,
struct sta_info sta,
struct sk_buff skb 
)

Definition at line 298 of file mesh_hwmp.c.

int mesh_nexthop_lookup ( struct sk_buff skb,
struct ieee80211_sub_if_data sdata 
)

mesh_nexthop_lookup - put the appropriate next hop on a mesh frame. Calling this function is considered "using" the associated mpath, so preempt a path refresh if this mpath expires soon.

: 802.11 frame to be sent : network subif the frame will be sent through

Returns: 0 if the next hop was found. Nonzero otherwise.

Definition at line 1121 of file mesh_hwmp.c.

int mesh_nexthop_resolve ( struct sk_buff skb,
struct ieee80211_sub_if_data sdata 
)

mesh_nexthop_resolve - lookup next hop; conditionally start path discovery

: 802.11 frame to be sent : network subif the frame will be sent through

Lookup next hop for given skb and start path discovery if no forwarding information is found.

Returns: 0 if the next hop was found and -ENOENT if the frame was queued. skb is freeed here if no mpath could be allocated.

Definition at line 1067 of file mesh_hwmp.c.

int mesh_path_error_tx ( u8  ttl,
u8 target,
__le32  target_sn,
__le16  target_rcode,
const u8 ra,
struct ieee80211_sub_if_data sdata 
)

mesh_send_path error - Sends a PERR mesh management frame

: broken destination : SN of the broken destination : reason code for this PERR : node this frame is addressed to

Note: This function may be called with driver locks taken that the driver also acquires in the TX path. To avoid a deadlock we don't transmit the frame directly but add it to the pending queue instead.

Definition at line 233 of file mesh_hwmp.c.

void mesh_path_start_discovery ( struct ieee80211_sub_if_data sdata)

mesh_path_start_discovery - launch a path discovery from the PREQ queue

: local mesh subif

Definition at line 973 of file mesh_hwmp.c.

void mesh_path_timer ( unsigned long  data)

Definition at line 1156 of file mesh_hwmp.c.

void mesh_path_tx_root_frame ( struct ieee80211_sub_if_data sdata)

Definition at line 1190 of file mesh_hwmp.c.

void mesh_rx_path_sel_frame ( struct ieee80211_sub_if_data sdata,
struct ieee80211_mgmt mgmt,
size_t  len 
)

Definition at line 851 of file mesh_hwmp.c.