From patchwork Fri Sep 8 11:17:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xing, Beilei" X-Patchwork-Id: 131248 X-Patchwork-Delegate: qi.z.zhang@intel.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 0EE8F4253D; Fri, 8 Sep 2023 04:59:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2304D40A6D; Fri, 8 Sep 2023 04:58:41 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 5916740A67 for ; Fri, 8 Sep 2023 04:58:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694141918; x=1725677918; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s1jSWnDvgZz2HXnaZpny6S84ZAjR0QjuzHPmnI74SoM=; b=RaRUv1m7Z+iGXRlKI4H9o4PUbkSWCIPncvhaBBxxiBuflWATZSBIsc7P ojgjxmPJZEZRUXva3JCpEaAatyWIOBgqbTB7lhMDmADy4S9ToVyWvkfTU y6n+wkX/DyPANIg+DChGs7GtdnFT5r3cRqnw97zU4AMiTy8brhieB3kbf wSfBNC81TC0cCJdG8976yQ6b9UKnPu5aznHz8H4lRL3aTNF6IlBmAZITb zD7Pmp/MtnALzHBVbP5Ohgi/tVrYmbGj7R4ZplV7PStm5ZLXkpyMNs6oe BFV9tl8+MaTLinndbuVMFDDqLrKrkTLeL6c8nPa8cDWpKwkT3AUbLB5H6 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10826"; a="357002112" X-IronPort-AV: E=Sophos;i="6.02,236,1688454000"; d="scan'208";a="357002112" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2023 19:58:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10826"; a="807789894" X-IronPort-AV: E=Sophos;i="6.02,236,1688454000"; d="scan'208";a="807789894" Received: from dpdk-beileix-icelake.sh.intel.com ([10.67.116.248]) by fmsmga008.fm.intel.com with ESMTP; 07 Sep 2023 19:58:35 -0700 From: beilei.xing@intel.com To: jingjing.wu@intel.com Cc: dev@dpdk.org, mingxia.liu@intel.com, Beilei Xing Subject: [PATCH v4 10/10] net/cpfl: support link update for representor Date: Fri, 8 Sep 2023 11:17:01 +0000 Message-Id: <20230908111701.1022724-11-beilei.xing@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230908111701.1022724-1-beilei.xing@intel.com> References: <20230907151606.849612-1-beilei.xing@intel.com> <20230908111701.1022724-1-beilei.xing@intel.com> MIME-Version: 1.0 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 From: Beilei Xing Add link update ops for representor. Signed-off-by: Jingjing Wu Signed-off-by: Beilei Xing --- drivers/net/cpfl/cpfl_ethdev.h | 1 + drivers/net/cpfl/cpfl_representor.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/net/cpfl/cpfl_ethdev.h b/drivers/net/cpfl/cpfl_ethdev.h index 4937d2c6e3..0dd9d4e7f9 100644 --- a/drivers/net/cpfl/cpfl_ethdev.h +++ b/drivers/net/cpfl/cpfl_ethdev.h @@ -162,6 +162,7 @@ struct cpfl_repr { struct cpfl_repr_id repr_id; struct rte_ether_addr mac_addr; struct cpfl_vport_info *vport_info; + bool func_up; /* If the represented function is up */ }; struct cpfl_adapter_ext { diff --git a/drivers/net/cpfl/cpfl_representor.c b/drivers/net/cpfl/cpfl_representor.c index 0cd92b1351..3c0fa957de 100644 --- a/drivers/net/cpfl/cpfl_representor.c +++ b/drivers/net/cpfl/cpfl_representor.c @@ -308,6 +308,23 @@ cpfl_repr_tx_queue_setup(__rte_unused struct rte_eth_dev *dev, return 0; } +static int +cpfl_repr_link_update(struct rte_eth_dev *ethdev, + __rte_unused int wait_to_complete) +{ + struct cpfl_repr *repr = CPFL_DEV_TO_REPR(ethdev); + struct rte_eth_link *dev_link = ðdev->data->dev_link; + + if (!(ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)) { + PMD_INIT_LOG(ERR, "This ethdev is not representor."); + return -EINVAL; + } + dev_link->link_status = repr->func_up ? + RTE_ETH_LINK_UP : RTE_ETH_LINK_DOWN; + + return 0; +} + static const struct eth_dev_ops cpfl_repr_dev_ops = { .dev_start = cpfl_repr_dev_start, .dev_stop = cpfl_repr_dev_stop, @@ -317,6 +334,8 @@ static const struct eth_dev_ops cpfl_repr_dev_ops = { .rx_queue_setup = cpfl_repr_rx_queue_setup, .tx_queue_setup = cpfl_repr_tx_queue_setup, + + .link_update = cpfl_repr_link_update, }; static int @@ -331,6 +350,8 @@ cpfl_repr_init(struct rte_eth_dev *eth_dev, void *init_param) repr->itf.type = CPFL_ITF_TYPE_REPRESENTOR; repr->itf.adapter = adapter; repr->itf.data = eth_dev->data; + if (repr->vport_info->vport_info.vport_status == CPCHNL2_VPORT_STATUS_ENABLED) + repr->func_up = true; eth_dev->dev_ops = &cpfl_repr_dev_ops;