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

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(c) 2001-2023 Intel Corporation
       3                 :            :  */
       4                 :            : 
       5                 :            : #include "ice_common.h"
       6                 :            : #include "ice_parser_util.h"
       7                 :            : 
       8                 :            : 
       9                 :          0 : static void _proto_off_dump(struct ice_hw *hw, struct ice_proto_off *po,
      10                 :            :                             int idx)
      11                 :            : {
      12         [ #  # ]:          0 :         ice_info(hw, "proto %d\n", idx);
      13         [ #  # ]:          0 :         ice_info(hw, "\tpolarity = %d\n", po->polarity);
      14         [ #  # ]:          0 :         ice_info(hw, "\tproto_id = %d\n", po->proto_id);
      15         [ #  # ]:          0 :         ice_info(hw, "\toffset = %d\n", po->offset);
      16                 :          0 : }
      17                 :            : 
      18                 :            : /**
      19                 :            :  * ice_proto_grp_dump - dump a proto group item info
      20                 :            :  * @hw: pointer to the hardware structure
      21                 :            :  * @item: proto group item to dump
      22                 :            :  */
      23                 :          0 : void ice_proto_grp_dump(struct ice_hw *hw, struct ice_proto_grp_item *item)
      24                 :            : {
      25                 :            :         int i;
      26                 :            : 
      27         [ #  # ]:          0 :         ice_info(hw, "index = %d\n", item->idx);
      28                 :            : 
      29         [ #  # ]:          0 :         for (i = 0; i < ICE_PROTO_COUNT_PER_GRP; i++)
      30                 :          0 :                 _proto_off_dump(hw, &item->po[i], i);
      31                 :          0 : }
      32                 :            : 
      33                 :            : /** The function parses a 22 bits Protocol entry with below format:
      34                 :            :  *  BIT 0:      Polarity of Protocol Offset (po->polarity)
      35                 :            :  *  BIT 1-8:    Protocol ID (po->proto_id)
      36                 :            :  *  BIT 9-11:   reserved
      37                 :            :  *  BIT 12-21:  Protocol Offset (po->offset)
      38                 :            :  */
      39                 :            : static void _proto_off_parse(struct ice_proto_off *po, u32 data)
      40                 :            : {
      41                 :          0 :         po->polarity = (data & 0x1) != 0;
      42                 :          0 :         po->proto_id = (u8)((data >> 1) & 0xff);
      43                 :          0 :         po->offset = (u16)((data >> 12) & 0x3ff);
      44                 :            : }
      45                 :            : 
      46                 :            : /** The function parses a 192 bits Protocol Group Table entry with below
      47                 :            :  *  format:
      48                 :            :  *  BIT 0-21:   Protocol 0 (grp->po[0])
      49                 :            :  *  BIT 22-43:  Protocol 1 (grp->po[1])
      50                 :            :  *  BIT 44-65:  Protocol 2 (grp->po[2])
      51                 :            :  *  BIT 66-87:  Protocol 3 (grp->po[3])
      52                 :            :  *  BIT 88-109: Protocol 4 (grp->po[4])
      53                 :            :  *  BIT 110-131:Protocol 5 (grp->po[5])
      54                 :            :  *  BIT 132-153:Protocol 6 (grp->po[6])
      55                 :            :  *  BIT 154-175:Protocol 7 (grp->po[7])
      56                 :            :  *  BIT 176-191:reserved
      57                 :            :  */
      58                 :          0 : static void _proto_grp_parse_item(struct ice_hw *hw, u16 idx, void *item,
      59                 :            :                                   void *data, int size)
      60                 :            : {
      61                 :            :         struct ice_proto_grp_item *grp = (struct ice_proto_grp_item *)item;
      62                 :            :         u8 *buf = (u8 *)data;
      63                 :            :         u32 d32;
      64                 :            : 
      65                 :          0 :         grp->idx = idx;
      66                 :            : 
      67                 :          0 :         d32 = *(u32 *)buf;
      68                 :            :         _proto_off_parse(&grp->po[0], d32);
      69                 :            : 
      70                 :          0 :         d32 = (*(u32 *)&buf[2] >> 6);
      71                 :            :         _proto_off_parse(&grp->po[1], d32);
      72                 :            : 
      73                 :          0 :         d32 = (*(u32 *)&buf[5] >> 4);
      74                 :            :         _proto_off_parse(&grp->po[2], d32);
      75                 :            : 
      76                 :          0 :         d32 = (*(u32 *)&buf[8] >> 2);
      77                 :            :         _proto_off_parse(&grp->po[3], d32);
      78                 :            : 
      79                 :          0 :         d32 = *(u32 *)&buf[11];
      80                 :            :         _proto_off_parse(&grp->po[4], d32);
      81                 :            : 
      82                 :          0 :         d32 = (*(u32 *)&buf[13] >> 6);
      83                 :            :         _proto_off_parse(&grp->po[5], d32);
      84                 :            : 
      85                 :          0 :         d32 = (*(u32 *)&buf[16] >> 4);
      86                 :            :         _proto_off_parse(&grp->po[6], d32);
      87                 :            : 
      88                 :          0 :         d32 = (*(u32 *)&buf[19] >> 2);
      89                 :            :         _proto_off_parse(&grp->po[7], d32);
      90                 :            : 
      91         [ #  # ]:          0 :         if (hw->debug_mask & ICE_DBG_PARSER)
      92                 :          0 :                 ice_proto_grp_dump(hw, grp);
      93                 :          0 : }
      94                 :            : 
      95                 :            : /**
      96                 :            :  * ice_proto_grp_table_get - create a proto group table
      97                 :            :  * @hw: pointer to the hardware structure
      98                 :            :  */
      99                 :          0 : struct ice_proto_grp_item *ice_proto_grp_table_get(struct ice_hw *hw)
     100                 :            : {
     101                 :          0 :         return (struct ice_proto_grp_item *)
     102                 :          0 :                 ice_parser_create_table(hw, ICE_SID_RXPARSER_PROTO_GRP,
     103                 :            :                                         sizeof(struct ice_proto_grp_item),
     104                 :            :                                         ICE_PROTO_GRP_TABLE_SIZE,
     105                 :            :                                         ice_parser_sect_item_get,
     106                 :            :                                         _proto_grp_parse_item, false);
     107                 :            : }

Generated by: LCOV version 1.14