Skip to content

Commit

Permalink
datapath: Remove flow member from struct ovs_skb_cb
Browse files Browse the repository at this point in the history
struct ovs_skb_cb is full on kernels < 3.11 due to compatibility code.
This patch removes the 'flow' member in order to make room for data
needed by layer 3 flow/port support that will be added in an upcoming
patch.  The 'flow' memeber was chosen for removal because it's only used
in ovs_execute_actions().

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
  • Loading branch information
ljakab authored and Pravin B Shelar committed Aug 26, 2014
1 parent 0725e74 commit ad50cb6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions datapath/actions.c
Expand Up @@ -950,9 +950,9 @@ static int loop_suppress(struct datapath *dp, struct sw_flow_actions *actions)
}

/* Execute a list of actions against 'skb'. */
int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, bool recirc)
int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb,
struct sw_flow_actions *acts, bool recirc)
{
struct sw_flow_actions *acts = rcu_dereference(OVS_CB(skb)->flow->sf_acts);
const u8 stack_cost = recirc ? RECIRC_STACK_COST : DEFAULT_STACK_COST;
struct loop_counter *loop;
int error;
Expand Down
12 changes: 7 additions & 5 deletions datapath/datapath.c
Expand Up @@ -257,6 +257,7 @@ void ovs_dp_process_packet(struct sk_buff *skb, bool recirc)
struct sw_flow_key *pkt_key = OVS_CB(skb)->pkt_key;
struct datapath *dp = p->dp;
struct sw_flow *flow;
struct sw_flow_actions *sf_acts;
struct dp_stats_percpu *stats;
u64 *stats_counter;
u32 n_mask_hit;
Expand All @@ -279,10 +280,10 @@ void ovs_dp_process_packet(struct sk_buff *skb, bool recirc)
goto out;
}

OVS_CB(skb)->flow = flow;
ovs_flow_stats_update(flow, pkt_key->tp.flags, skb);

ovs_flow_stats_update(OVS_CB(skb)->flow, pkt_key->tp.flags, skb);
ovs_execute_actions(dp, skb, recirc);
sf_acts = rcu_dereference(flow->sf_acts);
ovs_execute_actions(dp, skb, sf_acts, recirc);
stats_counter = &stats->n_hit;

out:
Expand Down Expand Up @@ -509,6 +510,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
struct sw_flow_actions *acts;
struct sk_buff *packet;
struct sw_flow *flow;
struct sw_flow_actions *sf_acts;
struct datapath *dp;
struct ethhdr *eth;
struct vport *input_vport;
Expand Down Expand Up @@ -557,7 +559,6 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
goto err_flow_free;

rcu_assign_pointer(flow->sf_acts, acts);
OVS_CB(packet)->flow = flow;
OVS_CB(packet)->pkt_key = &flow->key;
OVS_CB(skb)->egress_tun_info = NULL;
packet->priority = flow->key.phy.priority;
Expand All @@ -577,9 +578,10 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
goto err_unlock;

OVS_CB(packet)->input_vport = input_vport;
sf_acts = rcu_dereference(flow->sf_acts);

local_bh_disable();
err = ovs_execute_actions(dp, packet, false);
err = ovs_execute_actions(dp, packet, sf_acts, false);
local_bh_enable();
rcu_read_unlock();

Expand Down
7 changes: 3 additions & 4 deletions datapath/datapath.h
Expand Up @@ -96,18 +96,16 @@ struct datapath {

/**
* struct ovs_skb_cb - OVS data in skb CB
* @flow: The flow associated with this packet. May be %NULL if no flow.
* @pkt_key: The flow information extracted from the packet. Must be nonnull.
* @egress_tun_info: Tunnel information about this packet on egress path.
* NULL if the packet is not being tunneled.
* @input_vport: The original vport packet came in on. This value is cached
* when a packet is received by OVS.
*/
struct ovs_skb_cb {
struct sw_flow *flow;
struct sw_flow_key *pkt_key;
struct ovs_tunnel_info *egress_tun_info;
struct vport *input_vport;
struct vport *input_vport;
};
#define OVS_CB(skb) ((struct ovs_skb_cb *)(skb)->cb)

Expand Down Expand Up @@ -199,7 +197,8 @@ const char *ovs_dp_name(const struct datapath *dp);
struct sk_buff *ovs_vport_cmd_build_info(struct vport *, u32 portid, u32 seq,
u8 cmd);

int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb, bool recirc);
int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb,
struct sw_flow_actions *acts, bool recirc);
void ovs_dp_notify_wq(struct work_struct *work);

#define OVS_NLERR(fmt, ...) \
Expand Down

0 comments on commit ad50cb6

Please sign in to comment.