LCOV - code coverage report
Current view: top level - drivers/net/bnxt/tf_core - tf_session.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 4 0.0 %
Date: 2024-01-22 15:35:40 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 12 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(c) 2019-2023 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                 :            : #include "bitalloc.h"
      12                 :            : #include "tf_core.h"
      13                 :            : #include "tf_device.h"
      14                 :            : #include "tf_rm.h"
      15                 :            : #include "tf_resources.h"
      16                 :            : #include "stack.h"
      17                 :            : #include "ll.h"
      18                 :            : 
      19                 :            : /**
      20                 :            :  * The Session module provides session control support. A session is
      21                 :            :  * to the ULP layer known as a session_info instance. The session
      22                 :            :  * private data is the actual session.
      23                 :            :  *
      24                 :            :  * Session manages:
      25                 :            :  *   - The device and all the resources related to the device.
      26                 :            :  *   - Any session sharing between ULP applications
      27                 :            :  */
      28                 :            : 
      29                 :            : /** Session defines
      30                 :            :  */
      31                 :            : #define TF_SESSION_ID_INVALID     0xFFFFFFFF /** Invalid Session ID define */
      32                 :            : 
      33                 :            : /**
      34                 :            :  * At this stage we are using fixed size entries so that each
      35                 :            :  * stack entry represents either 2 or 4 RT (f/n)blocks. So we
      36                 :            :  * take the total block allocation for truflow and divide that
      37                 :            :  * by either 2 or 4.
      38                 :            :  */
      39                 :            : #ifdef TF_EM_ENTRY_IPV4_ONLY
      40                 :            : #define TF_SESSION_EM_ENTRY_SIZE 2 /* 2 blocks per entry */
      41                 :            : #else
      42                 :            : #define TF_SESSION_EM_ENTRY_SIZE 4 /* 4 blocks per entry */
      43                 :            : #endif
      44                 :            : 
      45                 :            : /**
      46                 :            :  * Session
      47                 :            :  *
      48                 :            :  * Shared memory containing private TruFlow session information.
      49                 :            :  * Through this structure the session can keep track of resource
      50                 :            :  * allocations. It also holds info about Session Clients.
      51                 :            :  *
      52                 :            :  * Memory is assigned to the Truflow instance by way of
      53                 :            :  * tf_open_session. Memory is allocated and owned by i.e. ULP.
      54                 :            :  *
      55                 :            :  * Access control to this shared memory is handled by the spin_lock in
      56                 :            :  * tf_session_info.
      57                 :            :  */
      58                 :            : struct tf_session {
      59                 :            :         /** TruFlow Version. Used to control the structure layout
      60                 :            :          * when sharing sessions. No guarantee that a secondary
      61                 :            :          * process would come from the same version of an executable.
      62                 :            :          */
      63                 :            :         struct tf_session_version ver;
      64                 :            : 
      65                 :            :         /**
      66                 :            :          * Session ID, allocated by FW on tf_open_session()
      67                 :            :          */
      68                 :            :         union tf_session_id session_id;
      69                 :            : 
      70                 :            :         /**
      71                 :            :          * Boolean controlling the use and availability of shared session.
      72                 :            :          * Shared session will allow the application to share resources
      73                 :            :          * on the firmware side without having to allocate them on firmware.
      74                 :            :          * Additional private session core_data will be allocated if this
      75                 :            :          * boolean is set to 'true', default 'false'.
      76                 :            :          *
      77                 :            :          */
      78                 :            :         bool shared_session;
      79                 :            : 
      80                 :            :         /**
      81                 :            :          * Boolean controlling the split of hardware resources for hotupgrade.
      82                 :            :          */
      83                 :            :         bool shared_session_hotup;
      84                 :            : 
      85                 :            :         /**
      86                 :            :          * This flag indicates the shared session on firmware side is created
      87                 :            :          * by this session. Some privileges may be assigned to this session.
      88                 :            :          *
      89                 :            :          */
      90                 :            :         bool shared_session_creator;
      91                 :            : 
      92                 :            :         /**
      93                 :            :          * Session Reference Count. To keep track of functions per
      94                 :            :          * session the ref_count is updated. There is also a
      95                 :            :          * parallel TruFlow Firmware ref_count in case the TruFlow
      96                 :            :          * Core goes away without informing the Firmware.
      97                 :            :          */
      98                 :            :         uint8_t ref_count;
      99                 :            : 
     100                 :            :         /**
     101                 :            :          * Session Reference Count for attached sessions. To keep
     102                 :            :          * track of application sharing of a session the
     103                 :            :          * ref_count_attach is updated.
     104                 :            :          */
     105                 :            :         uint8_t ref_count_attach;
     106                 :            : 
     107                 :            :         /**
     108                 :            :          * Device handle
     109                 :            :          */
     110                 :            :         struct tf_dev_info dev;
     111                 :            :         /**
     112                 :            :          * Device init flag. False if Device is not fully initialized,
     113                 :            :          * else true.
     114                 :            :          */
     115                 :            :         bool dev_init;
     116                 :            : 
     117                 :            :         /**
     118                 :            :          * Linked list of clients registered for this session
     119                 :            :          */
     120                 :            :         struct ll client_ll;
     121                 :            : 
     122                 :            :         /**
     123                 :            :          * em ext db reference for the session
     124                 :            :          */
     125                 :            :         void *em_ext_db_handle;
     126                 :            : 
     127                 :            :         /**
     128                 :            :          * tcam db reference for the session
     129                 :            :          */
     130                 :            :         void *tcam_db_handle;
     131                 :            : 
     132                 :            :         /**
     133                 :            :          * table db reference for the session
     134                 :            :          */
     135                 :            :         void *tbl_db_handle;
     136                 :            : 
     137                 :            :         /**
     138                 :            :          * identifier db reference for the session
     139                 :            :          */
     140                 :            :         void *id_db_handle;
     141                 :            : 
     142                 :            :         /**
     143                 :            :          * em db reference for the session
     144                 :            :          */
     145                 :            :         void *em_db_handle;
     146                 :            : 
     147                 :            :         /**
     148                 :            :          * EM allocator for session
     149                 :            :          */
     150                 :            :         void *em_pool[TF_DIR_MAX];
     151                 :            : 
     152                 :            :         /**
     153                 :            :          * tcam db reference for the session
     154                 :            :          */
     155                 :            :         void *tcam_shared_db_handle;
     156                 :            : 
     157                 :            :         /**
     158                 :            :          * SRAM db reference for the session
     159                 :            :          */
     160                 :            :         void *sram_handle;
     161                 :            : 
     162                 :            :         /**
     163                 :            :          * if table db reference for the session
     164                 :            :          */
     165                 :            :         void *if_tbl_db_handle;
     166                 :            : 
     167                 :            :         /**
     168                 :            :          * global db reference for the session
     169                 :            :          */
     170                 :            :         void *global_db_handle;
     171                 :            : 
     172                 :            :         /**
     173                 :            :          * Number of slices per row for WC TCAM
     174                 :            :          */
     175                 :            :         uint16_t wc_num_slices_per_row;
     176                 :            : 
     177                 :            :         /**
     178                 :            :          * Indicates if TCAM is controlled by TCAM Manager
     179                 :            :          */
     180                 :            :         int tcam_mgr_control[TF_DIR_MAX][TF_TCAM_TBL_TYPE_MAX];
     181                 :            : 
     182                 :            : };
     183                 :            : 
     184                 :            : /**
     185                 :            :  * Session Client
     186                 :            :  *
     187                 :            :  * Shared memory for each of the Session Clients. A session can have
     188                 :            :  * one or more clients.
     189                 :            :  */
     190                 :            : struct tf_session_client {
     191                 :            :         /**
     192                 :            :          * Linked list of clients
     193                 :            :          */
     194                 :            :         struct ll_entry ll_entry; /* For inserting in link list, must be
     195                 :            :                                    * first field of struct.
     196                 :            :                                    */
     197                 :            : 
     198                 :            :         /**
     199                 :            :          * String containing name of control channel interface to be
     200                 :            :          * used for this session to communicate with firmware.
     201                 :            :          *
     202                 :            :          * ctrl_chan_name will be used as part of a name for any
     203                 :            :          * shared memory allocation.
     204                 :            :          */
     205                 :            :         char ctrl_chan_name[TF_SESSION_NAME_MAX];
     206                 :            : 
     207                 :            :         /**
     208                 :            :          * Firmware FID, learned at time of Session Client create.
     209                 :            :          */
     210                 :            :         uint16_t fw_fid;
     211                 :            : 
     212                 :            :         /**
     213                 :            :          * Session Client ID, allocated by FW on tf_register_session()
     214                 :            :          */
     215                 :            :         union tf_session_client_id session_client_id;
     216                 :            : };
     217                 :            : 
     218                 :            : /**
     219                 :            :  * Session open parameter definition
     220                 :            :  */
     221                 :            : struct tf_session_open_session_parms {
     222                 :            :         /**
     223                 :            :          * [in] Pointer to the TF open session configuration
     224                 :            :          */
     225                 :            :         struct tf_open_session_parms *open_cfg;
     226                 :            : };
     227                 :            : 
     228                 :            : /**
     229                 :            :  * Session attach parameter definition
     230                 :            :  */
     231                 :            : struct tf_session_attach_session_parms {
     232                 :            :         /**
     233                 :            :          * [in] Pointer to the TF attach session configuration
     234                 :            :          */
     235                 :            :         struct tf_attach_session_parms *attach_cfg;
     236                 :            : };
     237                 :            : 
     238                 :            : /**
     239                 :            :  * Session close parameter definition
     240                 :            :  */
     241                 :            : struct tf_session_close_session_parms {
     242                 :            :         /**
     243                 :            :          * []
     244                 :            :          */
     245                 :            :         uint8_t *ref_count;
     246                 :            :         /**
     247                 :            :          * []
     248                 :            :          */
     249                 :            :         union tf_session_id *session_id;
     250                 :            : };
     251                 :            : 
     252                 :            : /**
     253                 :            :  * @page session Session Management
     254                 :            :  *
     255                 :            :  * @ref tf_session_open_session
     256                 :            :  *
     257                 :            :  * @ref tf_session_attach_session
     258                 :            :  *
     259                 :            :  * @ref tf_session_close_session
     260                 :            :  *
     261                 :            :  * @ref tf_session_is_fid_supported
     262                 :            :  *
     263                 :            :  * @ref tf_session_get_session_internal
     264                 :            :  *
     265                 :            :  * @ref tf_session_get_session
     266                 :            :  *
     267                 :            :  * @ref tf_session_get_session_client
     268                 :            :  *
     269                 :            :  * @ref tf_session_find_session_client_by_name
     270                 :            :  *
     271                 :            :  * @ref tf_session_find_session_client_by_fid
     272                 :            :  *
     273                 :            :  * @ref tf_session_get_device
     274                 :            :  *
     275                 :            :  * @ref tf_session_get_fw_session_id
     276                 :            :  *
     277                 :            :  * @ref tf_session_get_session_id
     278                 :            :  *
     279                 :            :  * @ref tf_session_is_shared_session_creator
     280                 :            :  *
     281                 :            :  * @ref tf_session_get_db
     282                 :            :  *
     283                 :            :  * @ref tf_session_set_db
     284                 :            :  *
     285                 :            :  * @ref tf_session_get_bp
     286                 :            :  *
     287                 :            :  * @ref tf_session_is_shared_session
     288                 :            :  *
     289                 :            :  * @ref tf_session_get_tcam_shared_db
     290                 :            :  *
     291                 :            :  * @ref tf_session_set_tcam_shared_db
     292                 :            :  *
     293                 :            :  * @ref tf_session_get_sram_db
     294                 :            :  *
     295                 :            :  * @ref tf_session_set_sram_db
     296                 :            :  */
     297                 :            : 
     298                 :            : /**
     299                 :            :  * Creates a host session with a corresponding firmware session.
     300                 :            :  *
     301                 :            :  * [in] tfp
     302                 :            :  *   Pointer to TF handle
     303                 :            :  *
     304                 :            :  * [in] parms
     305                 :            :  *   Pointer to the session open parameters
     306                 :            :  *
     307                 :            :  * Returns
     308                 :            :  *   - (0) if successful.
     309                 :            :  *   - (-EINVAL) on failure.
     310                 :            :  */
     311                 :            : int tf_session_open_session(struct tf *tfp,
     312                 :            :                             struct tf_session_open_session_parms *parms);
     313                 :            : 
     314                 :            : /**
     315                 :            :  * Attaches a previous created session.
     316                 :            :  *
     317                 :            :  * [in] tfp
     318                 :            :  *   Pointer to TF handle
     319                 :            :  *
     320                 :            :  * [in] parms
     321                 :            :  *   Pointer to the session attach parameters
     322                 :            :  *
     323                 :            :  * Returns
     324                 :            :  *   - (0) if successful.
     325                 :            :  *   - (-EINVAL) on failure.
     326                 :            :  */
     327                 :            : int tf_session_attach_session(struct tf *tfp,
     328                 :            :                               struct tf_session_attach_session_parms *parms);
     329                 :            : 
     330                 :            : /**
     331                 :            :  * Closes a previous created session. Only possible if previous
     332                 :            :  * registered Clients had been unregistered first.
     333                 :            :  *
     334                 :            :  * [in] tfp
     335                 :            :  *   Pointer to TF handle
     336                 :            :  *
     337                 :            :  * [in/out] parms
     338                 :            :  *   Pointer to the session close parameters.
     339                 :            :  *
     340                 :            :  * Returns
     341                 :            :  *   - (0) if successful.
     342                 :            :  *   - (-EUSERS) if clients are still registered with the session.
     343                 :            :  *   - (-EINVAL) on failure.
     344                 :            :  */
     345                 :            : int tf_session_close_session(struct tf *tfp,
     346                 :            :                              struct tf_session_close_session_parms *parms);
     347                 :            : 
     348                 :            : /**
     349                 :            :  * Verifies that the fid is supported by the session. Used to assure
     350                 :            :  * that a function i.e. client/control channel is registered with the
     351                 :            :  * session.
     352                 :            :  *
     353                 :            :  * [in] tfs
     354                 :            :  *   Pointer to TF Session handle
     355                 :            :  *
     356                 :            :  * [in] fid
     357                 :            :  *   FID value to check
     358                 :            :  *
     359                 :            :  * Returns
     360                 :            :  *   - (true) if successful, else false
     361                 :            :  *   - (-EINVAL) on failure.
     362                 :            :  */
     363                 :            : bool
     364                 :            : tf_session_is_fid_supported(struct tf_session *tfs,
     365                 :            :                             uint16_t fid);
     366                 :            : 
     367                 :            : /**
     368                 :            :  * Looks up the private session information from the TF session
     369                 :            :  * info. Does not perform a fid check against the registered
     370                 :            :  * clients. Should be used if tf_session_get_session() was used
     371                 :            :  * previously i.e. at the TF API boundary.
     372                 :            :  *
     373                 :            :  * [in] tfp
     374                 :            :  *   Pointer to TF handle
     375                 :            :  *
     376                 :            :  * [out] tfs
     377                 :            :  *   Pointer pointer to the session
     378                 :            :  *
     379                 :            :  * Returns
     380                 :            :  *   - (0) if successful.
     381                 :            :  *   - (-EINVAL) on failure.
     382                 :            :  */
     383                 :            : int tf_session_get_session_internal(struct tf *tfp,
     384                 :            :                                     struct tf_session **tfs);
     385                 :            : 
     386                 :            : /**
     387                 :            :  * Looks up the private session information from the TF session
     388                 :            :  * info. Performs a fid check against the clients on the session.
     389                 :            :  *
     390                 :            :  * [in] tfp
     391                 :            :  *   Pointer to TF handle
     392                 :            :  *
     393                 :            :  * [out] tfs
     394                 :            :  *   Pointer pointer to the session
     395                 :            :  *
     396                 :            :  * Returns
     397                 :            :  *   - (0) if successful.
     398                 :            :  *   - (-EINVAL) on failure.
     399                 :            :  */
     400                 :            : int tf_session_get_session(struct tf *tfp,
     401                 :            :                            struct tf_session **tfs);
     402                 :            : 
     403                 :            : /**
     404                 :            :  * Looks up client within the session.
     405                 :            :  *
     406                 :            :  * [in] tfs
     407                 :            :  *   Pointer pointer to the session
     408                 :            :  *
     409                 :            :  * [in] session_client_id
     410                 :            :  *   Client id to look for within the session
     411                 :            :  *
     412                 :            :  * Returns
     413                 :            :  *   client if successful.
     414                 :            :  *   - (NULL) on failure, client not found.
     415                 :            :  */
     416                 :            : struct tf_session_client *
     417                 :            : tf_session_get_session_client(struct tf_session *tfs,
     418                 :            :                               union tf_session_client_id session_client_id);
     419                 :            : 
     420                 :            : /**
     421                 :            :  * Looks up client using name within the session.
     422                 :            :  *
     423                 :            :  * [in] session, pointer to the session
     424                 :            :  *
     425                 :            :  * [in] session_client_name, name of the client to lookup in the session
     426                 :            :  *
     427                 :            :  * Returns:
     428                 :            :  *   - Pointer to the session, if found.
     429                 :            :  *   - (NULL) on failure, client not found.
     430                 :            :  */
     431                 :            : struct tf_session_client *
     432                 :            : tf_session_find_session_client_by_name(struct tf_session *tfs,
     433                 :            :                                        const char *ctrl_chan_name);
     434                 :            : 
     435                 :            : /**
     436                 :            :  * Looks up client using the fid.
     437                 :            :  *
     438                 :            :  * [in] session, pointer to the session
     439                 :            :  *
     440                 :            :  * [in] fid, fid of the client to find
     441                 :            :  *
     442                 :            :  * Returns:
     443                 :            :  *   - Pointer to the session, if found.
     444                 :            :  *   - (NULL) on failure, client not found.
     445                 :            :  */
     446                 :            : struct tf_session_client *
     447                 :            : tf_session_find_session_client_by_fid(struct tf_session *tfs,
     448                 :            :                                       uint16_t fid);
     449                 :            : 
     450                 :            : /**
     451                 :            :  * Looks up the device information from the TF Session.
     452                 :            :  *
     453                 :            :  * [in] tfs
     454                 :            :  *   Pointer to session handle
     455                 :            :  *
     456                 :            :  * [out] tfd
     457                 :            :  *   Pointer to the device
     458                 :            :  *
     459                 :            :  * Returns
     460                 :            :  *   - (0) if successful.
     461                 :            :  *   - (-EINVAL) on failure.
     462                 :            :  */
     463                 :            : int tf_session_get_device(struct tf_session *tfs,
     464                 :            :                           struct tf_dev_info **tfd);
     465                 :            : 
     466                 :            : /**
     467                 :            :  * Returns the session and the device from the tfp.
     468                 :            :  *
     469                 :            :  * [in] tfp
     470                 :            :  *   Pointer to TF handle
     471                 :            :  *
     472                 :            :  * [out] tfs
     473                 :            :  *   Pointer to the session
     474                 :            :  *
     475                 :            :  * [out] tfd
     476                 :            :  *   Pointer to the device
     477                 :            : 
     478                 :            :  * Returns
     479                 :            :  *   - (0) if successful.
     480                 :            :  *   - (-EINVAL) on failure.
     481                 :            :  */
     482                 :            : int tf_session_get(struct tf *tfp,
     483                 :            :                    struct tf_session **tfs,
     484                 :            :                    struct tf_dev_info **tfd);
     485                 :            : 
     486                 :            : /**
     487                 :            :  * Looks up the FW Session id the requested TF handle.
     488                 :            :  *
     489                 :            :  * [in] tfp
     490                 :            :  *   Pointer to TF handle
     491                 :            :  *
     492                 :            :  * [out] session_id
     493                 :            :  *   Pointer to the session_id
     494                 :            :  *
     495                 :            :  * Returns
     496                 :            :  *   - (0) if successful.
     497                 :            :  *   - (-EINVAL) on failure.
     498                 :            :  */
     499                 :            : int tf_session_get_fw_session_id(struct tf *tfp,
     500                 :            :                                  uint8_t *fw_session_id);
     501                 :            : 
     502                 :            : /**
     503                 :            :  * Looks up the Session id the requested TF handle.
     504                 :            :  *
     505                 :            :  * [in] tfp
     506                 :            :  *   Pointer to TF handle
     507                 :            :  *
     508                 :            :  * [out] session_id
     509                 :            :  *   Pointer to the session_id
     510                 :            :  *
     511                 :            :  * Returns
     512                 :            :  *   - (0) if successful.
     513                 :            :  *   - (-EINVAL) on failure.
     514                 :            :  */
     515                 :            : int tf_session_get_session_id(struct tf *tfp,
     516                 :            :                               union tf_session_id *session_id);
     517                 :            : 
     518                 :            : /**
     519                 :            :  * API to get the em_ext_db from tf_session.
     520                 :            :  *
     521                 :            :  * [in] tfp
     522                 :            :  *   Pointer to TF handle
     523                 :            :  *
     524                 :            :  * [out] em_ext_db_handle, pointer to eem handle
     525                 :            :  *
     526                 :            :  * Returns:
     527                 :            :  *   - (0) if successful.
     528                 :            :  *   - (-EINVAL) on failure.
     529                 :            :  */
     530                 :            : int
     531                 :            : tf_session_get_em_ext_db(struct tf *tfp,
     532                 :            :                         void **em_ext_db_handle);
     533                 :            : 
     534                 :            : /**
     535                 :            :  * API to set the em_ext_db in tf_session.
     536                 :            :  *
     537                 :            :  * [in] tfp
     538                 :            :  *   Pointer to TF handle
     539                 :            :  *
     540                 :            :  * [in] em_ext_db_handle, pointer to eem handle
     541                 :            :  *
     542                 :            :  * Returns:
     543                 :            :  *   - (0) if successful.
     544                 :            :  *   - (-EINVAL) on failure.
     545                 :            :  */
     546                 :            : int
     547                 :            : tf_session_set_em_ext_db(struct tf *tfp,
     548                 :            :                         void *em_ext_db_handle);
     549                 :            : 
     550                 :            : /**
     551                 :            :  * API to get the db from tf_session.
     552                 :            :  *
     553                 :            :  * [in] tfp
     554                 :            :  *   Pointer to TF handle
     555                 :            :  *
     556                 :            :  * [out] db_handle, pointer to db handle
     557                 :            :  *
     558                 :            :  * Returns:
     559                 :            :  *   - (0) if successful.
     560                 :            :  *   - (-EINVAL) on failure.
     561                 :            :  */
     562                 :            : int
     563                 :            : tf_session_get_db(struct tf *tfp,
     564                 :            :                    enum tf_module_type type,
     565                 :            :                   void **db_handle);
     566                 :            : 
     567                 :            : /**
     568                 :            :  * API to set the db in tf_session.
     569                 :            :  *
     570                 :            :  * [in] tfp
     571                 :            :  *   Pointer to TF handle
     572                 :            :  *
     573                 :            :  * [in] db_handle, pointer to db handle
     574                 :            :  *
     575                 :            :  * Returns:
     576                 :            :  *   - (0) if successful.
     577                 :            :  *   - (-EINVAL) on failure.
     578                 :            :  */
     579                 :            : int
     580                 :            : tf_session_set_db(struct tf *tfp,
     581                 :            :                    enum tf_module_type type,
     582                 :            :                   void *db_handle);
     583                 :            : 
     584                 :            : /**
     585                 :            :  * Check if the session is shared session.
     586                 :            :  *
     587                 :            :  * [in] session, pointer to the session
     588                 :            :  *
     589                 :            :  * Returns:
     590                 :            :  *   - true if it is shared session
     591                 :            :  *   - false if it is not shared session
     592                 :            :  */
     593                 :            : static inline bool
     594                 :            : tf_session_is_shared_session(struct tf_session *tfs)
     595                 :            : {
     596   [ #  #  #  #  :          0 :         return tfs->shared_session;
             #  #  #  # ]
     597                 :            : }
     598                 :            : 
     599                 :            : /**
     600                 :            :  * Check if the session is shared session for hot upgrade.
     601                 :            :  *
     602                 :            :  * [in] session, pointer to the session
     603                 :            :  *
     604                 :            :  * Returns:
     605                 :            :  *   - true if it is shared session for hot upgrade
     606                 :            :  *   - false if it is not shared session for hot upgrade
     607                 :            :  */
     608                 :            : static inline bool
     609                 :            : tf_session_is_shared_hotup_session(struct tf_session *tfs)
     610                 :            : {
     611         [ #  # ]:          0 :         return tfs->shared_session_hotup;
     612                 :            : }
     613                 :            : 
     614                 :            : /**
     615                 :            :  * Check if the session is the shared session creator
     616                 :            :  *
     617                 :            :  * [in] session, pointer to the session
     618                 :            :  *
     619                 :            :  * Returns:
     620                 :            :  *   - true if it is the shared session creator
     621                 :            :  *   - false if it is not the shared session creator
     622                 :            :  */
     623                 :            : static inline bool
     624                 :            : tf_session_is_shared_session_creator(struct tf_session *tfs)
     625                 :            : {
     626         [ #  # ]:          0 :         return tfs->shared_session_creator;
     627                 :            : }
     628                 :            : 
     629                 :            : /**
     630                 :            :  * Get the pointer to the parent bnxt struct
     631                 :            :  *
     632                 :            :  * [in] session, pointer to the session
     633                 :            :  *
     634                 :            :  * Returns:
     635                 :            :  *   - the pointer to the parent bnxt struct
     636                 :            :  */
     637                 :            : static inline struct bnxt*
     638                 :            : tf_session_get_bp(struct tf *tfp)
     639                 :            : {
     640                 :          0 :         return tfp->bp;
     641                 :            : }
     642                 :            : 
     643                 :            : /**
     644                 :            :  * Set the pointer to the tcam shared database
     645                 :            :  *
     646                 :            :  * [in] session, pointer to the session
     647                 :            :  *
     648                 :            :  * Returns:
     649                 :            :  *   - the pointer to the parent bnxt struct
     650                 :            :  */
     651                 :            : int
     652                 :            : tf_session_set_tcam_shared_db(struct tf *tfp,
     653                 :            :                               void *tcam_shared_db_handle);
     654                 :            : 
     655                 :            : /**
     656                 :            :  * Get the pointer to the tcam shared database
     657                 :            :  *
     658                 :            :  * [in] session, pointer to the session
     659                 :            :  *
     660                 :            :  * Returns:
     661                 :            :  *   - the pointer to the parent bnxt struct
     662                 :            :  */
     663                 :            : int
     664                 :            : tf_session_get_tcam_shared_db(struct tf *tfp,
     665                 :            :                               void **tcam_shared_db_handle);
     666                 :            : 
     667                 :            : /**
     668                 :            :  * Set the pointer to the SRAM database
     669                 :            :  *
     670                 :            :  * [in] session, pointer to the session
     671                 :            :  *
     672                 :            :  * Returns:
     673                 :            :  *   - the pointer to the parent bnxt struct
     674                 :            :  */
     675                 :            : int
     676                 :            : tf_session_set_sram_db(struct tf *tfp,
     677                 :            :                        void *sram_handle);
     678                 :            : 
     679                 :            : /**
     680                 :            :  * Get the pointer to the SRAM database
     681                 :            :  *
     682                 :            :  * [in] session, pointer to the session
     683                 :            :  *
     684                 :            :  * Returns:
     685                 :            :  *   - the pointer to the parent bnxt struct
     686                 :            :  */
     687                 :            : int
     688                 :            : tf_session_get_sram_db(struct tf *tfp,
     689                 :            :                        void **sram_handle);
     690                 :            : 
     691                 :            : /**
     692                 :            :  * Set the pointer to the global cfg database
     693                 :            :  *
     694                 :            :  * [in] session, pointer to the session
     695                 :            :  *
     696                 :            :  * Returns:
     697                 :            :  *   - (0) if successful.
     698                 :            :  *   - (-EINVAL) on failure.
     699                 :            :  */
     700                 :            : int
     701                 :            : tf_session_set_global_db(struct tf *tfp,
     702                 :            :                          void *global_handle);
     703                 :            : 
     704                 :            : /**
     705                 :            :  * Get the pointer to the global cfg database
     706                 :            :  *
     707                 :            :  * [in] session, pointer to the session
     708                 :            :  *
     709                 :            :  * Returns:
     710                 :            :  *   - (0) if successful.
     711                 :            :  *   - (-EINVAL) on failure.
     712                 :            :  */
     713                 :            : int
     714                 :            : tf_session_get_global_db(struct tf *tfp,
     715                 :            :                          void **global_handle);
     716                 :            : 
     717                 :            : /**
     718                 :            :  * Set the pointer to the if table cfg database
     719                 :            :  *
     720                 :            :  * [in] session, pointer to the session
     721                 :            :  *
     722                 :            :  * Returns:
     723                 :            :  *   - (0) if successful.
     724                 :            :  *   - (-EINVAL) on failure.
     725                 :            :  */
     726                 :            : int
     727                 :            : tf_session_set_if_tbl_db(struct tf *tfp,
     728                 :            :                          void *if_tbl_handle);
     729                 :            : 
     730                 :            : /**
     731                 :            :  * Get the pointer to the if table cfg database
     732                 :            :  *
     733                 :            :  * [in] session, pointer to the session
     734                 :            :  *
     735                 :            :  * Returns:
     736                 :            :  *   - (0) if successful.
     737                 :            :  *   - (-EINVAL) on failure.
     738                 :            :  */
     739                 :            : int
     740                 :            : tf_session_get_if_tbl_db(struct tf *tfp,
     741                 :            :                          void **if_tbl_handle);
     742                 :            : 
     743                 :            : /**
     744                 :            :  * Set hot upgrade session state.
     745                 :            :  *
     746                 :            :  * [in] tfp
     747                 :            :  *   Pointer to session handle
     748                 :            :  *
     749                 :            :  * [in] parms
     750                 :            :  *   Hot upgrade session state parms
     751                 :            :  *
     752                 :            :  * Returns:
     753                 :            :  *  0 on Success else internal Truflow error
     754                 :            :  */
     755                 :            : int
     756                 :            : tf_session_set_hotup_state(struct tf *tfp,
     757                 :            :                            struct tf_set_session_hotup_state_parms *parms);
     758                 :            : 
     759                 :            : /**
     760                 :            :  * Get hot upgrade session state.
     761                 :            :  *
     762                 :            :  * [in] tfp
     763                 :            :  *   Pointer to session handle
     764                 :            :  *
     765                 :            :  * [out] parms
     766                 :            :  *   Pointer to hot upgrade session state parms
     767                 :            :  *
     768                 :            :  * Returns:
     769                 :            :  *  0 on Success else internal Truflow error
     770                 :            :  */
     771                 :            : int
     772                 :            : tf_session_get_hotup_state(struct tf *tfp,
     773                 :            :                            struct tf_get_session_hotup_state_parms *parms);
     774                 :            : #endif /* _TF_SESSION_H_ */

Generated by: LCOV version 1.14