2
* Copyright (c) 2004 Mellanox Technologies LTD. All rights reserved.
4
* This software is available to you under a choice of one of two
5
* licenses. You may choose to be licensed under the terms of the GNU
6
* General Public License (GPL) Version 2, available from the file
7
* COPYING in the main directory of this source tree, or the
8
* OpenIB.org BSD license below:
10
* Redistribution and use in source and binary forms, with or
11
* without modification, are permitted provided that the following
14
* - Redistributions of source code must retain the above
15
* copyright notice, this list of conditions and the following
18
* - Redistributions in binary form must reproduce the above
19
* copyright notice, this list of conditions and the following
20
* disclaimer in the documentation and/or other materials
21
* provided with the distribution.
23
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
%title "IBIS Tcl Extension"
42
# define BEGIN_C_DECLS extern "C" {
43
# define END_C_DECLS }
44
#else /* !__cplusplus */
45
# define BEGIN_C_DECLS
47
#endif /* __cplusplus */
56
#include <opensm/osm_log.h>
57
#include <complib/cl_qmap.h>
58
#include <complib/cl_map.h>
59
#include <complib/cl_debug.h>
73
#define __PRI64_PREFIX "l"
75
#define __PRI64_PREFIX "L"
78
#define PRId64 __PRI64_PREFIX"d"
79
#define PRIo64 __PRI64_PREFIX"o"
80
#define PRIu64 __PRI64_PREFIX"u"
81
#define PRIx64 __PRI64_PREFIX"x"
84
/**********************************************************************
85
**********************************************************************/
89
#if defined( _DEBUG_ )
93
#endif /* defined( _DEBUG_ ) */
101
%include ibis_typemaps.i
104
// exception handling wrapper based on the MsgMgr interfaces
108
static char ibis_tcl_error_msg[1024];
109
static int ibis_tcl_error;
111
void ibis_set_tcl_error(char *err) {
112
if (strlen(err) < 1024)
113
strcpy(ibis_tcl_error_msg, err);
115
strncpy(ibis_tcl_error_msg, err, 1024);
120
// it assumes we do not send the messages to stderr
122
/* we can check if IBIS was initialized here */
123
if (!IbisObj.initialized)
126
Tcl_GetObjResult(interp),
127
"ibis was not yet initialized. please use ibis_init and then ibis_set_port before.", -1);
131
if (! IbisObj.port_guid)
134
Tcl_GetObjResult(interp),
135
" ibis was not yet initialized. please use ibis_set_port before.", -1);
141
if (ibis_tcl_error) {
142
Tcl_SetStringObj(Tcl_GetObjResult(interp), ibis_tcl_error_msg, -1);
148
// IBCR Interfaces and C Code
153
// IBPM Interfaces and C Code
158
// IBVS Interfaces and C Code
163
// IBBBM Interfaces and C Code
168
// IBSAC Interfaces and C Code
173
// IBSM Interfaces and C Code
178
// IBCC Interfaces and C Code
185
static ibis_opt_t *ibis_opt_p;
188
/* initialize the ibis object - is not done during init so we
189
can play with the options ... */
190
int ibis_ui_init(void)
192
ib_api_status_t status;
193
#ifdef OSM_BUILD_OPENIB
197
status = ibis_init( &IbisOpts, IbisOpts.log_flags );
198
if( status != IB_SUCCESS ) {
199
printf("-E- Error from ibis_init: %s.\n",
200
ib_get_err_str( status ));
205
status = ibcr_init(p_ibcr_global);
206
if( status != IB_SUCCESS )
208
printf("-E- fail to init ibcr_init.\n");
209
ibcr_destroy( p_ibcr_global );
213
status = ibpm_init(p_ibpm_global);
214
if( status != IB_SUCCESS )
216
printf("-E- fail to init ibpm_init.\n");
217
ibpm_destroy( p_ibpm_global );
221
status = ibvs_init(p_ibvs_global);
222
if( status != IB_SUCCESS )
224
printf("-E- Fail to init ibvs_init.\n");
225
ibvs_destroy( p_ibvs_global );
229
status = ibbbm_init(p_ibbbm_global);
230
if( status != IB_SUCCESS )
232
printf("-E- Fail to init ibbbm_init.\n");
233
ibbbm_destroy( p_ibbbm_global );
237
status = ibsm_init(gp_ibsm);
238
if( status != IB_SUCCESS )
240
printf("-E- Fail to init ibsm_init.\n");
241
ibsm_destroy( gp_ibsm );
245
status = ibcc_init(gp_ibcc);
246
if( status != IB_SUCCESS )
248
printf("-E- Fail to init ibcc_init.\n");
249
ibcc_destroy( gp_ibcc );
256
/* destroy the osm object and close the complib.
257
This function is called from by the Tcl_CreateExitHandler - meaning
258
it will be called when calling 'exit' in the osm shell. */
260
ibis_exit( ClientData clientData ) {
261
ibcr_destroy(p_ibcr_global);
262
ibpm_destroy(p_ibpm_global);
263
ibvs_destroy(p_ibvs_global);
264
ibbbm_destroy(p_ibbbm_global);
265
ibsm_destroy(gp_ibsm);
266
ibcc_destroy(gp_ibcc);
273
int ibis_ui_destroy(void)
280
/* simply return the active port guid ibis is binded to */
281
uint64_t ibis_get_port(void)
283
return (IbisObj.port_guid);
286
/* set the port we bind to and initialize sub packages */
287
int ibis_set_port(uint64_t port_guid)
289
ib_api_status_t status;
291
if (! IbisObj.initialized) {
292
ibis_set_tcl_error("ibis was not initialized! Please use ibis_init before any call to ibis_*");
297
IbisObj.port_guid = port_guid;
299
status = ibcr_bind(p_ibcr_global);
300
if( status != IB_SUCCESS )
302
printf("-E- Fail to ibcr_bind.\n");
303
ibcr_destroy( p_ibcr_global );
307
status = ibpm_bind(p_ibpm_global);
308
if( status != IB_SUCCESS )
310
printf("-E- Fail to ibpm_bind.\n");
311
ibpm_destroy( p_ibpm_global );
315
status = ibvs_bind(p_ibvs_global);
316
if( status != IB_SUCCESS )
318
printf("-E- Fail to ibvs_bind.\n");
319
ibvs_destroy( p_ibvs_global );
323
status = ibbbm_bind(p_ibbbm_global);
324
if( status != IB_SUCCESS )
326
printf("-E- Fail to ibbbm_bind.\n");
327
ibbbm_destroy( p_ibbbm_global );
331
status = ibsm_bind(gp_ibsm);
332
if( status != IB_SUCCESS )
334
printf("-E- Fail to ibsm_bind.\n");
335
ibsm_destroy( gp_ibsm );
339
status = ibcc_bind(gp_ibcc);
340
if( status != IB_SUCCESS )
342
printf("-E- Fail to ibcc_bind.\n");
343
ibcc_destroy( gp_ibcc );
347
if (ibsac_bind(&IbisObj))
349
printf("-E- Fail to ibsac_bind.\n");
356
int ibis_set_verbosity(int level) {
357
if (IbisObj.initialized)
358
osm_log_set_level( &(IbisObj.log), level );
360
IbisOpts.log_flags = level;
365
int ibis_puts( osm_log_level_t verbosity, char *msg) {
366
osm_log(&(IbisObj.log), verbosity, msg );
370
int ibis_set_transaction_timeout( uint32_t timeout_ms ) {
371
osm_log(&(IbisObj.log),
373
" Setting timeout to:%u[msec]\n", timeout_ms);
374
IbisOpts.transaction_timeout = timeout_ms;
378
/* return the list of port guids and their status etc */
379
static int ibis_get_local_ports_info (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
380
Tcl_Obj * tcl_result;
381
ibis_t *p_ibis = &IbisObj;
383
ib_api_status_t status;
384
uint32_t num_ports = GUID_ARRAY_SIZE;
385
ib_port_attr_t attr_array[GUID_ARRAY_SIZE];
386
static char res[128];
389
if (!IbisObj.initialized)
392
Tcl_GetObjResult(interp),
393
"ibis was not yet initialized. please use ibis_init before.", -1);
397
/* command options */
398
tcl_result = Tcl_GetObjResult(interp);
400
if ((objc < 1) || (objc > 1)) {
401
Tcl_SetStringObj(tcl_result,"Wrong # args. ibis_get_local_ports_info ",-1);
406
Call the transport layer for a list of local port
409
status = osm_vendor_get_all_port_attr(
413
if( status != IB_SUCCESS )
415
sprintf(ibis_tcl_error_msg,"-E- fail status:%x\n", status);
421
Go over all ports and build the return value
423
for( i = 0; i < num_ports; i++ )
426
// start with 1 on host channel adapters.
427
sprintf(res, "0x%016" PRIx64 " 0x%04X %s %u",
428
cl_ntoh64( attr_array[i].port_guid ),
430
ib_get_port_state_str( attr_array[i].link_state ),
431
attr_array[i].port_num
434
p_obj = Tcl_NewStringObj(res, strlen(res));
435
Tcl_ListObjAppendElement(interp, tcl_result, p_obj);
446
// INTERFACE DEFINITION (~copy of h file)
449
%section "IBIS Constants"
450
/* These constants are provided by IBIS: */
452
%subsection "Log Verbosity Flags",before,pre
453
/* To be or'ed and used as the "level" argument of ibis_set_verbosity */
455
#define IBIS_LOG_NONE 0x00
456
#define IBIS_LOG_ERROR 0x01
457
#define IBIS_LOG_INFO 0x02
458
#define IBIS_LOG_VERBOSE 0x04
459
#define IBIS_LOG_DEBUG 0x08
460
#define IBIS_LOG_FUNCS 0x10
461
#define IBIS_LOG_FRAMES 0x20
463
%section "IBIS Execution Flags",before,pre
464
/* These flags are updated by IBIS at run time to reflect internal state: */
470
%section "IBIS Functions",pre
471
/* IBIS UI functions */
473
This section provide the details about the functions IBIS exposes.
474
They all return 0 on succes.
477
int ibis_puts( uint8_t verbosity, char *msg);
478
/* Append a message to the OpenSM log */
480
/* prevent any exceptions on the following */
483
typedef struct _ibis_opt {
485
The IBIS options are available through the predefined object: ibis_opts.
486
It can be manipulated using the standard Tcl methods: cget and configure.
487
Examples: ibis_opts cget -force_log_flush
488
ibis_opts configure -force_log_flush TRUE */
489
// uint32_t transaction_timeout;
490
// /* The maximal time for a GetResp to be waited on before retry (100ms). */
491
boolean_t single_thread;
492
/* run single threaded */
493
boolean_t force_log_flush;
494
/* If TRUE - forces flash after each log message (TRUE). */
496
/* The log levels to be used */
498
/* The name of the log file used (read only) */
500
/* The SM_Key to be used when sending SubnetMgt and SubnetAdmin MADs */
502
/* The M_Key to be used when sending SubnetMgt */
504
/* The Vendor Key to be used when sending Vendor Specific MADs. */
507
%name(ibis_init) int ibis_ui_init();
508
/* Initialize ibis object */
509
int ibis_set_verbosity(int level);
510
/* Change the log verbosity */
511
int ibis_set_port(uint64_t guid);
512
/* Set the port IBIS is attached to and initialize all sub packages */
513
new_uint64_t ibis_get_port();
514
/* Provide the GUID of the port IBIS is attached to */
515
int ibis_set_transaction_timeout(uint32_t timeout_ms);
516
/* Set the transaction time out in [msec] */
517
%name(ibis_exit) int ibis_ui_destroy();
521
ibis_get_local_ports_info
523
Return the list of available IB ports with GUID, LID and State.
526
extern char * ibisSourceVersion;
533
/* Make sure that the osmv, complib and ibisp use
534
same modes (debug/free) */
535
if ( osm_is_debug() != cl_is_debug() ||
536
osm_is_debug() != ibisp_is_debug() ||
537
ibisp_is_debug() != cl_is_debug() )
539
fprintf(stderr, "-E- OSMV, Complib and Ibis were compiled using different modes\n");
540
fprintf(stderr, "-E- OSMV debug:%d Complib debug:%d IBIS debug:%d \n",
541
osm_is_debug(), cl_is_debug(), ibisp_is_debug() );
545
/* sub block required for declarations .... */
547
static int notFirstTime = 0;
549
/* we initialize the structs etc only once. */
550
if (0 == notFirstTime++) {
551
Tcl_StaticPackage(interp, "ibis", Ibis_Init, NULL);
552
Tcl_PkgProvide(interp, "ibis", IBIS_VERSION);
553
/* Default Options */
554
memset(&IbisOpts, 0,sizeof(ibis_opt_t));
555
IbisOpts.transaction_timeout = 4*OSM_DEFAULT_TRANS_TIMEOUT_MILLISEC;
556
IbisOpts.single_thread = TRUE;
557
IbisOpts.force_log_flush = TRUE;
561
IbisOpts.log_flags = OSM_LOG_ERROR;
562
strcpy(IbisOpts.log_file,"/tmp/ibis.log");
565
/* we want all exists to cleanup */
566
Tcl_CreateExitHandler(ibis_exit, NULL);
568
/* ------------------ IBCR ---------------------- */
569
p_ibcr_global = ibcr_construct();
571
if (p_ibcr_global == NULL) {
572
printf("-E- Error from ibcr_construct.\n");
576
/* ------------------ IBPM ---------------------- */
577
p_ibpm_global = ibpm_construct();
579
if (p_ibpm_global == NULL) {
580
printf("-E- Error from ibpm_construct.\n");
584
/* ------------------ IBVS ---------------------- */
585
p_ibvs_global = ibvs_construct();
587
if (p_ibvs_global == NULL) {
588
printf("-E- Error from ibvs_construct.\n");
592
/* ------------------ IBBBM ---------------------- */
593
p_ibbbm_global = ibbbm_construct();
595
if (p_ibbbm_global == NULL) {
596
printf("-E- Error from ibbbm_construct.\n");
600
/* ------------------ IBSM ---------------------- */
601
gp_ibsm = ibsm_construct();
603
if (gp_ibsm == NULL) {
604
printf("-E- Error from ibsm_construct.\n");
608
/* Initialize global records */
609
memset(&ibsm_node_info_obj, 0, sizeof(ib_node_info_t));
610
memset(&ibsm_port_info_obj, 0, sizeof(ib_port_info_t));
611
memset(&ibsm_switch_info_obj, 0, sizeof(ib_switch_info_t));
612
memset(&ibsm_lft_block_obj, 0, sizeof(ibsm_lft_block_t));
613
memset(&ibsm_mft_block_obj, 0, sizeof(ibsm_mft_block_t));
614
memset(&ibsm_guid_info_obj, 0, sizeof(ib_guid_info_t));
615
memset(&ibsm_pkey_table_obj, 0, sizeof(ib_pkey_table_t));
616
memset(&ibsm_sm_info_obj, 0, sizeof(ib_sm_info_t));
618
/* ------------------ IBCC ---------------------- */
620
gp_ibcc = ibcc_construct();
622
if (gp_ibcc == NULL) {
623
printf("-E- Error from ibcc_construct.\n");
627
/* Initialize global records */
628
memset(&ibcc_class_port_info_obj, 0, sizeof(ib_class_port_info_t));
629
memset(&ibcc_notice_obj, 0, sizeof(ibcc_notice_attr_t));
630
memset(&ibcc_cong_info_obj, 0, sizeof(ib_cong_info_t));
631
memset(&ibcc_cong_key_info_obj, 0, sizeof(ib_cong_key_info_t));
632
memset(&ibcc_ca_cong_log_obj, 0, sizeof(ibcc_ca_cong_log_t));
633
memset(&ibcc_sw_cong_log_obj, 0, sizeof(ibcc_sw_cong_log_t));
634
memset(&ibcc_sw_cong_setting_obj, 0, sizeof(ib_sw_cong_setting_t));
635
memset(&ibcc_sw_port_cong_setting_obj, 0, sizeof(ib_sw_port_cong_setting_t));
636
memset(&ibcc_ca_cong_setting_obj, 0, sizeof(ib_ca_cong_setting_t));
637
memset(&ibcc_table_obj, 0, sizeof(ib_cc_tbl_t));
638
memset(&ibcc_time_stamp_obj, 0, sizeof(ib_time_stamp_t));
640
/* ------------------ IBSAC ---------------------- */
642
/* Initialize global records */
643
memset(&ibsac_node_rec, 0,sizeof(ibsac_node_rec));
644
memset(&ibsac_portinfo_rec, 0,sizeof(ibsac_portinfo_rec));
645
memset(&ibsac_sminfo_rec, 0, sizeof(ib_sminfo_record_t));
646
memset(&ibsac_swinfo_rec, 0, sizeof(ib_switch_info_record_t));
647
memset(&ibsac_link_rec, 0, sizeof(ib_link_record_t));
648
memset(&ibsac_path_rec, 0, sizeof(ib_path_rec_t));
649
memset(&ibsac_lft_rec, 0, sizeof(ib_lft_record_t));
650
memset(&ibsac_mcm_rec, 0, sizeof(ib_member_rec_t));
653
* A1 Supported features:
655
* Query: Rec/Info Types Done
657
* NodeRecord (nr, ni) Y
658
* PortInfoRecord (pir, pi) Y
659
* SwitchInfoRecord (swir, swi) Y
660
* SMInfoRecord (smir, smi) Y
661
* PathRecord (path) Y
662
* LinkRecord (link) Y
663
* LinFwdTblRecord (lft) Y
664
* MulticastFwdTblRecord (mftr, mft) N - Not supported by OSM
666
* B Supported features:
667
* MCMemberRecord (mcm) Y
668
* ClassPortInfo (cpi) Y
669
* InformInfo (info) Y
670
* ServiceRecord (svc) Y
671
* SL2VLTableRecord (slvr, slvt) Y
672
* VLArbTableRecord (vlarb) Y
673
* PKeyTableRecord (pkr, pkt) Y
676
/* We use alternate SWIG Objects mangling */
678
SWIG_AltMnglRegTypeToPrefix("_sacNodeInfo_p", "ni");
679
SWIG_AltMnglRegTypeToPrefix("_sacNodeRec_p", "nr");
680
SWIG_AltMnglRegTypeToPrefix("_sacPortInfo_p", "pi");
681
SWIG_AltMnglRegTypeToPrefix("_sacPortRec_p", "pir");
682
SWIG_AltMnglRegTypeToPrefix("_sacSmInfo_p", "smi");
683
SWIG_AltMnglRegTypeToPrefix("_sacSmRec_p", "smir");
684
SWIG_AltMnglRegTypeToPrefix("_sacSwInfo_p", "swi");
685
SWIG_AltMnglRegTypeToPrefix("_sacSwRec_p", "swir");
686
SWIG_AltMnglRegTypeToPrefix("_sacLinkRec_p", "link");
687
SWIG_AltMnglRegTypeToPrefix("_sacPathRec_p", "path");
688
SWIG_AltMnglRegTypeToPrefix("_sacLFTRec_p", "lft");
689
SWIG_AltMnglRegTypeToPrefix("_sacMCMRec_p", "mcm");
690
SWIG_AltMnglRegTypeToPrefix("_sacClassPortInfo_p", "cpi");
691
SWIG_AltMnglRegTypeToPrefix("_sacInformInfo_p", "info");
692
SWIG_AltMnglRegTypeToPrefix("_sacServiceRec_p", "svc");
693
SWIG_AltMnglRegTypeToPrefix("_sacSlVlTbl_p", "slvt");
694
SWIG_AltMnglRegTypeToPrefix("_sacSlVlRec_p", "slvr");
695
SWIG_AltMnglRegTypeToPrefix("_sacVlArbRec_p", "vlarb");
696
SWIG_AltMnglRegTypeToPrefix("_sacPKeyTbl_p", "pkt");
697
SWIG_AltMnglRegTypeToPrefix("_sacPKeyRec_p", "pkr");
699
// register the pre-allocated objects
700
SWIG_AltMnglRegObj("ni",&(ibsac_node_rec.node_info));
701
SWIG_AltMnglRegObj("nr",&(ibsac_node_rec));
703
SWIG_AltMnglRegObj("pi", &(ibsac_portinfo_rec.port_info));
704
SWIG_AltMnglRegObj("pir",&(ibsac_portinfo_rec));
706
SWIG_AltMnglRegObj("smi", &(ibsac_sminfo_rec.sm_info));
707
SWIG_AltMnglRegObj("smir",&(ibsac_sminfo_rec));
709
SWIG_AltMnglRegObj("swi", &(ibsac_swinfo_rec.switch_info));
710
SWIG_AltMnglRegObj("swir",&(ibsac_swinfo_rec));
712
SWIG_AltMnglRegObj("path",&(ibsac_path_rec));
714
SWIG_AltMnglRegObj("link",&(ibsac_link_rec));
716
SWIG_AltMnglRegObj("lft",&(ibsac_lft_rec));
718
SWIG_AltMnglRegObj("mcm",&(ibsac_mcm_rec));
720
SWIG_AltMnglRegObj("cpi",&(ibsac_class_port_info));
721
SWIG_AltMnglRegObj("info",&(ibsac_inform_info));
722
SWIG_AltMnglRegObj("svc",&(ibsac_svc_rec));
724
SWIG_AltMnglRegObj("slvt", &(ibsac_slvl_rec.slvl_tbl));
725
SWIG_AltMnglRegObj("slvr", &(ibsac_slvl_rec));
727
SWIG_AltMnglRegObj("vlarb", &(ibsac_vlarb_rec));
729
SWIG_AltMnglRegObj("pkt", &(ibsac_pkey_rec.pkey_tbl));
730
SWIG_AltMnglRegObj("pkr", &(ibsac_pkey_rec));
735
/* we defined this as a native command so declare it in here */
736
Tcl_CreateObjCommand(interp, "ibis_get_local_ports_info",
737
ibis_get_local_ports_info, NULL, NULL);
739
/* this will declare an object osm_opts */
740
ibis_opt_p = &IbisOpts;
741
Tcl_CreateObjCommand(interp,"ibis_opts", Tclibis_opt_tMethodCmd,
742
(ClientData)ibis_opt_p, 0);
744
/* add commands for accessing the global query records */
746
/* ------------------ IBSM ---------------------- */
748
Tcl_CreateObjCommand(interp,"smNodeInfoMad",
749
TclsmNodeInfoMethodCmd,
750
(ClientData)&ibsm_node_info_obj, 0);
752
Tcl_CreateObjCommand(interp,"smPortInfoMad",
753
TclsmPortInfoMethodCmd,
754
(ClientData)&ibsm_port_info_obj, 0);
756
Tcl_CreateObjCommand(interp,"smSwitchInfoMad",
757
TclsmSwInfoMethodCmd,
758
(ClientData)&ibsm_switch_info_obj, 0);
760
Tcl_CreateObjCommand(interp,"smLftBlockMad",
761
TclsmLftBlockMethodCmd,
762
(ClientData)&ibsm_lft_block_obj, 0);
764
Tcl_CreateObjCommand(interp,"smMftBlockMad",
765
TclsmMftBlockMethodCmd,
766
(ClientData)&ibsm_mft_block_obj, 0);
768
Tcl_CreateObjCommand(interp,"smGuidInfoMad",
769
TclsmGuidInfoMethodCmd,
770
(ClientData)&ibsm_guid_info_obj, 0);
772
Tcl_CreateObjCommand(interp,"smPkeyTableMad",
773
TclsmPkeyTableMethodCmd,
774
(ClientData)&ibsm_pkey_table_obj, 0);
776
Tcl_CreateObjCommand(interp,"smSlVlTableMad",
777
TclsmSlVlTableMethodCmd,
778
(ClientData)&ibsm_slvl_table_obj, 0);
780
Tcl_CreateObjCommand(interp,"smVlArbTableMad",
781
TclsmVlArbTableMethodCmd,
782
(ClientData)&ibsm_vl_arb_table_obj, 0);
784
Tcl_CreateObjCommand(interp,"smSMInfoMad",
785
TclsmSMInfoMethodCmd,
786
(ClientData)&ibsm_sm_info_obj, 0);
788
Tcl_CreateObjCommand(interp,"smNodeDescMad",
789
TclsmNodeDescMethodCmd,
790
(ClientData)&ibsm_node_desc_obj, 0);
792
Tcl_CreateObjCommand(interp,"smNoticeMad",
793
TclsmNoticeMethodCmd,
794
(ClientData)&ibsm_notice_obj, 0);
796
/* ------------------ IBCC ---------------------- */
798
Tcl_CreateObjCommand(interp,"ccClassPortInfoMad",
799
TclccClassPortInfoMethodCmd,
800
(ClientData)&ibcc_class_port_info_obj, 0);
802
Tcl_CreateObjCommand(interp,"ccNoticeMad",
803
TclccNoticeMethodCmd,
804
(ClientData)&ibcc_notice_obj, 0);
806
Tcl_CreateObjCommand(interp,"ccCongestionInfoMad",
807
TclccCongestionInfoMethodCmd,
808
(ClientData)&ibcc_cong_info_obj, 0);
810
Tcl_CreateObjCommand(interp,"ccCongestionKeyInfoMad",
811
TclccCongestionKeyInfoMethodCmd,
812
(ClientData)&ibcc_cong_key_info_obj, 0);
814
Tcl_CreateObjCommand(interp,"ccCACongestionLogMad",
815
TclccCACongestionLogMethodCmd,
816
(ClientData)&ibcc_ca_cong_log_obj, 0);
818
Tcl_CreateObjCommand(interp,"ccSWCongestionLogMad",
819
TclccSWCongestionLogMethodCmd,
820
(ClientData)&ibcc_sw_cong_log_obj, 0);
822
Tcl_CreateObjCommand(interp,"ccSWCongestionSettingMad",
823
TclccSWCongestionSettingMethodCmd,
824
(ClientData)&ibcc_sw_cong_setting_obj, 0);
826
Tcl_CreateObjCommand(interp,"ccSWPortCongestionSettingMad",
827
TclccSWPortCongestionSettingMethodCmd,
828
(ClientData)&ibcc_sw_port_cong_setting_obj, 0);
830
Tcl_CreateObjCommand(interp,"ccCACongestionSettingMad",
831
TclccCACongestionSettingMethodCmd,
832
(ClientData)&ibcc_ca_cong_setting_obj, 0);
834
Tcl_CreateObjCommand(interp,"ccTableMad",
836
(ClientData)&ibcc_table_obj, 0);
838
Tcl_CreateObjCommand(interp,"ccTimeStampMad",
839
TclccTimeStampMethodCmd,
840
(ClientData)&ibcc_time_stamp_obj, 0);
842
/* ------------------ IBSAC --------------------- */
844
Tcl_CreateObjCommand(interp,"sacNodeQuery",
845
TclsacNodeRecMethodCmd,
846
(ClientData)&ibsac_node_rec, 0);
848
Tcl_CreateObjCommand(interp,"sacPortQuery",
849
TclsacPortRecMethodCmd,
850
(ClientData)&ibsac_portinfo_rec, 0);
852
Tcl_CreateObjCommand(interp,"sacSmQuery",
853
TclsacSmRecMethodCmd,
854
(ClientData)&ibsac_sminfo_rec, 0);
856
Tcl_CreateObjCommand(interp,"sacSwQuery",
857
TclsacSwRecMethodCmd,
858
(ClientData)&ibsac_swinfo_rec, 0);
860
Tcl_CreateObjCommand(interp,"sacLinkQuery",
861
TclsacLinkRecMethodCmd,
862
(ClientData)&ibsac_link_rec, 0);
864
Tcl_CreateObjCommand(interp,"sacPathQuery",
865
TclsacPathRecMethodCmd,
866
(ClientData)&ibsac_path_rec, 0);
868
Tcl_CreateObjCommand(interp,"sacLFTQuery",
869
TclsacLFTRecMethodCmd,
870
(ClientData)&ibsac_lft_rec, 0);
872
Tcl_CreateObjCommand(interp,"sacMCMQuery",
873
TclsacMCMRecMethodCmd,
874
(ClientData)&ibsac_mcm_rec, 0);
876
Tcl_CreateObjCommand(interp,"sacClassPortInfoQuery",
877
TclsacClassPortInfoMethodCmd,
878
(ClientData)&ibsac_class_port_info, 0);
880
Tcl_CreateObjCommand(interp,"sacInformInfoQuery",
881
TclsacInformInfoMethodCmd,
882
(ClientData)&ibsac_inform_info, 0);
884
Tcl_CreateObjCommand(interp,"sacServiceQuery",
885
TclsacServiceRecMethodCmd,
886
(ClientData)&ibsac_svc_rec, 0);
888
Tcl_CreateObjCommand(interp,"sacSLVlQuery",
889
TclsacSlVlRecMethodCmd,
890
(ClientData)&ibsac_slvl_rec, 0);
892
Tcl_CreateObjCommand(interp,"sacVlArbQuery",
893
TclsacVlArbRecMethodCmd,
894
(ClientData)&ibsac_vlarb_rec, 0);
896
Tcl_CreateObjCommand(interp,"sacPKeyQuery",
897
TclsacPKeyRecMethodCmd,
898
(ClientData)&ibsac_pkey_rec, 0);
901
use an embedded Tcl code for doing init if given command line
902
parameters: -port_num <port num>
906
"if {[file tail $argv0] == \"ibis\"} {\n"
907
" set _ibis_port_num_arg_idx [lsearch $argv -port_num]\n"
908
" if {$_ibis_port_num_arg_idx >= 0} {\n"
909
" if {[llength $argv] < $_ibis_port_num_arg_idx + 2} {\n"
910
" puts {ibis given -port_num with no actual port number argument}\n"
912
" set _ibis_port_num [lindex $argv [expr $_ibis_port_num_arg_idx + 1]]\n"
913
" set argv [lreplace $argv $_ibis_port_num_arg_idx [expr $_ibis_port_num_arg_idx + 1]]\n"
915
" set _ibis_all_ports [ibis_get_local_ports_info]\n"
916
" set first_port_idx [lsearch -all $_ibis_all_ports [lindex $_ibis_all_ports 0]]\n"
917
" if {[llength $first_port_idx] > 1} {\n"
918
" set _ibis_port_info [lindex $_ibis_all_ports $_ibis_port_num]\n"
920
" set _ibis_port_info [lindex $_ibis_all_ports [expr $_ibis_port_num - 1]]\n"
922
" if {[lindex $_ibis_port_info 2] != \"ACTIVE\"} {\n"
923
" puts \"Port $_ibis_port_num is not ACTIVE: $_ibis_port_info\"\n"
926
" ibis_set_port [lindex $_ibis_port_info 0]\n"
927
" puts \"Port set to:[lindex $_ibis_port_info 0]\"\n"