datapath: Simplify make_writable().
authorJesse Gross <jesse@nicira.com>
Tue, 7 Jun 2011 02:17:25 +0000 (19:17 -0700)
committerJesse Gross <jesse@nicira.com>
Thu, 16 Jun 2011 21:41:15 +0000 (14:41 -0700)
commit10db8b20d2ed55417f625a3212db3b5cef0331d2
tree82f7b8e03756e9d19a1b0cf1b4d5a1bb441c452e
parent1d0f14d4c1da6e67234c0c43db66721cd7fbac98
datapath: Simplify make_writable().

The current implementation of make_writable() is both overly complex
and unnecessarily aggressive about copying data.  We can improve
performance by only making a copy of the data if someone else holds
a reference to the portion of the data that we want to modify.  This
means that if a clone is held by the TCP stack for retransmission then
we do not need to make a copy if we are changing the IP header because
it will get regenerated on retransmit anyways.  Even when it is necessary
to copy we avoid duplicating struct sk_buff.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath/actions.c