LCOV - code coverage report
Current view: top level - lib/ethdev - rte_ethdev_cman.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 48 0.0 %
Date: 2024-12-01 18:57:19 Functions: 0 4 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 24 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(C) 2022 Marvell International Ltd.
       3                 :            :  */
       4                 :            : 
       5                 :            : #include <stdint.h>
       6                 :            : 
       7                 :            : #include <rte_errno.h>
       8                 :            : #include "rte_ethdev.h"
       9                 :            : #include "ethdev_driver.h"
      10                 :            : #include "ethdev_private.h"
      11                 :            : #include "ethdev_trace.h"
      12                 :            : 
      13                 :            : /* Get congestion management information for a port */
      14                 :            : int
      15                 :          0 : rte_eth_cman_info_get(uint16_t port_id, struct rte_eth_cman_info *info)
      16                 :            : {
      17                 :            :         struct rte_eth_dev *dev;
      18                 :            :         int ret;
      19                 :            : 
      20         [ #  # ]:          0 :         RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
      21                 :          0 :         dev = &rte_eth_devices[port_id];
      22                 :            : 
      23         [ #  # ]:          0 :         if (info == NULL) {
      24                 :          0 :                 RTE_ETHDEV_LOG_LINE(ERR, "congestion management info is NULL");
      25                 :          0 :                 return -EINVAL;
      26                 :            :         }
      27                 :            : 
      28         [ #  # ]:          0 :         if (dev->dev_ops->cman_info_get == NULL) {
      29                 :          0 :                 RTE_ETHDEV_LOG_LINE(ERR, "Function not implemented");
      30                 :          0 :                 return -ENOTSUP;
      31                 :            :         }
      32                 :            : 
      33                 :            :         memset(info, 0, sizeof(struct rte_eth_cman_info));
      34                 :          0 :         ret = eth_err(port_id, (*dev->dev_ops->cman_info_get)(dev, info));
      35                 :            : 
      36                 :          0 :         rte_eth_trace_cman_info_get(port_id, info, ret);
      37                 :            : 
      38                 :          0 :         return ret;
      39                 :            : }
      40                 :            : 
      41                 :            : /* Initialize congestion management structure with default values */
      42                 :            : int
      43                 :          0 : rte_eth_cman_config_init(uint16_t port_id, struct rte_eth_cman_config *config)
      44                 :            : {
      45                 :            :         struct rte_eth_dev *dev;
      46                 :            :         int ret;
      47                 :            : 
      48         [ #  # ]:          0 :         RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
      49                 :          0 :         dev = &rte_eth_devices[port_id];
      50                 :            : 
      51         [ #  # ]:          0 :         if (config == NULL) {
      52                 :          0 :                 RTE_ETHDEV_LOG_LINE(ERR, "congestion management config is NULL");
      53                 :          0 :                 return -EINVAL;
      54                 :            :         }
      55                 :            : 
      56         [ #  # ]:          0 :         if (dev->dev_ops->cman_config_init == NULL) {
      57                 :          0 :                 RTE_ETHDEV_LOG_LINE(ERR, "Function not implemented");
      58                 :          0 :                 return -ENOTSUP;
      59                 :            :         }
      60                 :            : 
      61                 :            :         memset(config, 0, sizeof(struct rte_eth_cman_config));
      62                 :          0 :         ret = eth_err(port_id, (*dev->dev_ops->cman_config_init)(dev, config));
      63                 :            : 
      64                 :          0 :         rte_eth_trace_cman_config_init(port_id, config, ret);
      65                 :            : 
      66                 :          0 :         return ret;
      67                 :            : }
      68                 :            : 
      69                 :            : /* Configure congestion management on a port */
      70                 :            : int
      71                 :          0 : rte_eth_cman_config_set(uint16_t port_id, const struct rte_eth_cman_config *config)
      72                 :            : {
      73                 :            :         struct rte_eth_dev *dev;
      74                 :            :         int ret;
      75                 :            : 
      76         [ #  # ]:          0 :         RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
      77                 :          0 :         dev = &rte_eth_devices[port_id];
      78                 :            : 
      79         [ #  # ]:          0 :         if (config == NULL) {
      80                 :          0 :                 RTE_ETHDEV_LOG_LINE(ERR, "congestion management config is NULL");
      81                 :          0 :                 return -EINVAL;
      82                 :            :         }
      83                 :            : 
      84         [ #  # ]:          0 :         if (dev->dev_ops->cman_config_set == NULL) {
      85                 :          0 :                 RTE_ETHDEV_LOG_LINE(ERR, "Function not implemented");
      86                 :          0 :                 return -ENOTSUP;
      87                 :            :         }
      88                 :            : 
      89                 :          0 :         ret = eth_err(port_id, (*dev->dev_ops->cman_config_set)(dev, config));
      90                 :            : 
      91                 :          0 :         rte_eth_trace_cman_config_set(port_id, config, ret);
      92                 :            : 
      93                 :          0 :         return ret;
      94                 :            : }
      95                 :            : 
      96                 :            : /* Retrieve congestion management configuration of a port */
      97                 :            : int
      98                 :          0 : rte_eth_cman_config_get(uint16_t port_id, struct rte_eth_cman_config *config)
      99                 :            : {
     100                 :            :         struct rte_eth_dev *dev;
     101                 :            :         int ret;
     102                 :            : 
     103         [ #  # ]:          0 :         RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
     104                 :          0 :         dev = &rte_eth_devices[port_id];
     105                 :            : 
     106         [ #  # ]:          0 :         if (config == NULL) {
     107                 :          0 :                 RTE_ETHDEV_LOG_LINE(ERR, "congestion management config is NULL");
     108                 :          0 :                 return -EINVAL;
     109                 :            :         }
     110                 :            : 
     111         [ #  # ]:          0 :         if (dev->dev_ops->cman_config_get == NULL) {
     112                 :          0 :                 RTE_ETHDEV_LOG_LINE(ERR, "Function not implemented");
     113                 :          0 :                 return -ENOTSUP;
     114                 :            :         }
     115                 :            : 
     116                 :            :         memset(config, 0, sizeof(struct rte_eth_cman_config));
     117                 :          0 :         ret = eth_err(port_id, (*dev->dev_ops->cman_config_get)(dev, config));
     118                 :            : 
     119                 :          0 :         rte_eth_trace_cman_config_get(port_id, config, ret);
     120                 :            : 
     121                 :          0 :         return ret;
     122                 :            : }

Generated by: LCOV version 1.14