From: xiangxia.m.yue@gmail.com
To: dev@dpdk.org
Cc: Tonghao Zhang <xiangxia.m.yue@gmail.com>, Ori Kam <orika@mellanox.com>
Subject: [dpdk-dev] [PATCH dpdk-dev 1/3] net/mlx5: avoid crash when setting hairpin queues
Date: Wed, 27 Nov 2019 22:18:41 +0800 [thread overview]
Message-ID: <1574864323-85580-1-git-send-email-xiangxia.m.yue@gmail.com> (raw)
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
If configuring the number of tx/rx queue with rte_eth_dev_configure
to nr_queues + hairpin_nr_queues, and setting tx/rx queues to
nr_queues with rte_eth_tx/rx_queue_setup. But not configuring the
hairpin queues via rte_eth_tx/rx_hairpin_queue_setup.
When starting the netdev, there is a crash because of NULL accessing.
Fixes: cf5516696d77 ("ethdev: add hairpin queue")
Cc: Ori Kam <orika@mellanox.com>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
drivers/net/mlx5/mlx5_ethdev.c | 2 +-
drivers/net/mlx5/mlx5_trigger.c | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 1d6c084119ec..0076d05b00cc 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -476,7 +476,7 @@ mlx5_dev_configure_rss_reta(struct rte_eth_dev *dev)
rxq_data = (*priv->rxqs)[i];
rxq_ctrl = container_of(rxq_data, struct mlx5_rxq_ctrl, rxq);
- if (rxq_ctrl->type == MLX5_RXQ_TYPE_STANDARD)
+ if (rxq_ctrl && rxq_ctrl->type == MLX5_RXQ_TYPE_STANDARD)
rss_queue_arr[j++] = i;
}
rss_queue_n = j;
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index cafab25c67e7..ab6937ab10d1 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -106,9 +106,12 @@ mlx5_rxq_start(struct rte_eth_dev *dev)
unsigned int i;
int ret = 0;
enum mlx5_rxq_obj_type obj_type = MLX5_RXQ_OBJ_TYPE_IBV;
+ struct mlx5_rxq_data *rxq = NULL;
for (i = 0; i < priv->rxqs_n; ++i) {
- if ((*priv->rxqs)[i]->lro) {
+ rxq = (*priv->rxqs)[i];
+
+ if (rxq && rxq->lro) {
obj_type = MLX5_RXQ_OBJ_TYPE_DEVX_RQ;
break;
}
--
2.23.0
next reply other threads:[~2019-11-27 14:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-27 14:18 xiangxia.m.yue [this message]
2019-11-27 14:18 ` [dpdk-dev] [PATCH dpdk-dev 2/3] net/mlx5: clean up redundant assignment xiangxia.m.yue
2019-11-27 14:51 ` Ori Kam
2019-12-15 8:55 ` Raslan Darawsheh
2019-11-27 14:18 ` [dpdk-dev] [PATCH dpdk-dev 3/3] net/mlx5: remove the assert for rxq cq xiangxia.m.yue
2019-11-27 14:52 ` Ori Kam
2019-11-28 1:18 ` Tonghao Zhang
2019-11-27 14:50 ` [dpdk-dev] [PATCH dpdk-dev 1/3] net/mlx5: avoid crash when setting hairpin queues Ori Kam
2019-12-15 8:54 ` Raslan Darawsheh
2019-12-15 9:02 ` Raslan Darawsheh
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=1574864323-85580-1-git-send-email-xiangxia.m.yue@gmail.com \
--to=xiangxia.m.yue@gmail.com \
--cc=dev@dpdk.org \
--cc=orika@mellanox.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).