| 273 | } |
| 274 | |
| 275 | static inline void |
| 276 | test_get_frag_opt(struct rte_mbuf **mb, int32_t num, |
| 277 | struct test_opt_data *opt, int ipv, bool opt_copied) |
| 278 | { |
| 279 | int32_t i; |
| 280 | |
| 281 | for (i = 0; i < num; i++) { |
| 282 | if (ipv == 4) { |
| 283 | struct rte_ipv4_hdr *iph = |
| 284 | rte_pktmbuf_mtod(mb[i], struct rte_ipv4_hdr *); |
| 285 | uint16_t header_len = (iph->version_ihl & |
| 286 | RTE_IPV4_HDR_IHL_MASK) * |
| 287 | RTE_IPV4_IHL_MULTIPLIER; |
| 288 | uint16_t opt_len = header_len - |
| 289 | sizeof(struct rte_ipv4_hdr); |
| 290 | |
| 291 | opt->opt_copied = opt_copied; |
| 292 | |
| 293 | if ((rte_be_to_cpu_16(iph->fragment_offset) & |
| 294 | RTE_IPV4_HDR_OFFSET_MASK) == 0) |
| 295 | opt->is_first_frag = true; |
| 296 | else |
| 297 | opt->is_first_frag = false; |
| 298 | |
| 299 | if (likely(opt_len <= RTE_IPV4_HDR_OPT_MAX_LEN)) { |
| 300 | char *iph_opt = rte_pktmbuf_mtod_offset(mb[i], |
| 301 | char *, sizeof(struct rte_ipv4_hdr)); |
| 302 | opt->len = opt_len; |
| 303 | memcpy(opt->data, iph_opt, opt_len); |
| 304 | } else { |
| 305 | opt->len = RTE_IPV4_HDR_OPT_MAX_LEN; |
| 306 | memset(opt->data, RTE_IPV4_HDR_OPT_EOL, |
| 307 | sizeof(opt->data)); |
| 308 | } |
| 309 | opt++; |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | static int |
| 315 | test_ip_frag(void) |
no test coverage detected