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 AD620A0C41; Tue, 7 Sep 2021 04:59:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2DC93410EB; Tue, 7 Sep 2021 04:59:52 +0200 (CEST) Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) by mails.dpdk.org (Postfix) with ESMTP id A0B3D40DF8 for ; Tue, 7 Sep 2021 04:59:50 +0200 (CEST) Received: by mail-io1-f46.google.com with SMTP id b10so10891291ioq.9 for ; Mon, 06 Sep 2021 19:59:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iluIeb2TZJPw4CF2uGb5GPdvK/QU3TUJPbmAn8iVCsI=; b=TABLX0m7VYa1dgKnklpiqzySf957BjYlElj6zRF9debmyqb058X/ytaDlPgXMqTm9H G+PbBoqrLEx6yIY1SeCnjRXckRFy0Ywq/zLYZ1NthqHR2RanyMNLQrPRb6rGjVGfEhuv 5lqe4BIsiBIhHU846QN6/lMgx5foY60mVAChWrgwAPWfEY2I8Qlnh6QE3WtM1/is94Qf +ky4TLc3oTwNxgOeAFcOKbIOC4L9wsxDK75XYnbMGt5ghW63Qos8rrX9Q+9Utj1zQfN+ W52rLsiqSBlb/oTnr3s8wOFODopzRLNZvxsa1qSAKwkwZiwsLvBIAX0H+2ZsSCjElGTN uI1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iluIeb2TZJPw4CF2uGb5GPdvK/QU3TUJPbmAn8iVCsI=; b=attitvKu6CiX8y+vNU4fn+Ds4eL5rtQTu6ZKYIfSD40Oey+YkgIFZx5BW6TLtn70/J +AneXH7NdYxs6uyNBD1CmB08brrIEkxNqy0RhTMW8YlJMJz450eyySuQ0WcYjIKBisNe CvZhPTF+2yU8gaANocQtFHxc5OGku9B5nKw5NAdhZG4qAtfZLE737jFXgCvBuA7Q+4MI YZ9ubPAcwLR0mkeQJ0+ygRKpFjeSyZQA2u+5slkJxKCdo8dNJXEJYj35t/3RMuKQnD0f 2L5NKANaGoHDFAgYU2PtYAaZr5ARmGMX7biKZZn7IjnmV608EKAp2Qo+3/3rxv759Dtk OZoA== X-Gm-Message-State: AOAM531AHuWZ/yUPJYnnSY/scBkj4bYDps8LkSJyxMPtQUQU/ouRMP/L mhtUqmXhkl75AE3EeOpw2H585v8zs76JiXIQeOU= X-Google-Smtp-Source: ABdhPJyB3XNtds0Fn04/zK2EUcwcRJ6/Fl16qh4rR446d7HYCW4GZtbsI2D2xatcTLYaHddvw8ATMolAS2ucuPhnW90= X-Received: by 2002:a05:6602:2219:: with SMTP id n25mr11909091ion.185.1630983589932; Mon, 06 Sep 2021 19:59:49 -0700 (PDT) MIME-Version: 1.0 References: <20210730160829.13597-1-hkalra@marvell.com> <20210730160829.13597-2-hkalra@marvell.com> In-Reply-To: <20210730160829.13597-2-hkalra@marvell.com> From: Jerin Jacob Date: Tue, 7 Sep 2021 08:29:23 +0530 Message-ID: To: Harman Kalra , Ferruh Yigit Cc: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , dpdk-dev Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 2/2] net/cnxk: callback for getting link status 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" On Fri, Jul 30, 2021 at 9:38 PM Harman Kalra wrote: > > Adding a new callback for reading the link status. PF can read it's > link status and can forward the same to VF once it comes up. > > Signed-off-by: Harman Kalra Series applied to dpdk-next-net-mrvl/for-next-net. Thanks. > --- > drivers/net/cnxk/cnxk_ethdev.c | 9 +++++++++ > drivers/net/cnxk/cnxk_ethdev.h | 2 ++ > drivers/net/cnxk/cnxk_link.c | 23 +++++++++++++++++++++++ > 3 files changed, 34 insertions(+) > > diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c > index 0e3652ed51..7152dcd002 100644 > --- a/drivers/net/cnxk/cnxk_ethdev.c > +++ b/drivers/net/cnxk/cnxk_ethdev.c > @@ -1314,6 +1314,10 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev) > /* Register up msg callbacks */ > roc_nix_mac_link_cb_register(nix, cnxk_eth_dev_link_status_cb); > > + /* Register up msg callbacks */ > + roc_nix_mac_link_info_get_cb_register(nix, > + cnxk_eth_dev_link_status_get_cb); > + > dev->eth_dev = eth_dev; > dev->configured = 0; > dev->ptype_disable = 0; > @@ -1415,6 +1419,11 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset) > /* Disable link status events */ > roc_nix_mac_link_event_start_stop(nix, false); > > + /* Unregister the link update op, this is required to stop VFs from > + * receiving link status updates on exit path. > + */ > + roc_nix_mac_link_cb_unregister(nix); > + > /* Free up SQs */ > for (i = 0; i < eth_dev->data->nb_tx_queues; i++) { > dev_ops->tx_queue_release(eth_dev->data->tx_queues[i]); > diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h > index 4eead03905..4caf26303f 100644 > --- a/drivers/net/cnxk/cnxk_ethdev.h > +++ b/drivers/net/cnxk/cnxk_ethdev.h > @@ -349,6 +349,8 @@ int cnxk_nix_rss_hash_conf_get(struct rte_eth_dev *eth_dev, > void cnxk_nix_toggle_flag_link_cfg(struct cnxk_eth_dev *dev, bool set); > void cnxk_eth_dev_link_status_cb(struct roc_nix *nix, > struct roc_nix_link_info *link); > +void cnxk_eth_dev_link_status_get_cb(struct roc_nix *nix, > + struct roc_nix_link_info *link); > int cnxk_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete); > int cnxk_nix_queue_stats_mapping(struct rte_eth_dev *dev, uint16_t queue_id, > uint8_t stat_idx, uint8_t is_rx); > diff --git a/drivers/net/cnxk/cnxk_link.c b/drivers/net/cnxk/cnxk_link.c > index 3fdbdba495..6a70801675 100644 > --- a/drivers/net/cnxk/cnxk_link.c > +++ b/drivers/net/cnxk/cnxk_link.c > @@ -45,6 +45,29 @@ nix_link_status_print(struct rte_eth_dev *eth_dev, struct rte_eth_link *link) > plt_info("Port %d: Link Down", (int)(eth_dev->data->port_id)); > } > > +void > +cnxk_eth_dev_link_status_get_cb(struct roc_nix *nix, > + struct roc_nix_link_info *link) > +{ > + struct cnxk_eth_dev *dev = (struct cnxk_eth_dev *)nix; > + struct rte_eth_link eth_link; > + struct rte_eth_dev *eth_dev; > + > + if (!link || !nix) > + return; > + > + eth_dev = dev->eth_dev; > + if (!eth_dev) > + return; > + > + rte_eth_linkstatus_get(eth_dev, ð_link); > + > + link->status = eth_link.link_status; > + link->speed = eth_link.link_speed; > + link->autoneg = eth_link.link_autoneg; > + link->full_duplex = eth_link.link_duplex; > +} > + > void > cnxk_eth_dev_link_status_cb(struct roc_nix *nix, struct roc_nix_link_info *link) > { > -- > 2.18.0 >