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