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 1FC5CA0A0C; Tue, 29 Jun 2021 16:12:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF5DF411AE; Tue, 29 Jun 2021 16:12:56 +0200 (CEST) Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) by mails.dpdk.org (Postfix) with ESMTP id B198640E01 for ; Tue, 29 Jun 2021 16:12:54 +0200 (CEST) Received: by mail-io1-f49.google.com with SMTP id v3so26606486ioq.9 for ; Tue, 29 Jun 2021 07:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rBjL7XTUhuEaPTZr7eHAesObHgI8U4w5DZl2eMp8RFU=; b=buPFtPRhE/bQtoh+CH086GIW2I1KImZxAHxKc8EOx9zdkN8YvHimelhxGZ//1sWqVC ZHo4wqCEY8mGA6+PJNdwIIpG5Usxphnue0jSKxC4S5A42I963cCha6JTJ4qTEZkkte5s nDC5s7InxzsM3PhEwcAb/qUA00G81i0n3DICcSZCrn9s7PQlkJD0VaIteh2fnB+jD8aH HTl4TEfpAUCGqJAR4osp8q/3XrVs/s20miJDcoa2HcK4ttqDZBwzeWUgPCSBzLeH2Mjk BQsdYYyCDrzc7OdMO2zAV4AJYOtP9CWM5AKktjQRsLtY/rLIXimJ//Qzgs39lyS7fOVM OLsQ== 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=rBjL7XTUhuEaPTZr7eHAesObHgI8U4w5DZl2eMp8RFU=; b=GLn2ZX1ibFIJ6mhxF0Nu6VhAilkuCF9frx3lo9XYgyDEs0SoqpAjsjvBkvsAadAh3L Bd0cPROOwoRMLggkp40v/Lqlwk79u8Zyj+QJuJ5H3WQXOTZMAh2p/6eZBLmVPVC3m1/o Jct3lQGtmvkYHZGe+Fm0WAeJdS4l8bC7tq8qO0XD31Nek4++uKeXtJ3pEkqLLRRWVIUx XpceLoQTi7LRbKX3E6OR14TodPs4RQgJSdMDUqRLUwNZWif/VjrwkUcTSd+4KKGsqw3C Zi2jti5y05B0oija/QDlyFJQcwOQ+Xi34IBmZJxVKLW89MbBW0U4A5EwA9c0WQ/W6pq6 LT6Q== X-Gm-Message-State: AOAM53250EUCqe8pjDoGi+nwKqmmQzan9x9Tpgfhlz+6UGAtkBM/1QYx 88HcpdNRCbNdpe1IG72CSkd1P8/jYtgmKR0x0jI= X-Google-Smtp-Source: ABdhPJy8LEt/iFEhyAyPbnfZxL5ltMVwU0rsAoiLsUoOV1EkmjSzNKX9njurksTBYH6Mi7lgfOYHij7/Nk7FTNqmxTM= X-Received: by 2002:a6b:7702:: with SMTP id n2mr4090596iom.1.1624975974171; Tue, 29 Jun 2021 07:12:54 -0700 (PDT) MIME-Version: 1.0 References: <20210622200554.1544-1-hkalra@marvell.com> <20210622200554.1544-2-hkalra@marvell.com> In-Reply-To: <20210622200554.1544-2-hkalra@marvell.com> From: Jerin Jacob Date: Tue, 29 Jun 2021 19:42:28 +0530 Message-ID: To: Harman Kalra Cc: Jerin Jacob , Nithin Dabilpuram , Kiran Kumar K , dpdk-dev Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 2/2] net/octeontx2: 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 Wed, Jun 23, 2021 at 1:36 AM 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 Acked-by: Jerin Jacob Series applied to dpdk-next-net-mrvl/for-dpdk-main. Thanks. > --- > drivers/net/octeontx2/otx2_ethdev.c | 8 +++++++- > drivers/net/octeontx2/otx2_ethdev.h | 2 ++ > drivers/net/octeontx2/otx2_link.c | 23 +++++++++++++++++++++++ > 3 files changed, 32 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c > index 0834de0cb1..471fa34da1 100644 > --- a/drivers/net/octeontx2/otx2_ethdev.c > +++ b/drivers/net/octeontx2/otx2_ethdev.c > @@ -42,7 +42,8 @@ nix_get_tx_offload_capa(struct otx2_eth_dev *dev) > > static const struct otx2_dev_ops otx2_dev_ops = { > .link_status_update = otx2_eth_dev_link_status_update, > - .ptp_info_update = otx2_eth_dev_ptp_info_update > + .ptp_info_update = otx2_eth_dev_ptp_info_update, > + .link_status_get = otx2_eth_dev_link_status_get > }; > > static int > @@ -2625,6 +2626,11 @@ otx2_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close) > > nix_cgx_stop_link_event(dev); > > + /* Unregister the dev ops, this is required to stop VFs from > + * receiving link status updates on exit path. > + */ > + dev->ops = NULL; > + > /* Free up SQs */ > for (i = 0; i < eth_dev->data->nb_tx_queues; i++) { > otx2_nix_tx_queue_release(eth_dev->data->tx_queues[i]); > diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h > index ac50da7b18..08f9a2a7bc 100644 > --- a/drivers/net/octeontx2/otx2_ethdev.h > +++ b/drivers/net/octeontx2/otx2_ethdev.h > @@ -453,6 +453,8 @@ void otx2_nix_toggle_flag_link_cfg(struct otx2_eth_dev *dev, bool set); > int otx2_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete); > void otx2_eth_dev_link_status_update(struct otx2_dev *dev, > struct cgx_link_user_info *link); > +void otx2_eth_dev_link_status_get(struct otx2_dev *dev, > + struct cgx_link_user_info *link); > int otx2_nix_dev_set_link_up(struct rte_eth_dev *eth_dev); > int otx2_nix_dev_set_link_down(struct rte_eth_dev *eth_dev); > int otx2_apply_link_speed(struct rte_eth_dev *eth_dev); > diff --git a/drivers/net/octeontx2/otx2_link.c b/drivers/net/octeontx2/otx2_link.c > index a79b997376..5378e5c3b9 100644 > --- a/drivers/net/octeontx2/otx2_link.c > +++ b/drivers/net/octeontx2/otx2_link.c > @@ -47,6 +47,29 @@ nix_link_status_print(struct rte_eth_dev *eth_dev, struct rte_eth_link *link) > otx2_info("Port %d: Link Down", (int)(eth_dev->data->port_id)); > } > > +void > +otx2_eth_dev_link_status_get(struct otx2_dev *dev, > + struct cgx_link_user_info *link) > +{ > + struct otx2_eth_dev *otx2_dev = (struct otx2_eth_dev *)dev; > + struct rte_eth_link eth_link; > + struct rte_eth_dev *eth_dev; > + > + if (!link || !dev) > + return; > + > + eth_dev = otx2_dev->eth_dev; > + if (!eth_dev) > + return; > + > + rte_eth_linkstatus_get(eth_dev, ð_link); > + > + link->link_up = eth_link.link_status; > + link->speed = eth_link.link_speed; > + link->an = eth_link.link_autoneg; > + link->full_duplex = eth_link.link_duplex; > +} > + > void > otx2_eth_dev_link_status_update(struct otx2_dev *dev, > struct cgx_link_user_info *link) > -- > 2.18.0 >