• Paolo Abeni's avatar
    net: pktgen: fix pkt_size · bb7ffb6b
    Paolo Abeni authored
    [ Upstream commit 63d75463 ]
    
    The commit 879c7220 ("net: pktgen: Observe needed_headroom
    of the device") increased the 'pkt_overhead' field value by
    LL_RESERVED_SPACE.
    As a side effect the generated packet size, computed as:
    
    	/* Eth + IPh + UDPh + mpls */
    	datalen = pkt_dev->cur_pkt_size - 14 - 20 - 8 -
    		  pkt_dev->pkt_overhead;
    
    is decreased by the same value.
    The above changed slightly the behavior of existing pktgen users,
    and made the procfs interface somewhat inconsistent.
    Fix it by restoring the previous pkt_overhead value and using
    LL_RESERVED_SPACE as extralen in skb allocation.
    Also, change pktgen_alloc_skb() to only partially reserve
    the headroom to allow the caller to prefetch from ll header
    start.
    
    v1 -> v2:
     - fixed some typos in the comments
    
    Fixes: 879c7220 ("net: pktgen: Observe needed_headroom of the device")
    Suggested-by: default avatarBen Greear <greearb@candelatech.com>
    Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    bb7ffb6b
pktgen.c 96.7 KB