linux/drivers/net/fddi/skfp/smt.c

// SPDX-License-Identifier: GPL-2.0-or-later
/******************************************************************************
 *
 *	(C)Copyright 1998,1999 SysKonnect,
 *	a business unit of Schneider & Koch & Co. Datensysteme GmbH.
 *
 *	See the file "skfddi.c" for further information.
 *
 *	The information in this file is provided "AS IS" without warranty.
 *
 ******************************************************************************/

#include "h/types.h"
#include "h/fddi.h"
#include "h/smc.h"
#include "h/smt_p.h"
#include <linux/bitrev.h>
#include <linux/kernel.h>

#define KERNEL
#include "h/smtstate.h"

/*
 * FC in SMbuf
 */
#define m_fc(mb)

#define SMT_TID_MAGIC

static const char *const smt_type_name[] = ;

static const char *const smt_class_name[] = ;

#define LAST_CLASS

static const struct fddi_addr SMT_Unknown = ;

/*
 * function prototypes
 */
#ifdef	LITTLE_ENDIAN
static int smt_swap_short(u_short s);
#endif
static int mac_index(struct s_smc *smc, int mac);
static int phy_index(struct s_smc *smc, int phy);
static int mac_con_resource_index(struct s_smc *smc, int mac);
static int phy_con_resource_index(struct s_smc *smc, int phy);
static void smt_send_rdf(struct s_smc *smc, SMbuf *rej, int fc, int reason,
			 int local);
static void smt_send_nif(struct s_smc *smc, const struct fddi_addr *dest, 
			 int fc, u_long tid, int type, int local);
static void smt_send_ecf(struct s_smc *smc, struct fddi_addr *dest, int fc,
                         u_long tid, int type, int len);
static void smt_echo_test(struct s_smc *smc, int dna);
static void smt_send_sif_config(struct s_smc *smc, struct fddi_addr *dest,
				u_long tid, int local);
static void smt_send_sif_operation(struct s_smc *smc, struct fddi_addr *dest,
				   u_long tid, int local);
#ifdef LITTLE_ENDIAN
static void smt_string_swap(char *data, const char *format, int len);
#endif
static void smt_add_frame_len(SMbuf *mb, int len);
static void smt_fill_una(struct s_smc *smc, struct smt_p_una *una);
static void smt_fill_sde(struct s_smc *smc, struct smt_p_sde *sde);
static void smt_fill_state(struct s_smc *smc, struct smt_p_state *state);
static void smt_fill_timestamp(struct s_smc *smc, struct smt_p_timestamp *ts);
static void smt_fill_policy(struct s_smc *smc, struct smt_p_policy *policy);
static void smt_fill_latency(struct s_smc *smc, struct smt_p_latency *latency);
static void smt_fill_neighbor(struct s_smc *smc, struct smt_p_neighbor *neighbor);
static int smt_fill_path(struct s_smc *smc, struct smt_p_path *path);
static void smt_fill_mac_status(struct s_smc *smc, struct smt_p_mac_status *st);
static void smt_fill_lem(struct s_smc *smc, struct smt_p_lem *lem, int phy);
static void smt_fill_version(struct s_smc *smc, struct smt_p_version *vers);
static void smt_fill_fsc(struct s_smc *smc, struct smt_p_fsc *fsc);
static void smt_fill_mac_counter(struct s_smc *smc, struct smt_p_mac_counter *mc);
static void smt_fill_mac_fnc(struct s_smc *smc, struct smt_p_mac_fnc *fnc);
static void smt_fill_manufacturer(struct s_smc *smc, 
				  struct smp_p_manufacturer *man);
static void smt_fill_user(struct s_smc *smc, struct smp_p_user *user);
static void smt_fill_setcount(struct s_smc *smc, struct smt_p_setcount *setcount);
static void smt_fill_echo(struct s_smc *smc, struct smt_p_echo *echo, u_long seed,
			  int len);

static void smt_clear_una_dna(struct s_smc *smc);
static void smt_clear_old_una_dna(struct s_smc *smc);
#ifdef	CONCENTRATOR
static int entity_to_index(void);
#endif
static void update_dac(struct s_smc *smc, int report);
static int div_ratio(u_long upper, u_long lower);
#ifdef  USE_CAN_ADDR
static void	hwm_conv_can(struct s_smc *smc, char *data, int len);
#else
#define hwm_conv_can
#endif


static inline int is_my_addr(const struct s_smc *smc, 
			     const struct fddi_addr *addr)
{}

static inline int is_broadcast(const struct fddi_addr *addr)
{}

static inline int is_individual(const struct fddi_addr *addr)
{}

static inline int is_equal(const struct fddi_addr *addr1, 
			   const struct fddi_addr *addr2)
{}

/*
 * list of mandatory paras in frames
 */
static const u_short plist_nif[] = ;

/*
 * init SMT agent
 */
void smt_agent_init(struct s_smc *smc)
{}

/*
 * SMT task
 * forever
 *	delay 30 seconds
 *	send NIF
 *	check tvu & tvd
 * end
 */
void smt_agent_task(struct s_smc *smc)
{}

#ifndef SMT_REAL_TOKEN_CT
void smt_emulate_token_ct(struct s_smc *smc, int mac_index)
{}
#endif

/*ARGSUSED1*/
void smt_event(struct s_smc *smc, int event)
{}

static int div_ratio(u_long upper, u_long lower)
{}

#ifndef	SLIM_SMT

/*
 * receive packet handler
 */
void smt_received_pack(struct s_smc *smc, SMbuf *mb, int fs)
/* int fs;  frame status */
{}

static void update_dac(struct s_smc *smc, int report)
{}

/*
 * send SMT frame
 *	set source address
 *	set station ID
 *	send frame
 */
void smt_send_frame(struct s_smc *smc, SMbuf *mb, int fc, int local)
/* SMbuf *mb;	buffer to send */
/* int fc;	FC value */
{}

/*
 * generate and send RDF
 */
static void smt_send_rdf(struct s_smc *smc, SMbuf *rej, int fc, int reason,
			 int local)
/* SMbuf *rej;	mbuf of offending frame */
/* int fc;	FC of denied frame */
/* int reason;	reason code */
{}

/*
 * generate and send NIF
 */
static void smt_send_nif(struct s_smc *smc, const struct fddi_addr *dest, 
			 int fc, u_long tid, int type, int local)
/* struct fddi_addr *dest;	dest address */
/* int fc;			frame control */
/* u_long tid;			transaction id */
/* int type;			frame type */
{}

#ifdef	DEBUG
/*
 * send NIF request (test purpose)
 */
static void smt_send_nif_request(struct s_smc *smc, struct fddi_addr *dest)
{
	smc->sm.pend[SMT_TID_NIF_TEST] = smt_get_tid(smc) ;
	smt_send_nif(smc,dest, FC_SMT_INFO, smc->sm.pend[SMT_TID_NIF_TEST],
		SMT_REQUEST,0) ;
}

/*
 * send ECF request (test purpose)
 */
static void smt_send_ecf_request(struct s_smc *smc, struct fddi_addr *dest,
				 int len)
{
	smc->sm.pend[SMT_TID_ECF] = smt_get_tid(smc) ;
	smt_send_ecf(smc,dest, FC_SMT_INFO, smc->sm.pend[SMT_TID_ECF],
		SMT_REQUEST,len) ;
}
#endif

/*
 * echo test
 */
static void smt_echo_test(struct s_smc *smc, int dna)
{}

/*
 * generate and send ECF
 */
static void smt_send_ecf(struct s_smc *smc, struct fddi_addr *dest, int fc,
			 u_long tid, int type, int len)
/* struct fddi_addr *dest;	dest address */
/* int fc;			frame control */
/* u_long tid;			transaction id */
/* int type;			frame type */
/* int len;			frame length */
{}

/*
 * generate and send SIF config response
 */

static void smt_send_sif_config(struct s_smc *smc, struct fddi_addr *dest,
				u_long tid, int local)
/* struct fddi_addr *dest;	dest address */
/* u_long tid;			transaction id */
{}

/*
 * generate and send SIF operation response
 */

static void smt_send_sif_operation(struct s_smc *smc, struct fddi_addr *dest,
				   u_long tid, int local)
/* struct fddi_addr *dest;	dest address */
/* u_long tid;			transaction id */
{}

/*
 * get and initialize SMT frame
 */
SMbuf *smt_build_frame(struct s_smc *smc, int class, int type,
				  int length)
{}

static void smt_add_frame_len(SMbuf *mb, int len)
{}



/*
 * fill values in UNA parameter
 */
static void smt_fill_una(struct s_smc *smc, struct smt_p_una *una)
{}

/*
 * fill values in SDE parameter
 */
static void smt_fill_sde(struct s_smc *smc, struct smt_p_sde *sde)
{}

/*
 * fill in values in station state parameter
 */
static void smt_fill_state(struct s_smc *smc, struct smt_p_state *state)
{}

/*
 * fill values in timestamp parameter
 */
static void smt_fill_timestamp(struct s_smc *smc, struct smt_p_timestamp *ts)
{}

void smt_set_timestamp(struct s_smc *smc, u_char *p)
{}

/*
 * fill values in station policy parameter
 */
static void smt_fill_policy(struct s_smc *smc, struct smt_p_policy *policy)
{}

/*
 * fill values in latency equivalent parameter
 */
static void smt_fill_latency(struct s_smc *smc, struct smt_p_latency *latency)
{}

/*
 * fill values in MAC neighbors parameter
 */
static void smt_fill_neighbor(struct s_smc *smc, struct smt_p_neighbor *neighbor)
{}

/*
 * fill values in path descriptor
 */
#ifdef	CONCENTRATOR
#define ALLPHYS
#else
#define ALLPHYS
#endif

static int smt_fill_path(struct s_smc *smc, struct smt_p_path *path)
{}

/*
 * fill values in mac status
 */
static void smt_fill_mac_status(struct s_smc *smc, struct smt_p_mac_status *st)
{}

/*
 * fill values in LEM status
 */
static void smt_fill_lem(struct s_smc *smc, struct smt_p_lem *lem, int phy)
{}

/*
 * fill version parameter
 */
static void smt_fill_version(struct s_smc *smc, struct smt_p_version *vers)
{}

#ifdef	SMT6_10
/*
 * fill frame status capabilities
 */
/*
 * note: this para 200B is NOT in swap table, because it's also set in
 * PMF add_para
 */
static void smt_fill_fsc(struct s_smc *smc, struct smt_p_fsc *fsc)
{}
#endif

/*
 * fill mac counter field
 */
static void smt_fill_mac_counter(struct s_smc *smc, struct smt_p_mac_counter *mc)
{}

/*
 * fill mac frame not copied counter
 */
static void smt_fill_mac_fnc(struct s_smc *smc, struct smt_p_mac_fnc *fnc)
{}


/*
 * fill manufacturer field
 */
static void smt_fill_manufacturer(struct s_smc *smc, 
				  struct smp_p_manufacturer *man)
{}

/*
 * fill user field
 */
static void smt_fill_user(struct s_smc *smc, struct smp_p_user *user)
{}

/*
 * fill set count
 */
static void smt_fill_setcount(struct s_smc *smc, struct smt_p_setcount *setcount)
{}

/*
 * fill echo data
 */
static void smt_fill_echo(struct s_smc *smc, struct smt_p_echo *echo, u_long seed,
			  int len)
{}

/*
 * clear DNA and UNA
 * called from CFM if configuration changes
 */
static void smt_clear_una_dna(struct s_smc *smc)
{}

static void smt_clear_old_una_dna(struct s_smc *smc)
{}

u_long smt_get_tid(struct s_smc *smc)
{}

#ifdef	LITTLE_ENDIAN
/*
 * table of parameter lengths
 */
static const struct smt_pdef {} smt_pdef[] = ;

#define N_SMT_PLEN
#endif

int smt_check_para(struct s_smc *smc, struct smt_header	*sm,
		   const u_short list[])
{}

void *sm_to_para(struct s_smc *smc, struct smt_header *sm, int para)
{}

#if	0
/*
 * send ANTC data test frame
 */
void fddi_send_antc(struct s_smc *smc, struct fddi_addr *dest)
{
	SK_UNUSED(smc) ;
	SK_UNUSED(dest) ;
#if	0
	SMbuf			*mb ;
	struct smt_header	*smt ;
	int			i ;
	char			*p ;

	mb = smt_get_mbuf() ;
	mb->sm_len = 3000+12 ;
	p = smtod(mb, char *) + 12 ;
	for (i = 0 ; i < 3000 ; i++)
		*p++ = 1 << (i&7) ;

	smt = smtod(mb, struct smt_header *) ;
	smt->smt_dest = *dest ;
	smt->smt_source = smc->mib.m[MAC0].fddiMACSMTAddress ;
	smt_send_mbuf(smc,mb,FC_ASYNC_LLC) ;
#endif
}
#endif

/*
 * return static mac index
 */
static int mac_index(struct s_smc *smc, int mac)
{}

/*
 * return static phy index
 */
static int phy_index(struct s_smc *smc, int phy)
{}

/*
 * return dynamic mac connection resource index
 */
static int mac_con_resource_index(struct s_smc *smc, int mac)
{}

/*
 * return dynamic phy connection resource index
 */
static int phy_con_resource_index(struct s_smc *smc, int phy)
{}

#ifdef	CONCENTRATOR
static int entity_to_index(struct s_smc *smc, int e)
{
	if (e == ENTITY_MAC)
		return mac_index(smc, 1);
	else
		return phy_index(smc, e - ENTITY_PHY(0));
}
#endif

#ifdef	LITTLE_ENDIAN
static int smt_swap_short(u_short s)
{}

void smt_swap_para(struct smt_header *sm, int len, int direction)
/* int direction;	0 encode 1 decode */
{}


static void smt_string_swap(char *data, const char *format, int len)
{}
#else
void smt_swap_para(struct smt_header *sm, int len, int direction)
/* int direction;	0 encode 1 decode */
{
	SK_UNUSED(sm) ;
	SK_UNUSED(len) ;
	SK_UNUSED(direction) ;
}
#endif

/*
 * PMF actions
 */
int smt_action(struct s_smc *smc, int class, int code, int index)
{}

/*
 * canonical conversion of <len> bytes beginning form *data
 */
#ifdef  USE_CAN_ADDR
static void hwm_conv_can(struct s_smc *smc, char *data, int len)
{}
#endif

#endif	/* no SLIM_SMT */