diff options
author | hselasky <hselasky@FreeBSD.org> | 2014-10-06 06:19:54 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2014-10-06 06:19:54 +0000 |
commit | f1f39047b6fe3b6c840c884d3173bb4d4fcd4d62 (patch) | |
tree | 2770c4c24380e68740e4bbb6e1d08dccfe61f68c /sys/netinet | |
parent | 37185e7390a0c255ae105ae62e8e8135235f9367 (diff) | |
download | FreeBSD-src-f1f39047b6fe3b6c840c884d3173bb4d4fcd4d62.zip FreeBSD-src-f1f39047b6fe3b6c840c884d3173bb4d4fcd4d62.tar.gz |
Minor code styling.
Suggested by: glebius @
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_output.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 0697767..07dd5c3 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -806,41 +806,40 @@ send: * Check if we should limit by maximum segment * size and count: */ - if (if_hw_tsomaxsegcount != 0 && if_hw_tsomaxsegsize != 0) { + if (if_hw_tsomaxsegcount != 0 && + if_hw_tsomaxsegsize != 0) { max_len = 0; mb = sbsndmbuf(&so->so_snd, off, &moff); while (mb != NULL && (u_int)max_len < len) { - u_int cur_length; - u_int cur_frags; + u_int mlen; + u_int frags; /* * Get length of mbuf fragment - * and how many hardware - * frags, rounded up, it would - * use: + * and how many hardware frags, + * rounded up, it would use: */ - cur_length = (mb->m_len - moff); - cur_frags = (cur_length + if_hw_tsomaxsegsize - - 1) / if_hw_tsomaxsegsize; + mlen = (mb->m_len - moff); + frags = howmany(mlen, + if_hw_tsomaxsegsize); /* Handle special case: Zero Length Mbuf */ - if (cur_frags == 0) - cur_frags = 1; + if (frags == 0) + frags = 1; /* * Check if the fragment limit - * will be reached or - * exceeded: + * will be reached or exceeded: */ - if (cur_frags >= if_hw_tsomaxsegcount) { - max_len += min(cur_length, + if (frags >= if_hw_tsomaxsegcount) { + max_len += min(mlen, if_hw_tsomaxsegcount * if_hw_tsomaxsegsize); break; } - max_len += cur_length; - if_hw_tsomaxsegcount -= cur_frags; + max_len += mlen; + if_hw_tsomaxsegcount -= frags; moff = 0; mb = mb->m_next; } |