diff options
author | davidcs <davidcs@FreeBSD.org> | 2017-08-31 21:56:17 +0000 |
---|---|---|
committer | davidcs <davidcs@FreeBSD.org> | 2017-08-31 21:56:17 +0000 |
commit | 276a2c239a551f8c003fc01fbc1a704177dfb609 (patch) | |
tree | fae24ddd31ff75d85940e9ae6cf6a539c5e7659c | |
parent | c0e3c88494c9a31d09b43dd13106d2b72dc25c82 (diff) | |
download | FreeBSD-src-276a2c239a551f8c003fc01fbc1a704177dfb609.zip FreeBSD-src-276a2c239a551f8c003fc01fbc1a704177dfb609.tar.gz |
MFC r322852
Fix qlnx_tso_check() so that every window of
(ETH_TX_LSO_WINDOW_BDS_NUM - nbds_in_hdr) has atleast
ETH_TX_LSO_WINDOW_MIN_LEN bytes
Approved by:re(marius)
-rw-r--r-- | sys/dev/qlnx/qlnxe/qlnx_os.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c index 04a84be..a1aea4d 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_os.c +++ b/sys/dev/qlnx/qlnxe/qlnx_os.c @@ -2921,25 +2921,35 @@ qlnx_tso_check(struct qlnx_fastpath *fp, bus_dma_segment_t *segs, int nsegs, { int i; uint32_t sum, nbds_in_hdr = 1; - bus_dma_segment_t *t_segs = segs; + uint32_t window; + bus_dma_segment_t *s_seg; - /* count the number of segments spanned by TCP header */ + /* If the header spans mulitple segments, skip those segments */ + + if (nsegs < ETH_TX_LSO_WINDOW_BDS_NUM) + return (0); i = 0; - while ((i < nsegs) && (offset > t_segs->ds_len)) { - nbds_in_hdr++; - offset = offset - t_segs->ds_len; - t_segs++; + + while ((i < nsegs) && (offset >= segs->ds_len)) { + offset = offset - segs->ds_len; + segs++; i++; + nbds_in_hdr++; } - while (nsegs >= QLNX_MAX_SEGMENTS_NON_TSO) { + window = ETH_TX_LSO_WINDOW_BDS_NUM - nbds_in_hdr; + + nsegs = nsegs - i; + + while (nsegs >= window) { sum = 0; + s_seg = segs; - for (i = 0; i < (ETH_TX_LSO_WINDOW_BDS_NUM - nbds_in_hdr); i++){ - sum += segs->ds_len; - segs++; + for (i = 0; i < window; i++){ + sum += s_seg->ds_len; + s_seg++; } if (sum < ETH_TX_LSO_WINDOW_MIN_LEN) { @@ -2947,7 +2957,8 @@ qlnx_tso_check(struct qlnx_fastpath *fp, bus_dma_segment_t *segs, int nsegs, return (-1); } - nsegs -= QLNX_MAX_SEGMENTS_NON_TSO; + nsegs = nsegs - 1; + segs++; } return (0); |