- if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM) {
- if (ol_flags & PKT_TX_IPV4) {
- ipv4_hdr =
- rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *,
- inner_l3_offset);
-
- if (ol_flags & PKT_TX_IP_CKSUM)
- ipv4_hdr->hdr_checksum = 0;
-
- udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr +
- m->l3_len);
- udp_hdr->dgram_cksum =
- hinic_ipv4_phdr_cksum(ipv4_hdr, ol_flags);
- } else {
- ipv6_hdr =
- rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *,
- inner_l3_offset);
-
- udp_hdr =
- rte_pktmbuf_mtod_offset(m, struct rte_udp_hdr *,
- (inner_l3_offset + m->l3_len));
- udp_hdr->dgram_cksum =
- hinic_ipv6_phdr_cksum(ipv6_hdr, ol_flags);
- }
-
- off_info->inner_l4_type = UDP_OFFLOAD_ENABLE;
- off_info->inner_l4_tcp_udp = 1;
- } else if (((ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) ||
- (ol_flags & PKT_TX_TCP_SEG)) {
- if (ol_flags & PKT_TX_IPV4) {
- ipv4_hdr =
- rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *,
- inner_l3_offset);
-
- if (ol_flags & PKT_TX_IP_CKSUM)
- ipv4_hdr->hdr_checksum = 0;
-
- /* non-TSO tcp */
- tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr +
- m->l3_len);
- tcp_hdr->cksum =
- hinic_ipv4_phdr_cksum(ipv4_hdr, ol_flags);
- } else {
- ipv6_hdr =
- rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *,
- inner_l3_offset);
- /* non-TSO tcp */
- tcp_hdr =
- rte_pktmbuf_mtod_offset(m, struct rte_tcp_hdr *,
- (inner_l3_offset + m->l3_len));
- tcp_hdr->cksum =
- hinic_ipv6_phdr_cksum(ipv6_hdr, ol_flags);
- }
-
- off_info->inner_l4_type = TCP_OFFLOAD_ENABLE;
- off_info->inner_l4_tcp_udp = 1;
- } else if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_SCTP_CKSUM) {
- off_info->inner_l4_type = SCTP_OFFLOAD_ENABLE;
- off_info->inner_l4_tcp_udp = 0;
- off_info->inner_l4_len = sizeof(struct rte_sctp_hdr);
- }