* helper function, splits processed packets into ipv4/ipv6 traffic. */
| 124 | * helper function, splits processed packets into ipv4/ipv6 traffic. |
| 125 | */ |
| 126 | static inline void |
| 127 | copy_to_trf(struct ipsec_traffic *trf, uint64_t satp, struct rte_mbuf *mb[], |
| 128 | uint32_t num) |
| 129 | { |
| 130 | uint32_t j, ofs, s; |
| 131 | struct traffic_type *out; |
| 132 | |
| 133 | /* |
| 134 | * determine traffic type(ipv4/ipv6) and offset for ACL classify |
| 135 | * based on SA type |
| 136 | */ |
| 137 | if ((satp & RTE_IPSEC_SATP_DIR_MASK) == RTE_IPSEC_SATP_DIR_IB) { |
| 138 | if ((satp & RTE_IPSEC_SATP_IPV_MASK) == RTE_IPSEC_SATP_IPV4) { |
| 139 | out = &trf->ip4; |
| 140 | ofs = offsetof(struct ip, ip_p); |
| 141 | } else { |
| 142 | out = &trf->ip6; |
| 143 | ofs = offsetof(struct ip6_hdr, ip6_nxt); |
| 144 | } |
| 145 | } else if (SATP_OUT_IPV4(satp)) { |
| 146 | out = &trf->ip4; |
| 147 | ofs = offsetof(struct ip, ip_p); |
| 148 | } else { |
| 149 | out = &trf->ip6; |
| 150 | ofs = offsetof(struct ip6_hdr, ip6_nxt); |
| 151 | } |
| 152 | |
| 153 | for (j = 0, s = out->num; j != num; j++) { |
| 154 | out->data[s + j] = rte_pktmbuf_mtod_offset(mb[j], |
| 155 | void *, ofs); |
| 156 | out->pkts[s + j] = mb[j]; |
| 157 | } |
| 158 | |
| 159 | out->num += num; |
| 160 | } |
| 161 | |
| 162 | static uint32_t |
| 163 | ipsec_prepare_crypto_group(struct ipsec_ctx *ctx, struct ipsec_sa *sa, |
no outgoing calls
no test coverage detected