1 /*
2  * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 /**
20  * DOC: Declare various struct, macros which shall be used in
21  * pmo ns offload feature.
22  *
23  * Note: This file shall not contain public API's prototype/declarations.
24  *
25  */
26 
27 #ifndef _WLAN_PMO_NS_PUBLIC_STRUCT_H_
28 #define _WLAN_PMO_NS_PUBLIC_STRUCT_H_
29 
30 #include "wlan_pmo_common_public_struct.h"
31 
32 /**
33  * enum pmo_ns_addr_scope - Internal identification of IPv6 addr scope
34  * @PMO_NS_ADDR_SCOPE_INVALID: invalid scope
35  * @PMO_NS_ADDR_SCOPE_NODELOCAL: node local scope
36  * @PMO_NS_ADDR_SCOPE_LINKLOCAL: link local scope
37  * @PMO_NS_ADDR_SCOPE_SITELOCAL: site local scope
38  * @PMO_NS_ADDR_SCOPE_ORGLOCAL: org local scope
39  * @PMO_NS_ADDR_SCOPE_GLOBAL: global scope
40  */
41 enum pmo_ns_addr_scope {
42 	PMO_NS_ADDR_SCOPE_INVALID = 0,
43 	PMO_NS_ADDR_SCOPE_NODELOCAL = 1,
44 	PMO_NS_ADDR_SCOPE_LINKLOCAL = 2,
45 	PMO_NS_ADDR_SCOPE_SITELOCAL = 3,
46 	PMO_NS_ADDR_SCOPE_ORGLOCAL = 4,
47 	PMO_NS_ADDR_SCOPE_GLOBAL = 5
48 };
49 
50 /**
51  * struct pmo_ns_offload_params - pmo ns offload parameters
52  * @enable: true when ns offload enable
53  * @num_ns_offload_count: total ns entries
54  * @src_ipv6_addr: in request source ipv 6 address
55  * @self_ipv6_addr: self ipv6 address
56  * @target_ipv6_addr: target ipv6 address
57  * @self_macaddr: self mac address
58  * @src_ipv6_addr_valid: true if source ipv6 address is valid else false
59  * @target_ipv6_addr_valid: target ipv6 address are valid or not
60  * @target_ipv6_addr_ac_type: target ipv6 address type (unicast or anycast)
61  * @slot_idx: slot index
62  * @bssid: BSSID
63  * @scope: scope
64  * @is_offload_applied: has the offload been applied to firmware
65  */
66 struct pmo_ns_offload_params {
67 	uint8_t enable;
68 	uint32_t num_ns_offload_count;
69 	uint8_t src_ipv6_addr[QDF_IPV6_ADDR_SIZE];
70 	uint8_t self_ipv6_addr[PMO_MAC_NUM_TARGET_IPV6_NS_OFFLOAD_NA]
71 		[QDF_IPV6_ADDR_SIZE];
72 	uint8_t target_ipv6_addr[PMO_MAC_NUM_TARGET_IPV6_NS_OFFLOAD_NA]
73 		[QDF_IPV6_ADDR_SIZE];
74 	struct qdf_mac_addr self_macaddr;
75 	uint8_t src_ipv6_addr_valid;
76 	uint8_t target_ipv6_addr_valid[PMO_MAC_NUM_TARGET_IPV6_NS_OFFLOAD_NA];
77 	uint8_t target_ipv6_addr_ac_type[PMO_MAC_NUM_TARGET_IPV6_NS_OFFLOAD_NA];
78 	uint8_t slot_idx;
79 	struct qdf_mac_addr bssid;
80 	enum pmo_ns_addr_scope scope[PMO_MAC_NUM_TARGET_IPV6_NS_OFFLOAD_NA];
81 	bool is_offload_applied;
82 };
83 
84 /**
85  * struct pmo_ns_req - pmo ns request
86  * @psoc: objmgr psoc
87  * @vdev_id: vdev id on which arp offload needed
88  * @trigger: context from where arp offload triggered
89  * @count: ns entries count
90  * @ipv6_addr: ipv6 address array
91  * @ipv6_addr_type: ipv6 address type (unicast/anycast) array
92  * @scope: scope
93  */
94 struct pmo_ns_req {
95 	struct wlan_objmgr_psoc *psoc;
96 	uint8_t vdev_id;
97 	enum pmo_offload_trigger trigger;
98 	uint32_t count;
99 	uint8_t ipv6_addr[PMO_MAC_NUM_TARGET_IPV6_NS_OFFLOAD_NA]
100 				[QDF_IPV6_ADDR_SIZE];
101 	uint8_t ipv6_addr_type[PMO_MAC_NUM_TARGET_IPV6_NS_OFFLOAD_NA];
102 	enum pmo_ns_addr_scope scope[PMO_MAC_NUM_TARGET_IPV6_NS_OFFLOAD_NA];
103 };
104 #endif /* end  of _WLAN_PMO_NS_PUBLIC_STRUCT_H_ */
105