示例#1
0
static void srp_decrease_port_bandwidth(int max_frame_size, int extra_byte, int port) {
  int stream_bandwidth_bps = srp_calculate_stream_bandwidth(max_frame_size, extra_byte);
  port_bandwidth[port] -= stream_bandwidth_bps;
   debug_printf("Decreasing port %d shaper bandwidth to %d bps\n", port, port_bandwidth[port]);
  if (port_bandwidth[port] < 0) __builtin_trap();
  mac_set_qav_bandwidth(c_mac_tx, port, port_bandwidth[port]);
}
示例#2
0
文件: avb.c 项目: Pandacorn/sw_avb
static void avb_set_talker_bandwidth() 
{
#if defined(ETHERNET_TX_HP_QUEUE) && defined(ETHERNET_TRAFFIC_SHAPER)
  int data_size = 0;
  for (int i=0;i<AVB_NUM_SOURCES;i++) {
    avb_source_info_t *source = &sources[i];
    if (source->stream.state == AVB_SOURCE_STATE_POTENTIAL ||
        source->stream.state == AVB_SOURCE_STATE_ENABLED)
      {
        int samples_per_packet = (source->stream.rate + (AVB1722_PACKET_RATE-1))/AVB1722_PACKET_RATE;
        data_size += 18 + 32 + (source->stream.num_channels * samples_per_packet * 4);
      }
  }
  mac_set_qav_bandwidth(c_mac_tx, (data_size*8*AVB1722_PACKET_RATE*102)/100);  
#endif
}
示例#3
0
static void srp_increase_port_bandwidth(int max_frame_size, int extra_byte, int port) {
  int stream_bandwidth_bps = srp_calculate_stream_bandwidth(max_frame_size, extra_byte);
  port_bandwidth[port] += stream_bandwidth_bps;
  debug_printf("Increasing port %d shaper bandwidth to %d bps\n", port, port_bandwidth[port]);
  mac_set_qav_bandwidth(c_mac_tx, port, port_bandwidth[port]);
}