diff options
author | Alex Wang <alexw@nicira.com> | 2014-10-12 18:18:47 -0700 |
---|---|---|
committer | Alex Wang <alexw@nicira.com> | 2014-12-30 11:47:30 -0800 |
commit | 1c1e46ed8457fae3621e3ec1a9ac487f20a39561 (patch) | |
tree | 18bc9d06060225a6281c747737dda6d4c20fd34d /lib/dpif.h | |
parent | 9da2564e2bfa4ffc5a05552630ce2aca00a521c9 (diff) | |
download | openvswitch-1c1e46ed8457fae3621e3ec1a9ac487f20a39561.tar.gz |
dpif-netdev: Add per-pmd flow-table/classifier.
This commit changes the per dpif-netdev datapath flow-table/
classifier to per pmd-thread. As direct benefit, datapath
and flow statistics no longer need to be protected by mutex
or be declared as per-thread variable, since they are only
written by the owning pmd thread.
As side effects, the flow-dump output of userspace datapath
can contain overlapping flows. To reduce confusion, the dump
from different pmd thread will be separated by a title line.
In addition, the flow operations via 'ovs-appctl dpctl/*'
are modified so that if the given flow in_port corresponds
to a dpdk interface, the operation will be conducted to all
pmd threads recv from that interface (expect for flow-get
which will always be applied to non-pmd threads).
Signed-off-by: Alex Wang <alexw@nicira.com>
Tested-by: Mark D. Gray <mark.d.gray@intel.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Diffstat (limited to 'lib/dpif.h')
-rw-r--r-- | lib/dpif.h | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/lib/dpif.h b/lib/dpif.h index c5bdf9197..52d3f0201 100644 --- a/lib/dpif.h +++ b/lib/dpif.h @@ -391,6 +391,7 @@ #include "netdev.h" #include "ofpbuf.h" #include "openflow/openflow.h" +#include "ovs-numa.h" #include "packets.h" #include "util.h" @@ -524,14 +525,15 @@ int dpif_flow_put(struct dpif *, enum dpif_flow_put_flags, const struct nlattr *key, size_t key_len, const struct nlattr *mask, size_t mask_len, const struct nlattr *actions, size_t actions_len, - const ovs_u128 *ufid, struct dpif_flow_stats *); - + const ovs_u128 *ufid, const int pmd_id, + struct dpif_flow_stats *); int dpif_flow_del(struct dpif *, const struct nlattr *key, size_t key_len, - const ovs_u128 *ufid, struct dpif_flow_stats *); + const ovs_u128 *ufid, const int pmd_id, + struct dpif_flow_stats *); int dpif_flow_get(struct dpif *, const struct nlattr *key, size_t key_len, - const ovs_u128 *ufid, + const ovs_u128 *ufid, const int pmd_id, struct ofpbuf *, struct dpif_flow *); /* Flow dumping interface @@ -569,6 +571,8 @@ struct dpif_flow_dump_thread *dpif_flow_dump_thread_create( struct dpif_flow_dump *); void dpif_flow_dump_thread_destroy(struct dpif_flow_dump_thread *); +#define PMD_ID_NULL OVS_CORE_UNSPEC + /* A datapath flow as dumped by dpif_flow_dump_next(). */ struct dpif_flow { const struct nlattr *key; /* Flow key, as OVS_KEY_ATTR_* attrs. */ @@ -579,6 +583,7 @@ struct dpif_flow { size_t actions_len; /* 'actions' length in bytes. */ ovs_u128 ufid; /* Unique flow identifier. */ bool ufid_present; /* True if 'ufid' was provided by datapath.*/ + int pmd_id; /* Datapath poll mode dirver id. */ struct dpif_flow_stats stats; /* Flow statistics. */ }; int dpif_flow_dump_next(struct dpif_flow_dump_thread *, @@ -620,6 +625,10 @@ enum dpif_op_type { * * If the operation succeeds, then 'stats', if nonnull, will be set to the * flow's statistics before the update. + * + * - If the datapath implements multiple pmd thread with its own flow + * table, 'pmd_id' should be used to specify the particular polling + * thread for the operation. */ struct dpif_flow_put { /* Input. */ @@ -631,6 +640,7 @@ struct dpif_flow_put { const struct nlattr *actions; /* Actions to perform on flow. */ size_t actions_len; /* Length of 'actions' in bytes. */ const ovs_u128 *ufid; /* Optional unique flow identifier. */ + int pmd_id; /* Datapath poll mode driver id. */ /* Output. */ struct dpif_flow_stats *stats; /* Optional flow statistics. */ @@ -648,6 +658,10 @@ struct dpif_flow_put { * Callers should always provide the 'key' to improve dpif logging in the event * of errors or unexpected behaviour. * + * If the datapath implements multiple polling thread with its own flow table, + * 'pmd_id' should be used to specify the particular polling thread for the + * operation. + * * If the operation succeeds, then 'stats', if nonnull, will be set to the * flow's statistics before its deletion. */ struct dpif_flow_del { @@ -657,6 +671,7 @@ struct dpif_flow_del { const ovs_u128 *ufid; /* Unique identifier of flow to delete. */ bool terse; /* OK to skip sending/receiving full flow * info? */ + int pmd_id; /* Datapath poll mode driver id. */ /* Output. */ struct dpif_flow_stats *stats; /* Optional flow statistics. */ @@ -706,6 +721,10 @@ struct dpif_execute { * Callers should always provide 'key' to improve dpif logging in the event of * errors or unexpected behaviour. * + * If the datapath implements multiple polling thread with its own flow table, + * 'pmd_id' should be used to specify the particular polling thread for the + * operation. + * * Succeeds with status 0 if the flow is fetched, or fails with ENOENT if no * such flow exists. Other failures are indicated with a positive errno value. */ @@ -714,6 +733,7 @@ struct dpif_flow_get { const struct nlattr *key; /* Flow to get. */ size_t key_len; /* Length of 'key' in bytes. */ const ovs_u128 *ufid; /* Unique identifier of flow to get. */ + int pmd_id; /* Datapath poll mode driver id. */ struct ofpbuf *buffer; /* Storage for output parameters. */ /* Output. */ @@ -770,8 +790,9 @@ struct dpif_upcall { /* A callback to process an upcall, currently implemented only by dpif-netdev. * * The caller provides the 'packet' and 'flow' to process, the corresponding - * 'ufid' as generated by dpif_flow_hash(), the 'type' of the upcall, and if - * 'type' is DPIF_UC_ACTION then the 'userdata' attached to the action. + * 'ufid' as generated by dpif_flow_hash(), the polling thread id 'pmd_id', + * the 'type' of the upcall, and if 'type' is DPIF_UC_ACTION then the + * 'userdata' attached to the action. * * The callback must fill in 'actions' with the datapath actions to apply to * 'packet'. 'wc' and 'put_actions' will either be both null or both nonnull. @@ -787,6 +808,7 @@ struct dpif_upcall { typedef int upcall_callback(const struct ofpbuf *packet, const struct flow *flow, ovs_u128 *ufid, + int pmd_id, enum dpif_upcall_type type, const struct nlattr *userdata, struct ofpbuf *actions, |