commit bef89920de0a25f3ef0c1965652679174e15152f Author: Jesper Dangaard Brouer Date: Fri Oct 26 01:01:11 2007 +0200 [IPROUTE2]: ATM cell alignment for ADSL. Modify the rate table to be aligned for ATM cells. This will provide accurate packets scheduling for links that uses an underlying ATM link layer, e.g. ADSL. This patch is quite cruel, as its not possible to change the setting runtime. Once the define ATM_ALIGN is set and the TC util is compiled, all rate tables are ATM cell aligned. Signed-off-by: Jesper Dangaard Brouer diff --git a/tc/tc_core.c b/tc/tc_core.c index 752b07c..5468112 100644 --- a/tc/tc_core.c +++ b/tc/tc_core.c @@ -65,6 +65,34 @@ unsigned tc_calc_xmitsize(unsigned rate, unsigned ticks) return ((double)rate*tc_core_tick2time(ticks))/TIME_UNITS_PER_SEC; } +#ifndef ATM_CELL_SIZE +#define ATM_CELL_SIZE 53 /* ATM cell size incl. header */ +#endif +#ifndef ATM_CELL_PAYLOAD +#define ATM_CELL_PAYLOAD 48 /* ATM payload size */ +#endif + +#define ATM_ALIGN y +/* + The align_to_cells is used for determining the (ATM) SAR alignment + overhead at the ATM layer. (SAR = Segmentation And Reassembly) + This is for example needed when scheduling packet on an ADSL + connection. The ATM-AAL overhead should preferably be added in the + kernel when doing table lookups (due to precision/alignment of the + table), if not the ATM-AAL overhead should be added to the size + before calling the function. --Hawk, d.7/11-2004. + */ +unsigned tc_align_to_cells(unsigned size, int cell_size, int cell_payload) +{ + int linksize, cells; + cells = size / cell_payload; + if ((size % cell_payload) > 0) { + cells++; + } + linksize = cells * cell_size; + return linksize; +} + /* rtab[pkt_len>>cell_log] = pkt_xmit_time */ @@ -87,6 +115,9 @@ int tc_calc_rtable(struct tc_ratespec *r, __u32 *rtab, int cell_log, unsigned mt unsigned sz = ((i+1)<cell_align=-1; // Due to the sz calc