• Krishna Kumar's avatar
    tcp: Slightly optimize tcp_sendmsg · def87cf4
    Krishna Kumar authored
    Slightly optimize tcp_sendmsg since NETIF_F_SG is used many
    times iteratively in the loop. The only other modification is
    to change:
    			} else if (i == MAX_SKB_FRAGS ||
    				   (!i &&
    				   !(sk->sk_route_caps & NETIF_F_SG))) {
    	to:
    			} else if (i == MAX_SKB_FRAGS || !sg) {
    
    The reason why this change is correct: this code (other than
    the MAX_SKB_FRAGS case) executes only due to the else part
    of: "if (skb_tailroom(skb) > 0) {" - i.e. there was no space
    in the skb to put the data inline. Hence SG is false is a
    sufficient condition, and there is no way a fragment can be
    added to the skb.
    
    Changelog:
    	- Added the above explanation for the change
    Signed-off-by: default avatarKrishna Kumar <krkumar2@in.ibm.com>
    Acked-by: default avatarIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    def87cf4
tcp.c 84.7 KB