From patchwork Tue Jan 24 11:40:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chava Leviatan X-Patchwork-Id: 1731113 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=marvell.com header.i=@marvell.com header.a=rsa-sha256 header.s=pfpt0220 header.b=UEvBxA9V; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P1Qqx419Jz23hB for ; Tue, 24 Jan 2023 23:14:05 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5872F40C1D; Tue, 24 Jan 2023 12:14:03 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5872F40C1D Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=marvell.com header.i=@marvell.com header.a=rsa-sha256 header.s=pfpt0220 header.b=UEvBxA9V X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4UuUUuXSGt1d; Tue, 24 Jan 2023 12:14:02 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 8044A4051F; Tue, 24 Jan 2023 12:14:01 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 8044A4051F Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 53FCCC0032; Tue, 24 Jan 2023 12:14:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4AB9FC002D for ; Tue, 24 Jan 2023 12:13:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 15AAE60C16 for ; Tue, 24 Jan 2023 12:13:59 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 15AAE60C16 Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.a=rsa-sha256 header.s=pfpt0220 header.b=UEvBxA9V X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j3G_niybwmgr for ; Tue, 24 Jan 2023 12:13:58 +0000 (UTC) X-Greylist: delayed 00:33:26 by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 38D1160C0E Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by smtp3.osuosl.org (Postfix) with ESMTPS id 38D1160C0E for ; Tue, 24 Jan 2023 12:13:58 +0000 (UTC) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30OBP1cr006218 for ; Tue, 24 Jan 2023 03:40:31 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0220; bh=hBtq2L6KmpuQn0LDHh8ys3pGm8dUAQFLpJYgKd/SkL0=; b=UEvBxA9VmlA2kZTmvFuWPLakf4lms/3S0lIkrQZSMLJAwIJVdSlk7qTUJIoH2XCtezZH hG8rGsFasF+IIMsWi+TT4zAnjlOuKr6KxvGdgAus0NQsmEcGKcEAUBP9B6+osKwScXOP MwWPQSKWENR8N4cRkwLO5KJn8xDcfQ7Rt1ekpBtkCbt/7Yy41tJWt6yRYIrblKQmIqFu +W2VidJSpc/rQBZr3TPuycJAGLtVJ+TKRFgvFZPaqMeTdrDwlo4XvEPazruH3IhCS+AY 9ulp2IldU0W8R7f5wga8BfvTWOWkmUtKvg2OgvB32yzMWv6RoSP3EoPVBGns6IJxmoJu cg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3n8gerfsf7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 24 Jan 2023 03:40:31 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 24 Jan 2023 03:40:28 -0800 Received: from pt-dtl3992.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Tue, 24 Jan 2023 03:40:28 -0800 From: To: Date: Tue, 24 Jan 2023 13:40:23 +0200 Message-ID: <20230124114023.16860-1-cleviatan@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Proofpoint-GUID: 2OU18qr1bp1DSUvCQiPZVdXEHLUdviZb X-Proofpoint-ORIG-GUID: 2OU18qr1bp1DSUvCQiPZVdXEHLUdviZb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-24_01,2022-06-22_01 Subject: [ovs-dev] [PATCH] netdev-dpdk: config tx queue number to be the minimum between device and ovs request X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Chava Leviatan Tx queue are set each time port is added/removed or the cmask changes by reconfigure_datapath. The amount of TX queues is set according to PMD thread and does not take into consideration the device capabilities . As a result , when transmitting packet from OVS to device driver by rte_eth_tx_burst , the device driver is called with dev->data->tx_queues[queue_id] which is not a legal address , hence can cause a crash . This patch suggests to set the tx queue as a minimum between the device capability and the PMD thread number as requested by reconfigure_datapath. The patch was tested on Marvell setup include DPU running OVS-dpdk , and Marvell DPDK Octeontx2 driver. DPU is bind to a host through PCI . Traffic is sent from associated host (VF) and remote host . Fixes: 050c60bfb5b4 ("netdev-dpdk: Use ->reconfigure() call to change rx/tx queues.") Reviewed-by: Liron Himi lironh@marvell.com Signed-off-by: Chava Leviatan --- lib/netdev-dpdk.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index ab5b8223e..278da12d4 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -508,6 +508,7 @@ struct netdev_dpdk { int requested_n_rxq; int requested_rxq_size; int requested_txq_size; + int device_n_txq; /* Number of rx/tx descriptors for physical devices */ int rxq_size; @@ -1124,6 +1125,7 @@ dpdk_eth_dev_port_config(struct netdev_dpdk *dev, int n_rxq, int n_txq) dev->up.n_rxq = n_rxq; dev->up.n_txq = n_txq; + dev->device_n_txq = n_txq; return 0; } @@ -2133,15 +2135,20 @@ netdev_dpdk_get_numa_id(const struct netdev *netdev) static int netdev_dpdk_set_tx_multiq(struct netdev *netdev, unsigned int n_txq) { + unsigned int req_n_txq; struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); ovs_mutex_lock(&dev->mutex); - if (dev->requested_n_txq == n_txq) { + req_n_txq = MIN(n_txq, dev->device_n_txq); + if (dev->requested_n_txq == req_n_txq) { goto out; } - - dev->requested_n_txq = n_txq; + if (!dev->device_n_txq) { + dev->device_n_txq = 1; + req_n_txq = 1; + } + dev->requested_n_txq = req_n_txq; netdev_request_reconfigure(netdev); out: