From: Yiding Zhou <yidingx.zhou@intel.com>
To: dev@dpdk.org, jingjing.wu@intel.com, beilei.xing@intel.com
Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stable@dpdk.org,
ramamani.yeleswarapu@intel.com
Subject: [PATCH] net/iavf: fix mismatch between rx_pkt_burst and RX descriptor
Date: Sat, 7 May 2022 17:36:37 +0800 [thread overview]
Message-ID: <20220507093637.127591-1-yidingx.zhou@intel.com> (raw)
Some kernel drivers return the capability VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC
when IAVF_RXDID_COMMS_OVS_1 is not supported. This causes PMD to use
rx_pkt_burst that handles the Flex Receive Descriptor format, but actually
configures the RXDID into IAVF_RXDID_LEGACY_1, then the fields of rte_mbuf
Will be filled with wrong values in rx_pkt_burst, which will eventually
lead to coredump.
This patch fixes mismatch between rx_pkt_burst and rx descriptor.
Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")
Cc: stable@dpdk.org
Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>
---
drivers/net/iavf/iavf_rxtx.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index 345f6aeebc..69584264de 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -2908,6 +2908,18 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
bool use_avx512 = false;
bool use_flex = false;
+ if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+ use_flex = true;
+
+ for (i = 0; i < dev->data->nb_rx_queues; i++) {
+ rxq = dev->data->rx_queues[i];
+ if (rxq->rxdid <= IAVF_RXDID_LEGACY_1 ||
+ !(vf->supported_rxdid & BIT(rxq->rxdid))) {
+ use_flex = false;
+ break;
+ }
+ }
+
check_ret = iavf_rx_vec_dev_check(dev);
if (check_ret >= 0 &&
rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) {
@@ -2923,10 +2935,6 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
use_avx512 = true;
#endif
- if (vf->vf_res->vf_cap_flags &
- VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
- use_flex = true;
-
for (i = 0; i < dev->data->nb_rx_queues; i++) {
rxq = dev->data->rx_queues[i];
(void)iavf_rxq_vec_setup(rxq);
@@ -3030,7 +3038,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
if (dev->data->scattered_rx) {
PMD_DRV_LOG(DEBUG, "Using a Scattered Rx callback (port=%d).",
dev->data->port_id);
- if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+ if (use_flex)
dev->rx_pkt_burst = iavf_recv_scattered_pkts_flex_rxd;
else
dev->rx_pkt_burst = iavf_recv_scattered_pkts;
@@ -3041,7 +3049,7 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
} else {
PMD_DRV_LOG(DEBUG, "Using Basic Rx callback (port=%d).",
dev->data->port_id);
- if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC)
+ if (use_flex)
dev->rx_pkt_burst = iavf_recv_pkts_flex_rxd;
else
dev->rx_pkt_burst = iavf_recv_pkts;
--
2.25.1
next reply other threads:[~2022-05-07 1:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-07 9:36 Yiding Zhou [this message]
2022-05-07 16:15 ` [PATCH v2] " Yiding Zhou
2022-05-07 19:52 ` Yiding Zhou
2022-05-09 2:05 ` Zhang, Qi Z
2022-05-11 0:04 ` Zhang, Qi Z
2022-05-17 0:57 ` Zhang, Qi Z
-- strict thread matches above, loose matches on Subject: below --
2022-05-07 9:34 [PATCH] " Yiding Zhou
2022-05-07 2:09 ` Zhang, Qi Z
2022-05-07 4:43 ` Zhou, YidingX
2022-05-07 7:03 ` Zhang, Qi Z
2022-05-07 7:20 ` Zhou, YidingX
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=20220507093637.127591-1-yidingx.zhou@intel.com \
--to=yidingx.zhou@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
--cc=ramamani.yeleswarapu@intel.com \
--cc=stable@dpdk.org \
/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).