From: Rasesh Mody <rasesh.mody@cavium.com>
To: <dev@dpdk.org>
Cc: Harish Patil <harish.patil@qlogic.com>, <Dept-EngDPDKDev@cavium.com>
Subject: [dpdk-dev] [PATCH 04/11] net/qede: fix coverity detected defects
Date: Tue, 25 Apr 2017 00:28:39 -0700 [thread overview]
Message-ID: <1493105326-31984-4-git-send-email-rasesh.mody@cavium.com> (raw)
In-Reply-To: <1493105326-31984-1-git-send-email-rasesh.mody@cavium.com>
From: Harish Patil <harish.patil@qlogic.com>
This defect is a functional issue where the RX CQE pointer remains
uninitialized in the LRO code path which can cause null pointer exception
while accessing VLAN or RSS hash value from CQE.
Fixes: 29540be7efce ("net/qede: support LRO/TSO offloads")
Coverity issue: 143474
Signed-off-by: Harish Patil <harish.patil@qlogic.com>
---
drivers/net/qede/qede_rxtx.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index ec045b0..b180c0b 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -991,6 +991,7 @@ static inline uint32_t qede_rx_cqe_to_tunn_pkt_type(uint16_t flags)
uint8_t bitfield_val;
uint8_t offset, tpa_agg_idx, flags;
struct qede_agg_info *tpa_info;
+ uint32_t rss_hash;
hw_comp_cons = rte_le_to_cpu_16(*rxq->hw_cons_ptr);
sw_comp_cons = ecore_chain_get_cons_idx(&rxq->rx_comp_ring);
@@ -1005,6 +1006,7 @@ static inline uint32_t qede_rx_cqe_to_tunn_pkt_type(uint16_t flags)
packet_type = RTE_PTYPE_UNKNOWN;
vlan_tci = 0;
tpa_start_flg = false;
+ rss_hash = 0;
/* Get the CQE from the completion ring */
cqe =
@@ -1068,6 +1070,10 @@ static inline uint32_t qede_rx_cqe_to_tunn_pkt_type(uint16_t flags)
offset = fp_cqe->placement_offset;
len = rte_le_to_cpu_16(fp_cqe->len_on_first_bd);
pkt_len = rte_le_to_cpu_16(fp_cqe->pkt_len);
+ vlan_tci = rte_le_to_cpu_16(fp_cqe->vlan_tag);
+ rss_hash = rte_le_to_cpu_32(fp_cqe->rss_hash);
+ htype = (uint8_t)GET_FIELD(bitfield_val,
+ ETH_FAST_PATH_RX_REG_CQE_RSS_HASH_TYPE);
} else {
parse_flag =
rte_le_to_cpu_16(cqe_start_tpa->pars_flags.flags);
@@ -1075,6 +1081,10 @@ static inline uint32_t qede_rx_cqe_to_tunn_pkt_type(uint16_t flags)
offset = cqe_start_tpa->placement_offset;
/* seg_len = len_on_first_bd */
len = rte_le_to_cpu_16(cqe_start_tpa->len_on_first_bd);
+ vlan_tci = rte_le_to_cpu_16(cqe_start_tpa->vlan_tag);
+ htype = (uint8_t)GET_FIELD(bitfield_val,
+ ETH_FAST_PATH_RX_TPA_START_CQE_RSS_HASH_TYPE);
+ rss_hash = rte_le_to_cpu_32(cqe_start_tpa->rss_hash);
}
if (qede_tunn_exist(parse_flag)) {
PMD_RX_LOG(INFO, rxq, "Rx tunneled packet\n");
@@ -1121,24 +1131,18 @@ static inline uint32_t qede_rx_cqe_to_tunn_pkt_type(uint16_t flags)
}
if (CQE_HAS_VLAN(parse_flag)) {
- vlan_tci = rte_le_to_cpu_16(fp_cqe->vlan_tag);
ol_flags |= PKT_RX_VLAN_PKT;
+ rx_mb->vlan_tci = vlan_tci;
}
-
if (CQE_HAS_OUTER_VLAN(parse_flag)) {
- vlan_tci = rte_le_to_cpu_16(fp_cqe->vlan_tag);
ol_flags |= PKT_RX_QINQ_PKT;
+ rx_mb->vlan_tci = vlan_tci;
rx_mb->vlan_tci_outer = 0;
}
-
/* RSS Hash */
- htype = (uint8_t)GET_FIELD(bitfield_val,
- ETH_FAST_PATH_RX_REG_CQE_RSS_HASH_TYPE);
- if (qdev->rss_enable && htype) {
+ if (qdev->rss_enable) {
ol_flags |= PKT_RX_RSS_HASH;
- rx_mb->hash.rss = rte_le_to_cpu_32(fp_cqe->rss_hash);
- PMD_RX_LOG(INFO, rxq, "Hash result 0x%x\n",
- rx_mb->hash.rss);
+ rx_mb->hash.rss = rss_hash;
}
if (unlikely(qede_alloc_rx_buffer(rxq) != 0)) {
@@ -1185,10 +1189,12 @@ static inline uint32_t qede_rx_cqe_to_tunn_pkt_type(uint16_t flags)
rx_mb->port = rxq->port_id;
rx_mb->ol_flags = ol_flags;
rx_mb->data_len = len;
- rx_mb->vlan_tci = vlan_tci;
rx_mb->packet_type = packet_type;
- PMD_RX_LOG(INFO, rxq, "pkt_type %04x len %04x flags %04lx\n",
- packet_type, len, (unsigned long)ol_flags);
+ PMD_RX_LOG(INFO, rxq,
+ "pkt_type 0x%04x len %u hash_type %d hash_val 0x%x"
+ " ol_flags 0x%04lx\n",
+ packet_type, len, htype, rx_mb->hash.rss,
+ (unsigned long)ol_flags);
if (!tpa_start_flg) {
rx_mb->nb_segs = fp_cqe->bd_num;
rx_mb->pkt_len = pkt_len;
--
1.7.10.3
next prev parent reply other threads:[~2017-04-25 7:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-25 7:28 [dpdk-dev] [PATCH 01/11] net/qede: fix default MAC address handling Rasesh Mody
2017-04-25 7:28 ` [dpdk-dev] [PATCH 02/11] net/qede: fix reset of fastpath rings after port stop Rasesh Mody
2017-04-25 7:28 ` [dpdk-dev] [PATCH 03/11] net/qede: fix LRO handling issue Rasesh Mody
2017-04-25 7:28 ` Rasesh Mody [this message]
2017-04-25 7:28 ` [dpdk-dev] [PATCH 05/11] net/qede: use new stripped VLAN mbuf flags Rasesh Mody
2017-04-25 7:28 ` [dpdk-dev] [PATCH 06/11] net/qede: remove IPV4/IPV6 as valid ntuple flows Rasesh Mody
2017-04-25 7:28 ` [dpdk-dev] [PATCH 07/11] net/qede: fix FW version string display for SRIOV Rasesh Mody
2017-04-25 7:28 ` [dpdk-dev] [PATCH 08/11] net/qede/base: fix coverity issues Rasesh Mody
2017-04-25 7:28 ` [dpdk-dev] [PATCH 09/11] net/qede/base: fix macro ecore mfw set field Rasesh Mody
2017-04-25 7:28 ` [dpdk-dev] [PATCH 10/11] net/qede/base: fix find zero bit macro Rasesh Mody
2017-04-25 7:28 ` [dpdk-dev] [PATCH 11/11] net/qede: fix to limit CFLAGS to base files Rasesh Mody
2017-05-02 6:15 ` [dpdk-dev] [dpdk-stable] " Yuanhan Liu
2017-05-04 0:14 ` Mody, Rasesh
2017-05-04 2:11 ` Yuanhan Liu
2017-05-07 5:15 ` Mody, Rasesh
2017-04-26 8:15 ` [dpdk-dev] [dpdk-stable] [PATCH 01/11] net/qede: fix default MAC address handling 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=1493105326-31984-4-git-send-email-rasesh.mody@cavium.com \
--to=rasesh.mody@cavium.com \
--cc=Dept-EngDPDKDev@cavium.com \
--cc=dev@dpdk.org \
--cc=harish.patil@qlogic.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).