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 73E7BA0C41; Wed, 15 Sep 2021 10:32:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 57EC14003F; Wed, 15 Sep 2021 10:32:35 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 8361A4003C for ; Wed, 15 Sep 2021 10:32:34 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18F7iM6V025843; Wed, 15 Sep 2021 01:32:33 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pfpt0220; bh=F1Vd/rPS9goh8+YZMhcCpvCujUSvoZnUGJaDE8L6p2A=; b=L2PpbaXPE7eS2t2gw6lIxRhpmMU2T/YysFmt6TTCebHAcFnkrnYjDcMlQWm4CMgdH4Si f2xiLoradycl05WYUzLaCjelLrS/xA3AA3TN1PqllbhkRQTbvirpgrPr+P3mZQu/3XGf AXkNCorfiWsJXFLuvdyXC3ZnaKXHSXEhAsI6ee9z1Eft90W5ejk0uOOtcUzAe9g0Ahd6 yS6RylwZbKLfM9MtruO0pEnnHPW827MxQ92cZUBi6HAOsxnac90cpbMiK9965VGROS1j wBRVJx2DAGialBj+QQHu9Kd7KZEcqrMsw9s2wP/9Uo016W+XG3/ep3I5PLKrzjTdKM4W pg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com with ESMTP id 3b2t41mehp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 15 Sep 2021 01:32:33 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 15 Sep 2021 01:32:31 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 15 Sep 2021 01:32:31 -0700 Received: from [10.28.175.194] (PE-LT1350.marvell.com [10.28.175.194]) by maili.marvell.com (Postfix) with ESMTP id 7F6763F7064; Wed, 15 Sep 2021 01:32:28 -0700 (PDT) To: Harman Kalra , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Ferruh Yigit , , References: <20210730160829.13597-1-hkalra@marvell.com> <20210730160829.13597-2-hkalra@marvell.com> From: Nithin Kumar Dabilpuram Message-ID: Date: Wed, 15 Sep 2021 14:02:26 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210730160829.13597-2-hkalra@marvell.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: PNG3kc9v-8vA06ofyjcoz5aokuHAaAZG X-Proofpoint-ORIG-GUID: PNG3kc9v-8vA06ofyjcoz5aokuHAaAZG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-15_01,2021-09-14_01,2020-04-07_01 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" Acked-by: Nithin Dabilpuram 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 > --- > 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) > { >