From patchwork Tue May 24 08:42:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harman Kalra X-Patchwork-Id: 111712 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 06FD4A04FF; Tue, 24 May 2022 10:43:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6FF154280B; Tue, 24 May 2022 10:43:03 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 77F124280B for ; Tue, 24 May 2022 10:43:01 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24NNBSVl022568 for ; Tue, 24 May 2022 01:43:00 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=jOy7EubK7vNenOa6roLFVdCH4P87nvUoC7Ok1WOMyCo=; b=HWvZ7hXzmsAppB19geZexvS+wMRZepNKwJj5wd7KiIuU6fj5OmvKidI/7U+oz2g8q4lh fKFF5tbEE5NDQ8sNrkqLyonDSrcNSpFDl/tIhVKPfj8uftdklTNk9Br7Q5wjGmxDxE6U KS82GDjMaCimFtMd9k3QDkqbg3icH4kYe0AairTosqX5vLeav5pl3WNNmZ0B+Wqj347h 6UMIWRMx0qVBqvNLymxkL7GT9e8QgJ2GPRZEVM3xH+gOxQsq6R3HNHrvzijfIjoU9iI1 gruHYDkNKtaSZIbWDUkNVsHdT1nfrD5hOfaMclwbWOCI1ceE3/lue62AiBqtnW+M0uWz ew== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3g8kqjhrtr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 24 May 2022 01:43:00 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 24 May 2022 01:42:58 -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.18 via Frontend Transport; Tue, 24 May 2022 01:42:59 -0700 Received: from localhost.localdomain (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id E3CB13F709B; Tue, 24 May 2022 01:42:57 -0700 (PDT) From: Harman Kalra To: , Harman Kalra Subject: [PATCH v3 04/11] net/octeontx: handle port reconfiguration Date: Tue, 24 May 2022 14:12:28 +0530 Message-ID: <20220524084235.17796-4-hkalra@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220524084235.17796-1-hkalra@marvell.com> References: <20220517173941.189330-2-hkalra@marvell.com> <20220524084235.17796-1-hkalra@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: pwZX92FdXzyAjUsJoSC84ofZlGFhk2U5 X-Proofpoint-GUID: pwZX92FdXzyAjUsJoSC84ofZlGFhk2U5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-24_06,2022-05-23_01,2022-02-23_01 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 Adding support for port reconfiguration as user may require to do so on a running system. Signed-off-by: Harman Kalra --- drivers/net/octeontx/octeontx_ethdev.c | 38 +++++++++++++++----------- drivers/net/octeontx/octeontx_ethdev.h | 1 + 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 9b13e22089..9351fcb5c7 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -518,30 +518,34 @@ octeontx_dev_configure(struct rte_eth_dev *dev) nic->num_tx_queues = dev->data->nb_tx_queues; - ret = octeontx_pko_channel_open(nic->pko_vfid * PKO_VF_NUM_DQ, - nic->num_tx_queues, - nic->base_ochan); - if (ret) { - octeontx_log_err("failed to open channel %d no-of-txq %d", - nic->base_ochan, nic->num_tx_queues); - return -EFAULT; - } + if (!nic->reconfigure) { + ret = octeontx_pko_channel_open(nic->pko_vfid * PKO_VF_NUM_DQ, + nic->num_tx_queues, + nic->base_ochan); + if (ret) { + octeontx_log_err("failed to open channel %d no-of-txq %d", + nic->base_ochan, nic->num_tx_queues); + return -EFAULT; + } - ret = octeontx_dev_vlan_offload_init(dev); - if (ret) { - octeontx_log_err("failed to initialize vlan offload"); - return -EFAULT; - } + ret = octeontx_dev_vlan_offload_init(dev); + if (ret) { + octeontx_log_err("failed to initialize vlan offload"); + return -EFAULT; + } - nic->pki.classifier_enable = false; - nic->pki.hash_enable = true; - nic->pki.initialized = false; + nic->pki.classifier_enable = false; + nic->pki.hash_enable = true; + nic->pki.initialized = false; + } nic->rx_offloads |= rxmode->offloads; nic->tx_offloads |= txmode->offloads; nic->rx_offload_flags |= octeontx_rx_offload_flags(dev); nic->tx_offload_flags |= octeontx_tx_offload_flags(dev); + nic->reconfigure = true; + return 0; } @@ -583,6 +587,7 @@ octeontx_dev_close(struct rte_eth_dev *dev) } octeontx_port_close(nic); + nic->reconfigure = false; return 0; } @@ -1431,6 +1436,7 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev, nic->ev_queues = 1; nic->ev_ports = 1; nic->print_flag = -1; + nic->reconfigure = false; data->dev_link.link_status = RTE_ETH_LINK_DOWN; data->dev_started = 0; diff --git a/drivers/net/octeontx/octeontx_ethdev.h b/drivers/net/octeontx/octeontx_ethdev.h index c493fa7a03..7e04faddb8 100644 --- a/drivers/net/octeontx/octeontx_ethdev.h +++ b/drivers/net/octeontx/octeontx_ethdev.h @@ -144,6 +144,7 @@ struct octeontx_nic { struct octeontx_vlan_info vlan_info; int print_flag; struct octeontx_fc_info fc; + bool reconfigure; } __rte_cache_aligned; struct octeontx_txq {