]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/tc_core.c
Merge branch 'main' into next
[mirror_iproute2.git] / tc / tc_core.c
index 8eb11223eb9d9c7fe0adabd76eb994d25b0508c3..498d35dca8fbfcbd4efe1bf24fbd05c3bcb9bd96 100644 (file)
@@ -152,6 +152,35 @@ int tc_calc_rtable(struct tc_ratespec *r, __u32 *rtab,
        return cell_log;
 }
 
+int tc_calc_rtable_64(struct tc_ratespec *r, __u32 *rtab,
+                  int cell_log, unsigned int mtu,
+                  enum link_layer linklayer, __u64 rate)
+{
+       int i;
+       unsigned int sz;
+       __u64 bps = rate;
+       unsigned int mpu = r->mpu;
+
+       if (mtu == 0)
+               mtu = 2047;
+
+       if (cell_log < 0) {
+               cell_log = 0;
+               while ((mtu >> cell_log) > 255)
+                       cell_log++;
+       }
+
+       for (i = 0; i < 256; i++) {
+               sz = tc_adjust_size((i + 1) << cell_log, mpu, linklayer);
+               rtab[i] = tc_calc_xmittime(bps, sz);
+       }
+
+       r->cell_align =  -1;
+       r->cell_log = cell_log;
+       r->linklayer = (linklayer & TC_LINKLAYER_MASK);
+       return cell_log;
+}
+
 /*
    stab[pkt_len>>cell_log] = pkt_xmit_size>>size_log
  */