X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Fipsec%2Fesp_inb.c;h=636c850fa6a9e724811983f0bd4e61c30a7bb14b;hb=6e858b4d9244cf53505589673755ab18ac2a4a83;hp=d66c88f05d5b2f2728d4b289e53b829e7947dff5;hpb=c99d26197c535ecda727fb1d641c2bbd27f95374;p=dpdk.git diff --git a/lib/ipsec/esp_inb.c b/lib/ipsec/esp_inb.c index d66c88f05d..636c850fa6 100644 --- a/lib/ipsec/esp_inb.c +++ b/lib/ipsec/esp_inb.c @@ -15,7 +15,7 @@ #include "misc.h" #include "pad.h" -typedef uint16_t (*esp_inb_process_t)(const struct rte_ipsec_sa *sa, +typedef uint16_t (*esp_inb_process_t)(struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], uint32_t sqn[], uint32_t dr[], uint16_t num, uint8_t sqh_len); @@ -459,7 +459,7 @@ static inline int32_t trs_process_check(struct rte_mbuf *mb, struct rte_mbuf **ml, uint32_t *tofs, struct rte_esp_tail espt, uint32_t hlen, uint32_t tlen) { - if ((mb->ol_flags & PKT_RX_SEC_OFFLOAD_FAILED) != 0 || + if ((mb->ol_flags & RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED) != 0 || tlen + hlen > mb->pkt_len) return -EBADMSG; @@ -475,7 +475,7 @@ trs_process_check(struct rte_mbuf *mb, struct rte_mbuf **ml, /* * packet checks for tunnel mode: - * - same as for trasnport mode + * - same as for transport mode * - esp tail next proto contains expected for that SA value */ static inline int32_t @@ -547,8 +547,8 @@ trs_process_step3(struct rte_mbuf *mb) /* reset mbuf packet type */ mb->packet_type &= (RTE_PTYPE_L2_MASK | RTE_PTYPE_L3_MASK); - /* clear the PKT_RX_SEC_OFFLOAD flag if set */ - mb->ol_flags &= ~PKT_RX_SEC_OFFLOAD; + /* clear the RTE_MBUF_F_RX_SEC_OFFLOAD flag if set */ + mb->ol_flags &= ~RTE_MBUF_F_RX_SEC_OFFLOAD; } /* @@ -561,22 +561,22 @@ trs_process_step3(struct rte_mbuf *mb) static inline void tun_process_step3(struct rte_mbuf *mb, uint64_t txof_msk, uint64_t txof_val) { - /* reset mbuf metatdata: L2/L3 len, packet type */ + /* reset mbuf metadata: L2/L3 len, packet type */ mb->packet_type = RTE_PTYPE_UNKNOWN; mb->tx_offload = (mb->tx_offload & txof_msk) | txof_val; - /* clear the PKT_RX_SEC_OFFLOAD flag if set */ - mb->ol_flags &= ~PKT_RX_SEC_OFFLOAD; + /* clear the RTE_MBUF_F_RX_SEC_OFFLOAD flag if set */ + mb->ol_flags &= ~RTE_MBUF_F_RX_SEC_OFFLOAD; } /* * *process* function for tunnel packets */ static inline uint16_t -tun_process(const struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], +tun_process(struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], uint32_t sqn[], uint32_t dr[], uint16_t num, uint8_t sqh_len) { - uint32_t adj, i, k, tl; + uint32_t adj, i, k, tl, bytes; uint32_t hl[num], to[num]; struct rte_esp_tail espt[num]; struct rte_mbuf *ml[num]; @@ -598,6 +598,7 @@ tun_process(const struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], process_step1(mb[i], tlen, &ml[i], &espt[i], &hl[i], &to[i]); k = 0; + bytes = 0; for (i = 0; i != num; i++) { adj = hl[i] + cofs; @@ -621,10 +622,13 @@ tun_process(const struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], tun_process_step3(mb[i], sa->tx_offload.msk, sa->tx_offload.val); k++; + bytes += mb[i]->pkt_len; } else dr[i - k] = i; } + sa->statistics.count += k; + sa->statistics.bytes += bytes; return k; } @@ -632,11 +636,11 @@ tun_process(const struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], * *process* function for tunnel packets */ static inline uint16_t -trs_process(const struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], +trs_process(struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], uint32_t sqn[], uint32_t dr[], uint16_t num, uint8_t sqh_len) { char *np; - uint32_t i, k, l2, tl; + uint32_t i, k, l2, tl, bytes; uint32_t hl[num], to[num]; struct rte_esp_tail espt[num]; struct rte_mbuf *ml[num]; @@ -656,6 +660,7 @@ trs_process(const struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], process_step1(mb[i], tlen, &ml[i], &espt[i], &hl[i], &to[i]); k = 0; + bytes = 0; for (i = 0; i != num; i++) { tl = tlen + espt[i].pad_len; @@ -674,10 +679,13 @@ trs_process(const struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], /* update mbuf's metadata */ trs_process_step3(mb[i]); k++; + bytes += mb[i]->pkt_len; } else dr[i - k] = i; } + sa->statistics.count += k; + sa->statistics.bytes += bytes; return k; }