diff mbox

[ovs-dev,07/13] ofproto: Generalize flow_mod_requester.

Message ID 1468577959-98487-7-git-send-email-jarno@ovn.org
State Superseded
Headers show

Commit Message

Jarno Rajahalme July 15, 2016, 10:19 a.m. UTC
Group mods also need a 'requester', so rename 'flow_mod_requester' as
'openflow_mod_requester'.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
---
 ofproto/ofproto.c | 50 ++++++++++++++++++++++++--------------------------
 1 file changed, 24 insertions(+), 26 deletions(-)
diff mbox

Patch

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index ac587f7..c36df4e 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -251,13 +251,13 @@  static void ofproto_rule_insert__(struct ofproto *, struct rule *)
 static void ofproto_rule_remove__(struct ofproto *, struct rule *)
     OVS_REQUIRES(ofproto_mutex);
 
-/* The source of a flow_mod request, in the code that processes flow_mods.
+/* The source of an OpenFlow request.
  *
- * A flow table modification request can be generated externally, via OpenFlow,
- * or internally through a function call.  This structure indicates the source
- * of an OpenFlow-generated flow_mod.  For an internal flow_mod, it isn't
- * meaningful and thus supplied as NULL. */
-struct flow_mod_requester {
+ * A table modification request can be generated externally, via OpenFlow, or
+ * internally through a function call.  This structure indicates the source of
+ * an OpenFlow-generated table modification.  For an internal flow_mod, it
+ * isn't meaningful and thus supplied as NULL. */
+struct openflow_mod_requester {
     struct ofconn *ofconn;      /* Connection on which flow_mod arrived. */
     const struct ofp_header *request;
 };
@@ -280,16 +280,16 @@  static void replace_rule_revert(struct ofproto *, struct rule *old_rule,
     OVS_REQUIRES(ofproto_mutex);
 
 static void replace_rule_finish(struct ofproto *, struct ofputil_flow_mod *,
-                                const struct flow_mod_requester *,
+                                const struct openflow_mod_requester *,
                                 struct rule *old_rule, struct rule *new_rule,
                                 struct ovs_list *dead_cookies)
     OVS_REQUIRES(ofproto_mutex);
 static void delete_flows__(struct rule_collection *,
                            enum ofp_flow_removed_reason,
-                           const struct flow_mod_requester *)
+                           const struct openflow_mod_requester *)
     OVS_REQUIRES(ofproto_mutex);
 
-static void send_buffered_packet(const struct flow_mod_requester *,
+static void send_buffered_packet(const struct openflow_mod_requester *,
                                  uint32_t buffer_id, struct rule *)
     OVS_REQUIRES(ofproto_mutex);
 
@@ -303,11 +303,11 @@  static enum ofperr ofproto_flow_mod_start(struct ofproto *,
     OVS_REQUIRES(ofproto_mutex);
 static void ofproto_flow_mod_finish(struct ofproto *,
                                     struct ofproto_flow_mod *,
-                                    const struct flow_mod_requester *)
+                                    const struct openflow_mod_requester *)
     OVS_REQUIRES(ofproto_mutex);
 static enum ofperr handle_flow_mod__(struct ofproto *,
                                      struct ofproto_flow_mod *,
-                                     const struct flow_mod_requester *)
+                                     const struct openflow_mod_requester *)
     OVS_EXCLUDED(ofproto_mutex);
 static void calc_duration(long long int start, long long int now,
                           uint32_t *sec, uint32_t *nsec);
@@ -4834,7 +4834,7 @@  add_flow_revert(struct ofproto *ofproto, struct ofproto_flow_mod *ofm)
 /* To be called after version bump. */
 static void
 add_flow_finish(struct ofproto *ofproto, struct ofproto_flow_mod *ofm,
-                const struct flow_mod_requester *req)
+                const struct openflow_mod_requester *req)
     OVS_REQUIRES(ofproto_mutex)
 {
     struct ofputil_flow_mod *fm = &ofm->fm;
@@ -4995,7 +4995,7 @@  replace_rule_revert(struct ofproto *ofproto,
 /* Adds the 'new_rule', replacing the 'old_rule'. */
 static void
 replace_rule_finish(struct ofproto *ofproto, struct ofputil_flow_mod *fm,
-                    const struct flow_mod_requester *req,
+                    const struct openflow_mod_requester *req,
                     struct rule *old_rule, struct rule *new_rule,
                     struct ovs_list *dead_cookies)
     OVS_REQUIRES(ofproto_mutex)
@@ -5162,7 +5162,7 @@  modify_flows_revert(struct ofproto *ofproto, struct ofproto_flow_mod *ofm)
 
 static void
 modify_flows_finish(struct ofproto *ofproto, struct ofproto_flow_mod *ofm,
-                    const struct flow_mod_requester *req)
+                    const struct openflow_mod_requester *req)
     OVS_REQUIRES(ofproto_mutex)
 {
     struct ofputil_flow_mod *fm = &ofm->fm;
@@ -5246,7 +5246,7 @@  static void
 delete_flows_finish__(struct ofproto *ofproto,
                       struct rule_collection *rules,
                       enum ofp_flow_removed_reason reason,
-                      const struct flow_mod_requester *req)
+                      const struct openflow_mod_requester *req)
     OVS_REQUIRES(ofproto_mutex)
 {
     if (rule_collection_n(rules)) {
@@ -5280,7 +5280,7 @@  delete_flows_finish__(struct ofproto *ofproto,
 static void
 delete_flows__(struct rule_collection *rules,
                enum ofp_flow_removed_reason reason,
-               const struct flow_mod_requester *req)
+               const struct openflow_mod_requester *req)
     OVS_REQUIRES(ofproto_mutex)
 {
     if (rule_collection_n(rules)) {
@@ -5343,7 +5343,7 @@  delete_flows_revert(struct ofproto *ofproto, struct ofproto_flow_mod *ofm)
 static void
 delete_flows_finish(struct ofproto *ofproto,
                     struct ofproto_flow_mod *ofm,
-                    const struct flow_mod_requester *req)
+                    const struct openflow_mod_requester *req)
     OVS_REQUIRES(ofproto_mutex)
 {
     delete_flows_finish__(ofproto, &ofm->old_rules, ofm->fm.delete_reason,
@@ -5477,10 +5477,7 @@  handle_flow_mod(struct ofconn *ofconn, const struct ofp_header *oh)
                                     u16_to_ofp(ofproto->max_ports),
                                     ofproto->n_tables);
     if (!error) {
-        struct flow_mod_requester req;
-
-        req.ofconn = ofconn;
-        req.request = oh;
+        struct openflow_mod_requester req = { ofconn, oh };
         error = handle_flow_mod__(ofproto, &ofm, &req);
     }
     if (error) {
@@ -5497,7 +5494,7 @@  exit:
 
 static enum ofperr
 handle_flow_mod__(struct ofproto *ofproto, struct ofproto_flow_mod *ofm,
-                  const struct flow_mod_requester *req)
+                  const struct openflow_mod_requester *req)
     OVS_EXCLUDED(ofproto_mutex)
 {
     enum ofperr error;
@@ -7039,7 +7036,7 @@  ofproto_flow_mod_revert(struct ofproto *ofproto, struct ofproto_flow_mod *ofm)
 static void
 ofproto_flow_mod_finish(struct ofproto *ofproto,
                         struct ofproto_flow_mod *ofm,
-                        const struct flow_mod_requester *req)
+                        const struct openflow_mod_requester *req)
     OVS_REQUIRES(ofproto_mutex)
 {
     switch (ofm->fm.command) {
@@ -7149,7 +7146,8 @@  do_bundle_commit(struct ofconn *ofconn, uint32_t id, uint16_t flags)
             /* 4. Finish. */
             LIST_FOR_EACH (be, node, &bundle->msg_list) {
                 if (be->type == OFPTYPE_FLOW_MOD) {
-                    struct flow_mod_requester req = { ofconn, be->ofp_msg };
+                    struct openflow_mod_requester req = { ofconn,
+                                                          be->ofp_msg };
 
                     /* Bump the lookup version to the one of the current
                      * message.  This makes all the changes in the bundle at
@@ -7542,8 +7540,8 @@  handle_openflow(struct ofconn *ofconn, const struct ofpbuf *ofp_msg)
 /* Asynchronous operations. */
 
 static void
-send_buffered_packet(const struct flow_mod_requester *req, uint32_t buffer_id,
-                     struct rule *rule)
+send_buffered_packet(const struct openflow_mod_requester *req,
+                     uint32_t buffer_id, struct rule *rule)
     OVS_REQUIRES(ofproto_mutex)
 {
     if (req && req->ofconn && buffer_id != UINT32_MAX) {