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