1 /* SPDX-License-Identifier: BSD-3-Clause
3 * Copyright(c) 2021 Xilinx, Inc.
6 #ifndef _SFC_FLOW_TUNNEL_H
7 #define _SFC_FLOW_TUNNEL_H
19 /** Flow Tunnel (FT) SW entry ID */
20 typedef uint8_t sfc_ft_id_t;
22 #define SFC_FT_TUNNEL_MARK_BITS \
23 (sizeof(sfc_ft_id_t) * CHAR_BIT)
25 #define SFC_FT_USER_MARK_BITS \
26 (sizeof(uint32_t) * CHAR_BIT - SFC_FT_TUNNEL_MARK_BITS)
28 #define SFC_FT_USER_MARK_MASK \
29 RTE_LEN2MASK(SFC_FT_USER_MARK_BITS, uint32_t)
31 #define SFC_FT_GET_TUNNEL_MARK(_mark) \
32 ((_mark) >> SFC_FT_USER_MARK_BITS)
34 #define SFC_FT_TUNNEL_MARK_INVALID (0)
36 #define SFC_FT_TUNNEL_MARK_TO_ID(_tunnel_mark) \
39 #define SFC_FT_ID_TO_TUNNEL_MARK(_id) \
42 #define SFC_FT_ID_TO_MARK(_id) \
43 (SFC_FT_ID_TO_TUNNEL_MARK(_id) << SFC_FT_USER_MARK_BITS)
45 #define SFC_FT_GET_USER_MARK(_mark) \
46 ((_mark) & SFC_FT_USER_MARK_MASK)
48 #define SFC_FT_MAX_NTUNNELS \
49 (RTE_LEN2MASK(SFC_FT_TUNNEL_MARK_BITS, uint8_t) - 1)
51 struct sfc_flow_tunnel {
52 bool jump_rule_is_set;
53 efx_tunnel_protocol_t encap_type;
60 bool sfc_flow_tunnel_is_supported(struct sfc_adapter *sa);
62 bool sfc_flow_tunnel_is_active(struct sfc_adapter *sa);
64 struct sfc_flow_tunnel *sfc_flow_tunnel_pick(struct sfc_adapter *sa,
67 int sfc_flow_tunnel_detect_jump_rule(struct sfc_adapter *sa,
68 const struct rte_flow_action *actions,
69 struct sfc_flow_spec_mae *spec,
70 struct rte_flow_error *error);
75 #endif /* _SFC_FLOW_TUNNEL_H */