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: 2025-04-03 19:37:06 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                 :            : #define ROC_IPSEC_ERR_RING_MAX_ENTRY 65536
     159                 :            : 
     160                 :            : union roc_ot_ipsec_err_ring_head {
     161                 :            :         uint64_t u64;
     162                 :            :         struct {
     163                 :            :                 uint16_t tail_pos;
     164                 :            :                 uint16_t tail_gen;
     165                 :            :                 uint16_t head_pos;
     166                 :            :                 uint16_t head_gen;
     167                 :            :         } s;
     168                 :            : };
     169                 :            : 
     170                 :            : union roc_ot_ipsec_err_ring_entry {
     171                 :            :         uint64_t u64;
     172                 :            :         struct {
     173                 :            :                 uint64_t data0 : 44;
     174                 :            :                 uint64_t data1 : 9;
     175                 :            :                 uint64_t rsvd : 3;
     176                 :            :                 uint64_t comp_code : 8;
     177                 :            :         } s;
     178                 :            : };
     179                 :            : 
     180                 :            : /* Common bit fields between inbound and outbound SA */
     181                 :            : union roc_ot_ipsec_sa_word2 {
     182                 :            :         struct {
     183                 :            :                 uint64_t valid : 1;
     184                 :            :                 uint64_t dir : 1;
     185                 :            :                 uint64_t outer_ip_ver : 1;
     186                 :            :                 uint64_t rsvd0 : 1;
     187                 :            :                 uint64_t mode : 1;
     188                 :            :                 uint64_t protocol : 1;
     189                 :            :                 uint64_t aes_key_len : 2;
     190                 :            : 
     191                 :            :                 uint64_t enc_type : 3;
     192                 :            :                 uint64_t life_unit : 1;
     193                 :            :                 uint64_t auth_type : 4;
     194                 :            : 
     195                 :            :                 uint64_t encap_type : 2;
     196                 :            :                 uint64_t et_ovrwr_ddr_en : 1;
     197                 :            :                 uint64_t esn_en : 1;
     198                 :            :                 uint64_t tport_l4_incr_csum : 1;
     199                 :            :                 uint64_t ip_hdr_verify : 2;
     200                 :            :                 uint64_t udp_ports_verify : 1;
     201                 :            : 
     202                 :            :                 uint64_t rsvd2 : 7;
     203                 :            :                 uint64_t async_mode : 1;
     204                 :            : 
     205                 :            :                 uint64_t spi : 32;
     206                 :            :         } s;
     207                 :            :         uint64_t u64;
     208                 :            : };
     209                 :            : 
     210                 :            : PLT_STATIC_ASSERT(sizeof(union roc_ot_ipsec_sa_word2) == 1 * sizeof(uint64_t));
     211                 :            : 
     212                 :            : union roc_ot_ipsec_outer_ip_hdr {
     213                 :            :         struct {
     214                 :            :                 uint32_t dst_addr;
     215                 :            :                 uint32_t src_addr;
     216                 :            :         } ipv4;
     217                 :            :         struct {
     218                 :            :                 uint8_t src_addr[16];
     219                 :            :                 uint8_t dst_addr[16];
     220                 :            :         } ipv6;
     221                 :            : };
     222                 :            : 
     223                 :            : struct roc_ot_ipsec_inb_ctx_update_reg {
     224                 :            :         uint64_t ar_base;
     225                 :            :         uint64_t ar_valid_mask;
     226                 :            :         uint64_t hard_life;
     227                 :            :         uint64_t soft_life;
     228                 :            :         uint64_t mib_octs;
     229                 :            :         uint64_t mib_pkts;
     230                 :            :         uint64_t ar_winbits[ROC_AR_WINBITS_SZ];
     231                 :            : };
     232                 :            : 
     233                 :            : union roc_ot_ipsec_outb_iv {
     234                 :            :         uint64_t u64[2];
     235                 :            :         uint8_t iv_dbg[16];
     236                 :            :         struct {
     237                 :            :                 uint8_t iv_dbg1[4];
     238                 :            :                 uint8_t salt[4];
     239                 :            : 
     240                 :            :                 uint32_t rsvd;
     241                 :            :                 uint8_t iv_dbg2[4];
     242                 :            :         } s;
     243                 :            : };
     244                 :            : 
     245                 :            : struct roc_ot_ipsec_outb_ctx_update_reg {
     246                 :            :         union {
     247                 :            :                 struct {
     248                 :            :                         uint64_t reserved_0_2 : 3;
     249                 :            :                         uint64_t address : 57;
     250                 :            :                         uint64_t mode : 4;
     251                 :            :                 } s;
     252                 :            :                 uint64_t u64;
     253                 :            :         } err_ctl;
     254                 :            : 
     255                 :            :         uint64_t esn_val;
     256                 :            :         uint64_t hard_life;
     257                 :            :         uint64_t soft_life;
     258                 :            :         uint64_t mib_octs;
     259                 :            :         uint64_t mib_pkts;
     260                 :            : };
     261                 :            : 
     262                 :            : union roc_ot_ipsec_outb_param1 {
     263                 :            :         uint16_t u16;
     264                 :            :         struct {
     265                 :            :                 uint16_t l4_csum_disable : 1;
     266                 :            :                 uint16_t ip_csum_disable : 1;
     267                 :            :                 uint16_t ttl_or_hop_limit : 1;
     268                 :            :                 uint16_t dummy_pkt : 1;
     269                 :            :                 uint16_t rfc_or_override_mode : 1;
     270                 :            :                 uint16_t reserved_5_15 : 11;
     271                 :            :         } s;
     272                 :            : };
     273                 :            : 
     274                 :            : union roc_ot_ipsec_inb_param1 {
     275                 :            :         uint16_t u16;
     276                 :            :         struct {
     277                 :            :                 uint16_t l4_csum_disable : 1;
     278                 :            :                 uint16_t ip_csum_disable : 1;
     279                 :            :                 uint16_t esp_trailer_disable : 1;
     280                 :            :                 uint16_t reserved_3_15 : 13;
     281                 :            :         } s;
     282                 :            : };
     283                 :            : 
     284                 :            : struct roc_ot_ipsec_inb_sa {
     285                 :            :         /* Word0 */
     286                 :            :         union {
     287                 :            :                 struct {
     288                 :            :                         uint64_t ar_win : 3;
     289                 :            :                         uint64_t hard_life_dec : 1;
     290                 :            :                         uint64_t soft_life_dec : 1;
     291                 :            :                         uint64_t count_glb_octets : 1;
     292                 :            :                         uint64_t count_glb_pkts : 1;
     293                 :            :                         uint64_t count_mib_bytes : 1;
     294                 :            : 
     295                 :            :                         uint64_t count_mib_pkts : 1;
     296                 :            :                         uint64_t hw_ctx_off : 7;
     297                 :            : 
     298                 :            :                         uint64_t ctx_id : 16;
     299                 :            : 
     300                 :            :                         uint64_t orig_pkt_fabs : 1;
     301                 :            :                         uint64_t orig_pkt_free : 1;
     302                 :            :                         uint64_t pkind : 6;
     303                 :            : 
     304                 :            :                         uint64_t rsvd0 : 1;
     305                 :            :                         uint64_t et_ovrwr : 1;
     306                 :            :                         uint64_t pkt_output : 2;
     307                 :            :                         uint64_t pkt_format : 1;
     308                 :            :                         uint64_t defrag_opt : 2;
     309                 :            :                         uint64_t x2p_dst : 1;
     310                 :            : 
     311                 :            :                         uint64_t ctx_push_size : 7;
     312                 :            :                         uint64_t rsvd1 : 1;
     313                 :            : 
     314                 :            :                         uint64_t ctx_hdr_size : 2;
     315                 :            :                         uint64_t aop_valid : 1;
     316                 :            :                         uint64_t rsvd2 : 1;
     317                 :            :                         uint64_t ctx_size : 4;
     318                 :            :                 } s;
     319                 :            :                 uint64_t u64;
     320                 :            :         } w0;
     321                 :            : 
     322                 :            :         /* Word1 */
     323                 :            :         union {
     324                 :            :                 struct {
     325                 :            :                         uint64_t orig_pkt_aura : 20;
     326                 :            :                         uint64_t rsvd3 : 4;
     327                 :            :                         uint64_t orig_pkt_foff : 8;
     328                 :            :                         uint64_t cookie : 32;
     329                 :            :                 } s;
     330                 :            :                 uint64_t u64;
     331                 :            :         } w1;
     332                 :            : 
     333                 :            :         /* Word 2 */
     334                 :            :         union {
     335                 :            :                 struct {
     336                 :            :                         uint64_t valid : 1;
     337                 :            :                         uint64_t dir : 1;
     338                 :            :                         uint64_t outer_ip_ver : 1;
     339                 :            :                         uint64_t rsvd4 : 1;
     340                 :            :                         uint64_t ipsec_mode : 1;
     341                 :            :                         uint64_t ipsec_protocol : 1;
     342                 :            :                         uint64_t aes_key_len : 2;
     343                 :            : 
     344                 :            :                         uint64_t enc_type : 3;
     345                 :            :                         uint64_t life_unit : 1;
     346                 :            :                         uint64_t auth_type : 4;
     347                 :            : 
     348                 :            :                         uint64_t encap_type : 2;
     349                 :            :                         uint64_t et_ovrwr_ddr_en : 1;
     350                 :            :                         uint64_t esn_en : 1;
     351                 :            :                         uint64_t tport_l4_incr_csum : 1;
     352                 :            :                         uint64_t ip_hdr_verify : 2;
     353                 :            :                         uint64_t udp_ports_verify : 1;
     354                 :            : 
     355                 :            :                         uint64_t l3hdr_on_err : 1;
     356                 :            :                         uint64_t rsvd6 : 6;
     357                 :            :                         uint64_t async_mode : 1;
     358                 :            : 
     359                 :            :                         uint64_t spi : 32;
     360                 :            :                 } s;
     361                 :            :                 uint64_t u64;
     362                 :            :         } w2;
     363                 :            : 
     364                 :            :         /* Word3 */
     365                 :            :         uint64_t rsvd7;
     366                 :            : 
     367                 :            :         /* Word4 - Word7 */
     368                 :            :         uint8_t cipher_key[ROC_CTX_MAX_CKEY_LEN];
     369                 :            : 
     370                 :            :         /* Word8 - Word9 */
     371                 :            :         union {
     372                 :            :                 struct {
     373                 :            :                         uint32_t rsvd8;
     374                 :            :                         uint8_t salt[4];
     375                 :            :                 } s;
     376                 :            :                 uint64_t u64;
     377                 :            :         } w8;
     378                 :            :         uint64_t rsvd9;
     379                 :            : 
     380                 :            :         /* Word10 */
     381                 :            :         union {
     382                 :            :                 struct {
     383                 :            :                         uint64_t rsvd10 : 32;
     384                 :            :                         uint64_t udp_src_port : 16;
     385                 :            :                         uint64_t udp_dst_port : 16;
     386                 :            :                 } s;
     387                 :            :                 uint64_t u64;
     388                 :            :         } w10;
     389                 :            : 
     390                 :            :         /* Word11 - Word14 */
     391                 :            :         union roc_ot_ipsec_outer_ip_hdr outer_hdr;
     392                 :            : 
     393                 :            :         /* Word15 - Word30 */
     394                 :            :         uint8_t hmac_opad_ipad[ROC_CTX_MAX_OPAD_IPAD_LEN];
     395                 :            : 
     396                 :            :         /* Word31 - Word100 */
     397                 :            :         struct roc_ot_ipsec_inb_ctx_update_reg ctx;
     398                 :            : };
     399                 :            : 
     400                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, w1) ==
     401                 :            :                   1 * sizeof(uint64_t));
     402                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, w2) ==
     403                 :            :                   2 * sizeof(uint64_t));
     404                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, cipher_key) ==
     405                 :            :                   4 * sizeof(uint64_t));
     406                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, w8) ==
     407                 :            :                   8 * sizeof(uint64_t));
     408                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, w10) ==
     409                 :            :                   10 * sizeof(uint64_t));
     410                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, outer_hdr) ==
     411                 :            :                   11 * sizeof(uint64_t));
     412                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, hmac_opad_ipad) ==
     413                 :            :                   15 * sizeof(uint64_t));
     414                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_inb_sa, ctx) ==
     415                 :            :                   31 * sizeof(uint64_t));
     416                 :            : 
     417                 :            : struct roc_ot_ipsec_outb_sa {
     418                 :            :         /* Word0 */
     419                 :            :         union {
     420                 :            :                 struct {
     421                 :            :                         uint64_t esn_en : 1;
     422                 :            :                         uint64_t ip_id : 1;
     423                 :            :                         uint64_t rsvd0 : 1;
     424                 :            :                         uint64_t hard_life_dec : 1;
     425                 :            :                         uint64_t soft_life_dec : 1;
     426                 :            :                         uint64_t count_glb_octets : 1;
     427                 :            :                         uint64_t count_glb_pkts : 1;
     428                 :            :                         uint64_t count_mib_bytes : 1;
     429                 :            : 
     430                 :            :                         uint64_t count_mib_pkts : 1;
     431                 :            :                         uint64_t hw_ctx_off : 7;
     432                 :            : 
     433                 :            :                         uint64_t ctx_id : 16;
     434                 :            :                         uint64_t rsvd1 : 16;
     435                 :            : 
     436                 :            :                         uint64_t ctx_push_size : 7;
     437                 :            :                         uint64_t rsvd2 : 1;
     438                 :            : 
     439                 :            :                         uint64_t ctx_hdr_size : 2;
     440                 :            :                         uint64_t aop_valid : 1;
     441                 :            :                         uint64_t rsvd3 : 1;
     442                 :            :                         uint64_t ctx_size : 4;
     443                 :            :                 } s;
     444                 :            :                 uint64_t u64;
     445                 :            :         } w0;
     446                 :            : 
     447                 :            :         /* Word1 */
     448                 :            :         union {
     449                 :            :                 struct {
     450                 :            :                         uint64_t rsvd4 : 32;
     451                 :            :                         uint64_t cookie : 32;
     452                 :            :                 } s;
     453                 :            :                 uint64_t u64;
     454                 :            :         } w1;
     455                 :            : 
     456                 :            :         /* Word 2 */
     457                 :            :         union {
     458                 :            :                 struct {
     459                 :            :                         uint64_t valid : 1;
     460                 :            :                         uint64_t dir : 1;
     461                 :            :                         uint64_t outer_ip_ver : 1;
     462                 :            :                         uint64_t rsvd5 : 1;
     463                 :            :                         uint64_t ipsec_mode : 1;
     464                 :            :                         uint64_t ipsec_protocol : 1;
     465                 :            :                         uint64_t aes_key_len : 2;
     466                 :            : 
     467                 :            :                         uint64_t enc_type : 3;
     468                 :            :                         uint64_t life_unit : 1;
     469                 :            :                         uint64_t auth_type : 4;
     470                 :            : 
     471                 :            :                         uint64_t encap_type : 2;
     472                 :            :                         uint64_t ipv4_df_src_or_ipv6_flw_lbl_src : 1;
     473                 :            :                         uint64_t dscp_src : 1;
     474                 :            :                         uint64_t iv_src : 2;
     475                 :            :                         uint64_t ipid_gen : 1;
     476                 :            :                         uint64_t rsvd6 : 1;
     477                 :            : 
     478                 :            :                         uint64_t rsvd7 : 7;
     479                 :            :                         uint64_t async_mode : 1;
     480                 :            : 
     481                 :            :                         uint64_t spi : 32;
     482                 :            :                 } s;
     483                 :            :                 uint64_t u64;
     484                 :            :         } w2;
     485                 :            : 
     486                 :            :         /* Word3 */
     487                 :            :         uint64_t rsvd8;
     488                 :            : 
     489                 :            :         /* Word4 - Word7 */
     490                 :            :         uint8_t cipher_key[ROC_CTX_MAX_CKEY_LEN];
     491                 :            : 
     492                 :            :         /* Word8 - Word9 */
     493                 :            :         union roc_ot_ipsec_outb_iv iv;
     494                 :            : 
     495                 :            :         /* Word10 */
     496                 :            :         union {
     497                 :            :                 struct {
     498                 :            :                         uint64_t rsvd9 : 4;
     499                 :            :                         uint64_t ipv4_df_or_ipv6_flw_lbl : 20;
     500                 :            : 
     501                 :            :                         uint64_t dscp : 6;
     502                 :            :                         uint64_t rsvd10 : 2;
     503                 :            : 
     504                 :            :                         uint64_t udp_dst_port : 16;
     505                 :            : 
     506                 :            :                         uint64_t udp_src_port : 16;
     507                 :            :                 } s;
     508                 :            :                 uint64_t u64;
     509                 :            :         } w10;
     510                 :            : 
     511                 :            :         /* Word11 - Word14 */
     512                 :            :         union roc_ot_ipsec_outer_ip_hdr outer_hdr;
     513                 :            : 
     514                 :            :         /* Word15 - Word30 */
     515                 :            :         uint8_t hmac_opad_ipad[ROC_CTX_MAX_OPAD_IPAD_LEN];
     516                 :            : 
     517                 :            :         /* Word31 - Word36 */
     518                 :            :         struct roc_ot_ipsec_outb_ctx_update_reg ctx;
     519                 :            : };
     520                 :            : 
     521                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, w1) ==
     522                 :            :                   1 * sizeof(uint64_t));
     523                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, w2) ==
     524                 :            :                   2 * sizeof(uint64_t));
     525                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, cipher_key) ==
     526                 :            :                   4 * sizeof(uint64_t));
     527                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, iv) ==
     528                 :            :                   8 * sizeof(uint64_t));
     529                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, w10) ==
     530                 :            :                   10 * sizeof(uint64_t));
     531                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, outer_hdr) ==
     532                 :            :                   11 * sizeof(uint64_t));
     533                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, hmac_opad_ipad) ==
     534                 :            :                   15 * sizeof(uint64_t));
     535                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ot_ipsec_outb_sa, ctx) ==
     536                 :            :                   31 * sizeof(uint64_t));
     537                 :            : 
     538                 :            : #define ROC_OT_IPSEC_SA_SZ_MAX \
     539                 :            :         (PLT_MAX(sizeof(struct roc_ot_ipsec_inb_sa), sizeof(struct roc_ot_ipsec_outb_sa)))
     540                 :            : 
     541                 :            : void __roc_api roc_ot_ipsec_inb_sa_init(struct roc_ot_ipsec_inb_sa *sa);
     542                 :            : void __roc_api roc_ot_ipsec_outb_sa_init(struct roc_ot_ipsec_outb_sa *sa);
     543                 :            : #endif /* __ROC_IE_OT_H__ */

Generated by: LCOV version 1.14