(changed the subj) Could anybody help confirm about pmd->flow_table below? -Thanks-
---------- Forwarded message ---------- From: Joo Kim <itsolut...@gmail.com> Date: Mon, Dec 19, 2016 at 4:35 PM Subject: Re: [ovs-dev] relationship between dpcls_rule and dp_netdev_flow To: Jarno Rajahalme <ja...@ovn.org> Cc: ovs-dev@openvswitch.org Jarno, Does pmd->flow_table(where each flow is inserted like below) hold individual flows, NOT wildcarding flow, right? Also, is the purpose of pmd->flow_table just for maintaining those individual flows info and dumping them (on show flow command)? -Thanks- static struct dp_netdev_flow * dp_netdev_flow_add(struct dp_netdev_pmd_thread *pmd, struct match *match, const ovs_u128 *ufid, const struct nlattr *actions, size_t actions_len) OVS_REQUIRES(pmd->flow_mutex) { . . . . netdev_flow_key_init_masked(&flow->cr.flow, &match->flow, &mask); /* Select dpcls for in_port. Relies on in_port to be exact match */ ovs_assert(match->wc.masks.in_port.odp_port == ODP_PORT_C(UINT32_MAX)); cls = dp_netdev_pmd_find_dpcls(pmd, in_port); dpcls_insert(cls, &flow->cr, &mask); cmap_insert(&pmd->flow_table, CONST_CAST(struct cmap_node *, &flow->node), dp_netdev_flow_hash(&flow->ufid)); <<<< On Tue, Nov 15, 2016 at 4:09 PM, Jarno Rajahalme <ja...@ovn.org> wrote: > > > On Nov 15, 2016, at 3:35 PM, Joo Kim <itsolut...@gmail.com> wrote: > > > > Hello, > > > > In this OVS (2.6) code below, > > It seems that a dp_netdev_flow obj contains a dpcls_rule struct, and > given > > a dpcls_rule, it gets the corresponding dp_netdev_flow via > > dp_netdev_flow_cast(). > > Does it mean dpcls_rule and dp_netdev_flow have an 1-1 mapping > > relationship? > > Yes, as you saw from the code, the relationship is 1:1. > > > But, as I understand, dpcls_rule could have a wildcard which can match > > multiple flows. Then, how does dp_netdev_flow_cast() (which seems to > assume > > 1-1 mapping) make sense? > > > > You are tripping over the overloaded term ‘flow’ here. struct > dp_netdev_flow and the associated struct dpcls_rule always have the same > wildcarding. A wildcarded dpcls_rule, and therefore dp_netdev_flow, can > match multiple transport connections, or multiple “exact match flows”. > > Jarno > > > > > struct dp_netdev_flow { > > const struct flow flow; /* Unmasked flow that created this entry. > > */ > > /* Hash table index by unmasked flow. */ > > const struct cmap_node node; /* In owning dp_netdev_pmd_thread's */ > > /* 'flow_table'. */ > > … > > /* Packet classification. */ > > struct dpcls_rule cr; /* In owning dp_netdev's 'cls'. */ > > /* 'cr' must be the last member. */ > > }; > > > > > > > > static struct dp_netdev_flow * > > dp_netdev_flow_cast(const struct dpcls_rule *cr) > > { > > return cr ? CONTAINER_OF(cr, struct dp_netdev_flow, cr) : NULL; > > } > > > > > > static struct dp_netdev_flow * > > dp_netdev_pmd_lookup_flow(struct dp_netdev_pmd_thread *pmd, > > const struct netdev_flow_key *key, > > int *lookup_num_p) > > { > > struct dpcls *cls; > > struct dpcls_rule *rule; > > odp_port_t in_port = u32_to_odp(MINIFLOW_GET_U32(&key->mf, in_port)); > > struct dp_netdev_flow *netdev_flow = NULL; > > > > cls = dp_netdev_pmd_lookup_dpcls(pmd, in_port); > > if (OVS_LIKELY(cls)) { > > dpcls_lookup(cls, key, &rule, 1, lookup_num_p); > > netdev_flow = dp_netdev_flow_cast(rule); <<<<< > > } > > return netdev_flow; > > } > > _______________________________________________ > > dev mailing list > > d...@openvswitch.org > > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > > _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev