LCOV - code coverage report
Current view: top level - drivers/common/cnxk - roc_ie_ot.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 1 0.0 %
Date: 2024-12-01 18:57:19 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) 2022 Marvell.
       3                 :            :  */
       4                 :            : 
       5                 :            : #ifndef __ROC_IE_OT_H__
       6                 :            : #define __ROC_IE_OT_H__
       7                 :            : 
       8                 :            : #include "roc_platform.h"
       9                 :            : 
      10                 :            : /* CN10K IPSEC opcodes */
      11                 :            : #define ROC_IE_OT_MAJOR_OP_PROCESS_OUTBOUND_IPSEC 0x28UL
      12                 :            : #define ROC_IE_OT_MAJOR_OP_PROCESS_INBOUND_IPSEC  0x29UL
      13                 :            : 
      14                 :            : #define ROC_IE_OT_MAJOR_OP_WRITE_SA 0x01UL
      15                 :            : #define ROC_IE_OT_MINOR_OP_WRITE_SA 0x09UL
      16                 :            : 
      17                 :            : #define ROC_IE_OT_CTX_ILEN 2
      18                 :            : /* PKIND to be used for CPT Meta parsing */
      19                 :            : #define ROC_IE_OT_CPT_PKIND       58
      20                 :            : #define ROC_IE_OT_CPT_TS_PKIND    54
      21                 :            : #define ROC_IE_OT_SA_CTX_HDR_SIZE 1
      22                 :            : 
      23                 :            : #define ROC_IE_OT_INPLACE_BIT BIT(6)
      24                 :            : 
      25                 :            : enum roc_ie_ot_ucc_ipsec {
      26                 :            :         ROC_IE_OT_UCC_SUCCESS = 0x00,
      27                 :            :         ROC_IE_OT_UCC_ERR_SA_INVAL = 0xb0,
      28                 :            :         ROC_IE_OT_UCC_ERR_SA_EXPIRED = 0xb1,
      29                 :            :         ROC_IE_OT_UCC_ERR_SA_OVERFLOW = 0xb2,
      30                 :            :         ROC_IE_OT_UCC_ERR_SA_ESP_BAD_ALGO = 0xb3,
      31                 :            :         ROC_IE_OT_UCC_ERR_SA_AH_BAD_ALGO = 0xb4,
      32                 :            :         ROC_IE_OT_UCC_ERR_SA_BAD_CTX = 0xb5,
      33                 :            :         ROC_IE_OT_UCC_SA_CTX_FLAG_MISMATCH = 0xb6,
      34                 :            :         ROC_IE_OT_UCC_ERR_AOP_IPSEC = 0xb7,
      35                 :            :         ROC_IE_OT_UCC_ERR_PKT_IP = 0xb8,
      36                 :            :         ROC_IE_OT_UCC_ERR_PKT_IP6_BAD_EXT = 0xb9,
      37                 :            :         ROC_IE_OT_UCC_ERR_PKT_IP6_HBH = 0xba,
      38                 :            :         ROC_IE_OT_UCC_ERR_PKT_IP6_BIGEXT = 0xbb,
      39                 :            :         ROC_IE_OT_UCC_ERR_PKT_IP_ULP = 0xbc,
      40                 :            :         ROC_IE_OT_UCC_ERR_PKT_SA_MISMATCH = 0xbd,
      41                 :            :         ROC_IE_OT_UCC_ERR_PKT_SPI_MISMATCH = 0xbe,
      42                 :            :         ROC_IE_OT_UCC_ERR_PKT_ESP_BADPAD = 0xbf,
      43                 :            :         ROC_IE_OT_UCC_ERR_PKT_BADICV = 0xc0,
      44                 :            :         ROC_IE_OT_UCC_ERR_PKT_REPLAY_SEQ = 0xc1,
      45                 :            :         ROC_IE_OT_UCC_ERR_PKT_BADNH = 0xc2,
      46                 :            :         ROC_IE_OT_UCC_ERR_PKT_SA_PORT_MISMATCH = 0xc3,
      47                 :            :         ROC_IE_OT_UCC_ERR_PKT_BAD_DLEN = 0xc4,
      48                 :            :         ROC_IE_OT_UCC_ERR_SA_ESP_BAD_KEYS = 0xc5,
      49                 :            :         ROC_IE_OT_UCC_ERR_SA_AH_BAD_KEYS = 0xc6,
      50                 :            :         ROC_IE_OT_UCC_ERR_SA_BAD_IP = 0xc7,
      51                 :            :         ROC_IE_OT_UCC_ERR_PKT_IP_FRAG = 0xc8,
      52                 :            :         ROC_IE_OT_UCC_ERR_PKT_REPLAY_WINDOW = 0xc9,
      53                 :            :         ROC_IE_OT_UCC_SUCCESS_PKT_IP_BADCSUM = 0xed,
      54                 :            :         ROC_IE_OT_UCC_SUCCESS_PKT_L4_GOODCSUM = 0xee,
      55                 :            :         ROC_IE_OT_UCC_SUCCESS_PKT_L4_BADCSUM = 0xef,
      56                 :            :         ROC_IE_OT_UCC_SUCCESS_SA_SOFTEXP_FIRST = 0xf0,
      57                 :            :         ROC_IE_OT_UCC_SUCCESS_PKT_UDPESP_NZCSUM = 0xf1,
      58                 :            :         ROC_IE_OT_UCC_SUCCESS_SA_SOFTEXP_AGAIN = 0xf2,
      59                 :            :         ROC_IE_OT_UCC_SUCCESS_PKT_UDP_ZEROCSUM = 0xf3,
      60                 :            :         ROC_IE_OT_UCC_SUCCESS_PKT_IP_GOODCSUM = 0x0,
      61                 :            : };
      62                 :            : 
      63                 :            : enum {
      64                 :            :         ROC_IE_OT_SA_AR_WIN_DISABLED = 0,
      65                 :            :         ROC_IE_OT_SA_AR_WIN_64 = 1,
      66                 :            :         ROC_IE_OT_SA_AR_WIN_128 = 2,
      67                 :            :         ROC_IE_OT_SA_AR_WIN_256 = 3,
      68                 :            :         ROC_IE_OT_SA_AR_WIN_512 = 4,
      69                 :            :         ROC_IE_OT_SA_AR_WIN_1024 = 5,
      70                 :            :         ROC_IE_OT_SA_AR_WIN_2048 = 6,
      71                 :            :         ROC_IE_OT_SA_AR_WIN_4096 = 7,
      72                 :            : };
      73                 :            : 
      74                 :            : enum {
      75                 :            :         ROC_IE_OT_SA_PKT_FMT_FULL = 0,
      76                 :            :         ROC_IE_OT_SA_PKT_FMT_META = 1,
      77                 :            : };
      78                 :            : 
      79                 :            : enum {
      80                 :            :         ROC_IE_OT_SA_PKT_OUTPUT_DECRYPTED = 0,
      81                 :            :         ROC_IE_OT_SA_PKT_OUTPUT_NO_FRAG = 1,
      82                 :            :         ROC_IE_OT_SA_PKT_OUTPUT_HW_BASED_DEFRAG = 2,
      83                 :            :         ROC_IE_OT_SA_PKT_OUTPUT_UCODE_BASED_DEFRAG = 3,
      84                 :            : };
      85                 :            : 
      86                 :            : enum {
      87                 :            :         ROC_IE_OT_SA_DEFRAG_ALL = 0,
      88                 :            :         ROC_IE_OT_SA_DEFRAG_IN_ORDER = 1,
      89                 :            :         ROC_IE_OT_SA_DEFRAG_IN_REV_ORDER = 2,
      90                 :            : };
      91                 :            : 
      92                 :            : enum {
      93                 :            :         ROC_IE_OT_SA_IV_SRC_DEFAULT = 0,
      94                 :            :         ROC_IE_OT_SA_IV_SRC_ENC_CTR = 1,
      95                 :            :         ROC_IE_OT_SA_IV_SRC_FROM_SA = 2,
      96                 :            : };
      97                 :            : 
      98                 :            : enum {
      99                 :            :         ROC_IE_OT_SA_COPY_FROM_SA = 0,
     100                 :            :         ROC_IE_OT_SA_COPY_FROM_INNER_IP_HDR = 1,
     101                 :            : };
     102                 :            : 
     103                 :            : enum {
     104                 :            :         ROC_IE_OT_SA_INNER_PKT_IP_CSUM_ENABLE = 0,
     105                 :            :         ROC_IE_OT_SA_INNER_PKT_IP_CSUM_DISABLE = 1,
     106                 :            : };
     107                 :            : 
     108                 :            : enum {
     109                 :            :         ROC_IE_OT_SA_INNER_PKT_L4_CSUM_ENABLE = 0,
     110                 :            :         ROC_IE_OT_SA_INNER_PKT_L4_CSUM_DISABLE = 1,
     111                 :            : };
     112                 :            : 
     113                 :            : enum {
     114                 :            :         ROC_IE_OT_SA_ENCAP_NONE = 0,
     115                 :            :         ROC_IE_OT_SA_ENCAP_UDP = 1,
     116                 :            :         ROC_IE_OT_SA_ENCAP_TCP = 2,
     117                 :            : };
     118                 :            : 
     119                 :            : enum {
     120                 :            :         ROC_IE_OT_SA_LIFE_UNIT_OCTETS = 0,
     121                 :            :         ROC_IE_OT_SA_LIFE_UNIT_PKTS = 1,
     122                 :            : };
     123                 :            : 
     124                 :            : enum {
     125                 :            :         ROC_IE_OT_SA_IP_HDR_VERIFY_DISABLED = 0,
     126                 :            :         ROC_IE_OT_SA_IP_HDR_VERIFY_DST_ADDR = 1,
     127                 :            :         ROC_IE_OT_SA_IP_HDR_VERIFY_SRC_DST_ADDR = 2,
     128                 :            : };
     129                 :            : 
     130                 :            : enum {
     131                 :            :         ROC_IE_OT_REAS_STS_SUCCESS = 0,
     132                 :            :         ROC_IE_OT_REAS_STS_TIMEOUT = 1,
     133                 :            :         ROC_IE_OT_REAS_STS_EVICT = 2,
     134                 :            :         ROC_IE_OT_REAS_STS_BAD_ORDER = 3,
     135                 :            :         ROC_IE_OT_REAS_STS_TOO_MANY = 4,
     136                 :            :         ROC_IE_OT_REAS_STS_HSH_EVICT = 5,
     137                 :            :         ROC_IE_OT_REAS_STS_OVERLAP = 6,
     138                 :            :         ROC_IE_OT_REAS_STS_ZOMBIE = 7,
     139                 :            :         ROC_IE_OT_REAS_STS_L3P_ERR = 8,
     140                 :            :         ROC_IE_OT_REAS_STS_MAX = 9
     141                 :            : };
     142                 :            : 
     143                 :            : enum {
     144                 :            :         ROC_IE_OT_ERR_CTL_MODE_NONE = 0,
     145                 :            :         ROC_IE_OT_ERR_CTL_MODE_CLEAR = 1,
     146                 :            :         ROC_IE_OT_ERR_CTL_MODE_RING = 2,
     147                 :            : };
     148                 :            : 
     149                 :            : static __plt_always_inline bool
     150                 :            : roc_ie_ot_ucc_is_success(uint8_t ucc)
     151                 :            : {
     152                 :            :         uint8_t uc_base = (uint8_t)ROC_IE_OT_UCC_SUCCESS_PKT_IP_BADCSUM - 1u;
     153                 :            : 
     154   [ #  #  #  #  :          0 :         ucc--;
          #  #  #  #  #  
                #  #  # ]
     155                 :            :         return (ucc >= uc_base);
     156                 :            : }
     157                 :            : 
     158                 :            : /* Context units in bytes */
     159                 :            : #define ROC_CTX_UNIT_8B           8
     160                 :            : #define ROC_CTX_UNIT_128B         128
     161                 :            : #define ROC_CTX_MAX_CKEY_LEN      32
     162                 :            : #define ROC_CTX_MAX_OPAD_IPAD_LEN 128
     163                 :            : 
     164                 :            : /* Anti reply window size supported */
     165                 :            : #define ROC_AR_WIN_SIZE_MIN        64
     166                 :            : #define ROC_AR_WIN_SIZE_MAX        4096
     167                 :            : #define ROC_LOG_MIN_AR_WIN_SIZE_M1 5
     168                 :            : 
     169                 :            : /* u64 array size to fit anti replay window bits */
     170                 :            : #define ROC_AR_WINBITS_SZ                                                      \
     171                 :            :         (PLT_ALIGN_CEIL(ROC_AR_WIN_SIZE_MAX, BITS_PER_LONG_LONG) /             \
     172                 :            :          BITS_PER_LONG_LONG)
     173                 :            : 
     174                 :            : #define ROC_IPSEC_ERR_RING_MAX_ENTRY 65536
     175                 :            : 
     176                 :            : union roc_ot_ipsec_err_ring_head {
     177                 :            :         uint64_t u64;
     178                 :            :         struct {
     179                 :            :                 uint16_t tail_pos;
     180                 :            :                 uint16_t tail_gen;
     181                 :            :                 uint16_t head_pos;
     182                 :            :                 uint16_t head_gen;
     183                 :            :         } s;
     184                 :            : };
     185                 :            : 
     186                 :            : union roc_ot_ipsec_err_ring_entry {
     187                 :            :         uint64_t u64;
     188                 :            :         struct {
     189                 :            :                 uint64_t data0 : 44;
     190                 :            :                 uint64_t data1 : 9;
     191                 :            :                 uint64_t rsvd : 3;
     192                 :            :                 uint64_t comp_code : 8;
     193                 :            :         } s;
     194                 :            : };
     195                 :            : 
     196                 :            : /* Common bit fields between inbound and outbound SA */
     197                 :            : union roc_ot_ipsec_sa_word2 {
     198                 :            :         struct {
     199                 :            :                 uint64_t valid : 1;
     200                 :            :                 uint64_t dir : 1;
     201                 :            :                 uint64_t outer_ip_ver : 1;
     202                 :            :                 uint64_t rsvd0 : 1;
     203                 :            :                 uint64_t mode : 1;
     204                 :            :                 uint64_t protocol : 1;
     205                 :            :                 uint64_t aes_key_len : 2;
     206                 :            : 
     207                 :            :                 uint64_t enc_type : 3;
     208                 :            :                 uint64_t life_unit : 1;
     209                 :            :                 uint64_t auth_type : 4;
     210                 :            : 
     211                 :            :                 uint64_t encap_type : 2;
     212                 :            :                 uint64_t et_ovrwr_ddr_en : 1;
     213                 :            :                 uint64_t esn_en : 1;
     214                 :            :                 uint64_t tport_l4_incr_csum : 1;
     215                 :            :                 uint64_t ip_hdr_verify : 2;
     216                 :            :                 uint64_t udp_ports_verify : 1;
     217                 :            : 
     218                 :            :                 uint64_t rsvd2 : 7;
     219                 :            :                 uint64_t async_mode : 1;
     220                 :            : 
     221                 :            :                 uint64_t spi : 32;
     222                 :            :         } s;
     223                 :            :         uint64_t u64;
     224                 :            : };
     225                 :            : 
     226                 :            : PLT_STATIC_ASSERT(sizeof(union roc_ot_ipsec_sa_word2) == 1 * sizeof(uint64_t));
     227                 :            : 
     228                 :            : union roc_ot_ipsec_outer_ip_hdr {
     229                 :            :         struct {
     230                 :            :                 uint32_t dst_addr;
     231                 :            :                 uint32_t src_addr;
     232                 :            :         } ipv4;
     233                 :            :         struct {
     234                 :            :                 uint8_t src_addr[16];
     235                 :            :                 uint8_t dst_addr[16];
     236                 :            :         } ipv6;
     237                 :            : };
     238                 :            : 
     239                 :            : struct roc_ot_ipsec_inb_ctx_update_reg {
     240                 :            :         uint64_t ar_base;
     241                 :            :         uint64_t ar_valid_mask;
     242                 :            :         uint64_t hard_life;
     243                 :            :         uint64_t soft_life;
     244                 :            :         uint64_t mib_octs;
     245                 :            :         uint64_t mib_pkts;
     246                 :            :         uint64_t ar_winbits[ROC_AR_WINBITS_SZ];
     247                 :            : };
     248                 :            : 
     249                 :            : union roc_ot_ipsec_outb_iv {
     250                 :            :         uint64_t u64[2];
     251                 :            :         uint8_t iv_dbg[16];
     252                 :            :         struct {
     253                 :            :                 uint8_t iv_dbg1[4];
     254                 :            :                 uint8_t salt[4];
     255                 :            : 
     256                 :            :                 uint32_t rsvd;
     257                 :            :                 uint8_t iv_dbg2[4];
     258                 :            :         } s;
     259                 :            : };
     260                 :            : 
     261                 :            : struct roc_ot_ipsec_outb_ctx_update_reg {
     262                 :            :         union {
     263                 :            :                 struct {
     264                 :            :                         uint64_t reserved_0_2 : 3;
     265                 :            :                         uint64_t address : 57;
     266                 :            :                         uint64_t mode : 4;
     267                 :            :                 } s;
     268                 :            :                 uint64_t u64;
     269                 :            :         } err_ctl;
     270                 :            : 
     271                 :            :         uint64_t esn_val;
     272                 :            :         uint64_t hard_life;
     273                 :            :         uint64_t soft_life;
     274                 :            :         uint64_t mib_octs;
     275                 :            :         uint64_t mib_pkts;
     276                 :            : };
     277                 :            : 
     278                 :            : union roc_ot_ipsec_outb_param1 {
     279                 :            :         uint16_t u16;
     280                 :            :         struct {
     281                 :            :                 uint16_t l4_csum_disable : 1;
     282                 :            :                 uint16_t ip_csum_disable : 1;
     283                 :            :                 uint16_t ttl_or_hop_limit : 1;
     284                 :            :                 uint16_t dummy_pkt : 1;
     285                 :            :                 uint16_t rfc_or_override_mode : 1;
     286                 :            :                 uint16_t reserved_5_15 : 11;
     287                 :            :         } s;
     288                 :            : };
     289                 :            : 
     290                 :            : union roc_ot_ipsec_inb_param1 {
     291                 :            :         uint16_t u16;
     292                 :            :         struct {
     293                 :            :                 uint16_t l4_csum_disable : 1;
     294                 :            :                 uint16_t ip_csum_disable : 1;
     295                 :            :                 uint16_t esp_trailer_disable : 1;
     296                 :            :                 uint16_t reserved_3_15 : 13;
     297                 :            :         } s;
     298                 :            : };
     299                 :            : 
     300                 :            : struct roc_ot_ipsec_inb_sa {
     301                 :            :         /* Word0 */
     302                 :            :         union {
     303                 :            :                 struct {
     304                 :            :                         uint64_t ar_win : 3;
     305                 :            :                         uint64_t hard_life_dec : 1;
     306                 :            :                         uint64_t soft_life_dec : 1;
     307                 :            :                         uint64_t count_glb_octets : 1;
     308                 :            :                         uint64_t count_glb_pkts : 1;
     309                 :            :                         uint64_t count_mib_bytes : 1;
     310                 :            : 
     311                 :            :                         uint64_t count_mib_pkts : 1;
     312                 :            :                         uint64_t hw_ctx_off : 7;
     313                 :            : 
     314                 :            :                         uint64_t ctx_id : 16;
     315                 :            : 
     316                 :            :                         uint64_t orig_pkt_fabs : 1;
     317                 :            :                         uint64_t orig_pkt_free : 1;
     318                 :            :                         uint64_t pkind : 6;
     319                 :            : 
     320                 :            :                         uint64_t rsvd0 : 1;
     321                 :            :                         uint64_t et_ovrwr : 1;
     322                 :            :                         uint64_t pkt_output : 2;
     323                 :            :                         uint64_t pkt_format : 1;
     324                 :            :                         uint64_t defrag_opt : 2;
     325                 :            :                         uint64_t x2p_dst : 1;
     326                 :            : 
     327                 :            :                         uint64_t ctx_push_size : 7;
     328                 :            :                         uint64_t rsvd1 : 1;
     329                 :            : 
     330                 :            :                         uint64_t ctx_hdr_size : 2;
     331                 :            :                         uint64_t aop_valid : 1;
     332                 :            :                         uint64_t rsvd2 : 1;
     333                 :            :                         uint64_t ctx_size : 4;
     334                 :            :                 } s;
     335                 :            :                 uint64_t u64;
     336                 :            :         } w0;
     337                 :            : 
     338                 :            :         /* Word1 */
     339                 :            :         union {
     340                 :            :                 struct {
     341                 :            :                         uint64_t orig_pkt_aura : 20;
     342                 :            :                         uint64_t rsvd3 : 4;
     343                 :            :                         uint64_t orig_pkt_foff : 8;
     344                 :            :                         uint64_t cookie : 32;
     345                 :            :                 } s;
     346                 :            :                 uint64_t u64;
     347                 :            :         } w1;
     348                 :            : 
     349                 :            :         /* Word 2 */
     350                 :            :         union {
     351                 :            :                 struct {
     352                 :            :                         uint64_t valid : 1;
     353                 :            :                         uint64_t dir : 1;
     354                 :            :                         uint64_t outer_ip_ver : 1;
     355                 :            :                         uint64_t rsvd4 : 1;
     356                 :            :                         uint64_t ipsec_mode : 1;
     357                 :            :                         uint64_t ipsec_protocol : 1;
     358                 :            :                         uint64_t aes_key_len : 2;
     359                 :            : 
     360                 :            :                         uint64_t enc_type : 3;
     361                 :            :                         uint64_t life_unit : 1;
     362                 :            :                         uint64_t auth_type : 4;
     363                 :            : 
     364                 :            :                         uint64_t encap_type : 2;
     365                 :            :                         uint64_t et_ovrwr_ddr_en : 1;
     366                 :            :                         uint64_t esn_en : 1;
     367                 :            :                         uint64_t tport_l4_incr_csum : 1;
     368                 :            :                         uint64_t ip_hdr_verify : 2;
     369                 :            :                         uint64_t udp_ports_verify : 1;
     370                 :            : 
     371                 :            :                         uint64_t l3hdr_on_err : 1;
     372                 :            :                         uint64_t rsvd6 : 6;
     373                 :            :                         uint64_t async_mode : 1;
     374                 :            : 
     375                 :            :                         uint64_t spi : 32;
     376                 :            :                 } s;
     377                 :            :                 uint64_t u64;
     378                 :            :         } w2;
     379                 :            : 
     380                 :            :         /* Word3 */
     381                 :            :         uint64_t rsvd7;
     382                 :            : 
     383                 :            :         /* Word4 - Word7 */
     384                 :            :         uint8_t cipher_key[ROC_CTX_MAX_CKEY_LEN];
     385                 :            : 
     386                 :            :         /* Word8 - Word9 */
     387                 :            :         union {
     388                 :            :                 struct {
     389                 :            :                         uint32_t rsvd8;
     390                 :            :                         uint8_t salt[4];
     391                 :            :                 } s;
     392                 :            :                 uint64_t u64;
     393                 :            :         } w8;
     394                 :            :         uint64_t rsvd9;
     395                 :            : 
     396                 :            :         /* Word10 */
     397                 :            :         union {
     398                 :            :                 struct {
     399                 :            :                         uint64_t rsvd10 : 32;
     400                 :            :                         uint64_t udp_src_port : 16;
     401                 :            :                         uint64_t udp_dst_port : 16;
     402                 :            :                 } s;
     403                 :            :                 uint64_t u64;
     404                 :            :         } w10;
     405                 :            : 
     406                 :            :         /* Word11 - Word14 */
     407                 :            :         union roc_ot_ipsec_outer_ip_hdr outer_hdr;
     408                 :            : 
     409                 :            :         /* Word15 - Word30 */
     410                 :            :         uint8_t hmac_opad_ipad[ROC_CTX_MAX_OPAD_IPAD_LEN];
     411                 :            : 
     412                 :            :         /* Word31 - Word100 */
     413                 :            :         struct roc_ot_ipsec_inb_ctx_update_reg ctx;
     414                 :            : };
     415                 :            : 
     416                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, w1) ==
     417                 :            :                   1 * sizeof(uint64_t));
     418                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, w2) ==
     419                 :            :                   2 * sizeof(uint64_t));
     420                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, cipher_key) ==
     421                 :            :                   4 * sizeof(uint64_t));
     422                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, w8) ==
     423                 :            :                   8 * sizeof(uint64_t));
     424                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, w10) ==
     425                 :            :                   10 * sizeof(uint64_t));
     426                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, outer_hdr) ==
     427                 :            :                   11 * sizeof(uint64_t));
     428                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, hmac_opad_ipad) ==
     429                 :            :                   15 * sizeof(uint64_t));
     430                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, ctx) ==
     431                 :            :                   31 * sizeof(uint64_t));
     432                 :            : 
     433                 :            : struct roc_ot_ipsec_outb_sa {
     434                 :            :         /* Word0 */
     435                 :            :         union {
     436                 :            :                 struct {
     437                 :            :                         uint64_t esn_en : 1;
     438                 :            :                         uint64_t ip_id : 1;
     439                 :            :                         uint64_t rsvd0 : 1;
     440                 :            :                         uint64_t hard_life_dec : 1;
     441                 :            :                         uint64_t soft_life_dec : 1;
     442                 :            :                         uint64_t count_glb_octets : 1;
     443                 :            :                         uint64_t count_glb_pkts : 1;
     444                 :            :                         uint64_t count_mib_bytes : 1;
     445                 :            : 
     446                 :            :                         uint64_t count_mib_pkts : 1;
     447                 :            :                         uint64_t hw_ctx_off : 7;
     448                 :            : 
     449                 :            :                         uint64_t ctx_id : 16;
     450                 :            :                         uint64_t rsvd1 : 16;
     451                 :            : 
     452                 :            :                         uint64_t ctx_push_size : 7;
     453                 :            :                         uint64_t rsvd2 : 1;
     454                 :            : 
     455                 :            :                         uint64_t ctx_hdr_size : 2;
     456                 :            :                         uint64_t aop_valid : 1;
     457                 :            :                         uint64_t rsvd3 : 1;
     458                 :            :                         uint64_t ctx_size : 4;
     459                 :            :                 } s;
     460                 :            :                 uint64_t u64;
     461                 :            :         } w0;
     462                 :            : 
     463                 :            :         /* Word1 */
     464                 :            :         union {
     465                 :            :                 struct {
     466                 :            :                         uint64_t rsvd4 : 32;
     467                 :            :                         uint64_t cookie : 32;
     468                 :            :                 } s;
     469                 :            :                 uint64_t u64;
     470                 :            :         } w1;
     471                 :            : 
     472                 :            :         /* Word 2 */
     473                 :            :         union {
     474                 :            :                 struct {
     475                 :            :                         uint64_t valid : 1;
     476                 :            :                         uint64_t dir : 1;
     477                 :            :                         uint64_t outer_ip_ver : 1;
     478                 :            :                         uint64_t rsvd5 : 1;
     479                 :            :                         uint64_t ipsec_mode : 1;
     480                 :            :                         uint64_t ipsec_protocol : 1;
     481                 :            :                         uint64_t aes_key_len : 2;
     482                 :            : 
     483                 :            :                         uint64_t enc_type : 3;
     484                 :            :                         uint64_t life_unit : 1;
     485                 :            :                         uint64_t auth_type : 4;
     486                 :            : 
     487                 :            :                         uint64_t encap_type : 2;
     488                 :            :                         uint64_t ipv4_df_src_or_ipv6_flw_lbl_src : 1;
     489                 :            :                         uint64_t dscp_src : 1;
     490                 :            :                         uint64_t iv_src : 2;
     491                 :            :                         uint64_t ipid_gen : 1;
     492                 :            :                         uint64_t rsvd6 : 1;
     493                 :            : 
     494                 :            :                         uint64_t rsvd7 : 7;
     495                 :            :                         uint64_t async_mode : 1;
     496                 :            : 
     497                 :            :                         uint64_t spi : 32;
     498                 :            :                 } s;
     499                 :            :                 uint64_t u64;
     500                 :            :         } w2;
     501                 :            : 
     502                 :            :         /* Word3 */
     503                 :            :         uint64_t rsvd8;
     504                 :            : 
     505                 :            :         /* Word4 - Word7 */
     506                 :            :         uint8_t cipher_key[ROC_CTX_MAX_CKEY_LEN];
     507                 :            : 
     508                 :            :         /* Word8 - Word9 */
     509                 :            :         union roc_ot_ipsec_outb_iv iv;
     510                 :            : 
     511                 :            :         /* Word10 */
     512                 :            :         union {
     513                 :            :                 struct {
     514                 :            :                         uint64_t rsvd9 : 4;
     515                 :            :                         uint64_t ipv4_df_or_ipv6_flw_lbl : 20;
     516                 :            : 
     517                 :            :                         uint64_t dscp : 6;
     518                 :            :                         uint64_t rsvd10 : 2;
     519                 :            : 
     520                 :            :                         uint64_t udp_dst_port : 16;
     521                 :            : 
     522                 :            :                         uint64_t udp_src_port : 16;
     523                 :            :                 } s;
     524                 :            :                 uint64_t u64;
     525                 :            :         } w10;
     526                 :            : 
     527                 :            :         /* Word11 - Word14 */
     528                 :            :         union roc_ot_ipsec_outer_ip_hdr outer_hdr;
     529                 :            : 
     530                 :            :         /* Word15 - Word30 */
     531                 :            :         uint8_t hmac_opad_ipad[ROC_CTX_MAX_OPAD_IPAD_LEN];
     532                 :            : 
     533                 :            :         /* Word31 - Word36 */
     534                 :            :         struct roc_ot_ipsec_outb_ctx_update_reg ctx;
     535                 :            : };
     536                 :            : 
     537                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, w1) ==
     538                 :            :                   1 * sizeof(uint64_t));
     539                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, w2) ==
     540                 :            :                   2 * sizeof(uint64_t));
     541                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, cipher_key) ==
     542                 :            :                   4 * sizeof(uint64_t));
     543                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, iv) ==
     544                 :            :                   8 * sizeof(uint64_t));
     545                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, w10) ==
     546                 :            :                   10 * sizeof(uint64_t));
     547                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, outer_hdr) ==
     548                 :            :                   11 * sizeof(uint64_t));
     549                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, hmac_opad_ipad) ==
     550                 :            :                   15 * sizeof(uint64_t));
     551                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, ctx) ==
     552                 :            :                   31 * sizeof(uint64_t));
     553                 :            : 
     554                 :            : #define ROC_OT_IPSEC_SA_SZ_MAX \
     555                 :            :         (PLT_MAX(sizeof(struct roc_ot_ipsec_inb_sa), sizeof(struct roc_ot_ipsec_outb_sa)))
     556                 :            : 
     557                 :            : void __roc_api roc_ot_ipsec_inb_sa_init(struct roc_ot_ipsec_inb_sa *sa,
     558                 :            :                                         bool is_inline);
     559                 :            : void __roc_api roc_ot_ipsec_outb_sa_init(struct roc_ot_ipsec_outb_sa *sa);
     560                 :            : #endif /* __ROC_IE_OT_H__ */

Generated by: LCOV version 1.14