DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>
To: Harman Kalra <hkalra@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>, Ferruh Yigit <ferruh.yigit@intel.com>,
	<jerinj@marvell.com>, <ndabilpuram@marvell.com>
Subject: Re: [dpdk-dev] [PATCH 2/2] net/cnxk: callback for getting link status
Date: Wed, 15 Sep 2021 14:02:26 +0530	[thread overview]
Message-ID: <eeeb8278-9fbd-e6a4-7585-a432d618c6d7@marvell.com> (raw)
In-Reply-To: <20210730160829.13597-2-hkalra@marvell.com>


Acked-by: Nithin Dabilpuram <ndabilpuram@marvell.com>

On 7/30/21 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 <hkalra@marvell.com>
> ---
>   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, &eth_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)
>   {
> 

  parent reply	other threads:[~2021-09-15  8:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 16:08 [dpdk-dev] [PATCH 1/2] common/cnxk: send link event to VF Harman Kalra
2021-07-30 16:08 ` [dpdk-dev] [PATCH 2/2] net/cnxk: callback for getting link status Harman Kalra
2021-09-07  2:59   ` Jerin Jacob
2021-09-15  8:32   ` Nithin Kumar Dabilpuram [this message]
2021-09-16 14:31 ` [dpdk-dev] [PATCH 1/2] common/cnxk: send link event to VF Jerin Jacob
2021-09-27 13:06 ` Kinsella, Ray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eeeb8278-9fbd-e6a4-7585-a432d618c6d7@marvell.com \
    --to=ndabilpuram@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=hkalra@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).