-*** Keywords ***
-| Get Max Rate And Jumbo
-| | [Documentation]
-| | ... | Argument framesize can be either integer in case of a single packet
-| | ... | in stream, or IMIX string defining mix of packets.
-| | ... | For jumbo frames detection, the maximal packet size is relevant.
-| | ... | For maximal transmit rate, the average packet size is relevant.
-| | ... | In both cases, encapsulation overhead (if any) has effect.
-| | ... | The maximal rate is computed from line limit bandwidth,
-| | ... | but NICs also have an independent limit in packet rate.
-| | ... | For some NICs, the limit is not reachable (bps limit is stricter),
-| | ... | in those cases None is used (meaning no limiting).
-| | ...
-| | ... | This keyword returns computed maximal unidirectional transmit rate
-| | ... | and jumbo boolean (some suites need that).
-| | ...
-| | ... | *Arguments:*
-| | ... | - bps_limit - Line rate limit in bps. Type: integer
-| | ... | - framesize - Framesize in bytes or IMIX. Type: integer or string
-| | ... | - overhead - Overhead in bytes. Default: 0. Type: integer
-| | ... | - pps_limit - NIC limit rate value in pps. Type: integer or None
-| | ...
-| | ... | *Returns:*
-| | ... | - 2-tuple, consisting of:
-| | ... | - Calculated unidirectional maximal transmit rate.
-| | ... | Type: integer or float
-| | ... | - Jumbo boolean, true if jumbo packet support has to be enabled.
-| | ... | Type: boolean
-| | ...
-| | ... | *Example:*
-| | ...
-| | ... | \| Get Max Rate And Jumbo | \${10000000} \| IMIX_v4_1 \
-| | ... | \| overhead=\${40} \| pps_limit=\${18750000} \|
-| | ...
-| | [Arguments] | ${bps_limit} | ${framesize}
-| | ... | ${overhead}=${0} | ${pps_limit}=${None}
-| | ...
-| | ${avg_size} = | Set Variable If | '${framesize}' == 'IMIX_v4_1'
-| | ... | ${353.83333} | ${framesize}
-| | ${max_size} = | Set Variable If | '${framesize}' == 'IMIX_v4_1'
-| | ... | ${1518} | ${framesize}
-| | # swo := size_with_overhead
-| | ${avg_swo} = | Evaluate | ${avg_size} + ${overhead}
-| | ${max_swo} = | Evaluate | ${max_size} + ${overhead}
-| | ${jumbo} = | Set Variable If | ${max_swo} < 1522
-| | ... | ${False} | ${True}
-| | # For testing None see: https://groups.google.com/\
-| | # forum/#!topic/robotframework-users/XntFz0ocD9E
-| | ${limit_set} = | Set Variable | ${pps_limit != None}
-| | ${rate} = | Evaluate | (${bps_limit}/((${avg_swo}+20)*8)).__trunc__()
-| | ${max_rate} = | Set Variable If | ${limit_set} and ${rate} > ${pps_limit}
-| | ... | ${pps_limit} | ${rate}
-| | Return From Keyword | ${max_rate} | ${jumbo}
-
-| Get Max Rate And Jumbo And Handle Multi Seg
-| | [Documentation]
-| | ... | This keyword adds correct multi seg configuration,
-| | ... | then returns the result of Get Max Rate And Jumbo keyword.
-| | ...
-| | ... | See Documentation of Get Max Rate And Jumbo for more details.
-| | ...
-| | ... | *Arguments:*
-| | ... | - bps_limit - Line rate limit in bps. Type: integer
-| | ... | - framesize - Framesize in bytes. Type: integer or string
-| | ... | - overhead - Overhead in bytes. Default: 0. Type: integer
-| | ... | - pps_limit - NIC limit rate value in pps. Type: integer or None
-| | ...
-| | ... | *Returns:*
-| | ... | - 2-tuple, consisting of:
-| | ... | - Calculated unidirectional maximal transmit rate.
-| | ... | Type: integer or float
-| | ... | - Jumbo boolean, true if jumbo packet support has to be enabled.
-| | ... | Type: boolean
-| | ...
-| | ... | *Example:*
-| | ...
-| | ... | \| Get Max Rate And Jumbo And Handle Multi Seg | \${10000000} \
-| | ... | \| IMIX_v4_1 \| overhead=\${40} \| pps_limit=\${18750000} \|
-| | ...
-| | [Arguments] | ${bps_limit} | ${framesize}
-| | ... | ${overhead}=${0} | ${pps_limit}=${None}
-| | ...
-| | ${max_rate} | ${jumbo} = | Get Max Rate And Jumbo
-| | ... | ${bps_limit} | ${framesize} | ${overhead} | ${pps_limit}
-| | Run Keyword If | not ${jumbo} | Add no multi seg to all DUTs
-| | Return From Keyword | ${max_rate} | ${jumbo}
-
-| Calculate pps
-| | [Documentation]
-| | ... | Calculate pps for given rate and L2 frame size,
-| | ... | additional 20B are added to L2 frame size as padding.
-| | ...
-| | ... | FIXME: Migrate callers to Get Max Rate And Jumbo
-| | ...
-| | ... | *Arguments*
-| | ... | - bps - Rate in bps. Type: integer
-| | ... | - framesize - L2 frame size in Bytes. Type: integer
-| | ...
-| | ... | *Return*
-| | ... | - Calculated pps. Type: integer
-| | ...
-| | ... | *Example:*
-| | ...
-| | ... | \| Calculate pps \| 10000000000 \| 64 \|
-| | ...
-| | [Arguments] | ${bps} | ${framesize}
-| | ...
-| | ${framesize}= | Get Frame Size | ${framesize}
-| | ${ret}= | Evaluate | (${bps}/((${framesize}+20)*8)).__trunc__()
-| | Return From Keyword | ${ret}