Lines Matching refs:node

63 char *ibnd_get_chassis_type(ibnd_node_t * node)  in ibnd_get_chassis_type()  argument
67 if (!node) { in ibnd_get_chassis_type()
72 if (!node->chassis) in ibnd_get_chassis_type()
75 chassis_type = mad_get_field(node->info, 0, IB_NODE_VENDORID_F); in ibnd_get_chassis_type()
81 if (node->ch_type == UNRESOLVED_CT || node->ch_type > ISR4200_CT) in ibnd_get_chassis_type()
83 return ChassisTypeStr[node->ch_type]; in ibnd_get_chassis_type()
87 if (node->ch_type_str[0] == '\0') in ibnd_get_chassis_type()
89 return node->ch_type_str; in ibnd_get_chassis_type()
99 char *ibnd_get_chassis_slot_str(ibnd_node_t * node, char *str, size_t size) in ibnd_get_chassis_slot_str() argument
103 if (!node) { in ibnd_get_chassis_slot_str()
109 vendor_id = mad_get_field(node->info, 0,IB_NODE_VENDORID_F); in ibnd_get_chassis_slot_str()
113 if (!node->chassis) in ibnd_get_chassis_slot_str()
115 if (node->ch_slot == UNRESOLVED_CS || node->ch_slot > SRBD_CS) in ibnd_get_chassis_slot_str()
119 snprintf(str, size, "%s %d Chip %d", ChassisSlotTypeStr[node->ch_slot], in ibnd_get_chassis_slot_str()
120 node->ch_slotnum, node->ch_anafanum); in ibnd_get_chassis_slot_str()
193 static uint64_t xsigo_chassisguid(ibnd_node_t * node) in xsigo_chassisguid() argument
196 mad_get_field64(node->info, 0, IB_NODE_SYSTEM_GUID_F); in xsigo_chassisguid()
207 if (!node->ports || !node->ports[1]) in xsigo_chassisguid()
211 if (!node->ports[1]->remoteport) in xsigo_chassisguid()
216 mad_get_field64(node->ports[1]->remoteport->node->info, 0, in xsigo_chassisguid()
225 static uint64_t get_chassisguid(ibnd_node_t * node) in get_chassisguid() argument
227 uint32_t vendid = mad_get_field(node->info, 0, IB_NODE_VENDORID_F); in get_chassisguid()
229 mad_get_field64(node->info, 0, IB_NODE_SYSTEM_GUID_F); in get_chassisguid()
234 return xsigo_chassisguid(node); in get_chassisguid()
240 ibnd_node_t * node) in find_chassisguid() argument
245 chguid = get_chassisguid(node); in find_chassisguid()
529 if (is_spine_9096(spineport->node)) { in get_router_slot()
533 } else if (is_spine_9288(spineport->node)) { in get_router_slot()
537 guessnum = spineport->node->guid % 4; in get_router_slot()
542 } else if (is_spine_2012(spineport->node)) { in get_router_slot()
546 guessnum = spineport->node->guid % 4; in get_router_slot()
551 } else if (is_spine_2004(spineport->node)) { in get_router_slot()
557 spineport->node->guid); in get_router_slot()
565 if (is_spine_9096(spineport->node)) { in get_slb_slot()
569 } else if (is_spine_9288(spineport->node)) { in get_slb_slot()
573 } else if (is_spine_2012(spineport->node)) { in get_slb_slot()
577 } else if (is_spine_2004(spineport->node)) { in get_slb_slot()
581 } else if (is_spine_4700(spineport->node)) { in get_slb_slot()
585 } else if (is_spine_4700x2(spineport->node)) { in get_slb_slot()
589 } else if (is_spine_4200(spineport->node)) { in get_slb_slot()
595 spineport->node->guid); in get_slb_slot()
604 static int fill_mellanox_chassis_record(ibnd_node_t * node) in fill_mellanox_chassis_record() argument
628 memcpy(node_desc, node->nodedesc, IB_SMP_DATA_SIZE); in fill_mellanox_chassis_record()
632 if (node->ch_found) /* somehow this node has already been passed */ in fill_mellanox_chassis_record()
636 dev_id = mad_get_field(node->info, 0,IB_NODE_DEVID_F); in fill_mellanox_chassis_record()
691 node->ch_anafanum = (unsigned char) atoi(&node_index[1]); in fill_mellanox_chassis_record()
692 if(node->ch_anafanum != 1){ in fill_mellanox_chassis_record()
693 IBND_DEBUG("Unexpected Chip number:%d \n",node->ch_anafanum); in fill_mellanox_chassis_record()
699 node->ch_slot = LINE_CS; in fill_mellanox_chassis_record()
701 node->ch_slot = SPINE_CS; in fill_mellanox_chassis_record()
708 node->ch_found = 1; in fill_mellanox_chassis_record()
710 node->ch_slotnum = (unsigned char) atoi(&system_slot_name[1]); in fill_mellanox_chassis_record()
711 if((node->ch_slot == LINE_CS && (node->ch_slotnum > (LINES_MAX_NUM + 1))) || in fill_mellanox_chassis_record()
712 (node->ch_slot == SPINE_CS && (node->ch_slotnum > (SPINES_MAX_NUM + 1)))){ in fill_mellanox_chassis_record()
713 IBND_ERROR("fill_mellanox_chassis_record: invalid slot number:%d \n",node->ch_slotnum); in fill_mellanox_chassis_record()
714 node->ch_slotnum = 0; in fill_mellanox_chassis_record()
719 strncpy(node->ch_type_str , system_type, sizeof(node->ch_type_str)-1); in fill_mellanox_chassis_record()
722 if(node->ch_slot == LINE_CS) in fill_mellanox_chassis_record()
724 for (p = 1; p <= node->numports && p <= 18 ; p++) { in fill_mellanox_chassis_record()
725 port = node->ports[p]; in fill_mellanox_chassis_record()
735 static int insert_mellanox_line_and_spine(ibnd_node_t * node, ibnd_chassis_t * chassis) in insert_mellanox_line_and_spine() argument
737 if (node->ch_slot == LINE_CS){ in insert_mellanox_line_and_spine()
739 if (chassis->linenode[node->ch_slotnum]) in insert_mellanox_line_and_spine()
742 chassis->linenode[node->ch_slotnum] = node; in insert_mellanox_line_and_spine()
744 else if (node->ch_slot == SPINE_CS){ in insert_mellanox_line_and_spine()
746 if (chassis->spinenode[node->ch_slotnum]) in insert_mellanox_line_and_spine()
749 chassis->spinenode[node->ch_slotnum] = node; in insert_mellanox_line_and_spine()
754 node->chassis = chassis; in insert_mellanox_line_and_spine()
767 static int fill_voltaire_chassis_record(ibnd_node_t * node) in fill_voltaire_chassis_record() argument
773 if (node->ch_found) /* somehow this node has already been passed */ in fill_voltaire_chassis_record()
775 node->ch_found = 1; in fill_voltaire_chassis_record()
780 if (is_router(node)) in fill_voltaire_chassis_record()
782 for (p = 1; p <= node->numports; p++) { in fill_voltaire_chassis_record()
783 port = node->ports[p]; in fill_voltaire_chassis_record()
784 if (port && is_spine(port->remoteport->node)) in fill_voltaire_chassis_record()
785 get_router_slot(node, port->remoteport); in fill_voltaire_chassis_record()
787 else if (is_spine(node)) { in fill_voltaire_chassis_record()
788 int is_4700x2 = is_spine_4700x2(node); in fill_voltaire_chassis_record()
790 for (p = 1; p <= node->numports; p++) { in fill_voltaire_chassis_record()
791 port = node->ports[p]; in fill_voltaire_chassis_record()
802 remnode = port->remoteport->node; in fill_voltaire_chassis_record()
808 if (!node->ch_type) in fill_voltaire_chassis_record()
810 get_sfb_slot(node, port->remoteport); in fill_voltaire_chassis_record()
815 } else if (is_line(node)) { in fill_voltaire_chassis_record()
816 int is_4700_line = is_line_4700(node); in fill_voltaire_chassis_record()
818 for (p = 1; p <= node->numports; p++) { in fill_voltaire_chassis_record()
819 port = node->ports[p]; in fill_voltaire_chassis_record()
828 get_slb_slot(node, port->remoteport); in fill_voltaire_chassis_record()
834 for (p = 1; p <= node->numports; p++) { in fill_voltaire_chassis_record()
835 port = node->ports[p]; in fill_voltaire_chassis_record()
844 static int get_line_index(ibnd_node_t * node) in get_line_index() argument
848 if (is_line_4700(node)) in get_line_index()
849 retval = node->ch_slotnum; in get_line_index()
851 retval = 3 * (node->ch_slotnum - 1) + node->ch_anafanum; in get_line_index()
861 static int get_spine_index(ibnd_node_t * node) in get_spine_index() argument
865 if (is_spine_9288(node) || is_spine_2012(node)) in get_spine_index()
866 retval = 3 * (node->ch_slotnum - 1) + node->ch_anafanum; in get_spine_index()
867 else if (is_spine_4700(node) || is_spine_4700x2(node)) in get_spine_index()
868 retval = 2 * (node->ch_slotnum - 1) + node->ch_anafanum; in get_spine_index()
870 retval = node->ch_slotnum; in get_spine_index()
879 static int insert_line_router(ibnd_node_t * node, ibnd_chassis_t * chassis) in insert_line_router() argument
881 int i = get_line_index(node); in insert_line_router()
889 chassis->linenode[i] = node; in insert_line_router()
890 node->chassis = chassis; in insert_line_router()
894 static int insert_spine(ibnd_node_t * node, ibnd_chassis_t * chassis) in insert_spine() argument
896 int i = get_spine_index(node); in insert_spine()
904 chassis->spinenode[i] = node; in insert_spine()
905 node->chassis = chassis; in insert_spine()
911 ibnd_node_t *node, *remnode; in pass_on_lines_catch_spines() local
918 node = chassis->linenode[i]; in pass_on_lines_catch_spines()
920 if (!(node && is_line(node))) in pass_on_lines_catch_spines()
923 is_4700_line = is_line_4700(node); in pass_on_lines_catch_spines()
925 for (p = 1; p <= node->numports; p++) { in pass_on_lines_catch_spines()
927 port = node->ports[p]; in pass_on_lines_catch_spines()
935 remnode = port->remoteport->node; in pass_on_lines_catch_spines()
948 ibnd_node_t *node, *remnode; in pass_on_spines_catch_lines() local
955 node = chassis->spinenode[i]; in pass_on_spines_catch_lines()
956 if (!node) in pass_on_spines_catch_lines()
959 is_4700x2 = is_spine_4700x2(node); in pass_on_spines_catch_lines()
961 for (p = 1; p <= node->numports; p++) { in pass_on_spines_catch_lines()
962 port = node->ports[p]; in pass_on_spines_catch_lines()
973 remnode = port->remoteport->node; in pass_on_spines_catch_lines()
991 ibnd_node_t *node; in pass_on_spines_interpolate_chguid() local
995 node = chassis->spinenode[i]; in pass_on_spines_interpolate_chguid()
996 if (!node) in pass_on_spines_interpolate_chguid()
1000 chassis->chassisguid = node->guid - 1; in pass_on_spines_interpolate_chguid()
1010 static int build_chassis(ibnd_node_t * node, ibnd_chassis_t * chassis) in build_chassis() argument
1017 if (insert_spine(node, chassis)) in build_chassis()
1021 for (p = 1; p <= node->numports; p++) { in build_chassis()
1023 port = node->ports[p]; in build_chassis()
1031 if (is_spine_4700x2(node) && (port->portnum > 18)) in build_chassis()
1034 remnode = port->remoteport->node; in build_chassis()
1162 ibnd_node_t *node = port->node; in voltaire_portmap() local
1163 int is_4700_line = is_line_4700(node); in voltaire_portmap()
1164 int is_4700x2_spine = is_spine_4700x2(node); in voltaire_portmap()
1166 if (!node->ch_found || (!is_line(node) && !is_4700x2_spine)) { in voltaire_portmap()
1179 if (port->node->ch_anafanum < 1 || port->node->ch_anafanum > 2) { in voltaire_portmap()
1184 chipnum = port->node->ch_anafanum - 1; in voltaire_portmap()
1186 if (is_line_24(node)) in voltaire_portmap()
1188 else if (is_line_2024(node)) in voltaire_portmap()
1219 static void add_node_to_chassis(ibnd_chassis_t * chassis, ibnd_node_t * node) in add_node_to_chassis() argument
1221 node->chassis = chassis; in add_node_to_chassis()
1222 node->next_chassis_node = chassis->nodes; in add_node_to_chassis()
1223 chassis->nodes = node; in add_node_to_chassis()
1240 ibnd_node_t *node; in group_nodes() local
1255 for (node = fabric->switches; node; node = node->type_next) { in group_nodes()
1257 vendor_id = mad_get_field(node->info, 0,IB_NODE_VENDORID_F); in group_nodes()
1260 && fill_voltaire_chassis_record(node)) in group_nodes()
1263 && fill_mellanox_chassis_record(node)) in group_nodes()
1270 for (node = fabric->switches; node; node = node->type_next) { in group_nodes()
1271 if (mad_get_field(node->info, 0, in group_nodes()
1274 if (!node->ch_found in group_nodes()
1275 || (node->chassis && node->chassis->chassisnum) in group_nodes()
1276 || !is_spine(node)) in group_nodes()
1281 if (build_chassis(node, chassis_scan.current_chassis)) in group_nodes()
1287 for (node = fabric->nodes; node; node = node->next) { in group_nodes()
1288 if (mad_get_field(node->info, 0, in group_nodes()
1291 if (mad_get_field64(node->info, 0, IB_NODE_SYSTEM_GUID_F)) { in group_nodes()
1292 chassis = find_chassisguid(fabric, node); in group_nodes()
1300 get_chassisguid(node); in group_nodes()
1310 for (node = fabric->nodes; node; node = node->next) { in group_nodes()
1312 vendor_id = mad_get_field(node->info, 0,IB_NODE_VENDORID_F); in group_nodes()
1316 if (mad_get_field64(node->info, 0, IB_NODE_SYSTEM_GUID_F)) { in group_nodes()
1317 chassis = find_chassisguid(fabric, node); in group_nodes()
1321 if (!node->ch_found) { in group_nodes()
1322 node->ch_found = 1; in group_nodes()
1323 add_node_to_chassis(chassis, node); in group_nodes()
1326 insert_mellanox_line_and_spine(node, chassis); in group_nodes()