From patchwork Fri Aug 27 06:56:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 97442 X-Patchwork-Delegate: ferruh.yigit@amd.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 56135A0C43; Fri, 27 Aug 2021 09:00:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E51741285; Fri, 27 Aug 2021 08:58:51 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 6AB94412A8 for ; Fri, 27 Aug 2021 08:58:42 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 122) id 277997F6FC; Fri, 27 Aug 2021 09:58:42 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17]) by shelob.oktetlabs.ru (Postfix) with ESMTP id 051FA7F6E5; Fri, 27 Aug 2021 09:57:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 051FA7F6E5 Authentication-Results: shelob.oktetlabs.ru/051FA7F6E5; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: dev@dpdk.org Cc: Igor Romanov , Andy Moreton , Ivan Malov Date: Fri, 27 Aug 2021 09:56:59 +0300 Message-Id: <20210827065717.1838258-21-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210827065717.1838258-1-andrew.rybchenko@oktetlabs.ru> References: <20210827065717.1838258-1-andrew.rybchenko@oktetlabs.ru> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 20/38] net/sfc: implement port representor link update 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 Sender: "dev" From: Igor Romanov Implement the callback by reporting link down if the representor is not started, otherwise report link up with undefined link speed. Link speed is undefined since representors can pass traffic to each other even if the PF link is down. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton Reviewed-by: Ivan Malov --- drivers/net/sfc/sfc_repr.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/sfc/sfc_repr.c b/drivers/net/sfc/sfc_repr.c index bfe6dd4c9b..207e7c77a0 100644 --- a/drivers/net/sfc/sfc_repr.c +++ b/drivers/net/sfc/sfc_repr.c @@ -471,6 +471,24 @@ sfc_repr_dev_infos_get(struct rte_eth_dev *dev, return 0; } +static int +sfc_repr_dev_link_update(struct rte_eth_dev *dev, + __rte_unused int wait_to_complete) +{ + struct sfc_repr *sr = sfc_repr_by_eth_dev(dev); + struct rte_eth_link link; + + if (sr->state != SFC_ETHDEV_STARTED) { + sfc_port_link_mode_to_info(EFX_LINK_UNKNOWN, &link); + } else { + memset(&link, 0, sizeof(link)); + link.link_status = ETH_LINK_UP; + link.link_speed = ETH_SPEED_NUM_UNKNOWN; + } + + return rte_eth_linkstatus_set(dev, &link); +} + static int sfc_repr_ring_create(uint16_t pf_port_id, uint16_t repr_id, const char *type_name, uint16_t qid, uint16_t nb_desc, @@ -782,6 +800,7 @@ static const struct eth_dev_ops sfc_repr_dev_ops = { .dev_stop = sfc_repr_dev_stop, .dev_close = sfc_repr_dev_close, .dev_infos_get = sfc_repr_dev_infos_get, + .link_update = sfc_repr_dev_link_update, .rx_queue_setup = sfc_repr_rx_queue_setup, .rx_queue_release = sfc_repr_rx_queue_release, .tx_queue_setup = sfc_repr_tx_queue_setup,