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 57AE6A0C56; Thu, 12 Aug 2021 13:11:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5202241200; Thu, 12 Aug 2021 13:11:21 +0200 (CEST) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by mails.dpdk.org (Postfix) with ESMTP id C756441200 for ; Thu, 12 Aug 2021 13:11:19 +0200 (CEST) Received: by mail-pj1-f50.google.com with SMTP id hv22-20020a17090ae416b0290178c579e424so10143172pjb.3 for ; Thu, 12 Aug 2021 04:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M/6WQKhhcHJZ8lH4P5Iti9nBeBhth8hCt890WgpnHJ8=; b=FpL6RYpbIcZuHpHoCLSrZgXFwwfFzpKLMCPo1K7biRNVUGO+Z3jjXYdWmW68ABYScu GrgHys8N0W4E8bml0kFiMxYTNzdyFPycF3u8SSMXQpuQSQQhb9/gi15yxv6uc1uKEswd 0z+pe3GvcNUV414VakbJF4R8GftmDnsiYIx2MPyy7VT033mgzuNNI0ZtfMng+trtATJw A1yZ7bSad5HkrXAJ1YY5U2ptP938ZMgGK6UuolLmcfDtWBi07DWbRqJe9sdqEp/Sn9xj TVnGxF/SM+1uLGOu5D/DOVazr3BIzGi2Ry0+3gHMi/sCNBo5PqdPFMbETYaG0q9o12IZ cCNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M/6WQKhhcHJZ8lH4P5Iti9nBeBhth8hCt890WgpnHJ8=; b=geEXYQH48qQdVVnNUnuQDwMsE+Bglmyyg4WPO9NrAlQWH/O/NDehr3Pb/Z1V6O62M9 k4XIL3gSzT36QlgyAtAx+qDRjkf2hHyauhn8zdujGiFVFU4LzOo9oK8ajIM5V9AQBP24 XlTtccwGPvreVhvf7qqVpECg2b1rsvyeSI9FcVG2uWzPFu061ix4KF+FPqO+vx6svo75 5Oug51Ldpp5fe0k4O164a5UVu+qfZH0rc63rA27Ou7VLJoriMkZhNBPhho+Ca8ajLI07 G8riQ1OgXDSDyFRnfPcSObai8f4Hut/xaJ3S5ybcyuPZ5xPuYIelcz0SEBBy/cvCeVxL k++Q== X-Gm-Message-State: AOAM532GKZzt2lw0UTvn+nF3aBli6Nhaa3oTC+n9ozXZjQnQ8+oPNZc4 +b4wKkbMC84ReA34Hn/p4WIh2Nu3PUF1Osbj X-Google-Smtp-Source: ABdhPJzayYkzurXXHGLNqwSEehsIi8vzMRqPik+sccNFkYqvaewhM4jaVtJV3DzgPzsEDWRT2agvHA== X-Received: by 2002:a17:90a:8909:: with SMTP id u9mr429303pjn.9.1628766678520; Thu, 12 Aug 2021 04:11:18 -0700 (PDT) Received: from C02D70YZMD6R.bytedance.net ([139.177.225.243]) by smtp.gmail.com with ESMTPSA id l126sm3291830pgl.14.2021.08.12.04.11.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Aug 2021 04:11:18 -0700 (PDT) From: Zhihong Wang To: dev@dpdk.org, ferruh.yigit@intel.com, xiaoyun.li@intel.com, aman.deep.singh@intel.com, irusskikh@marvell.com, cchemparathy@tilera.com Cc: Zhihong Wang Date: Thu, 12 Aug 2021 19:11:03 +0800 Message-Id: <20210812111105.54307-3-wangzhihong.wzh@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20210812111105.54307-1-wangzhihong.wzh@bytedance.com> References: <20210809062548.30187-1-wangzhihong.wzh@bytedance.com> <20210812111105.54307-1-wangzhihong.wzh@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 2/4] app/testpmd: use rte_ipv4_cksum in flowgen 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 Sender: "dev" Use the rte_ipv4_cksum API to replace local ip_sum implementation. Signed-off-by: Zhihong Wang --- app/test-pmd/flowgen.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index f2e6255c36..96d0cc79df 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -53,28 +53,6 @@ static struct rte_ether_addr cfg_ether_dst = #define IP_DEFTTL 64 /* from RFC 1340. */ -/* Use this type to inform GCC that ip_sum violates aliasing rules. */ -typedef unaligned_uint16_t alias_int16_t __attribute__((__may_alias__)); - -static inline uint16_t -ip_sum(const alias_int16_t *hdr, int hdr_len) -{ - uint32_t sum = 0; - - while (hdr_len > 1) - { - sum += *hdr++; - if (sum & 0x80000000) - sum = (sum & 0xFFFF) + (sum >> 16); - hdr_len -= 2; - } - - while (sum >> 16) - sum = (sum & 0xFFFF) + (sum >> 16); - - return ~sum; -} - /* * Multi-flow generation mode. * @@ -160,8 +138,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) next_flow); ip_hdr->total_length = RTE_CPU_TO_BE_16(pkt_size - sizeof(*eth_hdr)); - ip_hdr->hdr_checksum = ip_sum((const alias_int16_t *)ip_hdr, - sizeof(*ip_hdr)); + ip_hdr->hdr_checksum = rte_ipv4_cksum(ip_hdr); /* Initialize UDP header. */ udp_hdr = (struct rte_udp_hdr *)(ip_hdr + 1); -- 2.11.0