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 05FFBA04E0; Wed, 27 Nov 2019 15:18:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C7DB22B8E; Wed, 27 Nov 2019 15:18:54 +0100 (CET) Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by dpdk.org (Postfix) with ESMTP id 6028528EE for ; Wed, 27 Nov 2019 15:18:53 +0100 (CET) Received: by mail-pl1-f193.google.com with SMTP id g6so1453382plp.7 for ; Wed, 27 Nov 2019 06:18:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=WulthsjOX44zzy++AyqQ2ff8a7siow33/rPOQoMVJ9k=; b=rcaF/s87mWgVd1//Am/1vzG9BTD2hKWaa9OVHLsbMVqh3gK0b7b4MXXo1qxtoSDzU7 xLEkgAlhBAsWR9yb654Up+ZqK0FgshQ4BaQtgO3TlkBOgFihXlsB+xbmpnDb/FnpCSAm JBAIk9QYOdXGgWI6C1F9xXsHFM5Tc3OS/xMgyfKr0qeDK/B+dpx/ew5fzMosFsu+DMPO 6ooGJFjN4uStfOF91+o0tgT3iY9BO5Bj/kmwzxrAKpWmVvepM+2xgYwlVcqukSx51+hJ aL717kcAq3/f9IwSBUyDG6BLlI3JI/Y34xtEY10DWgb6uDdFkT0d64EeeR6uVKcz+NKD JJ9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WulthsjOX44zzy++AyqQ2ff8a7siow33/rPOQoMVJ9k=; b=EX8z9I58LkdvCEmQ5K/fYSzDrexHW0QEd6W3GCyC2eL2uhxE8xbmtSBweTv+U39j4A toF8493Mhi9XIfP3/l8Y8UDXrb53c3aNoXHEiALAnNsg4nwLoZj2sSRfTfqhN6iTZdiq 8XWuEEcMWkR3ogVE/hUcwnj/1POv8WkcnF0XxRxlb8tQYzcbXxATMEb9eo3vSuFw84Yw Pu70yyo0oBuDV8yWWxuvR8+px9qO1x2ff+v/2K/2bctjX9ZvW+h2SkkVgZQPZFQHACIq Kw5HxItr6d76zQo1QrC8wJMiv8Tr84uVcwoLO/nkNmjXydjpI5pQrJqaatlwBacGrkMG wZjw== X-Gm-Message-State: APjAAAWf8kZh1WOZquvP/OtENwaHL42ifJ/gmK2SfV+SxuWfnSOoQJZz Vc/oYjhITeJ8QHryQDF1zZie/AxA X-Google-Smtp-Source: APXvYqybx9C+lpA3XXotnIHOhCp9mFaY5ljPJar2bgVf5rOEuNUQcJH4nt7awXVAIDs9D4l2+d/f/g== X-Received: by 2002:a17:902:9b8f:: with SMTP id y15mr4139735plp.54.1574864332419; Wed, 27 Nov 2019 06:18:52 -0800 (PST) Received: from local.opencloud.tech.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id i3sm16612951pfd.154.2019.11.27.06.18.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Nov 2019 06:18:51 -0800 (PST) From: xiangxia.m.yue@gmail.com To: dev@dpdk.org Cc: Tonghao Zhang , Ori Kam Date: Wed, 27 Nov 2019 22:18:41 +0800 Message-Id: <1574864323-85580-1-git-send-email-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH dpdk-dev 1/3] net/mlx5: avoid crash when setting hairpin queues 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: Tonghao Zhang 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 Signed-off-by: Tonghao Zhang --- 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