net/bnxt: add initial TruFlow core session open
[dpdk.git] / drivers / net / bnxt / tf_core / tf_session.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2019-2020 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _TF_SESSION_H_
7 #define _TF_SESSION_H_
8
9 #include <stdint.h>
10 #include <stdlib.h>
11
12 #include "tf_core.h"
13 #include "tf_rm.h"
14
15 /** Session defines
16  */
17 #define TF_SESSIONS_MAX           1          /** max # sessions */
18 #define TF_SESSION_ID_INVALID     0xFFFFFFFF /** Invalid Session ID define */
19
20 /** Session
21  *
22  * Shared memory containing private TruFlow session information.
23  * Through this structure the session can keep track of resource
24  * allocations and (if so configured) any shadow copy of flow
25  * information.
26  *
27  * Memory is assigned to the Truflow instance by way of
28  * tf_open_session. Memory is allocated and owned by i.e. ULP.
29  *
30  * Access control to this shared memory is handled by the spin_lock in
31  * tf_session_info.
32  */
33 struct tf_session {
34         /** TrueFlow Version. Used to control the structure layout
35          * when sharing sessions. No guarantee that a secondary
36          * process would come from the same version of an executable.
37          */
38         struct tf_session_version ver;
39
40         /** Device type, provided by tf_open_session().
41          */
42         enum tf_device_type device_type;
43
44         /** Session ID, allocated by FW on tf_open_session().
45          */
46         union tf_session_id session_id;
47
48         /**
49          * String containing name of control channel interface to be
50          * used for this session to communicate with firmware.
51          *
52          * ctrl_chan_name will be used as part of a name for any
53          * shared memory allocation.
54          */
55         char ctrl_chan_name[TF_SESSION_NAME_MAX];
56
57         /**
58          * Boolean controlling the use and availability of shadow
59          * copy. Shadow copy will allow the TruFlow Core to keep track
60          * of resource content on the firmware side without having to
61          * query firmware. Additional private session core_data will
62          * be allocated if this boolean is set to 'true', default
63          * 'false'.
64          *
65          * Size of memory depends on the NVM Resource settings for the
66          * control channel.
67          */
68         bool shadow_copy;
69
70         /**
71          * Session Reference Count. To keep track of functions per
72          * session the ref_count is incremented. There is also a
73          * parallel TruFlow Firmware ref_count in case the TruFlow
74          * Core goes away without informing the Firmware.
75          */
76         uint8_t ref_count;
77
78         /** CRC32 seed table */
79 #define TF_LKUP_SEED_MEM_SIZE 512
80         uint32_t lkup_em_seed_mem[TF_DIR_MAX][TF_LKUP_SEED_MEM_SIZE];
81         /** Lookup3 init values */
82         uint32_t lkup_lkup3_init_cfg[TF_DIR_MAX];
83
84 };
85 #endif /* _TF_SESSION_H_ */