• Thomas Graf's avatar
    [NET]: Zerocopy sequential reading of skb data · 677e90ed
    Thomas Graf authored
    Implements sequential reading for both linear and non-linear
    skb data at zerocopy cost. The data is returned in chunks of
    arbitary length, therefore random access is not possible.
    
    Usage:
    	from	 := 0
    	to	 := 128
    	state	 := undef
    	data	 := undef
    	len	 := undef
    	consumed := 0
    
    	skb_prepare_seq_read(skb, from, to, &state)
    	while (len = skb_seq_read(consumed, &data, &state)) != 0 do
    		/* do something with 'data' of length 'len' */
    		if abort then
    			/* abort read if we don't wait for
    			 * skb_seq_read() to return 0 */
    			skb_abort_seq_read(&state)
    			return
    		endif
    		/* not necessary to consume all of 'len' */
    		consumed += len
    	done
    Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    677e90ed
skbuff.h 33.9 KB