linux/net/hsr/hsr_main.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright 2011-2014 Autronica Fire and Security AS
 *
 * Author(s):
 *	2011-2014 Arvid Brodin, [email protected]
 *
 * include file for HSR and PRP.
 */

#ifndef __HSR_PRIVATE_H
#define __HSR_PRIVATE_H

#include <linux/netdevice.h>
#include <linux/list.h>
#include <linux/if_vlan.h>
#include <linux/if_hsr.h>

/* Time constants as specified in the HSR specification (IEC-62439-3 2010)
 * Table 8.
 * All values in milliseconds.
 */
#define HSR_LIFE_CHECK_INTERVAL
#define HSR_NODE_FORGET_TIME
#define HSR_PROXY_NODE_FORGET_TIME
#define HSR_ANNOUNCE_INTERVAL
#define HSR_ENTRY_FORGET_TIME

/* By how much may slave1 and slave2 timestamps of latest received frame from
 * each node differ before we notify of communication problem?
 */
#define MAX_SLAVE_DIFF
#define HSR_SEQNR_START
#define HSR_SUP_SEQNR_START

/* How often shall we check for broken ring and remove node entries older than
 * HSR_NODE_FORGET_TIME?
 */
#define PRUNE_PERIOD
#define PRUNE_PROXY_PERIOD
#define HSR_TLV_EOT
#define HSR_TLV_ANNOUNCE
#define HSR_TLV_LIFE_CHECK
/* PRP V1 life check for Duplicate discard */
#define PRP_TLV_LIFE_CHECK_DD
/* PRP V1 life check for Duplicate Accept */
#define PRP_TLV_LIFE_CHECK_DA
/* PRP V1 life redundancy box MAC address */
#define PRP_TLV_REDBOX_MAC

#define HSR_V1_SUP_LSDUSIZE

/* The helper functions below assumes that 'path' occupies the 4 most
 * significant bits of the 16-bit field shared by 'path' and 'LSDU_size' (or
 * equivalently, the 4 most significant bits of HSR tag byte 14).
 *
 * This is unclear in the IEC specification; its definition of MAC addresses
 * indicates the spec is written with the least significant bit first (to the
 * left). This, however, would mean that the LSDU field would be split in two
 * with the path field in-between, which seems strange. I'm guessing the MAC
 * address definition is in error.
 */

static inline void set_hsr_tag_path(struct hsr_tag *ht, u16 path)
{}

static inline void set_hsr_tag_LSDU_size(struct hsr_tag *ht, u16 LSDU_size)
{}

struct hsr_ethhdr {} __packed;

struct hsr_vlan_ethhdr {} __packed;

struct hsr_sup_tlv {} __packed;

/* HSR/PRP Supervision Frame data types.
 * Field names as defined in the IEC:2010 standard for HSR.
 */
struct hsr_sup_tag {} __packed;

struct hsr_sup_payload {} __packed;

static inline void set_hsr_stag_path(struct hsr_sup_tag *hst, u16 path)
{}

static inline void set_hsr_stag_HSR_ver(struct hsr_sup_tag *hst, u16 HSR_ver)
{}

struct hsrv0_ethhdr_sp {} __packed;

struct hsrv1_ethhdr_sp {} __packed;

enum hsr_port_type {};

/* PRP Redunancy Control Trailor (RCT).
 * As defined in IEC-62439-4:2012, the PRP RCT is really { sequence Nr,
 * Lan indentifier (LanId), LSDU_size and PRP_suffix = 0x88FB }.
 *
 * Field names as defined in the IEC:2012 standard for PRP.
 */
struct prp_rct {} __packed;

static inline u16 get_prp_LSDU_size(struct prp_rct *rct)
{}

static inline void set_prp_lan_id(struct prp_rct *rct, u16 lan_id)
{}
static inline void set_prp_LSDU_size(struct prp_rct *rct, u16 LSDU_size)
{}

struct hsr_port {};

struct hsr_frame_info;
struct hsr_node;

struct hsr_proto_ops {};

struct hsr_self_node {};

struct hsr_priv {};

#define hsr_for_each_port(hsr, port)

struct hsr_port *hsr_port_get_hsr(struct hsr_priv *hsr, enum hsr_port_type pt);

/* Caller must ensure skb is a valid HSR frame */
static inline u16 hsr_get_skb_sequence_nr(struct sk_buff *skb)
{}

static inline struct prp_rct *skb_get_PRP_rct(struct sk_buff *skb)
{}

/* Assume caller has confirmed this skb is PRP suffixed */
static inline u16 prp_get_skb_sequence_nr(struct prp_rct *rct)
{}

/* assume there is a valid rct */
static inline bool prp_check_lsdu_size(struct sk_buff *skb,
				       struct prp_rct *rct,
				       bool is_sup)
{}

#if IS_ENABLED(CONFIG_DEBUG_FS)
void hsr_debugfs_rename(struct net_device *dev);
void hsr_debugfs_init(struct hsr_priv *priv, struct net_device *hsr_dev);
void hsr_debugfs_term(struct hsr_priv *priv);
void hsr_debugfs_create_root(void);
void hsr_debugfs_remove_root(void);
#else
static inline void hsr_debugfs_rename(struct net_device *dev)
{
}
static inline void hsr_debugfs_init(struct hsr_priv *priv,
				    struct net_device *hsr_dev)
{}
static inline void hsr_debugfs_term(struct hsr_priv *priv)
{}
static inline void hsr_debugfs_create_root(void)
{}
static inline void hsr_debugfs_remove_root(void)
{}
#endif

#endif /*  __HSR_PRIVATE_H */