lib/rstp.c
/* Converts the link speed to a port path cost [Table 17-3]. */
Converts the link speed to a port path cost [Table 17-3].
Converts the link speed to a port path cost [ Table 17 - 3 ] .
uint32_t
rstp_convert_speed_to_cost(unsigned int speed)
{
    uint32_t value;
    value = speed >= 10000000 ? 2 
          : speed >= 1000000 ? 20 
          : speed >= 100000 ? 200 
          : speed >= 10000 ? 2000 
          : speed >= 1000 ? 20000 
          : speed >= 100 ? 200000 
          : speed >= 10 ? 2000000 
          : speed >= 1 ? 20000000 
          : RSTP_DEFAULT_PORT_PATH_COST; 
    return value;
}
uint32_t rstp_convert_speed_to_cost ( unsigned int speed ) { uint32_t value ; value = speed >= 10000000 ? 2 : speed >= 1000000 ? 20 : speed >= 100000 ? 200 : speed >= 10000 ? 2000 : speed >= 1000 ? 20000 : speed >= 100 ? 200000 : speed >= 10 ? 2000000 : speed >= 1 ? 20000000 : RSTP_DEFAULT_PORT_PATH_COST ; return value ; }
Converts the link speed to a port path cost [Table 17-3].
Converts the link speed to a port path cost [ Table 17 - 3 ] .
/* 10 Tb/s. */ /* 1 Tb/s. */ /* 100 Gb/s. */ /* 10 Gb/s. */ /* 1 Gb/s. */ /* 100 Mb/s. */ /* 10 Mb/s. */ /* 1 Mb/s. */ /* 100 Mb/s. */