net/sfc: support encap flow items in transfer rules
[dpdk.git] / drivers / net / sfc / sfc_mae.h
index 56be8bf..53ddead 100644 (file)
@@ -26,9 +26,21 @@ struct sfc_mae_fw_rsrc {
        RTE_STD_C11
        union {
                efx_mae_aset_id_t       aset_id;
+               efx_mae_rule_id_t       rule_id;
        };
 };
 
+/** Outer rule registry entry */
+struct sfc_mae_outer_rule {
+       TAILQ_ENTRY(sfc_mae_outer_rule) entries;
+       unsigned int                    refcnt;
+       efx_mae_match_spec_t            *match_spec;
+       efx_tunnel_protocol_t           encap_type;
+       struct sfc_mae_fw_rsrc          fw_rsrc;
+};
+
+TAILQ_HEAD(sfc_mae_outer_rules, sfc_mae_outer_rule);
+
 /** Action set registry entry */
 struct sfc_mae_action_set {
        TAILQ_ENTRY(sfc_mae_action_set) entries;
@@ -53,8 +65,14 @@ struct sfc_mae {
        uint16_t                        switch_port_id;
        /** NIC support for MAE status */
        enum sfc_mae_status             status;
+       /** Priority level limit for MAE outer rules */
+       unsigned int                    nb_outer_rule_prios_max;
        /** Priority level limit for MAE action rules */
        unsigned int                    nb_action_rule_prios_max;
+       /** Encapsulation support status */
+       uint32_t                        encap_types_supported;
+       /** Outer rule registry */
+       struct sfc_mae_outer_rules      outer_rules;
        /** Action set registry */
        struct sfc_mae_action_sets      action_sets;
 };
@@ -115,6 +133,7 @@ struct sfc_mae_pattern_data {
         * L3 requirement for the innermost L2 item's "type" ("inner_type").
         * This contains one of:
         * - 0x0800/0xffff: IPV4
+        * - 0x86dd/0xffff: IPV6
         * - 0x0000/0x0000: no L3 item
         */
        struct sfc_mae_ethertype        innermost_ethertype_restriction;
@@ -122,17 +141,50 @@ struct sfc_mae_pattern_data {
        /**
         * The following two fields keep track of L3 "proto" mask and value.
         * The corresponding fields get filled in MAE match specification
-        * at the end of parsing.
+        * at the end of parsing. Also, the information is used by a
+        * post-check to enforce consistency requirements:
+        *
+        * - If a L3 item is followed by an item TCP, the former has
+        *   its "proto" set to either 0x06/0xff or 0x00/0x00.
+        *
+        * - If a L3 item is followed by an item UDP, the former has
+        *   its "proto" set to either 0x11/0xff or 0x00/0x00.
         */
        uint8_t                         l3_next_proto_value;
        uint8_t                         l3_next_proto_mask;
+
+       /*
+        * L4 requirement for L3 item's "proto".
+        * This contains one of:
+        * - 0x06/0xff: TCP
+        * - 0x11/0xff: UDP
+        * - 0x00/0x00: no L4 item
+        */
+       uint8_t                         l3_next_proto_restriction_value;
+       uint8_t                         l3_next_proto_restriction_mask;
 };
 
 struct sfc_mae_parse_ctx {
        struct sfc_adapter              *sa;
        efx_mae_match_spec_t            *match_spec_action;
+       efx_mae_match_spec_t            *match_spec_outer;
+       /*
+        * This points to either of the above two specifications depending
+        * on which part of the pattern is being parsed (outer / inner).
+        */
+       efx_mae_match_spec_t            *match_spec;
+       /*
+        * This points to either "field_ids_remap_to_encap"
+        * or "field_ids_no_remap" (see sfc_mae.c) depending on
+        * which part of the pattern is being parsed.
+        */
+       const efx_mae_field_id_t        *field_ids_remap;
+       /* This points to a tunnel-specific default mask. */
+       const void                      *tunnel_def_mask;
        bool                            match_mport_set;
        struct sfc_mae_pattern_data     pattern_data;
+       efx_tunnel_protocol_t           encap_type;
+       unsigned int                    priority;
 };
 
 int sfc_mae_attach(struct sfc_adapter *sa);