1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/******************************************************************************
3 *
4 *	(C)Copyright 1998,1999 SysKonnect,
5 *	a business unit of Schneider & Koch & Co. Datensysteme GmbH.
6 *
7 *	The information in this file is provided "AS IS" without warranty.
8 *
9 ******************************************************************************/
10
11/*
12 *	SMT 7.2 frame definitions
13 */
14
15#ifndef	_SMT_
16#define _SMT_
17
18/* #define SMT5_10 */
19#define SMT6_10
20#define SMT7_20
21
22#define	OPT_PMF		/* if parameter management is supported */
23#define	OPT_SRF		/* if status report is supported */
24
25/*
26 * SMT frame version 5.1
27 */
28
29#define SMT_VID	0x0001			/* V 5.1 .. 6.1 */
30#define SMT_VID_2 0x0002		/* V 7.2 */
31
32struct smt_sid {
33	u_char	sid_oem[2] ;			/* implementation spec. */
34	struct fddi_addr sid_node ;		/* node address */
35} ;
36
37typedef u_char	t_station_id[8] ;
38
39/*
40 * note on alignment :
41 * sizeof(struct smt_header) = 32
42 * all parameters are long aligned
43 * if struct smt_header starts at offset 0, all longs are aligned correctly
44 * (FC starts at offset 3)
45 */
46_packed struct smt_header {
47	struct fddi_addr    	smt_dest ;	/* destination address */
48	struct fddi_addr	smt_source ;	/* source address */
49	u_char			smt_class ;	/* NIF, SIF ... */
50	u_char			smt_type ;	/* req., response .. */
51	u_short			smt_version ;	/* version id */
52	u_int			smt_tid ;	/* transaction ID */
53	struct smt_sid		smt_sid ;	/* station ID */
54	u_short			smt_pad ;	/* pad with 0 */
55	u_short			smt_len ;	/* length of info field */
56} ;
57#define SWAP_SMTHEADER	"662sl8ss"
58
59#if	0
60/*
61 * MAC FC values
62 */
63#define FC_SMT_INFO	0x41		/* SMT info */
64#define FC_SMT_NSA	0x4f		/* SMT Next Station Addressing */
65#endif
66
67
68/*
69 * type codes
70 */
71#define SMT_ANNOUNCE	0x01		/* announcement */
72#define SMT_REQUEST	0x02		/* request */
73#define SMT_REPLY	0x03		/* reply */
74
75/*
76 * class codes
77 */
78#define SMT_NIF		0x01		/* neighbor information frames */
79#define SMT_SIF_CONFIG	0x02		/* station information configuration */
80#define SMT_SIF_OPER	0x03		/* station information operation */
81#define SMT_ECF		0x04		/* echo frames */
82#define SMT_RAF		0x05		/* resource allocation */
83#define SMT_RDF		0x06		/* request denied */
84#define SMT_SRF		0x07		/* status report */
85#define SMT_PMF_GET	0x08		/* parameter management get */
86#define SMT_PMF_SET	0x09		/* parameter management set */
87#define SMT_ESF		0xff		/* extended service */
88
89#define SMT_MAX_ECHO_LEN	4458	/* max length of SMT Echo */
90#if	defined(CONC) || defined(CONC_II)
91#define SMT_TEST_ECHO_LEN	50	/* test length of SMT Echo */
92#else
93#define SMT_TEST_ECHO_LEN	SMT_MAX_ECHO_LEN	/* test length */
94#endif
95
96#define SMT_MAX_INFO_LEN	(4352-20)	/* max length for SMT info */
97
98
99/*
100 * parameter types
101 */
102
103struct smt_para {
104	u_short	p_type ;		/* type */
105	u_short	p_len ;			/* length of parameter */
106} ;
107
108#define PARA_LEN	(sizeof(struct smt_para))
109
110#define SMTSETPARA(p,t)		(p)->para.p_type = (t),\
111				(p)->para.p_len = sizeof(*(p)) - PARA_LEN
112
113/*
114 * P01 : Upstream Neighbor Address, UNA
115 */
116#define SMT_P_UNA	0x0001		/* upstream neighbor address */
117#define SWAP_SMT_P_UNA	"s6"
118
119struct smt_p_una {
120	struct smt_para	para ;		/* generic parameter header */
121	u_short	una_pad ;
122	struct fddi_addr una_node ;	/* node address, zero if unknown */
123} ;
124
125/*
126 * P02 : Station Descriptor
127 */
128#define SMT_P_SDE	0x0002		/* station descriptor */
129#define SWAP_SMT_P_SDE	"1111"
130
131#define SMT_SDE_STATION		0	/* end node */
132#define SMT_SDE_CONCENTRATOR	1	/* concentrator */
133
134struct smt_p_sde {
135	struct smt_para	para ;		/* generic parameter header */
136	u_char	sde_type ;		/* station type */
137	u_char	sde_mac_count ;		/* number of MACs */
138	u_char	sde_non_master ;	/* number of A,B or S ports */
139	u_char	sde_master ;		/* number of S ports on conc. */
140} ;
141
142/*
143 * P03 : Station State
144 */
145#define SMT_P_STATE	0x0003		/* station state */
146#define SWAP_SMT_P_STATE	"scc"
147
148struct smt_p_state {
149	struct smt_para	para ;		/* generic parameter header */
150	u_short	st_pad ;
151	u_char	st_topology ;		/* topology */
152	u_char	st_dupl_addr ;		/* duplicate address detected */
153} ;
154#define SMT_ST_WRAPPED		(1<<0)	/* station wrapped */
155#define SMT_ST_UNATTACHED	(1<<1)	/* unattached concentrator */
156#define SMT_ST_TWISTED_A	(1<<2)	/* A-A connection, twisted ring */
157#define SMT_ST_TWISTED_B	(1<<3)	/* B-B connection, twisted ring */
158#define SMT_ST_ROOTED_S		(1<<4)	/* rooted station */
159#define SMT_ST_SRF		(1<<5)	/* SRF protocol supported */
160#define SMT_ST_SYNC_SERVICE	(1<<6)	/* use synchronous bandwidth */
161
162#define SMT_ST_MY_DUPA		(1<<0)	/* my station detected dupl. */
163#define SMT_ST_UNA_DUPA		(1<<1)	/* my UNA detected duplicate */
164
165/*
166 * P04 : timestamp
167 */
168#define SMT_P_TIMESTAMP	0x0004		/* time stamp */
169#define SWAP_SMT_P_TIMESTAMP	"8"
170struct smt_p_timestamp {
171	struct smt_para	para ;		/* generic parameter header */
172	u_char	ts_time[8] ;		/* time, resolution 80nS, unique */
173} ;
174
175/*
176 * P05 : station policies
177 */
178#define SMT_P_POLICY	0x0005		/* station policies */
179#define SWAP_SMT_P_POLICY	"ss"
180
181struct smt_p_policy {
182	struct smt_para	para ;		/* generic parameter header */
183	u_short	pl_config ;
184	u_short pl_connect ;		/* bit string POLICY_AA ... */
185} ;
186#define SMT_PL_HOLD		1	/* hold policy supported (Dual MAC) */
187
188/*
189 * P06 : latency equivalent
190 */
191#define SMT_P_LATENCY	0x0006		/* latency */
192#define SWAP_SMT_P_LATENCY	"ssss"
193
194/*
195 * note: latency has two phy entries by definition
196 * for a SAS, the 2nd one is null
197 */
198struct smt_p_latency {
199	struct smt_para	para ;		/* generic parameter header */
200	u_short	lt_phyout_idx1 ;	/* index */
201	u_short	lt_latency1 ;		/* latency , unit : byte clock */
202	u_short	lt_phyout_idx2 ;	/* 0 if SAS */
203	u_short	lt_latency2 ;		/* 0 if SAS */
204} ;
205
206/*
207 * P07 : MAC neighbors
208 */
209#define SMT_P_NEIGHBORS	0x0007		/* MAC neighbor description */
210#define SWAP_SMT_P_NEIGHBORS	"ss66"
211
212struct smt_p_neighbor {
213	struct smt_para	para ;		/* generic parameter header */
214	u_short	nb_mib_index ;		/* MIB index */
215	u_short	nb_mac_index ;		/* n+1 .. n+m, m = #MACs, n = #PHYs */
216	struct fddi_addr nb_una ;	/* UNA , 0 for unknown */
217	struct fddi_addr nb_dna ;	/* DNA , 0 for unknown */
218} ;
219
220/*
221 * PHY record
222 */
223#define SMT_PHY_A	0		/* A port */
224#define SMT_PHY_B	1		/* B port */
225#define SMT_PHY_S	2		/* slave port */
226#define SMT_PHY_M	3		/* master port */
227
228#define SMT_CS_DISABLED	0		/* connect state : disabled */
229#define SMT_CS_CONNECTING	1	/* connect state : connecting */
230#define SMT_CS_STANDBY	2		/* connect state : stand by */
231#define SMT_CS_ACTIVE	3		/* connect state : active */
232
233#define SMT_RM_NONE	0
234#define SMT_RM_MAC	1
235
236struct smt_phy_rec {
237	u_short	phy_mib_index ;		/* MIB index */
238	u_char	phy_type ;		/* A/B/S/M */
239	u_char	phy_connect_state ;	/* disabled/connecting/active */
240	u_char	phy_remote_type ;	/* A/B/S/M */
241	u_char	phy_remote_mac ;	/* none/remote */
242	u_short	phy_resource_idx ;	/* 1 .. n */
243} ;
244
245/*
246 * MAC record
247 */
248struct smt_mac_rec {
249	struct fddi_addr mac_addr ;		/* MAC address */
250	u_short		mac_resource_idx ;	/* n+1 .. n+m */
251} ;
252
253/*
254 * P08 : path descriptors
255 * should be really an array ; however our environment has a fixed number of
256 * PHYs and MACs
257 */
258#define SMT_P_PATH	0x0008			/* path descriptor */
259#define SWAP_SMT_P_PATH	"[6s]"
260
261struct smt_p_path {
262	struct smt_para	para ;		/* generic parameter header */
263	struct smt_phy_rec	pd_phy[2] ;	/* PHY A */
264	struct smt_mac_rec	pd_mac ;	/* MAC record */
265} ;
266
267/*
268 * P09 : MAC status
269 */
270#define SMT_P_MAC_STATUS	0x0009		/* MAC status */
271#define SWAP_SMT_P_MAC_STATUS	"sslllllllll"
272
273struct smt_p_mac_status {
274	struct smt_para	para ;		/* generic parameter header */
275	u_short st_mib_index ;		/* MIB index */
276	u_short	st_mac_index ;		/* n+1 .. n+m */
277	u_int	st_t_req ;		/* T_Req */
278	u_int	st_t_neg ;		/* T_Neg */
279	u_int	st_t_max ;		/* T_Max */
280	u_int	st_tvx_value ;		/* TVX_Value */
281	u_int	st_t_min ;		/* T_Min */
282	u_int	st_sba ;		/* synchr. bandwidth alloc */
283	u_int	st_frame_ct ;		/* frame counter */
284	u_int	st_error_ct ;		/* error counter */
285	u_int	st_lost_ct ;		/* lost frames counter */
286} ;
287
288/*
289 * P0A : PHY link error rate monitoring
290 */
291#define SMT_P_LEM	0x000a		/* link error monitor */
292#define SWAP_SMT_P_LEM	"ssccccll"
293/*
294 * units of lem_cutoff,lem_alarm,lem_estimate : 10**-x
295 */
296struct smt_p_lem {
297	struct smt_para	para ;		/* generic parameter header */
298	u_short	lem_mib_index ;		/* MIB index */
299	u_short	lem_phy_index ;		/* 1 .. n */
300	u_char	lem_pad2 ;		/* be nice and make it even . */
301	u_char	lem_cutoff ;		/* 0x4 .. 0xf, default 0x7 */
302	u_char	lem_alarm ;		/* 0x4 .. 0xf, default 0x8 */
303	u_char	lem_estimate ;		/* 0x0 .. 0xff */
304	u_int	lem_reject_ct ;		/* 0x00000000 .. 0xffffffff */
305	u_int	lem_ct ;		/* 0x00000000 .. 0xffffffff */
306} ;
307
308/*
309 * P0B : MAC frame counters
310 */
311#define SMT_P_MAC_COUNTER 0x000b	/* MAC frame counters */
312#define SWAP_SMT_P_MAC_COUNTER	"ssll"
313
314struct smt_p_mac_counter {
315	struct smt_para	para ;		/* generic parameter header */
316	u_short	mc_mib_index ;		/* MIB index */
317	u_short	mc_index ;		/* mac index */
318	u_int	mc_receive_ct ;		/* receive counter */
319	u_int	mc_transmit_ct ;	/* transmit counter */
320} ;
321
322/*
323 * P0C : MAC frame not copied counter
324 */
325#define SMT_P_MAC_FNC	0x000c		/* MAC frame not copied counter */
326#define SWAP_SMT_P_MAC_FNC	"ssl"
327
328struct smt_p_mac_fnc {
329	struct smt_para	para ;		/* generic parameter header */
330	u_short	nc_mib_index ;		/* MIB index */
331	u_short	nc_index ;		/* mac index */
332	u_int	nc_counter ;		/* not copied counter */
333} ;
334
335
336/*
337 * P0D : MAC priority values
338 */
339#define SMT_P_PRIORITY	0x000d		/* MAC priority values */
340#define SWAP_SMT_P_PRIORITY	"ssl"
341
342struct smt_p_priority {
343	struct smt_para	para ;		/* generic parameter header */
344	u_short	pr_mib_index ;		/* MIB index */
345	u_short	pr_index ;		/* mac index */
346	u_int	pr_priority[7] ;	/* priority values */
347} ;
348
349/*
350 * P0E : PHY elasticity buffer status
351 */
352#define SMT_P_EB	0x000e		/* PHY EB status */
353#define SWAP_SMT_P_EB	"ssl"
354
355struct smt_p_eb {
356	struct smt_para	para ;		/* generic parameter header */
357	u_short	eb_mib_index ;		/* MIB index */
358	u_short	eb_index ;		/* phy index */
359	u_int	eb_error_ct ;		/* # of eb overflows */
360} ;
361
362/*
363 * P0F : manufacturer field
364 */
365#define SMT_P_MANUFACTURER	0x000f	/* manufacturer field */
366#define SWAP_SMT_P_MANUFACTURER	""
367
368struct smp_p_manufacturer {
369	struct smt_para	para ;		/* generic parameter header */
370	u_char mf_data[32] ;		/* OUI + arbitrary data */
371} ;
372
373/*
374 * P10 : user field
375 */
376#define SMT_P_USER		0x0010	/* manufacturer field */
377#define SWAP_SMT_P_USER	""
378
379struct smp_p_user {
380	struct smt_para	para ;		/* generic parameter header */
381	u_char us_data[32] ;		/* arbitrary data */
382} ;
383
384
385
386/*
387 * P11 : echo data
388 */
389#define SMT_P_ECHODATA	0x0011		/* echo data */
390#define SWAP_SMT_P_ECHODATA	""
391
392struct smt_p_echo {
393	struct smt_para	para ;		/* generic parameter header */
394	u_char	ec_data[SMT_MAX_ECHO_LEN-4] ;	/* echo data */
395} ;
396
397/*
398 * P12 : reason code
399 */
400#define SMT_P_REASON	0x0012		/* reason code */
401#define SWAP_SMT_P_REASON	"l"
402
403struct smt_p_reason {
404	struct smt_para	para ;		/* generic parameter header */
405	u_int	rdf_reason ;		/* CLASS/VERSION */
406} ;
407#define SMT_RDF_CLASS	0x00000001	/* class not supported */
408#define SMT_RDF_VERSION	0x00000002	/* version not supported */
409#define SMT_RDF_SUCCESS	0x00000003	/* success (PMF) */
410#define SMT_RDF_BADSET	0x00000004	/* bad set count (PMF) */
411#define SMT_RDF_ILLEGAL 0x00000005	/* read only (PMF) */
412#define SMT_RDF_NOPARAM	0x6		/* parameter not supported (PMF) */
413#define SMT_RDF_RANGE	0x8		/* out of range */
414#define SMT_RDF_AUTHOR	0x9		/* not authorized */
415#define SMT_RDF_LENGTH	0x0a		/* length error */
416#define SMT_RDF_TOOLONG	0x0b		/* length error */
417#define SMT_RDF_SBA	0x0d		/* SBA denied */
418
419/*
420 * P13 : refused frame beginning
421 */
422#define SMT_P_REFUSED	0x0013		/* refused frame beginning */
423#define SWAP_SMT_P_REFUSED	"l"
424
425struct smt_p_refused {
426	struct smt_para	para ;		/* generic parameter header */
427	u_int	ref_fc ;		/* 3 bytes 0 + FC */
428	struct smt_header	ref_header ;	/* refused header */
429} ;
430
431/*
432 * P14 : supported SMT versions
433 */
434#define SMT_P_VERSION	0x0014		/* SMT supported versions */
435#define SWAP_SMT_P_VERSION	"sccss"
436
437struct smt_p_version {
438	struct smt_para	para ;		/* generic parameter header */
439	u_short	v_pad ;
440	u_char	v_n ;			/* 1 .. 0xff, #versions */
441	u_char	v_index ;		/* 1 .. 0xff, index of op. v. */
442	u_short	v_version[1] ;		/* list of min. 1 version */
443	u_short	v_pad2 ;		/* pad if necessary */
444} ;
445
446/*
447 * P15 : Resource Type
448 */
449#define	SWAP_SMT_P0015		"l"
450
451struct smt_p_0015 {
452	struct smt_para	para ;		/* generic parameter header */
453	u_int		res_type ;	/* resource type */
454} ;
455
456#define	SYNC_BW		0x00000001L	/* Synchronous Bandwidth */
457
458/*
459 * P16 : SBA Command
460 */
461#define	SWAP_SMT_P0016		"l"
462
463struct smt_p_0016 {
464	struct smt_para	para ;		/* generic parameter header */
465	u_int		sba_cmd ;	/* command for the SBA */
466} ;
467
468#define	REQUEST_ALLOCATION	0x1	/* req allocation of sync bandwidth */
469#define	REPORT_ALLOCATION	0x2	/* rep of sync bandwidth allocation */
470#define	CHANGE_ALLOCATION	0x3	/* forces a station using sync band-*/
471					/* width to change its current allo-*/
472					/* cation */
473
474/*
475 * P17 : SBA Payload Request
476 */
477#define	SWAP_SMT_P0017		"l"
478
479struct smt_p_0017 {
480	struct smt_para	para ;		/* generic parameter header */
481	int		sba_pl_req ;	/* total sync bandwidth measured in */
482} ;					/* bytes per 125 us */
483
484/*
485 * P18 : SBA Overhead Request
486 */
487#define	SWAP_SMT_P0018		"l"
488
489struct smt_p_0018 {
490	struct smt_para	para ;		/* generic parameter header */
491	int		sba_ov_req ;	/* total sync bandwidth req for overhead*/
492} ;					/* measured in bytes per T_Neg */
493
494/*
495 * P19 : SBA Allocation Address
496 */
497#define	SWAP_SMT_P0019		"s6"
498
499struct smt_p_0019 {
500	struct smt_para	para ;		/* generic parameter header */
501	u_short		sba_pad ;
502	struct fddi_addr alloc_addr ;	/* Allocation Address */
503} ;
504
505/*
506 * P1A : SBA Category
507 */
508#define	SWAP_SMT_P001A		"l"
509
510struct smt_p_001a {
511	struct smt_para	para ;		/* generic parameter header */
512	u_int		category ;	/* Allocator defined classification */
513} ;
514
515/*
516 * P1B : Maximum T_Neg
517 */
518#define	SWAP_SMT_P001B		"l"
519
520struct smt_p_001b {
521	struct smt_para	para ;		/* generic parameter header */
522	u_int		max_t_neg ;	/* longest T_NEG for the sync service*/
523} ;
524
525/*
526 * P1C : Minimum SBA Segment Size
527 */
528#define	SWAP_SMT_P001C		"l"
529
530struct smt_p_001c {
531	struct smt_para	para ;		/* generic parameter header */
532	u_int		min_seg_siz ;	/* smallest number of bytes per frame*/
533} ;
534
535/*
536 * P1D : SBA Allocatable
537 */
538#define	SWAP_SMT_P001D		"l"
539
540struct smt_p_001d {
541	struct smt_para	para ;		/* generic parameter header */
542	u_int		allocatable ;	/* total sync bw available for alloc */
543} ;
544
545/*
546 * P20 0B : frame status capabilities
547 * NOTE: not in swap table, is used by smt.c AND PMF table
548 */
549#define SMT_P_FSC	0x200b
550/* #define SWAP_SMT_P_FSC	"ssss" */
551
552struct smt_p_fsc {
553	struct smt_para	para ;		/* generic parameter header */
554	u_short	fsc_pad0 ;
555	u_short	fsc_mac_index ;		/* mac index 1 .. ff */
556	u_short	fsc_pad1 ;
557	u_short	fsc_value ;		/* FSC_TYPE[0-2] */
558} ;
559
560#define FSC_TYPE0	0		/* "normal" node (A/C handling) */
561#define FSC_TYPE1	1		/* Special A/C indicator forwarding */
562#define FSC_TYPE2	2		/* Special A/C indicator forwarding */
563
564/*
565 * P00 21 : user defined authorization (see pmf.c)
566 */
567#define SMT_P_AUTHOR	0x0021
568
569/*
570 * notification parameters
571 */
572#define SWAP_SMT_P1048	"ll"
573struct smt_p_1048 {
574	u_int p1048_flag ;
575	u_int p1048_cf_state ;
576} ;
577
578/*
579 * NOTE: all 2xxx 3xxx and 4xxx must include the INDEX in the swap string,
580 *	even so the INDEX is NOT part of the struct.
581 *	INDEX is already swapped in pmf.c, format in string is '4'
582 */
583#define SWAP_SMT_P208C	"4lss66"
584struct smt_p_208c {
585	u_int			p208c_flag ;
586	u_short			p208c_pad ;
587	u_short			p208c_dupcondition ;
588	struct	fddi_addr	p208c_fddilong ;
589	struct	fddi_addr	p208c_fddiunalong ;
590} ;
591
592#define SWAP_SMT_P208D	"4lllll"
593struct smt_p_208d {
594	u_int			p208d_flag ;
595	u_int			p208d_frame_ct ;
596	u_int			p208d_error_ct ;
597	u_int			p208d_lost_ct ;
598	u_int			p208d_ratio ;
599} ;
600
601#define SWAP_SMT_P208E	"4llll"
602struct smt_p_208e {
603	u_int			p208e_flag ;
604	u_int			p208e_not_copied ;
605	u_int			p208e_copied ;
606	u_int			p208e_not_copied_ratio ;
607} ;
608
609#define SWAP_SMT_P208F	"4ll6666s6"
610
611struct smt_p_208f {
612	u_int			p208f_multiple ;
613	u_int			p208f_nacondition ;
614	struct fddi_addr	p208f_old_una ;
615	struct fddi_addr	p208f_new_una ;
616	struct fddi_addr	p208f_old_dna ;
617	struct fddi_addr	p208f_new_dna ;
618	u_short			p208f_curren_path ;
619	struct fddi_addr	p208f_smt_address ;
620} ;
621
622#define SWAP_SMT_P2090	"4lssl"
623
624struct smt_p_2090 {
625	u_int			p2090_multiple ;
626	u_short			p2090_availablepaths ;
627	u_short			p2090_currentpath ;
628	u_int			p2090_requestedpaths ;
629} ;
630
631/*
632 * NOTE:
633 * special kludge for parameters 320b,320f,3210
634 * these parameters are part of RAF frames
635 * RAF frames are parsed in SBA.C and must be swapped
636 * PMF.C has special code to avoid double swapping
637 */
638#ifdef	LITTLE_ENDIAN
639#define SBAPATHINDEX	(0x01000000L)
640#else
641#define SBAPATHINDEX	(0x01L)
642#endif
643
644#define	SWAP_SMT_P320B	"42s"
645
646struct	smt_p_320b {
647	struct smt_para para ;	/* generic parameter header */
648	u_int	mib_index ;
649	u_short path_pad ;
650	u_short	path_index ;
651} ;
652
653#define	SWAP_SMT_P320F	"4l"
654
655struct	smt_p_320f {
656	struct smt_para para ;	/* generic parameter header */
657	u_int	mib_index ;
658	u_int	mib_payload ;
659} ;
660
661#define	SWAP_SMT_P3210	"4l"
662
663struct	smt_p_3210 {
664	struct smt_para para ;	/* generic parameter header */
665	u_int	mib_index ;
666	u_int	mib_overhead ;
667} ;
668
669#define SWAP_SMT_P4050	"4l1111ll"
670
671struct smt_p_4050 {
672	u_int			p4050_flag ;
673	u_char			p4050_pad ;
674	u_char			p4050_cutoff ;
675	u_char			p4050_alarm ;
676	u_char			p4050_estimate ;
677	u_int			p4050_reject_ct ;
678	u_int			p4050_ct ;
679} ;
680
681#define SWAP_SMT_P4051	"4lssss"
682struct smt_p_4051 {
683	u_int			p4051_multiple ;
684	u_short			p4051_porttype ;
685	u_short			p4051_connectstate ;
686	u_short			p4051_pc_neighbor ;
687	u_short			p4051_pc_withhold ;
688} ;
689
690#define SWAP_SMT_P4052	"4ll"
691struct smt_p_4052 {
692	u_int			p4052_flag ;
693	u_int			p4052_eberrorcount ;
694} ;
695
696#define SWAP_SMT_P4053	"4lsslss"
697
698struct smt_p_4053 {
699	u_int			p4053_multiple ;
700	u_short			p4053_availablepaths ;
701	u_short			p4053_currentpath ;
702	u_int			p4053_requestedpaths ;
703	u_short			p4053_mytype ;
704	u_short			p4053_neighbortype ;
705} ;
706
707
708#define SMT_P_SETCOUNT	0x1035
709#define SWAP_SMT_P_SETCOUNT	"l8"
710
711struct smt_p_setcount {
712	struct smt_para	para ;		/* generic parameter header */
713	u_int		count ;
714	u_char		timestamp[8] ;
715} ;
716
717/*
718 * SMT FRAMES
719 */
720
721/*
722 * NIF : neighbor information frames
723 */
724struct smt_nif {
725	struct smt_header	smt ;		/* generic header */
726	struct smt_p_una	una ;		/* UNA */
727	struct smt_p_sde	sde ;		/* station descriptor */
728	struct smt_p_state	state ;		/* station state */
729#ifdef	SMT6_10
730	struct smt_p_fsc	fsc ;		/* frame status cap. */
731#endif
732} ;
733
734/*
735 * SIF : station information frames
736 */
737struct smt_sif_config {
738	struct smt_header	smt ;		/* generic header */
739	struct smt_p_timestamp	ts ;		/* time stamp */
740	struct smt_p_sde	sde ;		/* station descriptor */
741	struct smt_p_version	version ;	/* supported versions */
742	struct smt_p_state	state ;		/* station state */
743	struct smt_p_policy	policy ;	/* station policy */
744	struct smt_p_latency	latency ;	/* path latency */
745	struct smt_p_neighbor	neighbor ;	/* neighbors, we have only one*/
746#ifdef	OPT_PMF
747	struct smt_p_setcount	setcount ;	 /* Set Count mandatory */
748#endif
749	/* WARNING : path MUST BE LAST FIELD !!! (see smt.c:smt_fill_path) */
750	struct smt_p_path	path ;		/* path descriptor */
751} ;
752#define SIZEOF_SMT_SIF_CONFIG	(sizeof(struct smt_sif_config)- \
753				 sizeof(struct smt_p_path))
754
755struct smt_sif_operation {
756	struct smt_header	smt ;		/* generic header */
757	struct smt_p_timestamp	ts ;		/* time stamp */
758	struct smt_p_mac_status	status ;	/* mac status */
759	struct smt_p_mac_counter mc ;		/* MAC counter */
760	struct smt_p_mac_fnc 	fnc ;		/* MAC frame not copied */
761	struct smp_p_manufacturer man ;		/* manufacturer field */
762	struct smp_p_user	user ;		/* user field */
763#ifdef	OPT_PMF
764	struct smt_p_setcount	setcount ;	 /* Set Count mandatory */
765#endif
766	/* must be last */
767	struct smt_p_lem	lem[];		/* phy lem status */
768} ;
769
770/*
771 * ECF : echo frame
772 */
773struct smt_ecf {
774	struct smt_header	smt ;		/* generic header */
775	struct smt_p_echo	ec_echo ;	/* echo parameter */
776} ;
777#define SMT_ECF_LEN	(sizeof(struct smt_header)+sizeof(struct smt_para))
778
779/*
780 * RDF : request denied frame
781 */
782struct smt_rdf {
783	struct smt_header	smt ;		/* generic header */
784	struct smt_p_reason	reason ;	/* reason code */
785	struct smt_p_version	version ;	/* supported versions */
786	struct smt_p_refused	refused ;	/* refused frame fragment */
787} ;
788
789/*
790 * SBA Request Allocation Response Frame
791 */
792struct smt_sba_alc_res {
793	struct smt_header	smt ;		/* generic header */
794	struct smt_p_0015	s_type ;	/* resource type */
795	struct smt_p_0016	cmd ;		/* SBA command */
796	struct smt_p_reason	reason ;	/* reason code */
797	struct smt_p_320b	path ;		/* path type */
798	struct smt_p_320f	payload ;	/* current SBA payload */
799	struct smt_p_3210	overhead ;	/* current SBA overhead */
800	struct smt_p_0019	a_addr ;	/* Allocation Address */
801	struct smt_p_001a	cat ;		/* Category - from the request */
802	struct smt_p_001d	alloc ;		/* SBA Allocatable */
803} ;
804
805/*
806 * SBA Request Allocation Request Frame
807 */
808struct smt_sba_alc_req {
809	struct smt_header	smt ;		/* generic header */
810	struct smt_p_0015	s_type ;	/* resource type */
811	struct smt_p_0016	cmd ;		/* SBA command */
812	struct smt_p_320b	path ;		/* path type */
813	struct smt_p_0017	pl_req ;	/* requested payload */
814	struct smt_p_0018	ov_req ;	/* requested SBA overhead */
815	struct smt_p_320f	payload ;	/* current SBA payload */
816	struct smt_p_3210	overhead ;	/* current SBA overhead */
817	struct smt_p_0019	a_addr ;	/* Allocation Address */
818	struct smt_p_001a	cat ;		/* Category - from the request */
819	struct smt_p_001b	tneg ;		/* max T-NEG */
820	struct smt_p_001c	segm ;		/* minimum segment size */
821} ;
822
823/*
824 * SBA Change Allocation Request Frame
825 */
826struct smt_sba_chg {
827	struct smt_header	smt ;		/* generic header */
828	struct smt_p_0015	s_type ;	/* resource type */
829	struct smt_p_0016	cmd ;		/* SBA command */
830	struct smt_p_320b	path ;		/* path type */
831	struct smt_p_320f	payload ;	/* current SBA payload */
832	struct smt_p_3210	overhead ;	/* current SBA overhead */
833	struct smt_p_001a	cat ;		/* Category - from the request */
834} ;
835
836/*
837 * SBA Report Allocation Request Frame
838 */
839struct smt_sba_rep_req {
840	struct smt_header	smt ;		/* generic header */
841	struct smt_p_0015	s_type ;	/* resource type */
842	struct smt_p_0016	cmd ;		/* SBA command */
843} ;
844
845/*
846 * SBA Report Allocation Response Frame
847 */
848struct smt_sba_rep_res {
849	struct smt_header	smt ;		/* generic header */
850	struct smt_p_0015	s_type ;	/* resource type */
851	struct smt_p_0016	cmd ;		/* SBA command */
852	struct smt_p_320b	path ;		/* path type */
853	struct smt_p_320f	payload ;	/* current SBA payload */
854	struct smt_p_3210	overhead ;	/* current SBA overhead */
855} ;
856
857/*
858 * actions
859 */
860#define SMT_STATION_ACTION	1
861#define SMT_STATION_ACTION_CONNECT	0
862#define SMT_STATION_ACTION_DISCONNECT	1
863#define SMT_STATION_ACTION_PATHTEST	2
864#define SMT_STATION_ACTION_SELFTEST	3
865#define SMT_STATION_ACTION_DISABLE_A	4
866#define SMT_STATION_ACTION_DISABLE_B	5
867#define SMT_STATION_ACTION_DISABLE_M	6
868
869#define SMT_PORT_ACTION		2
870#define SMT_PORT_ACTION_MAINT	0
871#define SMT_PORT_ACTION_ENABLE	1
872#define SMT_PORT_ACTION_DISABLE	2
873#define SMT_PORT_ACTION_START	3
874#define SMT_PORT_ACTION_STOP	4
875
876#endif	/* _SMT_ */
877