sfc: support TC decap rules matching on enc_ip_tos
[platform/kernel/linux-starfive.git] / drivers / net / ethernet / sfc / tc.h
index 8d2abca..0f14481 100644 (file)
@@ -74,6 +74,27 @@ static inline bool efx_tc_match_is_encap(const struct efx_tc_match_fields *mask)
               mask->enc_ip_ttl || mask->enc_sport || mask->enc_dport;
 }
 
+/**
+ * enum efx_tc_em_pseudo_type - &struct efx_tc_encap_match pseudo type
+ *
+ * These are used to classify "pseudo" encap matches, which don't refer
+ * to an entry in hardware but rather indicate that a section of the
+ * match space is in use by another Outer Rule.
+ *
+ * @EFX_TC_EM_DIRECT: real HW entry in Outer Rule table; not a pseudo.
+ *     Hardware index in &struct efx_tc_encap_match.fw_id is valid.
+ * @EFX_TC_EM_PSEUDO_MASK: registered by an encap match which includes a
+ *     match on an optional field (currently only ip_tos), to prevent an
+ *     overlapping encap match _without_ optional fields.
+ *     The pseudo encap match may be referenced again by an encap match
+ *     with a different ip_tos value, but all ip_tos_mask must match the
+ *     first (stored in our child_ip_tos_mask).
+ */
+enum efx_tc_em_pseudo_type {
+       EFX_TC_EM_DIRECT,
+       EFX_TC_EM_PSEUDO_MASK,
+};
+
 struct efx_tc_encap_match {
        __be32 src_ip, dst_ip;
        struct in6_addr src_ip6, dst_ip6;
@@ -81,8 +102,11 @@ struct efx_tc_encap_match {
        u8 ip_tos, ip_tos_mask;
        struct rhash_head linkage;
        enum efx_encap_type tun_type;
+       u8 child_ip_tos_mask;
        refcount_t ref;
+       enum efx_tc_em_pseudo_type type;
        u32 fw_id; /* index of this entry in firmware encap match table */
+       struct efx_tc_encap_match *pseudo; /* Referenced pseudo EM if needed */
 };
 
 struct efx_tc_match {