Lines Matching refs:sa
25 esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, in esp_inbound() argument
32 RTE_ASSERT(sa != NULL); in esp_inbound()
33 if (ipsec_get_action_type(sa) == in esp_inbound()
53 sizeof(struct rte_esp_hdr) - sa->iv_len - sa->digest_len; in esp_inbound()
55 if ((payload_len & (sa->block_size - 1)) || (payload_len <= 0)) { in esp_inbound()
57 payload_len, sa->block_size); in esp_inbound()
64 if (sa->aead_algo == RTE_CRYPTO_AEAD_AES_GCM) { in esp_inbound()
66 ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len; in esp_inbound()
75 icb->salt = sa->salt; in esp_inbound()
86 rte_pktmbuf_pkt_len(m) - sa->digest_len); in esp_inbound()
88 rte_pktmbuf_pkt_len(m) - sa->digest_len); in esp_inbound()
92 sa->iv_len; in esp_inbound()
101 switch (sa->cipher_algo) { in esp_inbound()
106 rte_memcpy(iv_ptr, iv, sa->iv_len); in esp_inbound()
110 icb->salt = sa->salt; in esp_inbound()
116 sa->cipher_algo); in esp_inbound()
120 switch (sa->auth_algo) { in esp_inbound()
126 sa->iv_len + payload_len; in esp_inbound()
130 sa->auth_algo); in esp_inbound()
135 rte_pktmbuf_pkt_len(m) - sa->digest_len); in esp_inbound()
137 rte_pktmbuf_pkt_len(m) - sa->digest_len); in esp_inbound()
144 esp_inbound_post(struct rte_mbuf *m, struct ipsec_sa *sa, in esp_inbound_post() argument
155 RTE_ASSERT(sa != NULL); in esp_inbound_post()
158 ips = ipsec_get_primary_session(sa); in esp_inbound_post()
181 rte_pktmbuf_pkt_len(m) - sa->digest_len - 1); in esp_inbound_post()
192 if (rte_pktmbuf_trim(m, *pad_len + 2 + sa->digest_len)) { in esp_inbound_post()
199 if (unlikely(IS_TRANSPORT(sa->flags))) { in esp_inbound_post()
202 sizeof(struct rte_esp_hdr) + sa->iv_len); in esp_inbound_post()
216 ipip_inbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len); in esp_inbound_post()
222 esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, in esp_outbound() argument
235 RTE_ASSERT(sa != NULL); in esp_outbound()
237 ips = ipsec_get_primary_session(sa); in esp_outbound()
242 if (unlikely(IS_TRANSPORT(sa->flags))) { in esp_outbound()
248 if (unlikely(IS_TRANSPORT(sa->flags))) { in esp_outbound()
263 ip_hdr_len + 2, sa->block_size); in esp_outbound()
266 RTE_ASSERT(IS_TUNNEL(sa->flags) || IS_TRANSPORT(sa->flags)); in esp_outbound()
268 if (likely(IS_IP4_TUNNEL(sa->flags))) in esp_outbound()
270 else if (IS_IP6_TUNNEL(sa->flags)) in esp_outbound()
272 else if (!IS_TRANSPORT(sa->flags)) { in esp_outbound()
274 sa->flags); in esp_outbound()
279 if (unlikely(ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len + in esp_outbound()
280 pad_payload_len + sa->digest_len > IP_MAXPACKET)) { in esp_outbound()
291 sa->digest_len); in esp_outbound()
300 switch (WITHOUT_TRANSPORT_VERSION(sa->flags)) { in esp_outbound()
302 ip4 = ip4ip_outbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len, in esp_outbound()
303 &sa->src, &sa->dst); in esp_outbound()
307 ip6 = ip6ip_outbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len, in esp_outbound()
308 &sa->src, &sa->dst); in esp_outbound()
313 sizeof(struct rte_esp_hdr) + sa->iv_len); in esp_outbound()
328 sa->seq++; in esp_outbound()
329 esp->spi = rte_cpu_to_be_32(sa->spi); in esp_outbound()
330 esp->seq = rte_cpu_to_be_32((uint32_t)sa->seq); in esp_outbound()
334 if (sa->aead_algo == RTE_CRYPTO_AEAD_AES_GCM) { in esp_outbound()
335 *iv = rte_cpu_to_be_64(sa->seq); in esp_outbound()
337 switch (sa->cipher_algo) { in esp_outbound()
341 memset(iv, 0, sa->iv_len); in esp_outbound()
344 *iv = rte_cpu_to_be_64(sa->seq); in esp_outbound()
349 sa->cipher_algo); in esp_outbound()
371 if (sa->aead_algo == RTE_CRYPTO_AEAD_AES_GCM) { in esp_outbound()
375 sizeof(struct rte_esp_hdr) + sa->iv_len; in esp_outbound()
385 icb->salt = sa->salt; in esp_outbound()
386 icb->iv = rte_cpu_to_be_64(sa->seq); in esp_outbound()
396 rte_pktmbuf_pkt_len(m) - sa->digest_len); in esp_outbound()
398 rte_pktmbuf_pkt_len(m) - sa->digest_len); in esp_outbound()
400 switch (sa->cipher_algo) { in esp_outbound()
406 sym_cop->cipher.data.length = pad_payload_len + sa->iv_len; in esp_outbound()
410 sizeof(struct rte_esp_hdr) + sa->iv_len; in esp_outbound()
415 sa->cipher_algo); in esp_outbound()
426 icb->salt = sa->salt; in esp_outbound()
427 icb->iv = rte_cpu_to_be_64(sa->seq); in esp_outbound()
430 switch (sa->auth_algo) { in esp_outbound()
436 sa->iv_len + pad_payload_len; in esp_outbound()
440 sa->auth_algo); in esp_outbound()
445 rte_pktmbuf_pkt_len(m) - sa->digest_len); in esp_outbound()
447 rte_pktmbuf_pkt_len(m) - sa->digest_len); in esp_outbound()
456 struct ipsec_sa *sa, in esp_outbound_post() argument
461 RTE_ASSERT(sa != NULL); in esp_outbound_post()
463 type = ipsec_get_action_type(sa); in esp_outbound_post()