📄 router.h
字号:
#define RPPARM_PORTMATE_SHFT 21 /* Port Mate for the port */#define RPPARM_PORTMATE_MASK (UINT64_CAST 0x7 << 21)#define RPPARM_HISTEN_SHFT 20 /* Histogram counter enable */#define RPPARM_HISTEN_MASK (UINT64_CAST 0x1 << 20)#define RPPARM_HISTSEL_SHFT 18#define RPPARM_HISTSEL_MASK (UINT64_CAST 0x3 << 18)#define RPPARM_DAMQHS_SHFT 16#define RPPARM_DAMQHS_MASK (UINT64_CAST 0x3 << 16)#define RPPARM_NULLTO_SHFT 10#define RPPARM_NULLTO_MASK (UINT64_CAST 0x3f << 10)#define RPPARM_MAXBURST_SHFT 0#define RPPARM_MAXBURST_MASK (UINT64_CAST 0x3ff)/* * NOTE: Normally the kernel tracks only UTILIZATION statistics. * The other 2 should not be used, except during any experimentation * with the router. */#define RPPARM_HISTSEL_AGE 0 /* Histogram age characterization. */#define RPPARM_HISTSEL_UTIL 1 /* Histogram link utilization */#define RPPARM_HISTSEL_DAMQ 2 /* Histogram DAMQ characterization. *//* * RR_STATUS_ERROR(_L) and RR_ERROR_CLEAR(_L) mask and shift definitions */#define RSERR_POWERNOK (UINT64_CAST 1 << 38)#define RSERR_PORT_DEADLOCK (UINT64_CAST 1 << 37)#define RSERR_WARMRESET (UINT64_CAST 1 << 36)#define RSERR_LINKRESET (UINT64_CAST 1 << 35)#define RSERR_RETRYTIMEOUT (UINT64_CAST 1 << 34)#define RSERR_FIFOOVERFLOW (UINT64_CAST 1 << 33)#define RSERR_ILLEGALPORT (UINT64_CAST 1 << 32)#define RSERR_DEADLOCKTO_SHFT 28#define RSERR_DEADLOCKTO_MASK (UINT64_CAST 0xf << 28)#define RSERR_RECVTAILTO_SHFT 24#define RSERR_RECVTAILTO_MASK (UINT64_CAST 0xf << 24)#define RSERR_RETRYCNT_SHFT 16#define RSERR_RETRYCNT_MASK (UINT64_CAST 0xff << 16)#define RSERR_CBERRCNT_SHFT 8#define RSERR_CBERRCNT_MASK (UINT64_CAST 0xff << 8)#define RSERR_SNERRCNT_SHFT 0#define RSERR_SNERRCNT_MASK (UINT64_CAST 0xff << 0)#define PORT_STATUS_UP (1 << 0) /* Router link up */#define PORT_STATUS_FENCE (1 << 1) /* Router link fenced */#define PORT_STATUS_RESETFAIL (1 << 2) /* Router link didnot * come out of reset */#define PORT_STATUS_DISCFAIL (1 << 3) /* Router link failed after * out of reset but before * router tables were * programmed */#define PORT_STATUS_KERNFAIL (1 << 4) /* Router link failed * after reset and the * router tables were * programmed */#define PORT_STATUS_UNDEF (1 << 5) /* Unable to pinpoint * why the router link * went down */ #define PROBE_RESULT_BAD (-1) /* Set if any of the router * links failed after reset */#define PROBE_RESULT_GOOD (0) /* Set if all the router links * which came out of reset * are up *//* Should be enough for 256 CPUs */#define MAX_RTR_BREADTH 64 /* Max # of routers possible *//* Get the require set of bits in a var. corr to a sequence of bits */#define GET_FIELD(var, fname) \ ((var) >> fname##_SHFT & fname##_MASK >> fname##_SHFT)/* Set the require set of bits in a var. corr to a sequence of bits */#define SET_FIELD(var, fname, fval) \ ((var) = (var) & ~fname##_MASK | (uint64_t) (fval) << fname##_SHFT)#ifndef __ASSEMBLY__typedef struct router_map_ent_s { uint64_t nic; moduleid_t module; slotid_t slot;} router_map_ent_t;struct rr_status_error_fmt { uint64_t rserr_unused : 30, rserr_fifooverflow : 1, rserr_illegalport : 1, rserr_deadlockto : 4, rserr_recvtailto : 4, rserr_retrycnt : 8, rserr_cberrcnt : 8, rserr_snerrcnt : 8;};/* * This type is used to store "absolute" counts of router events */typedef int router_count_t;/* All utilizations are on a scale from 0 - 1023. */#define RP_BYPASS_UTIL 0#define RP_RCV_UTIL 1#define RP_SEND_UTIL 2#define RP_TOTAL_PKTS 3 /* Free running clock/packet counter */#define RP_NUM_UTILS 3#define RP_HIST_REGS 2#define RP_NUM_BUCKETS 4#define RP_HIST_TYPES 3#define RP_AGE0 0#define RP_AGE1 1#define RP_AGE2 2#define RP_AGE3 3#define RR_UTIL_SCALE 1024/* * Router port-oriented information */typedef struct router_port_info_s { router_reg_t rp_histograms[RP_HIST_REGS];/* Port usage info */ router_reg_t rp_port_error; /* Port error info */ router_count_t rp_retry_errors; /* Total retry errors */ router_count_t rp_sn_errors; /* Total sn errors */ router_count_t rp_cb_errors; /* Total cb errors */ int rp_overflows; /* Total count overflows */ int rp_excess_err; /* Port has excessive errors */ ushort rp_util[RP_NUM_BUCKETS];/* Port utilization */} router_port_info_t;#define ROUTER_INFO_VERSION 7struct lboard_s;/* * Router information */typedef struct router_info_s { char ri_version; /* structure version */ cnodeid_t ri_cnode; /* cnode of its legal guardian hub */ nasid_t ri_nasid; /* Nasid of same */ char ri_ledcache; /* Last LED bitmap */ char ri_leds; /* Current LED bitmap */ char ri_portmask; /* Active port bitmap */ router_reg_t ri_stat_rev_id; /* Status rev ID value */ net_vec_t ri_vector; /* vector from guardian to router */ int ri_writeid; /* router's vector write ID */ int64_t ri_timebase; /* Time of first sample */ int64_t ri_timestamp; /* Time of last sample */ router_port_info_t ri_port[MAX_ROUTER_PORTS]; /* per port info */ moduleid_t ri_module; /* Which module are we in? */ slotid_t ri_slotnum; /* Which slot are we in? */ router_reg_t ri_glbl_parms[GLBL_PARMS_REGS]; /* Global parms0&1 register contents*/ vertex_hdl_t ri_vertex; /* hardware graph vertex */ router_reg_t ri_prot_conf; /* protection config. register */ int64_t ri_per_minute; /* Ticks per minute */ /* * Everything below here is for kernel use only and may change at * at any time with or without a change in the revision number * * Any pointers or things that come and go with DEBUG must go at * the bottom of the structure, below the user stuff. */ char ri_hist_type; /* histogram type */ vertex_hdl_t ri_guardian; /* guardian node for the router */ int64_t ri_last_print; /* When did we last print */ char ri_print; /* Should we print */ char ri_just_blink; /* Should we blink the LEDs */ #ifdef DEBUG int64_t ri_deltatime; /* Time it took to sample */#endif spinlock_t ri_lock; /* Lock for access to router info */ net_vec_t *ri_vecarray; /* Pointer to array of vectors */ struct lboard_s *ri_brd; /* Pointer to board structure */ char * ri_name; /* This board's hwg path */ unsigned char ri_port_maint[MAX_ROUTER_PORTS]; /* should we send a message to availmon */} router_info_t;/* Router info location specifiers */#define RIP_PROMLOG 2 /* Router info in promlog */#define RIP_CONSOLE 4 /* Router info on console */#define ROUTER_INFO_PRINT(_rip,_where) (_rip->ri_print |= _where) /* Set the field used to check if a * router info can be printed */#define IS_ROUTER_INFO_PRINTED(_rip,_where) \ (_rip->ri_print & _where) /* Was the router info printed to * the given location (_where) ? * Mainly used to prevent duplicate * router error states. */#define ROUTER_INFO_LOCK(_rip,_s) _s = mutex_spinlock(&(_rip->ri_lock)) /* Take the lock on router info * to gain exclusive access */#define ROUTER_INFO_UNLOCK(_rip,_s) mutex_spinunlock(&(_rip->ri_lock),_s) /* Release the lock on router info *//* * Router info hanging in the nodepda */typedef struct nodepda_router_info_s { vertex_hdl_t router_vhdl; /* vertex handle of the router */ short router_port; /* port thru which we entered */ short router_portmask; moduleid_t router_module; /* module in which router is there */ slotid_t router_slot; /* router slot */ unsigned char router_type; /* kind of router */ net_vec_t router_vector; /* vector from the guardian node */ router_info_t *router_infop; /* info hanging off the hwg vertex */ struct nodepda_router_info_s *router_next; /* pointer to next element */} nodepda_router_info_t;#define ROUTER_NAME_SIZE 20 /* Max size of a router name */#define NORMAL_ROUTER_NAME "normal_router"#define NULL_ROUTER_NAME "null_router"#define META_ROUTER_NAME "meta_router"#define REPEATER_ROUTER_NAME "repeater_router"#define UNKNOWN_ROUTER_NAME "unknown_router" /* The following definitions are needed by the router traversing * code either using the hardware graph or using vector operations. *//* Structure of the router queue element */typedef struct router_elt_s { union { /* queue element structure during router probing */ struct { /* number-in-a-can (unique) for the router */ nic_t nic; /* vector route from the master hub to * this router. */ net_vec_t vec; /* port status */ uint64_t status; char port_status[MAX_ROUTER_PORTS + 1]; } r_elt; /* queue element structure during router guardian * assignment */ struct { /* vertex handle for the router */ vertex_hdl_t vhdl; /* guardian for this router */ vertex_hdl_t guard; /* vector router from the guardian to the router */ net_vec_t vec; } k_elt; } u; /* easy to use port status interpretation */} router_elt_t;/* structure of the router queue */typedef struct router_queue_s { char head; /* Point where a queue element is inserted */ char tail; /* Point where a queue element is removed */ int type; router_elt_t array[MAX_RTR_BREADTH]; /* Entries for queue elements */} router_queue_t;#endif /* __ASSEMBLY__ *//* * RR_HISTOGRAM(_L) mask and shift definitions * There are two 64 bit histogram registers, so the following macros take * into account dealing with an array of 4 32 bit values indexed by _x */#define RHIST_BUCKET_SHFT(_x) (32 * ((_x) & 0x1))#define RHIST_BUCKET_MASK(_x) (UINT64_CAST 0xffffffff << RHIST_BUCKET_SHFT((_x) & 0x1))#define RHIST_GET_BUCKET(_x, _reg) \ ((RHIST_BUCKET_MASK(_x) & ((_reg)[(_x) >> 1])) >> RHIST_BUCKET_SHFT(_x))/* * RR_RESET_MASK(_L) mask and shift definitions */#define RRM_RESETOK(_L) (UINT64_CAST 1 << ((_L) - 1))#define RRM_RESETOK_ALL ALL_PORTS/* * RR_META_TABLE(_x) and RR_LOCAL_TABLE(_x) mask and shift definitions */#define RTABLE_SHFT(_L) (4 * ((_L) - 1))#define RTABLE_MASK(_L) (UINT64_CAST 0x7 << RTABLE_SHFT(_L))#define ROUTERINFO_STKSZ 4096#ifndef __ASSEMBLY__int router_reg_read(router_info_t *rip, int regno, router_reg_t *val);int router_reg_write(router_info_t *rip, int regno, router_reg_t val);int router_get_info(vertex_hdl_t routerv, router_info_t *, int);int router_set_leds(router_info_t *rip);void router_print_state(router_info_t *rip, int level, void (*pf)(int, char *, ...),int print_where);void capture_router_stats(router_info_t *rip);int probe_routers(void);void get_routername(unsigned char brd_type,char *rtrname);void router_guardians_set(vertex_hdl_t hwgraph_root);int router_hist_reselect(router_info_t *, int64_t);#endif /* __ASSEMBLY__ */#endif /* _ASM_IA64_SN_ROUTER_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -