xref: /dpdk/drivers/net/bnxt/tf_ulp/ulp_tun.h (revision e6e8f03e5459f25153f1e4cd3e9ac30d3e473a61)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2023 Broadcom
3  * All rights reserved.
4  */
5 
6 #ifndef _BNXT_TUN_H_
7 #define _BNXT_TUN_H_
8 
9 #include <inttypes.h>
10 #include <stdbool.h>
11 
12 #include "rte_version.h"
13 #include "rte_ethdev.h"
14 
15 #include "ulp_template_db_enum.h"
16 #include "ulp_template_struct.h"
17 
18 struct bnxt_tun_cache_entry {
19 	bool				t_dst_ip_valid;
20 	uint8_t				t_dmac[RTE_ETHER_ADDR_LEN];
21 	union {
22 		rte_be32_t		t_dst_ip;
23 		uint8_t			t_dst_ip6[16];
24 	};
25 	uint32_t			outer_tun_flow_id;
26 };
27 
28 struct bnxt_flow_app_tun_ent {
29 	struct rte_flow_tunnel			app_tunnel;
30 	uint32_t				tun_id;
31 	uint32_t				ref_cnt;
32 	struct rte_flow_action			action;
33 	struct rte_flow_item			item;
34 };
35 
36 int32_t
37 ulp_app_tun_search_entry(struct bnxt_ulp_context *ulp_ctx,
38 			 struct rte_flow_tunnel *app_tunnel,
39 			 struct bnxt_flow_app_tun_ent **tun_entry);
40 
41 void
42 ulp_app_tun_entry_delete(struct bnxt_flow_app_tun_ent *tun_entry);
43 
44 int32_t
45 ulp_app_tun_entry_set_decap_action(struct bnxt_flow_app_tun_ent *tun_entry);
46 
47 int32_t
48 ulp_app_tun_entry_set_decap_item(struct bnxt_flow_app_tun_ent *tun_entry);
49 
50 struct bnxt_flow_app_tun_ent *
51 ulp_app_tun_match_entry(struct bnxt_ulp_context *ulp_ctx, const void *ctx);
52 
53 /* Tunnel API to delete the tunnel entry */
54 void
55 ulp_tunnel_offload_entry_clear(struct bnxt_tun_cache_entry *tun_tbl,
56 			       uint8_t tun_idx);
57 
58 int32_t
59 ulp_tunnel_offload_process(struct ulp_rte_parser_params *params);
60 #endif
61