From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9E414A034C; Sun, 7 Aug 2022 13:49:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4803E40156; Sun, 7 Aug 2022 13:49:16 +0200 (CEST) Received: from forward501j.mail.yandex.net (forward501j.mail.yandex.net [5.45.198.251]) by mails.dpdk.org (Postfix) with ESMTP id D83684014F for ; Sun, 7 Aug 2022 13:49:14 +0200 (CEST) Received: from vla3-178a3f795968.qloud-c.yandex.net (vla3-178a3f795968.qloud-c.yandex.net [IPv6:2a02:6b8:c15:2584:0:640:178a:3f79]) by forward501j.mail.yandex.net (Yandex) with ESMTP id 18AC96233DC; Sun, 7 Aug 2022 14:49:14 +0300 (MSK) Received: by vla3-178a3f795968.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 1BQlKpXDD8-nChSv3op; Sun, 07 Aug 2022 14:49:13 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1659872953; bh=Yom7H/+8aLcBzuksrR9UpbBUsc56XXNaHRH7FzQxm8Q=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=NfcnGVcffgv/82D5GZKaU1pZbUUnTzS/lWiHJePgAlzH+ttTK9rhdo9sm2t8kxods DXAMcXq8eyvcXSKgZoUU9GHcaXr29gB+gNjUuWHvTaFMA6JvIwKXoLpwOj2qwYtXDL WCYlvP4xk2w3qW9gRkR0DggTYXqgpVMnR+t+rEUw= Authentication-Results: vla3-178a3f795968.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: Date: Sun, 7 Aug 2022 12:49:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v6] ip_frag: add IPv4 fragment copy packet API Content-Language: en-US To: Huichao Cai , Stephen Hemminger Cc: dev@dpdk.org References: <1658638211-6661-1-git-send-email-chcchc88@163.com> <1658650203-7831-1-git-send-email-chcchc88@163.com> <20220725084206.37cdbcac@hermes.local> <66a29fb8.75d.1823818ffdb.Coremail.chcchc88@163.com> From: Konstantin Ananyev In-Reply-To: <66a29fb8.75d.1823818ffdb.Coremail.chcchc88@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > > At 2022-07-25 23:42:06, "Stephen Hemminger" wrote: >>On Sun, 24 Jul 2022 16:10:03 +0800 >>Huichao Cai 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 > >than any performance gain of having a non-segmented fast path. I think checks are not that expensive. My guess - actual copying will be the main cycles eater here. Though if percentage of packets that need to be fragmented is tiny, might be it is still worth it. Though yes, I still think better would be not to use MBUF_FAST_FREE at all, but we are where we are. > These checks are consistent with the rte_ipv4_fragment_packet function. > I think these have been tested for performance.If these checks do affect > performance, > perhaps the legitimacy of the variable is better guaranteed by the caller