LCOV - code coverage report
Current view: top level - drivers/common/cnxk - roc_ie_ow.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 8 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(C) 2024 Marvell.
       3                 :            :  */
       4                 :            : 
       5                 :            : #ifndef __ROC_IE_OW_H__
       6                 :            : #define __ROC_IE_OW_H__
       7                 :            : 
       8                 :            : #include "roc_platform.h"
       9                 :            : 
      10                 :            : #include "roc_cpt.h"
      11                 :            : 
      12                 :            : /* CN20K IPsec opcodes */
      13                 :            : #define ROC_IE_OW_MAJOR_OP_PROCESS_OUTBOUND_IPSEC 0x28UL
      14                 :            : #define ROC_IE_OW_MAJOR_OP_PROCESS_INBOUND_IPSEC  0x29UL
      15                 :            : #define ROC_IE_OW_MAJOR_OP_PROCESS_INBOUND_REASS  0x2BUL
      16                 :            : 
      17                 :            : #define ROC_IE_OW_MAJOR_OP_WRITE_SA 0x01UL
      18                 :            : #define ROC_IE_OW_MINOR_OP_WRITE_SA 0x09UL
      19                 :            : 
      20                 :            : #define ROC_IE_OW_CTX_ILEN 2
      21                 :            : 
      22                 :            : /* PKIND to be used for CPT Meta parsing */
      23                 :            : #define ROC_IE_OW_CPT_PKIND       58
      24                 :            : #define ROC_IE_OW_CPT_TS_PKIND    54
      25                 :            : #define ROC_IE_OW_SA_CTX_HDR_SIZE 1
      26                 :            : 
      27                 :            : #define ROC_IE_OW_INPLACE_BIT BIT(6)
      28                 :            : 
      29                 :            : enum roc_ie_ow_ucc_ipsec {
      30                 :            :         ROC_IE_OW_UCC_SUCCESS = 0x00,
      31                 :            :         ROC_IE_OW_UCC_ERR_SA_INVAL = 0xb0,
      32                 :            :         ROC_IE_OW_UCC_ERR_SA_EXPIRED = 0xb1,
      33                 :            :         ROC_IE_OW_UCC_ERR_SA_OVERFLOW = 0xb2,
      34                 :            :         ROC_IE_OW_UCC_ERR_SA_ESP_BAD_ALGO = 0xb3,
      35                 :            :         ROC_IE_OW_UCC_ERR_SA_AH_BAD_ALGO = 0xb4,
      36                 :            :         ROC_IE_OW_UCC_ERR_SA_BAD_CTX = 0xb5,
      37                 :            :         ROC_IE_OW_UCC_SA_CTX_FLAG_MISMATCH = 0xb6,
      38                 :            :         ROC_IE_OW_UCC_ERR_AOP_IPSEC = 0xb7,
      39                 :            :         ROC_IE_OW_UCC_ERR_PKT_IP = 0xb8,
      40                 :            :         ROC_IE_OW_UCC_ERR_PKT_IP6_BAD_EXT = 0xb9,
      41                 :            :         ROC_IE_OW_UCC_ERR_PKT_IP6_HBH = 0xba,
      42                 :            :         ROC_IE_OW_UCC_ERR_PKT_IP6_BIGEXT = 0xbb,
      43                 :            :         ROC_IE_OW_UCC_ERR_PKT_IP_ULP = 0xbc,
      44                 :            :         ROC_IE_OW_UCC_ERR_PKT_SA_MISMATCH = 0xbd,
      45                 :            :         ROC_IE_OW_UCC_ERR_PKT_SPI_MISMATCH = 0xbe,
      46                 :            :         ROC_IE_OW_UCC_ERR_PKT_ESP_BADPAD = 0xbf,
      47                 :            :         ROC_IE_OW_UCC_ERR_PKT_BADICV = 0xc0,
      48                 :            :         ROC_IE_OW_UCC_ERR_PKT_REPLAY_SEQ = 0xc1,
      49                 :            :         ROC_IE_OW_UCC_ERR_PKT_BADNH = 0xc2,
      50                 :            :         ROC_IE_OW_UCC_ERR_PKT_SA_PORT_MISMATCH = 0xc3,
      51                 :            :         ROC_IE_OW_UCC_ERR_PKT_BAD_DLEN = 0xc4,
      52                 :            :         ROC_IE_OW_UCC_ERR_SA_ESP_BAD_KEYS = 0xc5,
      53                 :            :         ROC_IE_OW_UCC_ERR_SA_AH_BAD_KEYS = 0xc6,
      54                 :            :         ROC_IE_OW_UCC_ERR_SA_BAD_IP = 0xc7,
      55                 :            :         ROC_IE_OW_UCC_ERR_PKT_IP_FRAG = 0xc8,
      56                 :            :         ROC_IE_OW_UCC_ERR_PKT_REPLAY_WINDOW = 0xc9,
      57                 :            :         ROC_IE_OW_UCC_SUCCESS_PKT_IP_BADCSUM = 0xed,
      58                 :            :         ROC_IE_OW_UCC_SUCCESS_PKT_L4_GOODCSUM = 0xee,
      59                 :            :         ROC_IE_OW_UCC_SUCCESS_PKT_L4_BADCSUM = 0xef,
      60                 :            :         ROC_IE_OW_UCC_SUCCESS_SA_SOFTEXP_FIRST = 0xf0,
      61                 :            :         ROC_IE_OW_UCC_SUCCESS_PKT_UDPESP_NZCSUM = 0xf1,
      62                 :            :         ROC_IE_OW_UCC_SUCCESS_SA_SOFTEXP_AGAIN = 0xf2,
      63                 :            :         ROC_IE_OW_UCC_SUCCESS_PKT_UDP_ZEROCSUM = 0xf3,
      64                 :            :         ROC_IE_OW_UCC_SUCCESS_PKT_IP_GOODCSUM = 0x0,
      65                 :            : };
      66                 :            : 
      67                 :            : enum {
      68                 :            :         ROC_IE_OW_SA_AR_WIN_DISABLED = 0,
      69                 :            :         ROC_IE_OW_SA_AR_WIN_64 = 1,
      70                 :            :         ROC_IE_OW_SA_AR_WIN_128 = 2,
      71                 :            :         ROC_IE_OW_SA_AR_WIN_256 = 3,
      72                 :            :         ROC_IE_OW_SA_AR_WIN_512 = 4,
      73                 :            :         ROC_IE_OW_SA_AR_WIN_1024 = 5,
      74                 :            :         ROC_IE_OW_SA_AR_WIN_2048 = 6,
      75                 :            :         ROC_IE_OW_SA_AR_WIN_4096 = 7,
      76                 :            : };
      77                 :            : 
      78                 :            : enum {
      79                 :            :         ROC_IE_OW_SA_PKT_FMT_FULL = 0,
      80                 :            :         ROC_IE_OW_SA_PKT_FMT_META = 1,
      81                 :            : };
      82                 :            : 
      83                 :            : enum {
      84                 :            :         ROC_IE_OW_SA_PKT_OUTPUT_DECRYPTED = 0,
      85                 :            :         ROC_IE_OW_SA_PKT_OUTPUT_NO_FRAG = 1,
      86                 :            :         ROC_IE_OW_SA_PKT_OUTPUT_HW_BASED_DEFRAG = 2,
      87                 :            :         ROC_IE_OW_SA_PKT_OUTPUT_UCODE_BASED_DEFRAG = 3,
      88                 :            : };
      89                 :            : 
      90                 :            : enum {
      91                 :            :         ROC_IE_OW_SA_DEFRAG_ALL = 0,
      92                 :            :         ROC_IE_OW_SA_DEFRAG_IN_ORDER = 1,
      93                 :            :         ROC_IE_OW_SA_DEFRAG_IN_REV_ORDER = 2,
      94                 :            : };
      95                 :            : 
      96                 :            : enum {
      97                 :            :         ROC_IE_OW_SA_IV_SRC_DEFAULT = 0,
      98                 :            :         ROC_IE_OW_SA_IV_SRC_ENC_CTR = 1,
      99                 :            :         ROC_IE_OW_SA_IV_SRC_FROM_SA = 2,
     100                 :            : };
     101                 :            : 
     102                 :            : enum {
     103                 :            :         ROC_IE_OW_SA_COPY_FROM_SA = 0,
     104                 :            :         ROC_IE_OW_SA_COPY_FROM_INNER_IP_HDR = 1,
     105                 :            : };
     106                 :            : 
     107                 :            : enum {
     108                 :            :         ROC_IE_OW_SA_INNER_PKT_IP_CSUM_ENABLE = 0,
     109                 :            :         ROC_IE_OW_SA_INNER_PKT_IP_CSUM_DISABLE = 1,
     110                 :            : };
     111                 :            : 
     112                 :            : enum {
     113                 :            :         ROC_IE_OW_SA_INNER_PKT_L4_CSUM_ENABLE = 0,
     114                 :            :         ROC_IE_OW_SA_INNER_PKT_L4_CSUM_DISABLE = 1,
     115                 :            : };
     116                 :            : 
     117                 :            : enum {
     118                 :            :         ROC_IE_OW_SA_ENCAP_NONE = 0,
     119                 :            :         ROC_IE_OW_SA_ENCAP_UDP = 1,
     120                 :            :         ROC_IE_OW_SA_ENCAP_TCP = 2,
     121                 :            : };
     122                 :            : 
     123                 :            : enum {
     124                 :            :         ROC_IE_OW_SA_LIFE_UNIT_OCTETS = 0,
     125                 :            :         ROC_IE_OW_SA_LIFE_UNIT_PKTS = 1,
     126                 :            : };
     127                 :            : 
     128                 :            : enum {
     129                 :            :         ROC_IE_OW_SA_IP_HDR_VERIFY_DISABLED = 0,
     130                 :            :         ROC_IE_OW_SA_IP_HDR_VERIFY_DST_ADDR = 1,
     131                 :            :         ROC_IE_OW_SA_IP_HDR_VERIFY_SRC_DST_ADDR = 2,
     132                 :            : };
     133                 :            : 
     134                 :            : enum {
     135                 :            :         ROC_IE_OW_REAS_STS_SUCCESS = 0,
     136                 :            :         ROC_IE_OW_REAS_STS_TIMEOUT = 1,
     137                 :            :         ROC_IE_OW_REAS_STS_EVICT = 2,
     138                 :            :         ROC_IE_OW_REAS_STS_BAD_ORDER = 3,
     139                 :            :         ROC_IE_OW_REAS_STS_TOO_MANY = 4,
     140                 :            :         ROC_IE_OW_REAS_STS_HSH_EVICT = 5,
     141                 :            :         ROC_IE_OW_REAS_STS_OVERLAP = 6,
     142                 :            :         ROC_IE_OW_REAS_STS_ZOMBIE = 7,
     143                 :            :         ROC_IE_OW_REAS_STS_L3P_ERR = 8,
     144                 :            :         ROC_IE_OW_REAS_STS_MAX = 9
     145                 :            : };
     146                 :            : 
     147                 :            : enum {
     148                 :            :         ROC_IE_OW_ERR_CTL_MODE_NONE = 0,
     149                 :            :         ROC_IE_OW_ERR_CTL_MODE_CLEAR = 1,
     150                 :            :         ROC_IE_OW_ERR_CTL_MODE_RING = 2,
     151                 :            : };
     152                 :            : 
     153                 :            : static __plt_always_inline bool
     154                 :            : roc_ie_ow_ucc_is_success(uint8_t ucc)
     155                 :            : {
     156                 :            :         uint8_t uc_base = (uint8_t)ROC_IE_OW_UCC_SUCCESS_PKT_IP_BADCSUM - 1u;
     157                 :            : 
     158   [ #  #  #  #  :          0 :         ucc--;
             #  #  #  # ]
     159                 :            :         return (ucc >= uc_base);
     160                 :            : }
     161                 :            : 
     162                 :            : #define ROC_IPSEC_ERR_RING_MAX_ENTRY 65536
     163                 :            : 
     164                 :            : union roc_ow_ipsec_err_ring_head {
     165                 :            :         uint64_t u64;
     166                 :            :         struct {
     167                 :            :                 uint16_t tail_pos;
     168                 :            :                 uint16_t tail_gen;
     169                 :            :                 uint16_t head_pos;
     170                 :            :                 uint16_t head_gen;
     171                 :            :         } s;
     172                 :            : };
     173                 :            : 
     174                 :            : union roc_ow_ipsec_err_ring_entry {
     175                 :            :         uint64_t u64;
     176                 :            :         struct {
     177                 :            :                 uint64_t data0 : 44;
     178                 :            :                 uint64_t data1 : 9;
     179                 :            :                 uint64_t rsvd : 3;
     180                 :            :                 uint64_t comp_code : 8;
     181                 :            :         } s;
     182                 :            : };
     183                 :            : 
     184                 :            : /* Common bit fields between inbound and outbound SA */
     185                 :            : union roc_ow_ipsec_sa_word2 {
     186                 :            :         struct {
     187                 :            :                 uint64_t valid : 1;
     188                 :            :                 uint64_t dir : 1;
     189                 :            :                 uint64_t outer_ip_ver : 1;
     190                 :            :                 uint64_t rsvd0 : 1;
     191                 :            :                 uint64_t mode : 1;
     192                 :            :                 uint64_t protocol : 1;
     193                 :            :                 uint64_t aes_key_len : 2;
     194                 :            : 
     195                 :            :                 uint64_t enc_type : 3;
     196                 :            :                 uint64_t life_unit : 1;
     197                 :            :                 uint64_t auth_type : 4;
     198                 :            : 
     199                 :            :                 uint64_t encap_type : 2;
     200                 :            :                 uint64_t et_ovrwr_ddr_en : 1;
     201                 :            :                 uint64_t esn_en : 1;
     202                 :            :                 uint64_t tport_l4_incr_csum : 1;
     203                 :            :                 uint64_t ip_hdr_verify : 2;
     204                 :            :                 uint64_t udp_ports_verify : 1;
     205                 :            : 
     206                 :            :                 uint64_t rsvd2 : 7;
     207                 :            :                 uint64_t async_mode : 1;
     208                 :            : 
     209                 :            :                 uint64_t spi : 32;
     210                 :            :         } s;
     211                 :            :         uint64_t u64;
     212                 :            : };
     213                 :            : 
     214                 :            : PLT_STATIC_ASSERT(sizeof(union roc_ow_ipsec_sa_word2) == 1 * sizeof(uint64_t));
     215                 :            : 
     216                 :            : union roc_ow_ipsec_outer_ip_hdr {
     217                 :            :         struct {
     218                 :            :                 uint32_t dst_addr;
     219                 :            :                 uint32_t src_addr;
     220                 :            :         } ipv4;
     221                 :            :         struct {
     222                 :            :                 uint8_t src_addr[16];
     223                 :            :                 uint8_t dst_addr[16];
     224                 :            :         } ipv6;
     225                 :            : };
     226                 :            : 
     227                 :            : struct roc_ow_ipsec_inb_ctx_update_reg {
     228                 :            :         uint64_t ar_base;
     229                 :            :         uint64_t ar_valid_mask;
     230                 :            :         uint64_t hard_life;
     231                 :            :         uint64_t soft_life;
     232                 :            :         uint64_t mib_octs;
     233                 :            :         uint64_t mib_pkts;
     234                 :            :         uint64_t ar_winbits[ROC_AR_WINBITS_SZ];
     235                 :            : };
     236                 :            : 
     237                 :            : union roc_ow_ipsec_outb_iv {
     238                 :            :         uint64_t u64[2];
     239                 :            :         uint8_t iv_dbg[16];
     240                 :            :         struct {
     241                 :            :                 uint8_t iv_dbg1[4];
     242                 :            :                 uint8_t salt[4];
     243                 :            : 
     244                 :            :                 uint32_t rsvd;
     245                 :            :                 uint8_t iv_dbg2[4];
     246                 :            :         } s;
     247                 :            : };
     248                 :            : 
     249                 :            : struct roc_ow_ipsec_outb_ctx_update_reg {
     250                 :            :         union {
     251                 :            :                 struct {
     252                 :            :                         uint64_t reserved_0_2 : 3;
     253                 :            :                         uint64_t address : 57;
     254                 :            :                         uint64_t mode : 4;
     255                 :            :                 } s;
     256                 :            :                 uint64_t u64;
     257                 :            :         } err_ctl;
     258                 :            : 
     259                 :            :         uint64_t esn_val;
     260                 :            :         uint64_t hard_life;
     261                 :            :         uint64_t soft_life;
     262                 :            :         uint64_t mib_octs;
     263                 :            :         uint64_t mib_pkts;
     264                 :            : };
     265                 :            : 
     266                 :            : union roc_ow_ipsec_outb_param1 {
     267                 :            :         uint16_t u16;
     268                 :            :         struct {
     269                 :            :                 uint16_t l4_csum_disable : 1;
     270                 :            :                 uint16_t ip_csum_disable : 1;
     271                 :            :                 uint16_t ttl_or_hop_limit : 1;
     272                 :            :                 uint16_t dummy_pkt : 1;
     273                 :            :                 uint16_t rfc_or_override_mode : 1;
     274                 :            :                 uint16_t reserved_5_15 : 11;
     275                 :            :         } s;
     276                 :            : };
     277                 :            : 
     278                 :            : union roc_ow_ipsec_inb_param1 {
     279                 :            :         uint16_t u16;
     280                 :            :         struct {
     281                 :            :                 uint16_t l4_csum_disable : 1;
     282                 :            :                 uint16_t ip_csum_disable : 1;
     283                 :            :                 uint16_t esp_trailer_disable : 1;
     284                 :            :                 uint16_t reserved_3_15 : 13;
     285                 :            :         } s;
     286                 :            : };
     287                 :            : 
     288                 :            : struct roc_ow_ipsec_inb_sa {
     289                 :            :         /* Word0 */
     290                 :            :         union {
     291                 :            :                 struct {
     292                 :            :                         uint64_t ar_win : 3;
     293                 :            :                         uint64_t hard_life_dec : 1;
     294                 :            :                         uint64_t soft_life_dec : 1;
     295                 :            :                         uint64_t count_glb_octets : 1;
     296                 :            :                         uint64_t count_glb_pkts : 1;
     297                 :            :                         uint64_t count_mib_bytes : 1;
     298                 :            : 
     299                 :            :                         uint64_t count_mib_pkts : 1;
     300                 :            :                         uint64_t hw_ctx_off : 7;
     301                 :            : 
     302                 :            :                         uint64_t ctx_id : 16;
     303                 :            : 
     304                 :            :                         uint64_t orig_pkt_fabs : 1;
     305                 :            :                         uint64_t orig_pkt_free : 1;
     306                 :            :                         uint64_t pkind : 6;
     307                 :            : 
     308                 :            :                         uint64_t rsvd0 : 1;
     309                 :            :                         uint64_t et_ovrwr : 1;
     310                 :            :                         uint64_t pkt_output : 2;
     311                 :            :                         uint64_t pkt_format : 1;
     312                 :            :                         uint64_t defrag_opt : 2;
     313                 :            :                         uint64_t x2p_dst : 1;
     314                 :            : 
     315                 :            :                         uint64_t ctx_push_size : 7;
     316                 :            :                         uint64_t rsvd1 : 1;
     317                 :            : 
     318                 :            :                         uint64_t ctx_hdr_size : 2;
     319                 :            :                         uint64_t aop_valid : 1;
     320                 :            :                         uint64_t rsvd2 : 1;
     321                 :            :                         uint64_t ctx_size : 4;
     322                 :            :                 } s;
     323                 :            :                 uint64_t u64;
     324                 :            :         } w0;
     325                 :            : 
     326                 :            :         /* Word1 */
     327                 :            :         union {
     328                 :            :                 struct {
     329                 :            :                         uint64_t orig_pkt_aura : 20;
     330                 :            :                         uint64_t rsvd3 : 4;
     331                 :            :                         uint64_t orig_pkt_foff : 8;
     332                 :            :                         uint64_t cookie : 32;
     333                 :            :                 } s;
     334                 :            :                 uint64_t u64;
     335                 :            :         } w1;
     336                 :            : 
     337                 :            :         /* Word 2 */
     338                 :            :         union {
     339                 :            :                 struct {
     340                 :            :                         uint64_t valid : 1;
     341                 :            :                         uint64_t dir : 1;
     342                 :            :                         uint64_t outer_ip_ver : 1;
     343                 :            :                         uint64_t rsvd4 : 1;
     344                 :            :                         uint64_t ipsec_mode : 1;
     345                 :            :                         uint64_t ipsec_protocol : 1;
     346                 :            :                         uint64_t aes_key_len : 2;
     347                 :            : 
     348                 :            :                         uint64_t enc_type : 3;
     349                 :            :                         uint64_t life_unit : 1;
     350                 :            :                         uint64_t auth_type : 4;
     351                 :            : 
     352                 :            :                         uint64_t encap_type : 2;
     353                 :            :                         uint64_t et_ovrwr_ddr_en : 1;
     354                 :            :                         uint64_t esn_en : 1;
     355                 :            :                         uint64_t tport_l4_incr_csum : 1;
     356                 :            :                         uint64_t ip_hdr_verify : 2;
     357                 :            :                         uint64_t udp_ports_verify : 1;
     358                 :            : 
     359                 :            :                         uint64_t l3hdr_on_err : 1;
     360                 :            :                         uint64_t rsvd6 : 6;
     361                 :            :                         uint64_t async_mode : 1;
     362                 :            : 
     363                 :            :                         uint64_t spi : 32;
     364                 :            :                 } s;
     365                 :            :                 uint64_t u64;
     366                 :            :         } w2;
     367                 :            : 
     368                 :            :         /* Word3 */
     369                 :            :         uint64_t rsvd7;
     370                 :            : 
     371                 :            :         /* Word4 - Word7 */
     372                 :            :         uint8_t cipher_key[ROC_CTX_MAX_CKEY_LEN];
     373                 :            : 
     374                 :            :         /* Word8 - Word9 */
     375                 :            :         union {
     376                 :            :                 struct {
     377                 :            :                         uint32_t rsvd8;
     378                 :            :                         uint8_t salt[4];
     379                 :            :                 } s;
     380                 :            :                 uint64_t u64;
     381                 :            :         } w8;
     382                 :            :         uint64_t rsvd9;
     383                 :            : 
     384                 :            :         /* Word10 */
     385                 :            :         union {
     386                 :            :                 struct {
     387                 :            :                         uint64_t rsvd10 : 32;
     388                 :            :                         uint64_t udp_src_port : 16;
     389                 :            :                         uint64_t udp_dst_port : 16;
     390                 :            :                 } s;
     391                 :            :                 uint64_t u64;
     392                 :            :         } w10;
     393                 :            : 
     394                 :            :         /* Word11 - Word14 */
     395                 :            :         union roc_ow_ipsec_outer_ip_hdr outer_hdr;
     396                 :            : 
     397                 :            :         /* Word15 - Word30 */
     398                 :            :         uint8_t hmac_opad_ipad[ROC_CTX_MAX_OPAD_IPAD_LEN];
     399                 :            : 
     400                 :            :         /* Word31 - Word100 */
     401                 :            :         struct roc_ow_ipsec_inb_ctx_update_reg ctx;
     402                 :            : };
     403                 :            : 
     404                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_inb_sa, w1) == 1 * sizeof(uint64_t));
     405                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_inb_sa, w2) == 2 * sizeof(uint64_t));
     406                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_inb_sa, cipher_key) == 4 * sizeof(uint64_t));
     407                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_inb_sa, w8) == 8 * sizeof(uint64_t));
     408                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_inb_sa, w10) == 10 * sizeof(uint64_t));
     409                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_inb_sa, outer_hdr) == 11 * sizeof(uint64_t));
     410                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_inb_sa, hmac_opad_ipad) == 15 * sizeof(uint64_t));
     411                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_inb_sa, ctx) == 31 * sizeof(uint64_t));
     412                 :            : 
     413                 :            : struct roc_ow_ipsec_outb_sa {
     414                 :            :         /* Word0 */
     415                 :            :         union {
     416                 :            :                 struct {
     417                 :            :                         uint64_t esn_en : 1;
     418                 :            :                         uint64_t ip_id : 1;
     419                 :            :                         uint64_t rsvd0 : 1;
     420                 :            :                         uint64_t hard_life_dec : 1;
     421                 :            :                         uint64_t soft_life_dec : 1;
     422                 :            :                         uint64_t count_glb_octets : 1;
     423                 :            :                         uint64_t count_glb_pkts : 1;
     424                 :            :                         uint64_t count_mib_bytes : 1;
     425                 :            : 
     426                 :            :                         uint64_t count_mib_pkts : 1;
     427                 :            :                         uint64_t hw_ctx_off : 7;
     428                 :            : 
     429                 :            :                         uint64_t ctx_id : 16;
     430                 :            :                         uint64_t rsvd1 : 16;
     431                 :            : 
     432                 :            :                         uint64_t ctx_push_size : 7;
     433                 :            :                         uint64_t rsvd2 : 1;
     434                 :            : 
     435                 :            :                         uint64_t ctx_hdr_size : 2;
     436                 :            :                         uint64_t aop_valid : 1;
     437                 :            :                         uint64_t rsvd3 : 1;
     438                 :            :                         uint64_t ctx_size : 4;
     439                 :            :                 } s;
     440                 :            :                 uint64_t u64;
     441                 :            :         } w0;
     442                 :            : 
     443                 :            :         /* Word1 */
     444                 :            :         union {
     445                 :            :                 struct {
     446                 :            :                         uint64_t rsvd4 : 32;
     447                 :            :                         uint64_t cookie : 32;
     448                 :            :                 } s;
     449                 :            :                 uint64_t u64;
     450                 :            :         } w1;
     451                 :            : 
     452                 :            :         /* Word 2 */
     453                 :            :         union {
     454                 :            :                 struct {
     455                 :            :                         uint64_t valid : 1;
     456                 :            :                         uint64_t dir : 1;
     457                 :            :                         uint64_t outer_ip_ver : 1;
     458                 :            :                         uint64_t rsvd5 : 1;
     459                 :            :                         uint64_t ipsec_mode : 1;
     460                 :            :                         uint64_t ipsec_protocol : 1;
     461                 :            :                         uint64_t aes_key_len : 2;
     462                 :            : 
     463                 :            :                         uint64_t enc_type : 3;
     464                 :            :                         uint64_t life_unit : 1;
     465                 :            :                         uint64_t auth_type : 4;
     466                 :            : 
     467                 :            :                         uint64_t encap_type : 2;
     468                 :            :                         uint64_t ipv4_df_src_or_ipv6_flw_lbl_src : 1;
     469                 :            :                         uint64_t dscp_src : 1;
     470                 :            :                         uint64_t iv_src : 2;
     471                 :            :                         uint64_t ipid_gen : 1;
     472                 :            :                         uint64_t rsvd6 : 1;
     473                 :            : 
     474                 :            :                         uint64_t rsvd7 : 7;
     475                 :            :                         uint64_t async_mode : 1;
     476                 :            : 
     477                 :            :                         uint64_t spi : 32;
     478                 :            :                 } s;
     479                 :            :                 uint64_t u64;
     480                 :            :         } w2;
     481                 :            : 
     482                 :            :         /* Word3 */
     483                 :            :         union {
     484                 :            :                 struct {
     485                 :            :                         uint64_t hoplimit : 8;
     486                 :            :                         uint64_t rsvd8 : 56;
     487                 :            :                 } s;
     488                 :            :                 uint64_t u64;
     489                 :            :         } w3;
     490                 :            : 
     491                 :            :         /* Word4 - Word7 */
     492                 :            :         uint8_t cipher_key[ROC_CTX_MAX_CKEY_LEN];
     493                 :            : 
     494                 :            :         /* Word8 - Word9 */
     495                 :            :         union roc_ow_ipsec_outb_iv iv;
     496                 :            : 
     497                 :            :         /* Word10 */
     498                 :            :         union {
     499                 :            :                 struct {
     500                 :            :                         uint64_t rsvd9 : 4;
     501                 :            :                         uint64_t ipv4_df_or_ipv6_flw_lbl : 20;
     502                 :            : 
     503                 :            :                         uint64_t dscp : 6;
     504                 :            :                         uint64_t rsvd10 : 2;
     505                 :            : 
     506                 :            :                         uint64_t udp_dst_port : 16;
     507                 :            : 
     508                 :            :                         uint64_t udp_src_port : 16;
     509                 :            :                 } s;
     510                 :            :                 uint64_t u64;
     511                 :            :         } w10;
     512                 :            : 
     513                 :            :         /* Word11 - Word14 */
     514                 :            :         union roc_ow_ipsec_outer_ip_hdr outer_hdr;
     515                 :            : 
     516                 :            :         /* Word15 - Word30 */
     517                 :            :         uint8_t hmac_opad_ipad[ROC_CTX_MAX_OPAD_IPAD_LEN];
     518                 :            : 
     519                 :            :         /* Word31 - Word36 */
     520                 :            :         struct roc_ow_ipsec_outb_ctx_update_reg ctx;
     521                 :            : };
     522                 :            : 
     523                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_outb_sa, w1) == 1 * sizeof(uint64_t));
     524                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_outb_sa, w2) == 2 * sizeof(uint64_t));
     525                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_outb_sa, cipher_key) == 4 * sizeof(uint64_t));
     526                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_outb_sa, iv) == 8 * sizeof(uint64_t));
     527                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_outb_sa, w10) == 10 * sizeof(uint64_t));
     528                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_outb_sa, outer_hdr) == 11 * sizeof(uint64_t));
     529                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_outb_sa, hmac_opad_ipad) == 15 * sizeof(uint64_t));
     530                 :            : PLT_STATIC_ASSERT(offsetof(struct roc_ow_ipsec_outb_sa, ctx) == 31 * sizeof(uint64_t));
     531                 :            : 
     532                 :            : #define ROC_OW_IPSEC_SA_SZ_MAX \
     533                 :            :         (PLT_MAX(sizeof(struct roc_ow_ipsec_inb_sa), sizeof(struct roc_ow_ipsec_outb_sa)))
     534                 :            : 
     535                 :            : void __roc_api roc_ow_ipsec_inb_sa_init(struct roc_ow_ipsec_inb_sa *sa);
     536                 :            : void __roc_api roc_ow_reass_inb_sa_init(struct roc_ow_ipsec_inb_sa *sa);
     537                 :            : void __roc_api roc_ow_ipsec_outb_sa_init(struct roc_ow_ipsec_outb_sa *sa);
     538                 :            : 
     539                 :            : #endif /* __ROC_IE_OW_H__ */

Generated by: LCOV version 1.14