OSDN Git Service

net: mscc: ocelot: parse flower action before key
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 29 Sep 2020 22:27:28 +0000 (01:27 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 30 Sep 2020 01:26:24 +0000 (18:26 -0700)
When we'll make the switch to multiple chain offloading, we'll want to
know first what VCAP block the rule is offloaded to. This impacts what
keys are available. Since the VCAP block is determined by what actions
are used, parse the action first.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mscc/ocelot_flower.c

index ec1b6e2..ae51ec7 100644 (file)
@@ -44,8 +44,8 @@ static int ocelot_flower_parse_action(struct flow_cls_offload *f,
        return 0;
 }
 
-static int ocelot_flower_parse(struct flow_cls_offload *f,
-                              struct ocelot_vcap_filter *filter)
+static int ocelot_flower_parse_key(struct flow_cls_offload *f,
+                                  struct ocelot_vcap_filter *filter)
 {
        struct flow_rule *rule = flow_cls_offload_flow_rule(f);
        struct flow_dissector *dissector = rule->match.dissector;
@@ -179,9 +179,22 @@ finished_key_parsing:
        }
        /* else, a filter of type OCELOT_VCAP_KEY_ANY is implicitly added */
 
+       return 0;
+}
+
+static int ocelot_flower_parse(struct flow_cls_offload *f,
+                              struct ocelot_vcap_filter *filter)
+{
+       int ret;
+
        filter->prio = f->common.prio;
        filter->id = f->cookie;
-       return ocelot_flower_parse_action(f, filter);
+
+       ret = ocelot_flower_parse_action(f, filter);
+       if (ret)
+               return ret;
+
+       return ocelot_flower_parse_key(f, filter);
 }
 
 static struct ocelot_vcap_filter