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 96CB3A0559; Tue, 17 Mar 2020 10:25:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E0F981C0B9; Tue, 17 Mar 2020 10:24:27 +0100 (CET) Received: from incedge.chinasoftinc.com (unknown [114.113.233.8]) by dpdk.org (Postfix) with ESMTP id E8FA31C0AB for ; Tue, 17 Mar 2020 10:24:21 +0100 (CET) X-ASG-Debug-ID: 1584436944-0a3dd134b0001f0006-TfluYd Received: from mail.chinasoftinc.com (inccas001.ito.icss [10.168.0.51]) by incedge.chinasoftinc.com with ESMTP id rqg34nVvkMcTX0h3 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 17 Mar 2020 17:23:03 +0800 (CST) X-Barracuda-Envelope-From: huwei013@chinasoftinc.com X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.51 X-ASG-Whitelist: Client Received: from localhost.localdomain (114.119.4.74) by INCCAS001.ito.icss (10.168.0.60) with Microsoft SMTP Server id 14.3.487.0; Tue, 17 Mar 2020 17:13:13 +0800 From: "Wei Hu (Xavier)" X-Barracuda-RBL-Trusted-Forwarder: 10.168.0.60 To: Date: Tue, 17 Mar 2020 17:12:02 +0800 X-ASG-Orig-Subj: [PATCH 3/7] net/hns3: fix packets's offload features flags in Rx Message-ID: <20200317091206.34928-4-huwei013@chinasoftinc.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200317091206.34928-1-huwei013@chinasoftinc.com> References: <20200317091206.34928-1-huwei013@chinasoftinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [114.119.4.74] X-Barracuda-Connect: inccas001.ito.icss[10.168.0.51] X-Barracuda-Start-Time: 1584436983 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://incspam.chinasofti.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at chinasoftinc.com X-Barracuda-Scan-Msg-Size: 2557 Subject: [dpdk-dev] [PATCH 3/7] net/hns3: fix packets's offload features flags in Rx 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" From: Chengwen Feng Currently there is a certain probability of the unexpected ol_flag of the Rx packets's rte_mbuf when receiving packets. The root cause as below: 1. The member variable named ol_flag of the structure named rte_mbuf is not properly initialized to zero in the '.rx_pkt_burst' ops implementation function named hns3_recv_pkts. 2. When multi-segment rte_mbufs are needed for long packet in Rx operation, the driver should assign value to the ol_flag of the first segment, not to the ol_flag of the last segment. This patch fixes it with the following modification in the '.rx_pkt_burst' ops implementation function named hns3_recv_pkts. 1. Where the first write operation in the '.rx_pkt_burst' ops implementation function, assign PKT_RX_RSS_HASH to ol_flags directly using '=' operation instead of '|=' operation. 2. In the static function named hns3_rx_set_cksum_flag, the last rte_mbuf's ol_flags should be assigned when processing multi-segment. We fix it by passing first_seg variable to the function instead of rxm(the last segment's address). Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") Fixes: ad7cf94823e8 ("net/hns3: fix offload flag for RSS hash") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_rxtx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index ec6d19f58..0c965b1b8 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -1582,7 +1582,7 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) first_seg->pkt_len = pkt_len; first_seg->port = rxq->port_id; first_seg->hash.rss = rte_le_to_cpu_32(rxd.rx.rss_hash); - first_seg->ol_flags |= PKT_RX_RSS_HASH; + first_seg->ol_flags = PKT_RX_RSS_HASH; if (unlikely(hns3_get_bit(bd_base_info, HNS3_RXD_LUM_B))) { first_seg->hash.fdir.hi = rte_le_to_cpu_32(rxd.rx.fd_id); @@ -1599,7 +1599,8 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) ol_info); if (bd_base_info & BIT(HNS3_RXD_L3L4P_B)) - hns3_rx_set_cksum_flag(rxm, first_seg->packet_type, + hns3_rx_set_cksum_flag(first_seg, + first_seg->packet_type, cksum_err); first_seg->vlan_tci = rte_le_to_cpu_16(rxd.rx.vlan_tag); -- 2.23.0