From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E82CCA04E7; Mon, 2 Nov 2020 18:08:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 759C431FC; Mon, 2 Nov 2020 18:08:28 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id A09912E8B; Mon, 2 Nov 2020 18:08:25 +0100 (CET) IronPort-SDR: l6y7xoGlNWWbPlK0LQBNF48AsQlQLSFPBPCSm+dEFjCDWd/tCXcZXLLgj+kpAFLmhiK4a1WqmP EENYeJ1zubDw== X-IronPort-AV: E=McAfee;i="6000,8403,9793"; a="253626738" X-IronPort-AV: E=Sophos;i="5.77,445,1596524400"; d="scan'208";a="253626738" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2020 09:08:23 -0800 IronPort-SDR: lwB4Mmh1dP8EVI1fHjxriHRU21Tw6ouBgVfCKay2p5sQ8lR50hzf8GdDU1NbzaRnr+9ZXnrWWw pgpZHr3kNLtQ== X-IronPort-AV: E=Sophos;i="5.77,445,1596524400"; d="scan'208";a="538095803" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.219.143]) ([10.213.219.143]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2020 09:08:21 -0800 To: Xiaoyun wang , dev@dpdk.org Cc: bluca@debian.org, stable@dpdk.org, luoxingyu@huawei.com, luoxianjun@huawei.com, yin.yinshi@huawei.com, zhouguoyang@huawei.com References: <39bc11d96f40e26afc0d1799def59003b697987a.1604115055.git.cloud.wangxiaoyun@huawei.com> From: Ferruh Yigit Message-ID: Date: Mon, 2 Nov 2020 17:08:18 +0000 MIME-Version: 1.0 In-Reply-To: <39bc11d96f40e26afc0d1799def59003b697987a.1604115055.git.cloud.wangxiaoyun@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v1 1/2] net/hinic: fix outer_l3_len parse error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" On 10/31/2020 3:38 AM, Xiaoyun wang wrote: > This patch fixes outer_l3_len parse error when > PKT_TX_OUTER_IP_CKSUM is not set, which does not affect > checksum function, just be consistent with mbuf meta > information description. > > Fixes: 8c8b61234ffd ("net/hinic: refactor checksum functions") > Cc: stable@dpdk.org > Signed-off-by: Xiaoyun wang > --- > drivers/net/hinic/hinic_pmd_tx.c | 25 ++++++++++++------------- > 1 file changed, 12 insertions(+), 13 deletions(-) > > diff --git a/drivers/net/hinic/hinic_pmd_tx.c b/drivers/net/hinic/hinic_pmd_tx.c > index 2dd4fe1..125627e 100644 > --- a/drivers/net/hinic/hinic_pmd_tx.c > +++ b/drivers/net/hinic/hinic_pmd_tx.c > @@ -779,26 +779,25 @@ static inline void hinic_analyze_tx_info(struct rte_mbuf *mbuf, > { > struct rte_ether_hdr *eth_hdr; > struct rte_vlan_hdr *vlan_hdr; > - struct rte_ipv4_hdr *ip4h; > - u16 pkt_type; > - u8 *hdr; > + struct rte_ipv4_hdr *ipv4_hdr; > + u16 eth_type; > > - hdr = (u8 *)rte_pktmbuf_mtod(mbuf, u8*); > - eth_hdr = (struct rte_ether_hdr *)hdr; > - pkt_type = rte_be_to_cpu_16(eth_hdr->ether_type); > + eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); > + eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); > > - if (pkt_type == RTE_ETHER_TYPE_VLAN) { > + if (eth_type == RTE_ETHER_TYPE_VLAN) { > off_info->outer_l2_len = ETHER_LEN_WITH_VLAN; > - vlan_hdr = (struct rte_vlan_hdr *)(hdr + 1); > - pkt_type = rte_be_to_cpu_16(vlan_hdr->eth_proto); > + vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); > + eth_type = rte_be_to_cpu_16(vlan_hdr->eth_proto); > } else { > off_info->outer_l2_len = ETHER_LEN_NO_VLAN; > } > > - if (pkt_type == RTE_ETHER_TYPE_IPV4) { > - ip4h = (struct rte_ipv4_hdr *)(hdr + off_info->outer_l2_len); > - off_info->outer_l3_len = rte_ipv4_hdr_len(ip4h); > - } else if (pkt_type == RTE_ETHER_TYPE_IPV6) { > + if (eth_type == RTE_ETHER_TYPE_IPV4) { > + ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf, struct rte_ipv4_hdr *, > + off_info->outer_l2_len); > + off_info->outer_l3_len = rte_ipv4_hdr_len(ipv4_hdr); > + } else if (eth_type == RTE_ETHER_TYPE_IPV6) { > /* not support ipv6 extension header */ > off_info->outer_l3_len = sizeof(struct rte_ipv6_hdr); > } > The actual fix is following [1] and rest is refactoring, right? It is hard to catch the actual fix with refactoring, can you please describe the actual problem and fix in the commit log to clarify it? [1] @@ -789,7 +789,7 @@ static inline void hinic_analyze_tx_info(struct rte_mbuf *mbuf, if (pkt_type == RTE_ETHER_TYPE_VLAN) { off_info->outer_l2_len = ETHER_LEN_WITH_VLAN; - vlan_hdr = (struct rte_vlan_hdr *)(hdr + 1); + vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); pkt_type = rte_be_to_cpu_16(vlan_hdr->eth_proto); } else { off_info->outer_l2_len = ETHER_LEN_NO_VLAN;