xref: /dpdk/drivers/net/dpaa/fmlib/fm_vsp_ext.h (revision 663ff698e38f8a806dd312f64f11478583c0e736)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2008-2012 Freescale Semiconductor, Inc
3  * Copyright 2019-2020 NXP
4  */
5 
6 /*
7  * @File          fm_vsp_ext.h
8  *
9  * @Description   FM Virtual Storage-Profile
10  */
11 #ifndef __FM_VSP_EXT_H
12 #define __FM_VSP_EXT_H
13 #include "ncsw_ext.h"
14 #include "fm_ext.h"
15 #include "net_ext.h"
16 
17 typedef struct t_fm_vsp_params {
18 	t_handle	h_fm;
19 			/**< A handle to the FM object this VSP related to */
20 	t_fm_ext_pools	ext_buf_pools;
21 			/**< Which external buffer pools are used (up to
22 			 * FM_PORT_MAX_NUM_OF_EXT_POOLS), and their sizes.
23 			 * Parameter associated with Rx / OP port
24 			 */
25 	uint16_t	liodn_offset;	/**< VSP's LIODN offset */
26 	struct {
27 		e_fm_port_type	port_type; /**< Port type */
28 		uint8_t	port_id;           /**< Port Id - relative to type */
29 	} port_params;
30 	uint8_t	relative_profile_id;
31 			/**< VSP Id - relative to VSP's range defined in
32 			 * relevant FM object
33 			 */
34 } t_fm_vsp_params;
35 
36 typedef struct ioc_fm_vsp_params_t {
37 	struct t_fm_vsp_params vsp_params;
38 	void		*id;		/**< return value */
39 } ioc_fm_vsp_params_t;
40 
41 typedef struct t_fm_port_vspalloc_params {
42 	uint8_t     num_of_profiles;
43 		/**< Number of Virtual Storage Profiles; must be a power of 2 */
44 	uint8_t     dflt_relative_id;
45 	/**< The default Virtual-Storage-Profile-id dedicated to Rx/OP port. The
46 	 * same default Virtual-Storage-Profile-id will be for coupled Tx port
47 	 * if relevant function called for Rx port
48 	 */
49 } t_fm_port_vspalloc_params;
50 
51 typedef struct ioc_fm_port_vsp_alloc_params_t {
52 	struct t_fm_port_vspalloc_params params;
53 	void	*p_fm_tx_port;
54 	/**< Handle to coupled Tx Port; not relevant for OP port. */
55 } ioc_fm_port_vsp_alloc_params_t;
56 
57 typedef struct ioc_fm_buffer_prefix_content_t {
58 	uint16_t priv_data_size;
59 		/**< Number of bytes to be left at the beginning of the external
60 		 * buffer; Note that the private-area will start from the base
61 		 * of the buffer address.
62 		 */
63 	bool pass_prs_result;
64 			/**< TRUE to pass the parse result to/from the FM; User
65 			 * may use fm_port_get_buffer_prs_result() in order to
66 			 * get the parser-result from a buffer.
67 			 */
68 	bool pass_time_stamp;
69 			/**< TRUE to pass the timeStamp to/from the FM User may
70 			 * use fm_port_get_buffer_time_stamp() in order to get
71 			 * the parser-result from a buffer.
72 			 */
73 	bool pass_hash_result;
74 			/**< TRUE to pass the KG hash result to/from the FM User
75 			 * may use fm_port_get_buffer_hash_result() in order to
76 			 * get the parser-result from a buffer.
77 			 */
78 	bool pass_all_other_pcd_info;
79 			/**< Add all other Internal-Context information: AD,
80 			 * hash-result, key, etc.
81 			 */
82 	uint16_t data_align;
83 			/**< 0 to use driver's default alignment [64],
84 			 * other value for selecting a data alignment (must be a
85 			 * power of 2); if write optimization is used, must be
86 			 * >= 16.
87 			 */
88 	uint8_t manip_extra_space;
89 			/**< Maximum extra size needed
90 			 * (insertion-size minus removal-size);
91 			 * Note that this field impacts the size of the
92 			 * buffer-prefix (i.e. it pushes the data offset);
93 			 * This field is irrelevant if DPAA_VERSION==10
94 			 */
95 } ioc_fm_buffer_prefix_content_t;
96 
97 typedef struct ioc_fm_buffer_prefix_content_params_t {
98 	void    *p_fm_vsp;
99 	ioc_fm_buffer_prefix_content_t fm_buffer_prefix_content;
100 } ioc_fm_buffer_prefix_content_params_t;
101 
102 uint32_t fm_port_vsp_alloc(t_handle h_fm_port,
103 			  t_fm_port_vspalloc_params *p_params);
104 
105 t_handle fm_vsp_config(t_fm_vsp_params *p_fm_vsp_params);
106 
107 uint32_t fm_vsp_init(t_handle h_fm_vsp);
108 
109 uint32_t fm_vsp_free(t_handle h_fm_vsp);
110 
111 uint32_t fm_vsp_config_buffer_prefix_content(t_handle h_fm_vsp,
112 		t_fm_buffer_prefix_content *p_fm_buffer_prefix_content);
113 
114 #define FM_PORT_IOC_VSP_ALLOC \
115 	_IOW(FM_IOC_TYPE_BASE, FM_PORT_IOC_NUM(38), \
116 	ioc_fm_port_vsp_alloc_params_t)
117 
118 #define FM_IOC_VSP_CONFIG \
119 	_IOWR(FM_IOC_TYPE_BASE, FM_IOC_NUM(8), ioc_fm_vsp_params_t)
120 
121 #define FM_IOC_VSP_INIT	\
122 	_IOW(FM_IOC_TYPE_BASE, FM_IOC_NUM(9), ioc_fm_obj_t)
123 
124 #define FM_IOC_VSP_FREE	\
125 	_IOW(FM_IOC_TYPE_BASE, FM_IOC_NUM(10), ioc_fm_obj_t)
126 
127 #define FM_IOC_VSP_CONFIG_BUFFER_PREFIX_CONTENT \
128 	_IOW(FM_IOC_TYPE_BASE, FM_IOC_NUM(12), \
129 	ioc_fm_buffer_prefix_content_params_t)
130 
131 #endif /* __FM_VSP_EXT_H */
132