FreeBSD/sys/dev/bxe/bxe.c
/*
 * Checks to ensure the 13 bd sliding window is >= MSS for TSO.
 * Check that (13 total bds - 3 bds) = 10 bd window >= MSS.
 * The window: 3 bds are = 1 for headers BD + 2 for parse BD and last BD
 * The headers comes in a separate bd in FreeBSD so 13-3=10.
 * Returns: 0 if OK to send, 1 if packet needs further defragmentation
 */
Checks to ensure the 13 bd sliding window is >= MSS for TSO.
Check that (13 total bds - 3 bds) = 10 bd window >= MSS.
The window: 3 bds are = 1 for headers BD + 2 for parse BD and last BD
The headers comes in a separate bd in FreeBSD so 13-3=10.
Returns: 0 if OK to send, 1 if packet needs further defragmentation
Checks to ensure the 13 bd sliding window is > = MSS for TSO . Check that ( 13 total bds - 3 bds ) = 10 bd window > = MSS . The window : 3 bds are = 1 for headers BD + 2 for parse BD and last BD The headers comes in a separate bd in FreeBSD so 13 - 3 = 10 . Returns : 0 if OK to send 1 if packet needs further defragmentation
static int
bxe_chktso_window(struct bxe_softc  *sc,
                  int               nsegs,
                  bus_dma_segment_t *segs,
                  struct mbuf       *m)
{
    uint32_t num_wnds, wnd_size, wnd_sum;
    int32_t frag_idx, wnd_idx;
    unsigned short lso_mss;
    int defrag;
    defrag = 0;
    wnd_sum = 0;
    wnd_size = 10;
    num_wnds = nsegs - wnd_size;
    lso_mss = htole16(m->m_pkthdr.tso_segsz);
    for (frag_idx = 1; (frag_idx <= wnd_size); frag_idx++) {
        wnd_sum += htole16(segs[frag_idx].ds_len);
    }
    if (wnd_sum < lso_mss) {
        return (1);
    }
    for (wnd_idx = 0; wnd_idx < num_wnds; wnd_idx++, frag_idx++) {
        wnd_sum -= htole16(segs[wnd_idx+1].ds_len);
        wnd_sum += htole16(segs[frag_idx].ds_len);
        if (wnd_sum < lso_mss) {
            return (1);
        }
    }
    return (0);
}
static int bxe_chktso_window ( struct bxe_softc * sc , int nsegs , bus_dma_segment_t * segs , struct mbuf * m ) { uint32_t num_wnds , wnd_size , wnd_sum ; int32_t frag_idx , wnd_idx ; unsigned short lso_mss ; int defrag ; defrag = 0 ; wnd_sum = 0 ; wnd_size = 10 ; num_wnds = nsegs - wnd_size ; lso_mss = htole16 ( m -> m_pkthdr . tso_segsz ) ; for ( frag_idx = 1 ; ( frag_idx <= wnd_size ) ; frag_idx ++ ) { wnd_sum += htole16 ( segs [ frag_idx ] . ds_len ) ; } if ( wnd_sum < lso_mss ) { return ( 1 ) ; } for ( wnd_idx = 0 ; wnd_idx < num_wnds ; wnd_idx ++ , frag_idx ++ ) { wnd_sum -= htole16 ( segs [ wnd_idx + 1 ] . ds_len ) ; wnd_sum += htole16 ( segs [ frag_idx ] . ds_len ) ; if ( wnd_sum < lso_mss ) { return ( 1 ) ; } } return ( 0 ) ; }
Checks to ensure the 13 bd sliding window is >= MSS for TSO.
Checks to ensure the 13 bd sliding window is > = MSS for TSO .
/*
     * Total header lengths Eth+IP+TCP in first FreeBSD mbuf so calculate the
     * first window sum of data while skipping the first assuming it is the
     * header in FreeBSD.
     */ /* check the first 10 bd window size */ /* run through the windows */ /* subtract the first mbuf->m_len of the last wndw(-header) */ /* add the next mbuf len to the len of our new window */