From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8C84745537; Sun, 30 Jun 2024 14:45:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5FDD5410F2; Sun, 30 Jun 2024 14:45:32 +0200 (CEST) Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) by mails.dpdk.org (Postfix) with ESMTP id 90256411F3 for ; Fri, 28 Jun 2024 18:36:17 +0200 (CEST) Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-57d1782679fso1170053a12.0 for ; Fri, 28 Jun 2024 09:36:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netgate.com; s=google; t=1719592577; x=1720197377; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=B+WC5JF6v+2f+Wql2/imhYYhzRFjl1b/VENRhujuU1o=; b=Cz8LKfeLA9uORVQqjoU/1s8EmM4PA0S9he3B38HT93wc/7raFw69ZVLtMiH7bwSKcn mhGrS0/x1G+WrV4iJMPvZslRHQrV9O+fIZ3DE+swVyNW0JzVN0Mw1uilzL2A/P+yPoze 71DSgsHxHl81JhOp11+g3dt9KSo3BZqYuggA4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719592577; x=1720197377; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=B+WC5JF6v+2f+Wql2/imhYYhzRFjl1b/VENRhujuU1o=; b=Y2kDLnnVla+T4hnls+lJbUgjM5Q1XECNuK9Jbytzc2t9ijsexBw8yDQBOaBVLyW4po d4WiP6oq8YgOCmW9n0xloHDW6znuo1+B0bgkOzp8gmpKeNROAzNvOrtjF8OyVzAwEhfK tTV7RozZ4qWOlfp6yTlvsWDfgCKKRUNtmTlcUWmssQHRNaf0iTHyoN0e+fCyw/MJBaQz QDD8brHbx0bPw543DZwSIsPn4TIGffKYwyAxXcvXV/hJWpn4ExTikVbSt49jq4DKRF9c Tv1k4ZvbNqUB81NcbCksaHuP8Tqa2TcJL+MP1ppQ+CUo1B4NtR4yet8jvQlBjTRG72ZP vcVg== X-Forwarded-Encrypted: i=1; AJvYcCXh95egIrS1/nnl4hVtd1oBOP7ucQ85nsFXgKfHXXBqUYNMi6gEzHc4uHKuBPjuwfP8atsxHZjA79hIeAk= X-Gm-Message-State: AOJu0YwQqjjt4au/sRWA+nAHc+Rjyqx3WPTfW+Cu2/XPKIKSYod61k+F 97Cs0rBoQ8CutsvAm3SpGv5IKsIHq++sdjyPDt73ldw9wLiR+wZoz4B9HNvlZQ== X-Google-Smtp-Source: AGHT+IEAoucejglzk07+9/8Z2WyiUhJCYjZ9mzKbnAw7/Fiiv/PZN+dPFwOIdvxD9z9WsJ5ObKJhtw== X-Received: by 2002:a50:c303:0:b0:57c:6861:d72b with SMTP id 4fb4d7f45d1cf-57d4bd56331mr11088127a12.9.1719592577055; Fri, 28 Jun 2024 09:36:17 -0700 (PDT) Received: from book2.local ([87.116.166.73]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-58612c83529sm1237552a12.6.2024.06.28.09.36.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 09:36:16 -0700 (PDT) From: Alexander Skorichenko To: samandrew@microsoft.com, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru Cc: longli@microsoft.com, weh@microsoft.com, dev@dpdk.org, Alexander Skorichenko Subject: [PATCH] net/netvsc: fix mtu_set in netvsc devices Date: Fri, 28 Jun 2024 18:35:03 +0200 Message-Id: <20240628163503.15893-1-askorichenko@netgate.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sun, 30 Jun 2024 14:45:29 +0200 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Prevent segfault in hn_reinit() caused by changing the MTU for an incompletely initialized device. Signed-off-by: Alexander Skorichenko --- drivers/net/netvsc/hn_ethdev.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index b8a32832d7..f8cb05a118 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -1127,8 +1127,10 @@ hn_reinit(struct rte_eth_dev *dev, uint16_t mtu) int i, ret = 0; /* Point primary queues at new primary channel */ - rxqs[0]->chan = hv->channels[0]; - txqs[0]->chan = hv->channels[0]; + if (rxqs[0]) { + rxqs[0]->chan = hv->channels[0]; + txqs[0]->chan = hv->channels[0]; + } ret = hn_attach(hv, mtu); if (ret) @@ -1140,10 +1142,12 @@ hn_reinit(struct rte_eth_dev *dev, uint16_t mtu) return ret; /* Point any additional queues at new subchannels */ - for (i = 1; i < dev->data->nb_rx_queues; i++) - rxqs[i]->chan = hv->channels[i]; - for (i = 1; i < dev->data->nb_tx_queues; i++) - txqs[i]->chan = hv->channels[i]; + if (rxqs[0]) { + for (i = 1; i < dev->data->nb_rx_queues; i++) + rxqs[i]->chan = hv->channels[i]; + for (i = 1; i < dev->data->nb_tx_queues; i++) + txqs[i]->chan = hv->channels[i]; + } return ret; } -- 2.34.1