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? 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?
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