Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *	(C)Copyright 1998,1999 SysKonnect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *	a business unit of Schneider & Koch & Co. Datensysteme GmbH.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *	See the file "skfddi.c" for further information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *	The information in this file is provided "AS IS" without warranty.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * *******************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * This SBA code implements the Synchronous Bandwidth Allocation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * functions described in the "FDDI Synchronous Forum Implementer's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * Agreement" dated December 1th, 1993.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * *******************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *	PURPOSE: The purpose of this function is to control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *		 synchronous allocations on a single FDDI segment.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *		 Allocations are limited to the primary FDDI ring.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *		 The SBM provides recovery mechanisms to recover
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *		 unused bandwidth also resolves T_Neg and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *		 reconfiguration changes. Many of the SBM state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *		 machine inputs are sourced by the underlying
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  *		 FDDI sub-system supporting the SBA application.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * *******************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include "h/types.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include "h/fddi.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include "h/smc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include "h/smt_p.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #ifndef	SLIM_SMT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #ifdef ESS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #ifndef lint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) static const char ID_sccs[] = "@(#)ess.c	1.10 96/02/23 (C) SK" ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define LINT_USE(x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define LINT_USE(x)	(x)=(x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #define MS2BCLK(x)	((x)*12500L)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	-------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	LOCAL VARIABLES:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	-------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) static const u_short plist_raf_alc_res[] = { SMT_P0012, SMT_P320B, SMT_P320F,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 					SMT_P3210, SMT_P0019, SMT_P001A,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 					SMT_P001D, 0 } ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) static const u_short plist_raf_chg_req[] = { SMT_P320B, SMT_P320F, SMT_P3210,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 					SMT_P001A, 0 } ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) static const struct fddi_addr smt_sba_da = {{0x80,0x01,0x43,0x00,0x80,0x0C}} ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) static const struct fddi_addr null_addr = {{0,0,0,0,0,0}} ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	-------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	GLOBAL VARIABLES:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	-------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	-------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	LOCAL FUNCTIONS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	-------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) static void ess_send_response(struct s_smc *smc, struct smt_header *sm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 			      int sba_cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) static void ess_config_fifo(struct s_smc *smc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) static void ess_send_alc_req(struct s_smc *smc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) static void ess_send_frame(struct s_smc *smc, SMbuf *mb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	-------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	EXTERNAL FUNCTIONS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	-------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	-------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	PUBLIC FUNCTIONS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	-------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) void ess_timer_poll(struct s_smc *smc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) void ess_para_change(struct s_smc *smc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) int ess_raf_received_pack(struct s_smc *smc, SMbuf *mb, struct smt_header *sm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 			  int fs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) static int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)  * --------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  *	End Station Support	(ESS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)  * --------------------------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)  * evaluate the RAF frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) int ess_raf_received_pack(struct s_smc *smc, SMbuf *mb, struct smt_header *sm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 			  int fs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	void			*p ;		/* universal pointer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	struct smt_p_0016	*cmd ;		/* para: command for the ESS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	SMbuf			*db ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	u_long			msg_res_type ;	/* recource type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	u_long			payload, overhead ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	int			local ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	int			i ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	 * Message Processing Code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	 local = ((fs & L_INDICATOR) != 0) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	 * get the resource type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	if (!(p = (void *) sm_to_para(smc,sm,SMT_P0015))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		DB_ESS("ESS: RAF frame error, parameter type not found");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	msg_res_type = ((struct smt_p_0015 *)p)->res_type ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	 * get the pointer to the ESS command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	if (!(cmd = (struct smt_p_0016 *) sm_to_para(smc,sm,SMT_P0016))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		 * error in frame: para ESS command was not found
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		 DB_ESS("ESS: RAF frame error, parameter command not found");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		 return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	DB_ESSN(2, "fc %x	ft %x", sm->smt_class, sm->smt_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	DB_ESSN(2, "ver %x	tran %x", sm->smt_version, sm->smt_tid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	DB_ESSN(2, "stn_id %pM", &sm->smt_source);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	DB_ESSN(2, "infolen %x	res %lx", sm->smt_len, msg_res_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	DB_ESSN(2, "sbacmd %x", cmd->sba_cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	 * evaluate the ESS command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	switch (cmd->sba_cmd) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	 * Process an ESS Allocation Request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	case REQUEST_ALLOCATION :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 		 * check for an RAF Request (Allocation Request)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		if (sm->smt_type == SMT_REQUEST) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 			 * process the Allocation request only if the frame is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 			 * local and no static allocation is used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 			if (!local || smc->mib.fddiESSPayload)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 				return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 			
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 			p = (void *) sm_to_para(smc,sm,SMT_P0019)  ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 			for (i = 0; i < 5; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 				if (((struct smt_p_0019 *)p)->alloc_addr.a[i]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 					return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 			 * Note: The Application should send a LAN_LOC_FRAME.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 			 *	 The ESS do not send the Frame to the network!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 			smc->ess.alloc_trans_id = sm->smt_tid ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 			DB_ESS("ESS: save Alloc Req Trans ID %x", sm->smt_tid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 			p = (void *) sm_to_para(smc,sm,SMT_P320F) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 			((struct smt_p_320f *)p)->mib_payload =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 				smc->mib.a[PATH0].fddiPATHSbaPayload ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 			p = (void *) sm_to_para(smc,sm,SMT_P3210) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 			((struct smt_p_3210 *)p)->mib_overhead =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 				smc->mib.a[PATH0].fddiPATHSbaOverhead ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 			sm->smt_dest = smt_sba_da ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 			if (smc->ess.local_sba_active)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 				return fs | I_INDICATOR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 			if (!(db = smt_get_mbuf(smc)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 				return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 			db->sm_len = mb->sm_len ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 			db->sm_off = mb->sm_off ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 			memcpy(((char *)(db->sm_data+db->sm_off)),(char *)sm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 				(int)db->sm_len) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 			dump_smt(smc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 				(struct smt_header *)(db->sm_data+db->sm_off),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 				"RAF") ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 			smt_send_frame(smc,db,FC_SMT_INFO,0) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 			return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		 * The RAF frame is an Allocation Response !
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		 * check the parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		if (smt_check_para(smc,sm,plist_raf_alc_res)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 			DB_ESS("ESS: RAF with para problem, ignoring");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 			return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		 * VERIFY THE FRAME IS WELL BUILT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 		 *	1. path index = primary ring only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		 *	2. resource type = sync bw only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 		 *	3. trans action id = alloc_trans_id
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 		 *	4. reason code = success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		 * If any are violated, discard the RAF frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		if ((((struct smt_p_320b *)sm_to_para(smc,sm,SMT_P320B))->path_index
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			!= PRIMARY_RING) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 			(msg_res_type != SYNC_BW) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 		(((struct smt_p_reason *)sm_to_para(smc,sm,SMT_P0012))->rdf_reason
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 			!= SMT_RDF_SUCCESS) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 			(sm->smt_tid != smc->ess.alloc_trans_id)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 			DB_ESS("ESS: Allocation Response not accepted");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 			return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 		 * Extract message parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 		p = (void *) sm_to_para(smc,sm,SMT_P320F) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)                 if (!p) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)                         printk(KERN_ERR "ESS: sm_to_para failed");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)                         return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)                 }       
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 		payload = ((struct smt_p_320f *)p)->mib_payload ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 		p = (void *) sm_to_para(smc,sm,SMT_P3210) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)                 if (!p) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)                         printk(KERN_ERR "ESS: sm_to_para failed");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)                         return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)                 }       
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 		overhead = ((struct smt_p_3210 *)p)->mib_overhead ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 		DB_ESSN(2, "payload= %lx	overhead= %lx",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 			payload, overhead);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 		 * process the bandwidth allocation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 		(void)process_bw_alloc(smc,(long)payload,(long)overhead) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 		return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 		/* end of Process Allocation Request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	 * Process an ESS Change Request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	case CHANGE_ALLOCATION :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		 * except only replies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 		if (sm->smt_type != SMT_REQUEST) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 			DB_ESS("ESS: Do not process Change Responses");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 			return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 		 * check the para for the Change Request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 		if (smt_check_para(smc,sm,plist_raf_chg_req)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 			DB_ESS("ESS: RAF with para problem, ignoring");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 			return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 		 * Verify the path index and resource
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 		 * type are correct. If any of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 		 * these are false, don't process this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 		 * change request frame.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 		if ((((struct smt_p_320b *)sm_to_para(smc,sm,SMT_P320B))->path_index
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 			!= PRIMARY_RING) || (msg_res_type != SYNC_BW)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 			DB_ESS("ESS: RAF frame with para problem, ignoring");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 			return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 		 * Extract message queue parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 		p = (void *) sm_to_para(smc,sm,SMT_P320F) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 		payload = ((struct smt_p_320f *)p)->mib_payload ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 		p = (void *) sm_to_para(smc,sm,SMT_P3210) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 		overhead = ((struct smt_p_3210 *)p)->mib_overhead ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 		DB_ESSN(2, "ESS: Change Request from %pM",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 			&sm->smt_source);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 		DB_ESSN(2, "payload= %lx	overhead= %lx",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 			payload, overhead);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 		 * process the bandwidth allocation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 		if(!process_bw_alloc(smc,(long)payload,(long)overhead))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 			return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 		 * send an RAF Change Reply
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 		ess_send_response(smc,sm,CHANGE_ALLOCATION) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 		return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 		/* end of Process Change Request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	 * Process Report Response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	case REPORT_ALLOCATION :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 		 * except only requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 		if (sm->smt_type != SMT_REQUEST) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 			DB_ESS("ESS: Do not process a Report Reply");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 			return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 		DB_ESSN(2, "ESS: Report Request from %pM",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 			&sm->smt_source);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 		 * verify that the resource type is sync bw only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 		if (msg_res_type != SYNC_BW) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 			DB_ESS("ESS: ignoring RAF with para problem");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 			return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 		 * send an RAF Change Reply
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 		ess_send_response(smc,sm,REPORT_ALLOCATION) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 		return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 		/* end of Process Report Request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 		 * error in frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 		DB_ESS("ESS: ignoring RAF with bad sba_cmd");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 		break ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 	return fs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)  * determines the synchronous bandwidth, set the TSYNC register and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)  * mib variables SBAPayload, SBAOverhead and fddiMACT-NEG.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) static int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	 * determine the synchronous bandwidth (sync_bw) in bytes per T-NEG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	 * if the payload is greater than zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	 * For the SBAPayload and the SBAOverhead we have the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	 * unite quations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)  	 *		      _		  _
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	 *		     |	     bytes |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	 *	SBAPayload = | 8000 ------ |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	 *		     |		s  |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	 *		      -		  -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)  	 *		       _       _
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	 *		      |	 bytes	|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	 *	SBAOverhead = | ------	|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	 *		      |	 T-NEG	|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	 *		       -       -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)  	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	 * T-NEG is described by the equation:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	 *		     (-) fddiMACT-NEG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	 *	T-NEG =	    -------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 	 *			12500000 1/s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	 * The number of bytes we are able to send is the payload
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	 * plus the overhead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	 *			  bytes    T-NEG SBAPayload 8000 bytes/s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	 * sync_bw =  SBAOverhead ------ + -----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 	 *	   		  T-NEG		T-NEG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	 *	      		     1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	 * sync_bw =  SBAOverhead + ---- (-)fddiMACT-NEG * SBAPayload
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 	 *	       		    1562
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 	 * set the mib attributes fddiPATHSbaOverhead, fddiPATHSbaPayload
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) /*	if (smt_set_obj(smc,SMT_P320F,payload,S_SET)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 		DB_ESS("ESS: SMT does not accept the payload value");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 		return FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 	if (smt_set_obj(smc,SMT_P3210,overhead,S_SET)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 		DB_ESS("ESS: SMT does not accept the overhead value");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 		return FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 	} */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	/* premliminary */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 	if (payload > MAX_PAYLOAD || overhead > 5000) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 		DB_ESS("ESS: payload / overhead not accepted");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 		return FALSE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 	 * start the iterative allocation process if the payload or the overhead
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 	 * are smaller than the parsed values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 	if (smc->mib.fddiESSPayload &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 		((u_long)payload != smc->mib.fddiESSPayload ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 		(u_long)overhead != smc->mib.fddiESSOverhead)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 		smc->ess.raf_act_timer_poll = TRUE ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 		smc->ess.timer_count = 0 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 	 * evulate the Payload
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 	if (payload) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 		DB_ESSN(2, "ESS: turn SMT_ST_SYNC_SERVICE bit on");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 		smc->ess.sync_bw_available = TRUE ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 		smc->ess.sync_bw = overhead -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 			(long)smc->mib.m[MAC0].fddiMACT_Neg *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 			payload / 1562 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 	else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 		DB_ESSN(2, "ESS: turn SMT_ST_SYNC_SERVICE bit off");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 		smc->ess.sync_bw_available = FALSE ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 		smc->ess.sync_bw = 0 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 		overhead = 0 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 	smc->mib.a[PATH0].fddiPATHSbaPayload = payload ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) 	smc->mib.a[PATH0].fddiPATHSbaOverhead = overhead ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 	DB_ESSN(2, "tsync = %lx", smc->ess.sync_bw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 	ess_config_fifo(smc) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 	set_formac_tsync(smc,smc->ess.sync_bw) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 	return TRUE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) static void ess_send_response(struct s_smc *smc, struct smt_header *sm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 			      int sba_cmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 	struct smt_sba_chg	*chg ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 	SMbuf			*mb ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) 	void			*p ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) 	 * get and initialize the response frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) 	if (sba_cmd == CHANGE_ALLOCATION) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 		if (!(mb=smt_build_frame(smc,SMT_RAF,SMT_REPLY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) 				sizeof(struct smt_sba_chg))))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) 				return ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) 	else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) 		if (!(mb=smt_build_frame(smc,SMT_RAF,SMT_REPLY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 				sizeof(struct smt_sba_rep_res))))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) 				return ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) 	chg = smtod(mb,struct smt_sba_chg *) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) 	chg->smt.smt_tid = sm->smt_tid ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) 	chg->smt.smt_dest = sm->smt_source ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 	/* set P15 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) 	chg->s_type.para.p_type = SMT_P0015 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) 	chg->s_type.para.p_len = sizeof(struct smt_p_0015) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) 	chg->s_type.res_type = SYNC_BW ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) 	/* set P16 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 	chg->cmd.para.p_type = SMT_P0016 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) 	chg->cmd.para.p_len = sizeof(struct smt_p_0016) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) 	chg->cmd.sba_cmd = sba_cmd ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) 	/* set P320B */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) 	chg->path.para.p_type = SMT_P320B ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 	chg->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) 	chg->path.mib_index = SBAPATHINDEX ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) 	chg->path.path_pad = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) 	chg->path.path_index = PRIMARY_RING ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) 	/* set P320F */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 	chg->payload.para.p_type = SMT_P320F ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) 	chg->payload.para.p_len = sizeof(struct smt_p_320f) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) 	chg->payload.mib_index = SBAPATHINDEX ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) 	chg->payload.mib_payload = smc->mib.a[PATH0].fddiPATHSbaPayload ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 	/* set P3210 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) 	chg->overhead.para.p_type = SMT_P3210 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) 	chg->overhead.para.p_len = sizeof(struct smt_p_3210) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 	chg->overhead.mib_index = SBAPATHINDEX ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) 	chg->overhead.mib_overhead = smc->mib.a[PATH0].fddiPATHSbaOverhead ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 	if (sba_cmd == CHANGE_ALLOCATION) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) 		/* set P1A */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) 		chg->cat.para.p_type = SMT_P001A ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) 		chg->cat.para.p_len = sizeof(struct smt_p_001a) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) 		p = (void *) sm_to_para(smc,sm,SMT_P001A) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) 		chg->cat.category = ((struct smt_p_001a *)p)->category ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) 	dump_smt(smc,(struct smt_header *)chg,"RAF") ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) 	ess_send_frame(smc,mb) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) void ess_timer_poll(struct s_smc *smc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) 	if (!smc->ess.raf_act_timer_poll)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 		return ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) 	DB_ESSN(2, "ESS: timer_poll");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) 	smc->ess.timer_count++ ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) 	if (smc->ess.timer_count == 10) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) 		smc->ess.timer_count = 0 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) 		ess_send_alc_req(smc) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) static void ess_send_alc_req(struct s_smc *smc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) 	struct smt_sba_alc_req *req ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) 	SMbuf	*mb ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) 	 * send never allocation request where the requested payload and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) 	 * overhead is zero or deallocate bandwidth when no bandwidth is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) 	 * parsed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) 	if (!smc->mib.fddiESSPayload) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) 		smc->mib.fddiESSOverhead = 0 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) 	else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) 		if (!smc->mib.fddiESSOverhead)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) 			smc->mib.fddiESSOverhead = DEFAULT_OV ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) 	if (smc->mib.fddiESSOverhead ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) 		smc->mib.a[PATH0].fddiPATHSbaOverhead &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) 		smc->mib.fddiESSPayload ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) 		smc->mib.a[PATH0].fddiPATHSbaPayload){
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) 		smc->ess.raf_act_timer_poll = FALSE ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) 		smc->ess.timer_count = 7 ;	/* next RAF alc req after 3 s */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) 		return ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) 	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) 	 * get and initialize the response frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) 	if (!(mb=smt_build_frame(smc,SMT_RAF,SMT_REQUEST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) 			sizeof(struct smt_sba_alc_req))))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) 			return ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) 	req = smtod(mb,struct smt_sba_alc_req *) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) 	req->smt.smt_tid = smc->ess.alloc_trans_id = smt_get_tid(smc) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) 	req->smt.smt_dest = smt_sba_da ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) 	/* set P15 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) 	req->s_type.para.p_type = SMT_P0015 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) 	req->s_type.para.p_len = sizeof(struct smt_p_0015) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) 	req->s_type.res_type = SYNC_BW ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) 	/* set P16 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) 	req->cmd.para.p_type = SMT_P0016 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) 	req->cmd.para.p_len = sizeof(struct smt_p_0016) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) 	req->cmd.sba_cmd = REQUEST_ALLOCATION ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) 	 * set the parameter type and parameter length of all used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) 	 * parameters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) 	/* set P320B */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) 	req->path.para.p_type = SMT_P320B ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) 	req->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) 	req->path.mib_index = SBAPATHINDEX ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) 	req->path.path_pad = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) 	req->path.path_index = PRIMARY_RING ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) 	/* set P0017 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) 	req->pl_req.para.p_type = SMT_P0017 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) 	req->pl_req.para.p_len = sizeof(struct smt_p_0017) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) 	req->pl_req.sba_pl_req = smc->mib.fddiESSPayload -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) 		smc->mib.a[PATH0].fddiPATHSbaPayload ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) 	/* set P0018 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) 	req->ov_req.para.p_type = SMT_P0018 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) 	req->ov_req.para.p_len = sizeof(struct smt_p_0018) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) 	req->ov_req.sba_ov_req = smc->mib.fddiESSOverhead -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) 		smc->mib.a[PATH0].fddiPATHSbaOverhead ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) 	/* set P320F */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) 	req->payload.para.p_type = SMT_P320F ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) 	req->payload.para.p_len = sizeof(struct smt_p_320f) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) 	req->payload.mib_index = SBAPATHINDEX ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) 	req->payload.mib_payload = smc->mib.a[PATH0].fddiPATHSbaPayload ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) 	/* set P3210 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) 	req->overhead.para.p_type = SMT_P3210 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) 	req->overhead.para.p_len = sizeof(struct smt_p_3210) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) 	req->overhead.mib_index = SBAPATHINDEX ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) 	req->overhead.mib_overhead = smc->mib.a[PATH0].fddiPATHSbaOverhead ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) 	/* set P19 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) 	req->a_addr.para.p_type = SMT_P0019 ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) 	req->a_addr.para.p_len = sizeof(struct smt_p_0019) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) 	req->a_addr.sba_pad = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) 	req->a_addr.alloc_addr = null_addr ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) 	/* set P1A */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) 	req->cat.para.p_type = SMT_P001A ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) 	req->cat.para.p_len = sizeof(struct smt_p_001a) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) 	req->cat.category = smc->mib.fddiESSCategory ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) 	/* set P1B */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) 	req->tneg.para.p_type = SMT_P001B ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) 	req->tneg.para.p_len = sizeof(struct smt_p_001b) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) 	req->tneg.max_t_neg = smc->mib.fddiESSMaxTNeg ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) 	/* set P1C */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) 	req->segm.para.p_type = SMT_P001C ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) 	req->segm.para.p_len = sizeof(struct smt_p_001c) - PARA_LEN ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) 	req->segm.min_seg_siz = smc->mib.fddiESSMinSegmentSize ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) 	dump_smt(smc,(struct smt_header *)req,"RAF") ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) 	ess_send_frame(smc,mb) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) static void ess_send_frame(struct s_smc *smc, SMbuf *mb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) 	 * check if the frame must be send to the own ESS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) 	if (smc->ess.local_sba_active) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) 		 * Send the Change Reply to the local SBA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) 		DB_ESS("ESS:Send to the local SBA");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) 		if (!smc->ess.sba_reply_pend)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) 			smc->ess.sba_reply_pend = mb ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) 		else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) 			DB_ESS("Frame is lost - another frame was pending");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) 			smt_free_mbuf(smc,mb) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) 	else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) 		 * Send the SBA RAF Change Reply to the network
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) 		DB_ESS("ESS:Send to the network");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) 		smt_send_frame(smc,mb,FC_SMT_INFO,0) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) void ess_para_change(struct s_smc *smc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) 	(void)process_bw_alloc(smc,(long)smc->mib.a[PATH0].fddiPATHSbaPayload,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) 		(long)smc->mib.a[PATH0].fddiPATHSbaOverhead) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) static void ess_config_fifo(struct s_smc *smc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) 	 * if nothing to do exit 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) 	if (smc->mib.a[PATH0].fddiPATHSbaPayload) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) 		if (smc->hw.fp.fifo.fifo_config_mode & SYNC_TRAFFIC_ON &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) 			(smc->hw.fp.fifo.fifo_config_mode&SEND_ASYNC_AS_SYNC) ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) 			smc->mib.fddiESSSynchTxMode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) 			return ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) 	else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) 		if (!(smc->hw.fp.fifo.fifo_config_mode & SYNC_TRAFFIC_ON)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) 			return ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) 	 * split up the FIFO and reinitialize the queues
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) 	formac_reinit_tx(smc) ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) #endif /* ESS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) #endif	/* no SLIM_SMT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718)