LCOV - code coverage report
Current view: top level - drivers/net/enetc - enetc.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 4 0.0 %
Date: 2026-10-01 18:19:24 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 18 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright 2018-2019,2024-2026 NXP
       3                 :            :  */
       4                 :            : 
       5                 :            : #ifndef _ENETC_H_
       6                 :            : #define _ENETC_H_
       7                 :            : 
       8                 :            : #include <pthread.h>
       9                 :            : #include <rte_stdatomic.h>
      10                 :            : #include <rte_time.h>
      11                 :            : #include <ethdev_pci.h>
      12                 :            : 
      13                 :            : #include "compat.h"
      14                 :            : #include "base/enetc_hw.h"
      15                 :            : #include "base/enetc4_hw.h"
      16                 :            : #include "enetc_logs.h"
      17                 :            : #include "ntmp.h"
      18                 :            : 
      19                 :            : #define PCI_VENDOR_ID_FREESCALE 0x1957
      20                 :            : 
      21                 :            : /* Max TX rings per ENETC. */
      22                 :            : #define MAX_TX_RINGS    2
      23                 :            : 
      24                 :            : /* Max RX rings per ENTEC. */
      25                 :            : #define MAX_RX_RINGS    1
      26                 :            : 
      27                 :            : /* Max BD counts per Ring. */
      28                 :            : #define MAX_BD_COUNT   64000
      29                 :            : /* Min BD counts per Ring. */
      30                 :            : #define MIN_BD_COUNT   32
      31                 :            : /* BD ALIGN */
      32                 :            : #define BD_ALIGN       8
      33                 :            : /* Max segments per ENETC4 TX packet (scatter-gather) */
      34                 :            : #define ENETC4_MAX_SEGS 63
      35                 :            : 
      36                 :            : /* minimum frame size supported */
      37                 :            : #define ENETC_MAC_MINFRM_SIZE   68
      38                 :            : /* maximum frame size supported */
      39                 :            : #define ENETC_MAC_MAXFRM_SIZE   9600
      40                 :            : 
      41                 :            : /* The max frame size with default MTU */
      42                 :            : #define ENETC_ETH_MAX_LEN (RTE_ETHER_MTU + \
      43                 :            :                 RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
      44                 :            : 
      45                 :            : /* eth name size */
      46                 :            : #define ENETC_ETH_NAMESIZE      20
      47                 :            : 
      48                 :            : #define ENETC_DEFAULT_MSG_SIZE  1024    /* max size */
      49                 :            : 
      50                 :            : /* Message length is in multiple of 32 bytes */
      51                 :            : #define ENETC_VSI_PSI_MSG_SIZE  32
      52                 :            : 
      53                 :            : /* size for marking hugepage non-cacheable */
      54                 :            : #define SIZE_2MB        0x200000
      55                 :            : 
      56                 :            : #define ENETC4_TXQ_PRIORITIES   "enetc4_txq_prior"
      57                 :            : #define ENETC4_TXQ_WRR          "enetc4_txq_wrr"
      58                 :            : 
      59                 :            : #define ENETC_TXBD(BDR, i) (&(((struct enetc_tx_bd *)((BDR).bd_base))[i]))
      60                 :            : #define ENETC_RXBD(BDR, i) (&(((union enetc_rx_bd *)((BDR).bd_base))[i]))
      61                 :            : 
      62                 :            : #define ENETC4_MBUF_F_TX_IP_IPV4 (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_IPV4)
      63                 :            : #define ENETC4_TX_CKSUM_OFFLOAD_MASK (RTE_MBUF_F_TX_IP_CKSUM | \
      64                 :            :                                     RTE_MBUF_F_TX_TCP_CKSUM | \
      65                 :            :                                     RTE_MBUF_F_TX_UDP_CKSUM)
      66                 :            : 
      67                 :            : #define ENETC_CBD(R, i) (&(((struct enetc_cbd *)((R).bd_base))[i]))
      68                 :            : #define ENETC_CBDR_TIMEOUT      1000 /* In multiple of ENETC_CBDR_DELAY */
      69                 :            : #define ENETC_CBDR_DELAY        100 /* usecs */
      70                 :            : #define ENETC_CBDR_SIZE         64
      71                 :            : #define ENETC_CBDR_ALIGN        128
      72                 :            : 
      73                 :            : /* supported RSS */
      74                 :            : #define ENETC_RSS_OFFLOAD_ALL ( \
      75                 :            :         RTE_ETH_RSS_IP | \
      76                 :            :         RTE_ETH_RSS_UDP | \
      77                 :            :         RTE_ETH_RSS_TCP)
      78                 :            : 
      79                 :            : struct enetc_swbd {
      80                 :            :         struct rte_mbuf *buffer_addr;
      81                 :            : };
      82                 :            : 
      83                 :            : struct enetc_bdr {
      84                 :            :         void *bd_base;                  /* points to Rx or Tx BD ring */
      85                 :            :         struct enetc_swbd *q_swbd;
      86                 :            :         union {
      87                 :            :                 void *tcir;
      88                 :            :                 void *rcir;
      89                 :            :         };
      90                 :            :         int bd_count; /* # of BDs */
      91                 :            :         int next_to_use;
      92                 :            :         int next_to_clean;
      93                 :            :         uint16_t index;
      94                 :            :         uint8_t crc_len; /* 0 if CRC stripped, 4 otherwise */
      95                 :            :         union {
      96                 :            :                 void *tcisr; /* Tx */
      97                 :            :                 int next_to_alloc; /* Rx */
      98                 :            :         };
      99                 :            :         struct rte_mempool *mb_pool;   /* mbuf pool to populate RX ring. */
     100                 :            :         /* Partial scatter-gather chain persisted across burst calls. */
     101                 :            :         struct rte_mbuf *pkt_first_seg; /* first segment of in-progress frame */
     102                 :            :         struct rte_mbuf *pkt_last_seg;  /* last segment linked so far */
     103                 :            :         struct rte_eth_dev *ndev;
     104                 :            :         uint64_t ierrors;
     105                 :            :         uint8_t rx_deferred_start;
     106                 :            :         uint8_t tx_deferred_start;
     107                 :            :         uint8_t lso_enable;
     108                 :            :         void *rbidr;
     109                 :            :         uint8_t rsc_enable;
     110                 :            : };
     111                 :            : 
     112                 :            : /*
     113                 :            :  * Saved SI counter baseline for VF stats reset. Since the SI-level
     114                 :            :  * hardware counters (SIROCT0, SIRFRM0, SITOCT0, SITFRM0, SITDFCR)
     115                 :            :  * are read-only for a VF and cannot be directly zeroed, stats_reset
     116                 :            :  * captures the current counter values as a baseline. stats_get then
     117                 :            :  * reports the delta: current_hw_value - baseline.
     118                 :            :  */
     119                 :            : struct enetc4_vf_stats_saved {
     120                 :            :         uint64_t ipackets;
     121                 :            :         uint64_t opackets;
     122                 :            :         uint64_t ibytes;
     123                 :            :         uint64_t obytes;
     124                 :            :         uint64_t oerrors;
     125                 :            : };
     126                 :            : 
     127                 :            : struct enetc_eth_hw {
     128                 :            :         struct rte_eth_dev *ndev;
     129                 :            :         struct enetc_hw hw;
     130                 :            :         uint16_t device_id;
     131                 :            :         uint16_t vendor_id;
     132                 :            :         uint8_t revision_id;
     133                 :            :         struct enetc_eth_mac_info mac;
     134                 :            :         struct netc_cbdr cbdr;
     135                 :            :         uint32_t num_rss;
     136                 :            :         uint32_t max_rx_queues;
     137                 :            :         uint32_t max_tx_queues;
     138                 :            :         uint32_t vsi_timeout; /* VSI-PSI message wait timeout (iterations) */
     139                 :            :         uint32_t vsi_delay;   /* VSI-PSI message wait delay (us) */
     140                 :            :         uint32_t *txq_prior;  /* per-queue TX priority (TBMR priority bits) */
     141                 :            :         uint32_t *txq_wrr;    /* per-queue TX WRR weight pre-shifted for TBMR[WRR] */
     142                 :            :         uint8_t nc_mode;      /* 1 = non-cacheable BD memory, use _nc ops */
     143                 :            :         uint8_t rxq_intr_en;  /* 1 = per-queue Rx MSI-X interrupts enabled */
     144                 :            :         /* 1 = legacy PF-to-VF link message layout (4-bit speed / 4-bit cookie),
     145                 :            :          * for PF kernel versions before 6.18.37. Set via vf_link_legacy devarg.
     146                 :            :          */
     147                 :            :         uint8_t vf_link_legacy;
     148                 :            :         /* serializes all VSI-PSI mailbox transactions and RBMR read-modify-write
     149                 :            :          * sequences so that set_congestion_mode() and rx_queue_start/stop()
     150                 :            :          * cannot race on the same RBMR register.
     151                 :            :          */
     152                 :            :         pthread_mutex_t vsi_lock;
     153                 :            :         /* 1 = TX PAUSE negotiated on port; VF RX rings must have RBMR_CM set.
     154                 :            :          * Updated from the PF-to-VF link status mailbox message (BIT(1)).
     155                 :            :          * Always accessed under vsi_lock, so relaxed ordering suffices.
     156                 :            :          */
     157                 :            :         RTE_ATOMIC(uint8_t)tx_pause_active;
     158                 :            :         /* Baseline snapshot for VF stats reset (software delta approach). */
     159                 :            :         struct enetc4_vf_stats_saved vf_stats_saved;
     160                 :            : };
     161                 :            : 
     162                 :            : /*
     163                 :            :  * Structure to store private data for each driver instance (for each port).
     164                 :            :  */
     165                 :            : struct enetc_eth_adapter {
     166                 :            :         struct rte_eth_dev *ndev;
     167                 :            :         struct enetc_eth_hw hw;
     168                 :            : };
     169                 :            : 
     170                 :            : #define ENETC_DEV_PRIVATE(adapter) \
     171                 :            :         ((struct enetc_eth_adapter *)adapter)
     172                 :            : 
     173                 :            : #define ENETC_DEV_PRIVATE_TO_HW(adapter) \
     174                 :            :         (&((struct enetc_eth_adapter *)adapter)->hw)
     175                 :            : 
     176                 :            : #define ENETC_DEV_PRIVATE_TO_STATS(adapter) \
     177                 :            :         (&((struct enetc_eth_adapter *)adapter)->stats)
     178                 :            : 
     179                 :            : #define ENETC_DEV_PRIVATE_TO_INTR(adapter) \
     180                 :            :         (&((struct enetc_eth_adapter *)adapter)->intr)
     181                 :            : 
     182                 :            : /* Class ID for PSI-TO-VSI messages */
     183                 :            : #define ENETC_MSG_CLASS_ID_CMD_SUCCESS          0x1
     184                 :            : #define ENETC_MSG_CLASS_ID_PERMISSION_DENY      0x2
     185                 :            : #define ENETC_MSG_CLASS_ID_CMD_NOT_SUPPORT      0x3
     186                 :            : #define ENETC_MSG_CLASS_ID_PSI_BUSY             0x4
     187                 :            : #define ENETC_MSG_CLASS_ID_CRC_ERROR            0x5
     188                 :            : #define ENETC_MSG_CLASS_ID_PROTO_NOT_SUPPORT    0x6
     189                 :            : #define ENETC_MSG_CLASS_ID_INVALID_MSG_LEN      0x7
     190                 :            : #define ENETC_MSG_CLASS_ID_CMD_TIMEOUT          0x8
     191                 :            : #define ENETC_MSG_CLASS_ID_CMD_DEFERED          0xf
     192                 :            : 
     193                 :            : #define ENETC_PROMISC_DISABLE                   0x41
     194                 :            : #define ENETC_PROMISC_ENABLE                    0x43
     195                 :            : #define ENETC_ALLMULTI_PROMISC_DIS              0x81
     196                 :            : #define ENETC_ALLMULTI_PROMISC_EN               0x83
     197                 :            : 
     198                 :            : #define ENETC_PROMISC_VLAN_DISABLE              0x1
     199                 :            : #define ENETC_PROMISC_VLAN_ENABLE               0x3
     200                 :            : 
     201                 :            : /* Enum for class IDs */
     202                 :            : enum enetc_msg_cmd_class_id {
     203                 :            :         ENETC_CLASS_ID_MAC_FILTER = 0x20,
     204                 :            :         ENETC_CLASS_ID_VLAN_FILTER = 0x21,
     205                 :            :         /* Configure SI VLAN isolation (insert / remove) */
     206                 :            :         ENETC_CLASS_ID_SI_VLAN_ISO = 0x24,
     207                 :            :         ENETC_CLASS_ID_LINK_STATUS = 0x80,
     208                 :            :         ENETC_CLASS_ID_LINK_SPEED = 0x81,
     209                 :            :         ENETC_CLASS_ID_GET_IP_VER = 0xF0
     210                 :            : };
     211                 :            : 
     212                 :            : /* Enum for command IDs */
     213                 :            : enum enetc_msg_cmd_id {
     214                 :            :         ENETC_CMD_ID_SET_PRIMARY_MAC = 0,
     215                 :            :         ENETC_MSG_ADD_EXACT_MAC_ENTRIES = 1,
     216                 :            :         ENETC_CMD_ID_SET_MAC_PROMISCUOUS = 5,
     217                 :            :         ENETC_MSG_ADD_EXACT_VLAN_ENTRIES = 0,
     218                 :            :         ENETC_MSG_REMOVE_EXACT_VLAN_ENTRIES = 1,
     219                 :            :         ENETC_CMD_ID_SET_VLAN_PROMISCUOUS = 4,
     220                 :            :         ENETC_CMD_ID_GET_LINK_STATUS = 0,
     221                 :            :         ENETC_CMD_ID_REGISTER_LINK_NOTIF = 1,
     222                 :            :         ENETC_CMD_ID_UNREGISTER_LINK_NOTIF = 2,
     223                 :            :         ENETC_CMD_ID_GET_LINK_SPEED = 0,
     224                 :            :         /* Get IP version command IDs (class ID 0xF0) */
     225                 :            :         ENETC_CMD_ID_GET_IP_MJ = 0,
     226                 :            :         ENETC_CMD_ID_GET_IP_MN = 1,
     227                 :            :         ENETC_CMD_ID_GET_IP_INT = 2,
     228                 :            :         ENETC_CMD_ID_GET_IP_MNT = 3,
     229                 :            :         ENETC_CMD_ID_GET_IP_CFG = 4
     230                 :            : };
     231                 :            : 
     232                 :            : /* Command IDs for class ID 0x24 (SI VLAN isolation) */
     233                 :            : enum enetc_msg_si_vlan_cmd_id {
     234                 :            :         ENETC_CMD_ID_SET_SI_VLAN_ISO = 1,
     235                 :            : };
     236                 :            : 
     237                 :            : /* IP_VER value returned when the version is not available */
     238                 :            : #define ENETC_IP_VER_NOT_AVAILABLE      0xFF
     239                 :            : 
     240                 :            : enum mac_addr_status {
     241                 :            :         ENETC_INVALID_MAC_ADDR = 0x0,
     242                 :            :         ENETC_DUPLICATE_MAC_ADDR = 0X1,
     243                 :            :         ENETC_MAC_ADDR_NOT_FOUND = 0X2,
     244                 :            :         ENETC_MAC_FILTER_NO_RESOURCE = 0x3
     245                 :            : };
     246                 :            : 
     247                 :            : enum vlan_status {
     248                 :            :         ENETC_INVALID_VLAN_ENTRY = 0x0,
     249                 :            :         ENETC_DUPLICATE_VLAN_ENTRY = 0X1,
     250                 :            :         ENETC_VLAN_ENTRY_NOT_FOUND = 0x2,
     251                 :            :         ENETC_VLAN_NO_RESOURCE = 0x3
     252                 :            : };
     253                 :            : 
     254                 :            : /* Link status bitmask in PF-to-VF mailbox notification.
     255                 :            :  * Link up is encoded as the DOWN bit being clear.
     256                 :            :  * TX_PAUSE is set when the port has negotiated TX PAUSE; VF must enable
     257                 :            :  * congestion mode (ENETC_RBMR_CM) on its RX rings accordingly.
     258                 :            :  */
     259                 :            : #define ENETC_LINK_DOWN      (1u << 0)
     260                 :            : #define ENETC_LINK_TX_PAUSE  (1u << 1)
     261                 :            : 
     262                 :            : enum speed {
     263                 :            :         ENETC_SPEED_UNKNOWN = 0x0,
     264                 :            :         ENETC_SPEED_10_HALF_DUPLEX = 0x1,
     265                 :            :         ENETC_SPEED_10_FULL_DUPLEX = 0x2,
     266                 :            :         ENETC_SPEED_100_HALF_DUPLEX = 0x3,
     267                 :            :         ENETC_SPEED_100_FULL_DUPLEX = 0x4,
     268                 :            :         ENETC_SPEED_1000 = 0x5,
     269                 :            :         ENETC_SPEED_2500 = 0x6,
     270                 :            :         ENETC_SPEED_5000 = 0x7,
     271                 :            :         /* Do not add enumeration values for any speed greater than
     272                 :            :          * 5Gbps. For any speed greater than 5Gbps, its speed class
     273                 :            :          * code should follow the formula below.
     274                 :            :          *
     275                 :            :          * SPEED = (link_speed - 5000) / 1000 + ENETC_SPEED_5000
     276                 :            :          *
     277                 :            :          * The unit of link_speed should be Mbps. The resulting SPEED
     278                 :            :          * must fit in the 8-bit speed code field (0x0 to 0xff).
     279                 :            :          */
     280                 :            : };
     281                 :            : 
     282                 :            : /* Legacy speed class codes for backward compatibility with an older kernel PF
     283                 :            :  * (before 6.18.37) that encoded a 4-bit speed code and 4-bit cookie in the
     284                 :            :  * message's lower byte. Used only when the vf_link_legacy devarg is set.
     285                 :            :  */
     286                 :            : enum speed_legacy {
     287                 :            :         ENETC_SPEED_LEGACY_10G = 0x8,
     288                 :            :         ENETC_SPEED_LEGACY_25G = 0x9,
     289                 :            :         ENETC_SPEED_LEGACY_50G = 0xA,
     290                 :            :         ENETC_SPEED_LEGACY_100G = 0xB,
     291                 :            :         ENETC_SPEED_LEGACY_NOT_SUPPORTED = 0xF
     292                 :            : };
     293                 :            : 
     294                 :            : /* PSI-VSI command header format */
     295                 :            : struct enetc_msg_cmd_header {
     296                 :            :         uint16_t csum;          /* INET_CHECKSUM */
     297                 :            :         uint8_t class_id;       /* Command class type */
     298                 :            :         uint8_t cmd_id;         /* Denotes the specific required action */
     299                 :            :         uint8_t proto_ver;      /* Supported VSI-PSI command protocol version */
     300                 :            :         uint8_t len;            /* Extended message body length */
     301                 :            :         uint8_t reserved_1;
     302                 :            :         uint8_t cookie; /* Control command execution asynchronously on PSI side */
     303                 :            :         uint64_t reserved_2;
     304                 :            : };
     305                 :            : 
     306                 :            : /* VF-PF set primary MAC address message format */
     307                 :            : struct enetc_msg_cmd_set_primary_mac {
     308                 :            :         struct enetc_msg_cmd_header header;
     309                 :            :         uint8_t count;  /* number of MAC addresses */
     310                 :            :         uint8_t reserved_1;
     311                 :            :         uint16_t reserved_2;
     312                 :            :         struct rte_ether_addr addr;
     313                 :            : };
     314                 :            : 
     315                 :            : struct enetc_msg_cmd_set_promisc {
     316                 :            :         struct enetc_msg_cmd_header header;
     317                 :            :         uint8_t op_type;
     318                 :            : };
     319                 :            : 
     320                 :            : struct enetc_msg_cmd_get_link_status {
     321                 :            :         struct enetc_msg_cmd_header header;
     322                 :            : };
     323                 :            : 
     324                 :            : struct enetc_msg_cmd_get_link_speed {
     325                 :            :         struct enetc_msg_cmd_header header;
     326                 :            : };
     327                 :            : 
     328                 :            : /* Get IP version command message format (class ID 0xF0) */
     329                 :            : struct enetc_msg_cmd_get_ip_ver {
     330                 :            :         struct enetc_msg_cmd_header header;
     331                 :            : };
     332                 :            : 
     333                 :            : struct enetc_msg_cmd_set_vlan_promisc {
     334                 :            :         struct enetc_msg_cmd_header header;
     335                 :            :         uint8_t op;
     336                 :            :         uint8_t reserved;
     337                 :            : };
     338                 :            : 
     339                 :            : struct enetc_msg_vlan_exact_filter {
     340                 :            :         struct enetc_msg_cmd_header header;
     341                 :            :         uint8_t vlan_count;
     342                 :            :         uint8_t reserved_1;
     343                 :            :         uint16_t reserved_2;
     344                 :            :         uint16_t vlan_id;
     345                 :            :         uint8_t tpid;
     346                 :            :         uint8_t reserved2;
     347                 :            : };
     348                 :            : 
     349                 :            : /* VSI-PSI SI VLAN isolation message (class 0x24, cmd 0x1) */
     350                 :            : struct enetc_msg_si_vlan_iso {
     351                 :            :         struct enetc_msg_cmd_header header;
     352                 :            :         uint8_t ctrl;          /* E[7], VTEA[6], TPID[1:0] */
     353                 :            :         uint8_t pcp_dei_vid_hi; /* PCP[7:5], DEI[4], VID[11:8] */
     354                 :            :         uint8_t vid_lo;        /* VID[7:0] */
     355                 :            :         uint8_t reserved_0;
     356                 :            :         uint8_t flags;         /* SVIE[2], VTE[1] */
     357                 :            :         uint8_t reserved_1[3];
     358                 :            : };
     359                 :            : 
     360                 :            : #define ENETC_SI_VLAN_ISO_E     BIT(7)  /* ctrl: enable SI VLAN */
     361                 :            : #define ENETC_SI_VLAN_ISO_VTEA  BIT(6)  /* ctrl: 0=strip, 1=zero VID */
     362                 :            : #define ENETC_SI_VLAN_ISO_SVIE  BIT(2)  /* flags: Tx insertion enable */
     363                 :            : #define ENETC_SI_VLAN_ISO_VTE   BIT(1)  /* flags: Rx removal enable */
     364                 :            : 
     365                 :            : struct enetc_psi_reply_msg {
     366                 :            :         uint8_t class_id;
     367                 :            :         uint8_t status;
     368                 :            : };
     369                 :            : 
     370                 :            : /* msg size encoding: default and max msg value of 1024B encoded as 0 */
     371                 :            : static inline uint32_t enetc_vsi_set_msize(uint32_t size)
     372                 :            : {
     373         [ #  # ]:          0 :         return size < ENETC_DEFAULT_MSG_SIZE ? size >> 5 : 0;
     374                 :            : }
     375                 :            : 
     376                 :            : /*
     377                 :            :  * ENETC4 function prototypes
     378                 :            :  */
     379                 :            : int enetc4_pci_remove(struct rte_pci_device *pci_dev);
     380                 :            : int enetc4_dev_configure(struct rte_eth_dev *dev);
     381                 :            : int enetc4_dev_close(struct rte_eth_dev *dev);
     382                 :            : int enetc4_dev_infos_get(struct rte_eth_dev *dev,
     383                 :            :                          struct rte_eth_dev_info *dev_info);
     384                 :            : int enetc4_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
     385                 :            :                           uint16_t nb_rx_desc, unsigned int socket_id __rte_unused,
     386                 :            :                           const struct rte_eth_rxconf *rx_conf,
     387                 :            :                           struct rte_mempool *mb_pool);
     388                 :            : int enetc4_rx_queue_start(struct rte_eth_dev *dev, uint16_t qidx);
     389                 :            : int enetc4_rx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx);
     390                 :            : void enetc4_rx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
     391                 :            : int enetc4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
     392                 :            :                           uint16_t nb_desc, unsigned int socket_id __rte_unused,
     393                 :            :                           const struct rte_eth_txconf *tx_conf);
     394                 :            : int enetc4_tx_queue_start(struct rte_eth_dev *dev, uint16_t qidx);
     395                 :            : int enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx);
     396                 :            : void enetc4_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid);
     397                 :            : const uint32_t *enetc4_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused,
     398                 :            :                         size_t *no_of_elements);
     399                 :            : void enetc4_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
     400                 :            :                          struct rte_eth_rxq_info *qinfo);
     401                 :            : void enetc4_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
     402                 :            :                          struct rte_eth_txq_info *qinfo);
     403                 :            : 
     404                 :            : /*
     405                 :            :  * enetc4_vf function prototype
     406                 :            :  */
     407                 :            : int enetc4_vf_dev_stop(struct rte_eth_dev *dev);
     408                 :            : int enetc4_vf_dev_intr(struct rte_eth_dev *eth_dev, bool enable);
     409                 :            : 
     410                 :            : /*
     411                 :            :  * RX/TX ENETC function prototypes
     412                 :            :  */
     413                 :            : uint16_t enetc_xmit_pkts(void *txq, struct rte_mbuf **tx_pkts,
     414                 :            :                 uint16_t nb_pkts);
     415                 :            : uint16_t enetc_xmit_pkts_nc(void *txq, struct rte_mbuf **tx_pkts,
     416                 :            :                 uint16_t nb_pkts);
     417                 :            : uint16_t enetc_xmit_pkts_lso(void *txq, struct rte_mbuf **tx_pkts,
     418                 :            :                 uint16_t nb_pkts);
     419                 :            : uint16_t enetc_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts,
     420                 :            :                 uint16_t nb_pkts);
     421                 :            : uint16_t enetc_recv_pkts_nc(void *rxq, struct rte_mbuf **rx_pkts,
     422                 :            :                 uint16_t nb_pkts);
     423                 :            : uint16_t enetc_recv_pkts_rsc(void *rxq, struct rte_mbuf **rx_pkts,
     424                 :            :                 uint16_t nb_pkts);
     425                 :            : uint16_t enetc_xmit_pkts_cacheable(void *txq, struct rte_mbuf **tx_pkts,
     426                 :            :                 uint16_t nb_pkts);
     427                 :            : uint16_t enetc_recv_pkts_cacheable(void *rxq, struct rte_mbuf **rx_pkts,
     428                 :            :                 uint16_t nb_pkts);
     429                 :            : 
     430                 :            : int enetc_refill_rx_ring(struct enetc_bdr *rx_ring, const int buff_cnt);
     431                 :            : int enetc_refill_rx_ring_rsc(struct enetc_bdr *rx_ring, const int buff_cnt);
     432                 :            : 
     433                 :            : /*
     434                 :            :  * Cache-maintenance constants for cacheable BD ring mode.
     435                 :            :  *
     436                 :            :  * BD = 16 bytes, cache line = 64 bytes => 4 BDs per cache line.
     437                 :            :  * Every dcbf in enetc_refill_rx_ring() flushes a full 64-byte cache line.
     438                 :            :  * To ensure each dcbf covers only fully-written BDs the caller
     439                 :            :  * must pass a count rounded DOWN to a multiple of ENETC_BD_PER_CL so that
     440                 :            :  * the last partial group is left in cache to be completed and flushed in
     441                 :            :  * the next call.
     442                 :            :  */
     443                 :            : #define ENETC_BD_PER_CL         (RTE_CACHE_LINE_SIZE / sizeof(union enetc_rx_bd))
     444                 :            : #define ENETC_BD_PER_CL_MASK    (ENETC_BD_PER_CL - 1)
     445                 :            : /* Round n DOWN to the nearest multiple of ENETC_BD_PER_CL. */
     446                 :            : #define ENETC_BD_ALIGN_DOWN(n)  ((n) & ~(unsigned int)ENETC_BD_PER_CL_MASK)
     447                 :            : 
     448                 :            : void enetc4_dev_hw_init(struct rte_eth_dev *eth_dev);
     449                 :            : void enetc_print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr);
     450                 :            : 
     451                 :            : static inline int
     452                 :            : enetc_bd_unused(struct enetc_bdr *bdr)
     453                 :            : {
     454   [ #  #  #  #  :          0 :         if (bdr->next_to_clean > bdr->next_to_use)
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     455                 :          0 :                 return bdr->next_to_clean - bdr->next_to_use - 1;
     456                 :            : 
     457                 :          0 :         return bdr->bd_count + bdr->next_to_clean - bdr->next_to_use - 1;
     458                 :            : }
     459                 :            : 
     460                 :            : /* Per-ring BDR registers dumped by .get_reg (shared by PF and VF) */
     461                 :            : extern const uint32_t enetc4_txbdr_regs[6];
     462                 :            : extern const uint32_t enetc4_rxbdr_regs[8];
     463                 :            : 
     464                 :            : /* CBDR prototypes */
     465                 :            : int enetc4_setup_cbdr(struct rte_eth_dev *dev, struct enetc_hw *hw,
     466                 :            :                         int bd_count, struct netc_cbdr *cbdr);
     467                 :            : void enetc_free_cbdr(struct netc_cbdr *cbdr);
     468                 :            : int enetc_ntmp_rsst_query_or_update_entry(struct netc_cbdr *cbdr, uint32_t *table,
     469                 :            :                         int count, bool query);
     470                 :            : 
     471                 :            : #endif /* _ENETC_H_ */

Generated by: LCOV version 1.14