linux/net/mac80211/mesh_hwmp.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2008, 2009 open80211s Ltd.
 * Copyright (C) 2019, 2021-2023 Intel Corporation
 * Author:     Luis Carlos Cobo <[email protected]>
 */

#include <linux/slab.h>
#include <linux/etherdevice.h>
#include <asm/unaligned.h>
#include "wme.h"
#include "mesh.h"

#define TEST_FRAME_LEN
#define MAX_METRIC
#define ARITH_SHIFT
#define LINK_FAIL_THRESH

#define MAX_PREQ_QUEUE_LEN

static void mesh_queue_preq(struct mesh_path *, u8);

static inline u32 u32_field_get(const u8 *preq_elem, int offset, bool ae)
{}

static inline u16 u16_field_get(const u8 *preq_elem, int offset, bool ae)
{}

/* HWMP IE processing macros */
#define AE_F
#define AE_F_SET(x)
#define PREQ_IE_FLAGS(x)
#define PREQ_IE_HOPCOUNT(x)
#define PREQ_IE_TTL(x)
#define PREQ_IE_PREQ_ID(x)
#define PREQ_IE_ORIG_ADDR(x)
#define PREQ_IE_ORIG_SN(x)
#define PREQ_IE_LIFETIME(x)
#define PREQ_IE_METRIC(x)
#define PREQ_IE_TARGET_F(x)
#define PREQ_IE_TARGET_ADDR(x)
#define PREQ_IE_TARGET_SN(x)


#define PREP_IE_FLAGS(x)
#define PREP_IE_HOPCOUNT(x)
#define PREP_IE_TTL(x)
#define PREP_IE_ORIG_ADDR(x)
#define PREP_IE_ORIG_SN(x)
#define PREP_IE_LIFETIME(x)
#define PREP_IE_METRIC(x)
#define PREP_IE_TARGET_ADDR(x)
#define PREP_IE_TARGET_SN(x)

#define PERR_IE_TTL(x)
#define PERR_IE_TARGET_FLAGS(x)
#define PERR_IE_TARGET_ADDR(x)
#define PERR_IE_TARGET_SN(x)
#define PERR_IE_TARGET_RCODE(x)

#define MSEC_TO_TU(x)
#define SN_GT(x, y)
#define SN_LT(x, y)
#define MAX_SANE_SN_DELTA

static inline u32 SN_DELTA(u32 x, u32 y)
{}

#define net_traversal_jiffies(s)
#define default_lifetime(s)
#define min_preq_int_jiff(s)
#define max_preq_retries(s)
#define disc_timeout_jiff(s)
#define root_path_confirmation_jiffies(s)

enum mpath_frame_type {};

static const u8 broadcast_addr[ETH_ALEN] =;

static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
				  const u8 *orig_addr, u32 orig_sn,
				  u8 target_flags, const u8 *target,
				  u32 target_sn, const u8 *da,
				  u8 hop_count, u8 ttl,
				  u32 lifetime, u32 metric, u32 preq_id,
				  struct ieee80211_sub_if_data *sdata)
{}


/*  Headroom is not adjusted.  Caller should ensure that skb has sufficient
 *  headroom in case the frame is encrypted. */
static void prepare_frame_for_deferred_tx(struct ieee80211_sub_if_data *sdata,
		struct sk_buff *skb)
{}

/**
 * mesh_path_error_tx - Sends a PERR mesh management frame
 *
 * @ttl: allowed remaining hops
 * @target: broken destination
 * @target_sn: SN of the broken destination
 * @target_rcode: reason code for this PERR
 * @ra: node this frame is addressed to
 * @sdata: local mesh subif
 *
 * 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.
 *
 * Returns: 0 on success
 */
int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata,
		       u8 ttl, const u8 *target, u32 target_sn,
		       u16 target_rcode, const u8 *ra)
{}

void ieee80211s_update_metric(struct ieee80211_local *local,
			      struct sta_info *sta,
			      struct ieee80211_tx_status *st)
{}

u32 airtime_link_metric_get(struct ieee80211_local *local,
			    struct sta_info *sta)
{}

/**
 * hwmp_route_info_get - Update routing info to originator and transmitter
 *
 * @sdata: local mesh subif
 * @mgmt: mesh management frame
 * @hwmp_ie: hwmp information element (PREP or PREQ)
 * @action: type of hwmp ie
 *
 * This function updates the path routing information to the originator and the
 * transmitter of a HWMP PREQ or PREP frame.
 *
 * Returns: metric to frame originator or 0 if the frame should not be further
 * processed
 *
 * Notes: this function is the only place (besides user-provided info) where
 * path routing information is updated.
 */
static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
			       struct ieee80211_mgmt *mgmt,
			       const u8 *hwmp_ie, enum mpath_frame_type action)
{}

static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
				    struct ieee80211_mgmt *mgmt,
				    const u8 *preq_elem, u32 orig_metric)
{}


static inline struct sta_info *
next_hop_deref_protected(struct mesh_path *mpath)
{}


static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
				    struct ieee80211_mgmt *mgmt,
				    const u8 *prep_elem, u32 metric)
{}

static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata,
				    struct ieee80211_mgmt *mgmt,
				    const u8 *perr_elem)
{}

static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
				    struct ieee80211_mgmt *mgmt,
				    const struct ieee80211_rann_ie *rann)
{}


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

/**
 * mesh_queue_preq - queue a PREQ to a given destination
 *
 * @mpath: mesh path to discover
 * @flags: special attributes of the PREQ to be sent
 *
 * Locking: the function must be called from within a rcu read lock block.
 *
 */
static void mesh_queue_preq(struct mesh_path *mpath, u8 flags)
{}

/**
 * mesh_path_start_discovery - launch a path discovery from the PREQ queue
 *
 * @sdata: local mesh subif
 */
void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata)
{}

/**
 * mesh_nexthop_resolve - lookup next hop; conditionally start path discovery
 *
 * @skb: 802.11 frame to be sent
 * @sdata: 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 freed here if no mpath could be allocated.
 */
int mesh_nexthop_resolve(struct ieee80211_sub_if_data *sdata,
			 struct sk_buff *skb)
{}

/**
 * mesh_nexthop_lookup_nolearn - try to set next hop without path discovery
 * @skb: 802.11 frame to be sent
 * @sdata: network subif the frame will be sent through
 *
 * Check if the meshDA (addr3) of a unicast frame is a direct neighbor.
 * And if so, set the RA (addr1) to it to transmit to this node directly,
 * avoiding PREQ/PREP path discovery.
 *
 * Returns: 0 if the next hop was found and -ENOENT otherwise.
 */
static int mesh_nexthop_lookup_nolearn(struct ieee80211_sub_if_data *sdata,
				       struct sk_buff *skb)
{}

void mesh_path_refresh(struct ieee80211_sub_if_data *sdata,
		       struct mesh_path *mpath, const u8 *addr)
{}

/**
 * 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.
 *
 * @skb: 802.11 frame to be sent
 * @sdata: network subif the frame will be sent through
 *
 * Returns: 0 if the next hop was found. Nonzero otherwise.
 */
int mesh_nexthop_lookup(struct ieee80211_sub_if_data *sdata,
			struct sk_buff *skb)
{}

void mesh_path_timer(struct timer_list *t)
{}

void mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata)
{}