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 1E17FA00C3 for ; Thu, 14 May 2020 06:09:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 038041D672; Thu, 14 May 2020 06:09:48 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id A12451D647; Thu, 14 May 2020 06:09:44 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04E3xX1u032445; Wed, 13 May 2020 21:09:43 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=TkfapuEcTUPwhErHcONtBrTi+MPRqKdvM7SQ6TJuyf4=; b=SIxyyM14bkt98L9HbF3Lvv+eqekpP7oyUHISLLE/ohPWebA1LUVrbyeWp9K1M0+HdzkE flu8zCnpQRrPGaBMaEbRSVywxptJe/IgCUJJYkgnr+amQYRu+Iy2E3mFjzlRVRCN6brM W9R7ubQx3lfCtBsC8kFoqpatrRUDhcft0h/n6Oz1l07T/b8tFZVY4x5nXp9I4FXZ3ubR GmaP7k4O92P7aEvlVPV5PjIMBT7MwhLRG9mGoPoavXgo2Ih4Qt6yfrVtbgfD3LIyoGzh SJFiZ8Av09K7B2BNIcEGI0KExy7Hr7ZFRfRG88bxvQrKmQD7UIL3HAvCBTJ2QnckQBfr RA== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3100xageqc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 13 May 2020 21:09:43 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 13 May 2020 21:09:42 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 13 May 2020 21:09:41 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 13 May 2020 21:09:41 -0700 Received: from irv1user08.caveonetworks.com (unknown [10.104.116.105]) by maili.marvell.com (Postfix) with ESMTP id 667BD3F7040; Wed, 13 May 2020 21:09:41 -0700 (PDT) Received: (from rmody@localhost) by irv1user08.caveonetworks.com (8.14.4/8.14.4/Submit) id 04E49fB0025569; Wed, 13 May 2020 21:09:41 -0700 X-Authentication-Warning: irv1user08.caveonetworks.com: rmody set sender to rmody@marvell.com using -f From: Rasesh Mody To: , , CC: Rasesh Mody , , Date: Wed, 13 May 2020 21:09:38 -0700 Message-ID: <20200514040938.25505-2-rmody@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200505030943.1091-1-rmody@marvell.com> References: <20200505030943.1091-1-rmody@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.676 definitions=2020-05-13_09:2020-05-13, 2020-05-13 signatures=0 Subject: [dpdk-stable] [PATCH v2 2/2] examples/kni: fix MTU change to setup Tx queue X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" This patch adds a fix to setup Tx queue when changing KNI interface MTU. It ensures device can safely start txq post MTU change operation. Fixes: fc9ee41b7016 ("examples/kni: convert to new ethdev offloads API") Cc: stable@dpdk.org Signed-off-by: Rasesh Mody --- examples/kni/main.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/examples/kni/main.c b/examples/kni/main.c index 6b4ab3b5b..7a927a50c 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -774,9 +774,11 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu) { int ret; uint16_t nb_rxd = NB_RXD; + uint16_t nb_txd = NB_TXD; struct rte_eth_conf conf; struct rte_eth_dev_info dev_info; struct rte_eth_rxconf rxq_conf; + struct rte_eth_txconf txq_conf; if (!rte_eth_dev_is_valid_port(port_id)) { RTE_LOG(ERR, APP, "Invalid port id %d\n", port_id); @@ -804,7 +806,7 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu) return ret; } - ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, NULL); + ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, &nb_txd); if (ret < 0) rte_exit(EXIT_FAILURE, "Could not adjust number of descriptors " "for port%u (%d)\n", (unsigned int)port_id, @@ -829,6 +831,16 @@ kni_change_mtu(uint16_t port_id, unsigned int new_mtu) return ret; } + txq_conf = dev_info.default_txconf; + txq_conf.offloads = conf.txmode.offloads; + ret = rte_eth_tx_queue_setup(port_id, 0, nb_txd, + rte_eth_dev_socket_id(port_id), &txq_conf); + if (ret < 0) { + RTE_LOG(ERR, APP, "Fail to setup Tx queue of port %d\n", + port_id); + return ret; + } + /* Restart specific port */ ret = rte_eth_dev_start(port_id); if (ret < 0) { -- 2.18.0