From: Ben Pfaff Date: Fri, 30 Jan 2009 18:58:50 +0000 (-0800) Subject: datapath: Move all fwd_save_skb() calls into a single location. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a28ef86084edba52c5ac7a90a0de3a9f03ef3295;p=openvswitch datapath: Move all fwd_save_skb() calls into a single location. --- diff --git a/datapath/datapath.c b/datapath/datapath.c index 6d6ea9ec..7cdea6a7 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -757,8 +757,7 @@ int dp_output_port(struct datapath *dp, struct sk_buff *skb, int out_port, return output_all(dp, skb, 0); case OFPP_CONTROLLER: - return dp_output_control(dp, skb, fwd_save_skb(skb), 0, - OFPR_ACTION); + return dp_output_control(dp, skb, 0, OFPR_ACTION); case OFPP_LOCAL: { struct net_device *dev = dp->netdev; @@ -801,23 +800,24 @@ bad_port: return -ENOENT; } -/* Takes ownership of 'skb' and transmits it to 'dp''s control path. If - * 'buffer_id' != -1, then only the first 64 bytes of 'skb' are sent; - * otherwise, all of 'skb' is sent. 'reason' indicates why 'skb' is being - * sent. 'max_len' sets the maximum number of bytes that the caller - * wants to be sent; a value of 0 indicates the entire packet should be - * sent. */ +/* Takes ownership of 'skb' and transmits it to 'dp''s control path. 'reason' + * indicates why 'skb' is being sent. 'max_len' sets the maximum number of + * bytes that the caller wants to be sent; a value of 0 indicates the entire + * packet should be sent. */ int dp_output_control(struct datapath *dp, struct sk_buff *skb, - uint32_t buffer_id, size_t max_len, int reason) + size_t max_len, int reason) { /* FIXME? Can we avoid creating a new skbuff in the case where we * forward the whole packet? */ struct sk_buff *f_skb; struct ofp_packet_in *opi; size_t fwd_len, opi_len; + uint32_t buffer_id; int err; + buffer_id = fwd_save_skb(skb); + fwd_len = skb->len; if ((buffer_id != (uint32_t) -1) && max_len) fwd_len = min(fwd_len, max_len); diff --git a/datapath/datapath.h b/datapath/datapath.h index 84eb5dc2..babf10e0 100644 --- a/datapath/datapath.h +++ b/datapath/datapath.h @@ -94,8 +94,7 @@ int dp_del_switch_port(struct net_bridge_port *); int dp_xmit_skb(struct sk_buff *skb); int dp_output_port(struct datapath *, struct sk_buff *, int out_port, int ignore_no_fwd); -int dp_output_control(struct datapath *, struct sk_buff *, uint32_t, - size_t, int); +int dp_output_control(struct datapath *, struct sk_buff *, size_t, int); void dp_set_origin(struct datapath *, uint16_t, struct sk_buff *); int dp_send_features_reply(struct datapath *, const struct sender *); int dp_send_config_reply(struct datapath *, const struct sender *); diff --git a/datapath/dp_act.c b/datapath/dp_act.c index 379af117..dcc93b93 100644 --- a/datapath/dp_act.c +++ b/datapath/dp_act.c @@ -41,8 +41,7 @@ do_output(struct datapath *dp, struct sk_buff *skb, size_t max_len, return -ENOMEM; return (likely(out_port != OFPP_CONTROLLER) ? dp_output_port(dp, skb, out_port, ignore_no_fwd) - : dp_output_control(dp, skb, fwd_save_skb(skb), - max_len, OFPR_ACTION)); + : dp_output_control(dp, skb, max_len, OFPR_ACTION)); } diff --git a/datapath/forward.c b/datapath/forward.c index d8662397..14b88972 100644 --- a/datapath/forward.c +++ b/datapath/forward.c @@ -71,8 +71,7 @@ void fwd_port_input(struct sw_chain *chain, struct sk_buff *skb, WARN_ON_ONCE(skb_shared(skb)); WARN_ON_ONCE(skb->destructor); if (run_flow_through_tables(chain, skb, p)) - dp_output_control(chain->dp, skb, fwd_save_skb(skb), - chain->dp->miss_send_len, + dp_output_control(chain->dp, skb, chain->dp->miss_send_len, OFPR_NO_MATCH); }