From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Xiaoyun wang <cloud.wangxiaoyun@huawei.com>, dev@dpdk.org
Cc: bluca@debian.org, stable@dpdk.org, luoxingyu@huawei.com,
luoxianjun@huawei.com, yin.yinshi@huawei.com,
zhouguoyang@huawei.com
Subject: Re: [dpdk-dev] [PATCH v1 1/2] net/hinic: fix outer_l3_len parse error
Date: Mon, 2 Nov 2020 17:26:41 +0000 [thread overview]
Message-ID: <446509c8-3e6b-d0c6-d8a9-90eeeab4098b@intel.com> (raw)
In-Reply-To: <f680486e-a1a2-8c71-9726-b57826fa27d3@intel.com>
On 11/2/2020 5:08 PM, Ferruh Yigit wrote:
> 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 <cloud.wangxiaoyun@huawei.com>
>> ---
>> 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;
Added following to the commit log while merging, please correct it if it is
wrong/missing:
The outer_l3_len is calculated wrong because 'vlan_hdr' is calculated
wrong, 'vlan_hdr' fixed and code refactored.
next prev parent reply other threads:[~2020-11-02 17:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-31 3:38 [dpdk-dev] [PATCH v1 0/2] fix some csum errors Xiaoyun wang
2020-10-31 3:38 ` [dpdk-dev] [PATCH v1 1/2] net/hinic: fix outer_l3_len parse error Xiaoyun wang
2020-11-02 17:08 ` Ferruh Yigit
2020-11-02 17:26 ` Ferruh Yigit [this message]
2020-11-04 2:19 ` Wangxiaoyun (Cloud)
2020-11-04 11:05 ` Ferruh Yigit
2020-10-31 3:38 ` [dpdk-dev] [PATCH v1 2/2] net/hinic: fix SCTP checksum error Xiaoyun wang
2020-11-02 17:47 ` [dpdk-dev] [PATCH v1 0/2] fix some csum errors Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=446509c8-3e6b-d0c6-d8a9-90eeeab4098b@intel.com \
--to=ferruh.yigit@intel.com \
--cc=bluca@debian.org \
--cc=cloud.wangxiaoyun@huawei.com \
--cc=dev@dpdk.org \
--cc=luoxianjun@huawei.com \
--cc=luoxingyu@huawei.com \
--cc=stable@dpdk.org \
--cc=yin.yinshi@huawei.com \
--cc=zhouguoyang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).