LCOV - code coverage report
Current view: top level - lib/gso - gso_tcp4.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 24 0.0 %
Date: 2025-03-01 20:23:48 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 14 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(c) 2017 Intel Corporation
       3                 :            :  */
       4                 :            : 
       5                 :            : #include "gso_common.h"
       6                 :            : #include "gso_tcp4.h"
       7                 :            : 
       8                 :            : static void
       9                 :          0 : update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta,
      10                 :            :                 struct rte_mbuf **segs, uint16_t nb_segs)
      11                 :            : {
      12                 :            :         struct rte_ipv4_hdr *ipv4_hdr;
      13                 :            :         struct rte_tcp_hdr *tcp_hdr;
      14                 :            :         uint32_t sent_seq;
      15                 :            :         uint16_t id, tail_idx, i;
      16                 :          0 :         uint16_t l3_offset = pkt->l2_len;
      17                 :          0 :         uint16_t l4_offset = l3_offset + pkt->l3_len;
      18                 :            : 
      19                 :          0 :         ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *,
      20                 :            :                                            l3_offset);
      21                 :          0 :         tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len);
      22         [ #  # ]:          0 :         id = rte_be_to_cpu_16(ipv4_hdr->packet_id);
      23         [ #  # ]:          0 :         sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq);
      24                 :          0 :         tail_idx = nb_segs - 1;
      25                 :            : 
      26         [ #  # ]:          0 :         for (i = 0; i < nb_segs; i++) {
      27                 :          0 :                 update_ipv4_header(segs[i], l3_offset, id);
      28                 :          0 :                 update_tcp_header(segs[i], l4_offset, sent_seq, i < tail_idx);
      29                 :          0 :                 id += ipid_delta;
      30                 :          0 :                 sent_seq += (segs[i]->pkt_len - segs[i]->data_len);
      31                 :            :         }
      32                 :          0 : }
      33                 :            : 
      34                 :            : int
      35                 :          0 : gso_tcp4_segment(struct rte_mbuf *pkt,
      36                 :            :                 uint16_t gso_size,
      37                 :            :                 uint8_t ipid_delta,
      38                 :            :                 struct rte_mempool *direct_pool,
      39                 :            :                 struct rte_mempool *indirect_pool,
      40                 :            :                 struct rte_mbuf **pkts_out,
      41                 :            :                 uint16_t nb_pkts_out)
      42                 :            : {
      43                 :            :         struct rte_ipv4_hdr *ipv4_hdr;
      44                 :            :         uint16_t pyld_unit_size, hdr_offset;
      45                 :            :         uint16_t frag_off;
      46                 :            :         int ret;
      47                 :            : 
      48                 :            :         /* Don't process the fragmented packet */
      49                 :          0 :         ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *,
      50                 :            :                                            pkt->l2_len);
      51         [ #  # ]:          0 :         frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset);
      52         [ #  # ]:          0 :         if (unlikely(IS_FRAGMENTED(frag_off))) {
      53                 :            :                 return 0;
      54                 :            :         }
      55                 :            : 
      56                 :            :         /* Don't process the packet without data */
      57                 :          0 :         hdr_offset = pkt->l2_len + pkt->l3_len + pkt->l4_len;
      58         [ #  # ]:          0 :         if (unlikely(hdr_offset >= pkt->pkt_len)) {
      59                 :            :                 return 0;
      60                 :            :         }
      61                 :            : 
      62                 :          0 :         pyld_unit_size = gso_size - hdr_offset;
      63                 :            : 
      64                 :            :         /* Segment the payload */
      65                 :          0 :         ret = gso_do_segment(pkt, hdr_offset, pyld_unit_size, direct_pool,
      66                 :            :                         indirect_pool, pkts_out, nb_pkts_out);
      67         [ #  # ]:          0 :         if (ret > 1)
      68                 :          0 :                 update_ipv4_tcp_headers(pkt, ipid_delta, pkts_out, ret);
      69                 :            : 
      70                 :            :         return ret;
      71                 :            : }

Generated by: LCOV version 1.14