Lines Matching refs:sw

122 	if (p->p_node->sw)
123 return p->p_node->sw;
124 else if (p->p_remote_physp && p->p_remote_physp->p_node->sw)
125 return p->p_remote_physp->p_node->sw;
171 static inline int get_next_switch(lash_t *p_lash, int sw, int link)
173 return p_lash->switches[sw]->node->links[link]->switch_id;
176 static void remove_semipermanent_depend_for_sp(lash_t * p_lash, int sw,
186 output_link = switches[sw]->routing_table[dest_switch].out_link;
187 i_next_switch = get_next_switch(p_lash, sw, output_link);
189 while (sw != dest_switch) {
190 v = cdg_vertex_matrix[lane][sw][i_next_switch];
195 cdg_vertex_matrix[lane][sw][i_next_switch] = NULL;
230 sw = i_next_switch;
231 output_link = switches[sw]->routing_table[dest_switch].out_link;
233 if (sw != dest_switch)
234 i_next_switch = get_next_switch(p_lash, sw, output_link);
238 inline static void enqueue(cl_list_t * bfsq, switch_t * sw)
240 CL_ASSERT(sw->q_state == UNQUEUED);
241 sw->q_state = Q_MEMBER;
242 cl_list_insert_tail(bfsq, sw);
245 inline static void dequeue(cl_list_t * bfsq, switch_t ** sw)
247 *sw = (switch_t *) cl_list_remove_head(bfsq);
248 CL_ASSERT((*sw)->q_state == Q_MEMBER);
249 (*sw)->q_state = MST_MEMBER;
252 static int get_phys_connection(switch_t *sw, int switch_to)
256 for (i = 0; i < sw->node->num_links; i++)
257 if (sw->node->links[i]->switch_id == switch_to)
264 switch_t **switches = p_lash->switches, *sw, *swi;
274 dequeue(&bfsq, &sw);
275 for (i = 0; i < sw->node->num_links; i++) {
276 swi = switches[sw->node->links[i]->switch_id];
279 sw->dij_channels[sw->used_channels++] = swi->id;
291 switch_t *sw = p_lash->switches[sw_id];
292 int num_channels = sw->used_channels;
296 next_switch = sw->dij_channels[i];
304 if (sw->routing_table[i_dest->switch_id].out_link ==
306 sw->routing_table[i_dest->switch_id].out_link =
307 get_phys_connection(sw, next_switch);
321 i_dest->switch_id = sw->id;
327 static int generate_cdg_for_sp(lash_t * p_lash, int sw, int dest_switch,
336 output_link = switches[sw]->routing_table[dest_switch].out_link;
337 next_switch = get_next_switch(p_lash, sw, output_link);
339 while (sw != dest_switch) {
341 if (cdg_vertex_matrix[lane][sw][next_switch] == NULL) {
345 v->from = sw;
348 cdg_vertex_matrix[lane][sw][next_switch] = v;
350 v = cdg_vertex_matrix[lane][sw][next_switch];
376 sw = next_switch;
377 output_link = switches[sw]->routing_table[dest_switch].out_link;
379 if (sw != dest_switch) {
381 next_switch = get_next_switch(p_lash, sw, output_link);
389 static void set_temp_depend_to_permanent_for_sp(lash_t * p_lash, int sw,
397 output_link = switches[sw]->routing_table[dest_switch].out_link;
398 next_switch = get_next_switch(p_lash, sw, output_link);
400 while (sw != dest_switch) {
401 v = cdg_vertex_matrix[lane][sw][next_switch];
409 sw = next_switch;
410 output_link = switches[sw]->routing_table[dest_switch].out_link;
412 if (sw != dest_switch)
413 next_switch = get_next_switch(p_lash, sw, output_link);
418 static void remove_temp_depend_for_sp(lash_t * p_lash, int sw, int dest_switch,
426 output_link = switches[sw]->routing_table[dest_switch].out_link;
427 next_switch = get_next_switch(p_lash, sw, output_link);
429 while (sw != dest_switch) {
430 v = cdg_vertex_matrix[lane][sw][next_switch];
434 cdg_vertex_matrix[lane][sw][next_switch] = NULL;
446 sw = next_switch;
447 output_link = switches[sw]->routing_table[dest_switch].out_link;
449 if (sw != dest_switch)
450 next_switch = get_next_switch(p_lash, sw, output_link);
611 switch_t *sw;
614 sw = malloc(sizeof(*sw) + num_switches * sizeof(sw->routing_table[0]));
615 if (!sw)
618 memset(sw, 0, sizeof(*sw));
620 sw->routing_table[i].out_link = NONE;
621 sw->routing_table[i].lane = NONE;
624 sw->id = id;
625 sw->dij_channels = malloc(num_ports * sizeof(int));
626 if (!sw->dij_channels) {
627 free(sw);
631 sw->p_sw = p_sw;
632 p_sw->priv = sw;
634 if (osm_mesh_node_create(p_lash, sw)) {
635 free(sw->dij_channels);
636 free(sw);
640 return sw;
643 static void switch_delete(lash_t *p_lash, switch_t * sw)
645 if (sw->dij_channels)
646 free(sw->dij_channels);
647 free(sw);
971 static int get_next_port(switch_t *sw, int link)
973 link_t *l = sw->node->links[link];
1001 switch_t *sw;
1007 sw = p_sw->priv;
1018 uint8_t egress_port = port->p_node->sw ? 0 :
1033 (uint8_t) sw->
1036 get_next_port(sw, lash_egress_port);
1045 cl_ntoh64(current_guid), sw->id, lid,
1075 if (p_remote_physp && p_remote_physp->p_node->sw) {
1081 get_lash_id(p_remote_physp->p_node->sw);