<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><p style="margin: 0;"><br></p><p style="margin: 0;"><br></p><p style="margin: 0;"><br></p><p style="margin: 0;"><br></p><p style="margin: 0;"><br></p><div style="position:relative;zoom:1"></div><div id="divNeteaseMailCard"></div><p style="margin: 0;"><br></p><pre><br>At 2022-07-25 23:42:06, "Stephen Hemminger" <stephen@networkplumber.org> wrote:
>On Sun, 24 Jul 2022 16:10:03 +0800
>Huichao Cai <chcchc88@163.com> wrote:
>
>> +
>> +      /*
>> +       * Formal parameter checking.
>> +       */
>> +      if (unlikely(pkt_in == NULL) || unlikely(pkts_out == NULL) ||
>> +          unlikely(nb_pkts_out == 0) || unlikely(pool_direct == NULL) ||
>> +          unlikely(mtu_size < RTE_ETHER_MIN_MTU))
>> +              return -EINVAL;
>> +
>> +      in_hdr = rte_pktmbuf_mtod(pkt_in, struct rte_ipv4_hdr *);
>> +      header_len = (in_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) *
>> +          RTE_IPV4_IHL_MULTIPLIER;
>> +
>> +      /* Check IP header length */
>> +      if (unlikely(pkt_in->data_len < header_len) ||
>> +          unlikely(mtu_size < header_len))
>> +              return -EINVAL;
>> +
>
>My suspicions are all this input parameter checking probably costs more
<div>>than any performance gain of having a non-segmented fast path.</div><div><span style="font-size: 14px;">These checks are consistent with the rte_ipv4_fragment_packet function.</span></div><div><span style="font-size: 14px;">I think these have been tested for performance.If these checks do affect performance, </span></div><div><span style="font-size: 14px;">perhaps the legitimacy of the variable is better guaranteed by the caller</span></div></pre></div>