From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4F8FA034F; Mon, 11 Oct 2021 16:51:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A4AFD4117C; Mon, 11 Oct 2021 16:49:55 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id BF62F4117D for ; Mon, 11 Oct 2021 16:49:52 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 122) id 929D77F700; Mon, 11 Oct 2021 17:49:52 +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 1A8747F70A; Mon, 11 Oct 2021 17:49:09 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 1A8747F70A Authentication-Results: shelob.oktetlabs.ru/1A8747F70A; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: dev@dpdk.org Cc: Igor Romanov , Andy Moreton , Ivan Malov Date: Mon, 11 Oct 2021 17:48:39 +0300 Message-Id: <20211011144857.446802-21-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211011144857.446802-1-andrew.rybchenko@oktetlabs.ru> References: <20210827065717.1838258-1-andrew.rybchenko@oktetlabs.ru> <20211011144857.446802-1-andrew.rybchenko@oktetlabs.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 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 f60106c196..9b70a3be76 100644 --- a/drivers/net/sfc/sfc_repr.c +++ b/drivers/net/sfc/sfc_repr.c @@ -463,6 +463,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, @@ -760,6 +778,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, -- 2.30.2