Logo Search packages:      
Sourcecode: libnl version File versions  Download package

int rtnl_qdisc_tbf_set_peakrate ( struct rtnl_qdisc *  qdisc,
int  rate,
int  bucket,
int  cell 
)

Set peak rate of TBF qdisc.

  • qdisc TBF qdisc to be modified.
  • rate New peak rate in bytes per second.
  • bucket Size of peakrate bucket.
  • cell Size of a peakrate cell or 0 to get default value.
    Returns:
    0 on success or a negative error code.

Definition at line 448 of file tbf.c.

References rtnl_tc_calc_txtime().

{
      struct rtnl_tbf *tbf;
      int cell_log;
      
      tbf = tbf_alloc(qdisc);
      if (!tbf)
            return nl_errno(ENOMEM);

      cell_log = calc_cell_log(cell, bucket);
      if (cell_log < 0)
            return cell_log;

      tbf->qt_peakrate.rs_rate = rate;
      tbf->qt_peakrate_bucket = bucket;
      tbf->qt_peakrate.rs_cell_log = cell_log;
      tbf->qt_peakrate_txtime = rtnl_tc_calc_txtime(bucket, rate);
      
      tbf->qt_mask |= TBF_ATTR_PEAKRATE;

      return 0;
}


Generated by  Doxygen 1.6.0   Back to index