LCOV - code coverage report
Current view: top level - drivers/net/sfc - sfc_tbl_meta.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 16 0.0 %
Date: 2025-03-01 20:23:48 Functions: 0 3 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                 :            :  *
       3                 :            :  * Copyright (c) 2023 Advanced Micro Devices, Inc.
       4                 :            :  */
       5                 :            : 
       6                 :            : #include "sfc.h"
       7                 :            : #include "sfc_tbl_meta.h"
       8                 :            : #include "sfc_tbl_meta_cache.h"
       9                 :            : 
      10                 :            : const struct sfc_tbl_meta *
      11                 :          0 : sfc_tbl_meta_lookup(struct sfc_adapter *sa, efx_table_id_t table_id)
      12                 :            : {
      13                 :            :         struct sfc_tbl_meta *meta;
      14                 :            :         struct sfc_tbls *tables = &sa->hw_tables;
      15                 :            :         int rc;
      16                 :            : 
      17                 :            :         SFC_ASSERT(sfc_adapter_is_locked(sa));
      18                 :            : 
      19         [ #  # ]:          0 :         if (tables->status != SFC_TBLS_STATUS_SUPPORTED)
      20                 :            :                 return NULL;
      21                 :            : 
      22                 :          0 :         rc = rte_hash_lookup_data(tables->meta.cache, (const void *)&table_id,
      23                 :            :                                   (void **)&meta);
      24         [ #  # ]:          0 :         if (rc < 0)
      25                 :            :                 return NULL;
      26                 :            : 
      27                 :            :         SFC_ASSERT(meta != NULL);
      28                 :            :         SFC_ASSERT(meta->table_id == table_id);
      29                 :            : 
      30                 :          0 :         return meta;
      31                 :            : }
      32                 :            : 
      33                 :            : int
      34                 :          0 : sfc_tbl_meta_init(struct sfc_adapter *sa)
      35                 :            : {
      36                 :            :         struct sfc_tbls *tables = &sa->hw_tables;
      37                 :            :         struct sfc_tbl_meta_cache *meta = &tables->meta;
      38                 :            :         int rc;
      39                 :            : 
      40                 :            :         SFC_ASSERT(sfc_adapter_is_locked(sa));
      41                 :            : 
      42         [ #  # ]:          0 :         if (tables->status != SFC_TBLS_STATUS_SUPPORTED)
      43                 :            :                 return 0;
      44                 :            : 
      45                 :          0 :         rc = sfc_tbl_meta_cache_ctor(&meta->cache);
      46         [ #  # ]:          0 :         if (rc != 0)
      47                 :            :                 return rc;
      48                 :            : 
      49                 :          0 :         rc = sfc_tbl_meta_cache_update(meta->cache, sa->nic);
      50         [ #  # ]:          0 :         if (rc != 0) {
      51                 :          0 :                 sfc_tbl_meta_cache_dtor(&meta->cache);
      52                 :          0 :                 return rc;
      53                 :            :         }
      54                 :            : 
      55                 :            :         return 0;
      56                 :            : }
      57                 :            : 
      58                 :            : void
      59                 :          0 : sfc_tbl_meta_fini(struct sfc_adapter *sa)
      60                 :            : {
      61                 :            :         struct sfc_tbls *tables = &sa->hw_tables;
      62                 :            :         struct sfc_tbl_meta_cache *meta = &tables->meta;
      63                 :            : 
      64         [ #  # ]:          0 :         if (meta->cache == NULL)
      65                 :            :                 return;
      66                 :            : 
      67                 :            :         SFC_ASSERT(sfc_adapter_is_locked(sa));
      68                 :            :         SFC_ASSERT(tables->status == SFC_TBLS_STATUS_SUPPORTED);
      69                 :            : 
      70                 :          0 :         sfc_tbl_meta_cache_dtor(&meta->cache);
      71                 :            : }

Generated by: LCOV version 1.14