aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2005-06-23 23:59:51 -0400
committerDavid S. Miller <davem@davemloft.net>2005-06-23 23:59:51 -0400
commit677e90eda3bd8cfde0b748daaa46476162a03950 (patch)
tree4b40614cf9cd125883d0430467be9172997ca184 /include
parent6408f79cce401e1bfecf923e7156f84f96e021e3 (diff)
[NET]: Zerocopy sequential reading of skb data
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: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/skbuff.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index d7c839a21842..171a37dff83a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -321,6 +321,24 @@ extern void skb_over_panic(struct sk_buff *skb, int len,
321extern void skb_under_panic(struct sk_buff *skb, int len, 321extern void skb_under_panic(struct sk_buff *skb, int len,
322 void *here); 322 void *here);
323 323
324struct skb_seq_state
325{
326 __u32 lower_offset;
327 __u32 upper_offset;
328 __u32 frag_idx;
329 __u32 stepped_offset;
330 struct sk_buff *root_skb;
331 struct sk_buff *cur_skb;
332 __u8 *frag_data;
333};
334
335extern void skb_prepare_seq_read(struct sk_buff *skb,
336 unsigned int from, unsigned int to,
337 struct skb_seq_state *st);
338extern unsigned int skb_seq_read(unsigned int consumed, const u8 **data,
339 struct skb_seq_state *st);
340extern void skb_abort_seq_read(struct skb_seq_state *st);
341
324/* Internal */ 342/* Internal */
325#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) 343#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end))
326 344