X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_ipsec%2Fesp_inb.c;h=5c653dd394372b7bad437b52048a79b127f0f507;hb=f31d17807236094268ccd1bead5d740a10fec513;hp=fb10b708536704d04e8e0bd46fc14332e929b048;hpb=8734e669fc175bf652020bc30d67d99a7073f1a4;p=dpdk.git diff --git a/lib/librte_ipsec/esp_inb.c b/lib/librte_ipsec/esp_inb.c index fb10b70853..5c653dd394 100644 --- a/lib/librte_ipsec/esp_inb.c +++ b/lib/librte_ipsec/esp_inb.c @@ -296,15 +296,15 @@ esp_inb_pkt_prepare(const struct rte_ipsec_session *ss, struct rte_mbuf *mb[], */ static inline void process_step1(struct rte_mbuf *mb, uint32_t tlen, struct rte_mbuf **ml, - struct esp_tail *espt, uint32_t *hlen, uint32_t *tofs) + struct rte_esp_tail *espt, uint32_t *hlen, uint32_t *tofs) { - const struct esp_tail *pt; + const struct rte_esp_tail *pt; uint32_t ofs; ofs = mb->pkt_len - tlen; hlen[0] = mb->l2_len + mb->l3_len; ml[0] = mbuf_get_seg_ofs(mb, &ofs); - pt = rte_pktmbuf_mtod_offset(ml[0], const struct esp_tail *, ofs); + pt = rte_pktmbuf_mtod_offset(ml[0], const struct rte_esp_tail *, ofs); tofs[0] = ofs; espt[0] = pt[0]; } @@ -341,7 +341,7 @@ check_pad_bytes(struct rte_mbuf *mb, uint32_t ofs, uint32_t len) */ static inline int32_t trs_process_check(struct rte_mbuf *mb, struct rte_mbuf **ml, - uint32_t *tofs, struct esp_tail espt, uint32_t hlen, uint32_t tlen) + uint32_t *tofs, struct rte_esp_tail espt, uint32_t hlen, uint32_t tlen) { if ((mb->ol_flags & PKT_RX_SEC_OFFLOAD_FAILED) != 0 || tlen + hlen > mb->pkt_len) @@ -364,7 +364,7 @@ trs_process_check(struct rte_mbuf *mb, struct rte_mbuf **ml, */ static inline int32_t tun_process_check(struct rte_mbuf *mb, struct rte_mbuf **ml, - uint32_t *tofs, struct esp_tail espt, uint32_t hlen, uint32_t tlen, + uint32_t *tofs, struct rte_esp_tail espt, uint32_t hlen, uint32_t tlen, uint8_t proto) { return (trs_process_check(mb, ml, tofs, espt, hlen, tlen) || @@ -462,8 +462,10 @@ tun_process(const struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], { uint32_t adj, i, k, tl; uint32_t hl[num], to[num]; - struct esp_tail espt[num]; + struct rte_esp_tail espt[num]; struct rte_mbuf *ml[num]; + const void *outh; + void *inh; /* * remove icv, esp trailer and high-order @@ -489,9 +491,16 @@ tun_process(const struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], if (tun_process_check(mb[i], &ml[i], &to[i], espt[i], adj, tl, sa->proto) == 0) { + outh = rte_pktmbuf_mtod_offset(mb[i], uint8_t *, + mb[i]->l2_len); + /* modify packet's layout */ - tun_process_step2(mb[i], ml[i], hl[i], adj, to[i], - tl, sqn + k); + inh = tun_process_step2(mb[i], ml[i], hl[i], adj, + to[i], tl, sqn + k); + + /* update inner ip header */ + update_tun_inb_l3hdr(sa, outh, inh); + /* update mbuf's metadata */ tun_process_step3(mb[i], sa->tx_offload.msk, sa->tx_offload.val); @@ -514,7 +523,7 @@ trs_process(const struct rte_ipsec_sa *sa, struct rte_mbuf *mb[], char *np; uint32_t i, k, l2, tl; uint32_t hl[num], to[num]; - struct esp_tail espt[num]; + struct rte_esp_tail espt[num]; struct rte_mbuf *ml[num]; /*