Lines Matching defs:flow

42 #include "flow.h"
88 * operations on vports, etc.), Writes to other state (flow table
223 struct sw_flow *flow;
233 /* Look up flow. */
234 flow = ovs_flow_tbl_lookup_stats(&dp->table, key, skb_get_hash(skb),
236 if (unlikely(!flow)) {
259 ovs_flow_stats_update(flow, key->tp.flags, skb);
260 sf_acts = rcu_dereference(flow->sf_acts);
327 /* The initial flow key extracted by ovs_flow_key_extract()
560 struct sw_flow *flow;
600 flow = ovs_flow_alloc();
601 err = PTR_ERR(flow);
602 if (IS_ERR(flow))
606 packet, &flow->key, log);
611 &flow->key, &acts, log);
615 rcu_assign_pointer(flow->sf_acts, acts);
616 packet->priority = flow->key.phy.priority;
617 packet->mark = flow->key.phy.skb_mark;
625 input_vport = ovs_vport_rcu(dp, flow->key.phy.in_port);
634 sf_acts = rcu_dereference(flow->sf_acts);
637 err = ovs_execute_actions(dp, packet, sf_acts, &flow->key);
641 ovs_flow_free(flow, false);
647 ovs_flow_free(flow, false);
738 /* OVS_FLOW_ATTR_UFID, or unmasked flow key as fallback
765 static int ovs_flow_cmd_fill_stats(const struct sw_flow *flow,
772 ovs_flow_stats_get(flow, &stats, &used, &tcp_flags);
793 static int ovs_flow_cmd_fill_actions(const struct sw_flow *flow,
800 * this is the first flow to be dumped into 'skb'. This is unusual for
813 sf_acts = rcu_dereference_ovsl(flow->sf_acts);
833 static int ovs_flow_cmd_fill_info(const struct sw_flow *flow, int dp_ifindex,
848 err = ovs_nla_put_identifier(flow, skb);
852 if (should_fill_key(&flow->id, ufid_flags)) {
853 err = ovs_nla_put_masked_key(flow, skb);
859 err = ovs_nla_put_mask(flow, skb);
864 err = ovs_flow_cmd_fill_stats(flow, skb);
869 err = ovs_flow_cmd_fill_actions(flow, skb, skb_orig_len);
904 static struct sk_buff *ovs_flow_cmd_build_info(const struct sw_flow *flow,
912 skb = ovs_flow_cmd_alloc_info(ovsl_dereference(flow->sf_acts),
913 &flow->id, info, always, ufid_flags);
917 retval = ovs_flow_cmd_fill_info(flow, dp_ifindex, skb,
932 struct sw_flow *flow = NULL, *new_flow;
946 OVS_NLERR(log, "Flow key attr not present in new flow.");
950 OVS_NLERR(log, "Flow actions attr not present in new flow.");
954 /* Most of the time we need to allocate a new flow, do it before
978 /* Extract flow identifier. */
1006 /* Check if this is a duplicate flow */
1008 flow = ovs_flow_tbl_lookup_ufid(&dp->table, &new_flow->id);
1009 if (!flow)
1010 flow = ovs_flow_tbl_lookup(&dp->table, key);
1011 if (likely(!flow)) {
1014 /* Put flow in bucket. */
1034 /* Bail out if we're not allowed to modify an existing flow.
1045 /* The flow identifier has to be the same for flow updates.
1046 * Look for any overlapping flow.
1048 if (unlikely(!ovs_flow_cmp(flow, &match))) {
1049 if (ovs_identifier_is_key(&flow->id))
1050 flow = ovs_flow_tbl_lookup_exact(&dp->table,
1053 flow = NULL;
1054 if (!flow) {
1060 old_acts = ovsl_dereference(flow->sf_acts);
1061 rcu_assign_pointer(flow->sf_acts, acts);
1064 error = ovs_flow_cmd_fill_info(flow,
1155 "Flow key attribute not present in set flow.");
1180 struct sw_flow *flow;
1219 /* Check that the flow exists. */
1221 flow = ovs_flow_tbl_lookup_ufid(&dp->table, &sfid);
1223 flow = ovs_flow_tbl_lookup_exact(&dp->table, &match);
1224 if (unlikely(!flow)) {
1231 old_acts = ovsl_dereference(flow->sf_acts);
1232 rcu_assign_pointer(flow->sf_acts, acts);
1235 error = ovs_flow_cmd_fill_info(flow,
1245 reply = ovs_flow_cmd_build_info(flow, ovs_header->dp_ifindex,
1257 ovs_flow_stats_clear(flow);
1283 struct sw_flow *flow;
1313 flow = ovs_flow_tbl_lookup_ufid(&dp->table, &ufid);
1315 flow = ovs_flow_tbl_lookup_exact(&dp->table, &match);
1316 if (!flow) {
1321 reply = ovs_flow_cmd_build_info(flow, ovs_header->dp_ifindex, info,
1342 struct sw_flow *flow = NULL;
1373 flow = ovs_flow_tbl_lookup_ufid(&dp->table, &ufid);
1375 flow = ovs_flow_tbl_lookup_exact(&dp->table, &match);
1376 if (unlikely(!flow)) {
1381 ovs_flow_tbl_remove(&dp->table, flow);
1384 reply = ovs_flow_cmd_alloc_info((const struct sw_flow_actions __force *) flow->sf_acts,
1385 &flow->id, info, false, ufid_flags);
1389 err = ovs_flow_cmd_fill_info(flow, ovs_header->dp_ifindex,
1408 ovs_flow_free(flow, true);
1439 struct sw_flow *flow;
1444 flow = ovs_flow_tbl_dump_next(ti, &bucket, &obj);
1445 if (!flow)
1448 if (ovs_flow_cmd_fill_info(flow, ovs_header->dp_ifindex, skb,
1805 /* RCU destroy the ports, meters and flow tables. */