743
743
static void calculate_far_max_ifp(struct ast_udptl *udptl)
745
unsigned new_max = 40;
745
unsigned new_max = 60;
747
747
/* calculate the maximum IFP the local endpoint should
748
748
* generate based on the far end's maximum datagram size
749
* and the current error correction mode
749
* and the current error correction mode. some endpoints
750
* bogus 'max datagram' values that would result in unusable
751
* (too small) maximum IFP values, so we have a a reasonable
752
* minimum value to ensure that we can actually construct
751
755
switch (udptl->error_correction_scheme) {
752
756
case UDPTL_ERROR_CORRECTION_NONE:
753
757
/* only need room for sequence number and length indicators */
754
new_max = udptl->far_max_datagram - 6;
758
new_max = MAX(new_max, udptl->far_max_datagram - 6);
756
760
case UDPTL_ERROR_CORRECTION_REDUNDANCY:
757
761
/* need room for sequence number, length indicators and the
758
762
* configured number of redundant packets
760
new_max = (udptl->far_max_datagram - 8) / (udptl->error_correction_entries + 1);
764
new_max = MAX(new_max, (udptl->far_max_datagram - 8) / (udptl->error_correction_entries + 1));
762
766
case UDPTL_ERROR_CORRECTION_FEC:
763
767
/* need room for sequence number, length indicators and a
764
768
* a single IFP of the maximum size expected
766
new_max = (udptl->far_max_datagram - 10) / 2;
770
new_max = MAX(new_max, (udptl->far_max_datagram - 10) / 2);
769
773
/* subtract 25% of space for insurance */