MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_get_prev_mtu

Function sctp_get_prev_mtu

freebsd/netinet/sctputil.c:949–966  ·  view source on GitHub ↗

* Return the largest MTU in sctp_mtu_sizes smaller than val. * If val is smaller than the minimum, just return the largest * multiple of 4 smaller or equal to val. * Ensure that the result is a multiple of 4. */

Source from the content-addressed store, hash-verified

947 * Ensure that the result is a multiple of 4.
948 */
949uint32_t
950sctp_get_prev_mtu(uint32_t val)
951{
952 uint32_t i;
953
954 val &= 0xfffffffc;
955 if (val <= sctp_mtu_sizes[0]) {
956 return (val);
957 }
958 for (i = 1; i < (sizeof(sctp_mtu_sizes) / sizeof(uint32_t)); i++) {
959 if (val <= sctp_mtu_sizes[i]) {
960 break;
961 }
962 }
963 KASSERT((sctp_mtu_sizes[i - 1] & 0x00000003) == 0,
964 ("sctp_mtu_sizes[%u] not a multiple of 4", i - 1));
965 return (sctp_mtu_sizes[i - 1]);
966}
967
968/*
969 * Return the smallest MTU in sctp_mtu_sizes larger than val.

Callers 1

sctp_notifyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected