From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1B66DA04C3; Fri, 22 Nov 2019 15:16:41 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 08C1D5596; Fri, 22 Nov 2019 15:16:01 +0100 (CET) Received: from smtp.tom.com (smtprz15.163.net [106.3.154.248]) by dpdk.org (Postfix) with ESMTP id 131BD374 for ; Fri, 22 Nov 2019 13:06:35 +0100 (CET) Received: from my-app01.tom.com (my-app01.tom.com [127.0.0.1]) by freemail01.tom.com (Postfix) with ESMTP id 7A28A1C81A45 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) Received: from my-app01.tom.com (HELO smtp.tom.com) ([127.0.0.1]) by my-app01 (TOM SMTP Server) with SMTP ID -1777405614 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) Received: from antispam1.tom.com (unknown [172.25.16.55]) by freemail01.tom.com (Postfix) with ESMTP id 6B19C1C81A28 for ; Fri, 22 Nov 2019 20:06:38 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tom.com; s=201807; t=1574424398; bh=gArXmcHvjfBZf3/zrlpv3xzicqJiLFS0WE/WH3chEq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tDwdGWGBvRel0K5F8YUz8SKEYzfdw1HI1k4ZnVq/mnxiZfxN8Jkwg3FVhbIoK4Bn/ zk4RTurag8SGDbgnO0Gykl9VURjXB51F48QxVdH978mmkbCjX3/7tvraiJAbaz1yfk slo0EoZuySPKmfpOrI318I5I6NCDF9bGl0CCfNaY= Received: from antispam1.tom.com (antispam1.tom.com [127.0.0.1]) by antispam1.tom.com (Postfix) with ESMTP id 6ACA410017C7 for ; Fri, 22 Nov 2019 20:06:09 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam1.tom.com Received: from antispam1.tom.com ([127.0.0.1]) by antispam1.tom.com (antispam1.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id riq7xWla5FFh for ; Fri, 22 Nov 2019 20:06:09 +0800 (CST) Received: from localhost.localdomain (unknown [203.160.91.226]) by antispam1.tom.com (Postfix) with ESMTPA id B27E21001828; Fri, 22 Nov 2019 20:06:08 +0800 (CST) From: "Wei Hu (Xavier)" To: dev@dpdk.org, stable@dpdk.org Cc: xavier_huwei@163.com, xavier.huwei@tom.com, huwei87@hisilicon.com Date: Fri, 22 Nov 2019 20:06:23 +0800 Message-Id: <20191122120624.4963-6-xavier.huwei@tom.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191122120624.4963-1-xavier.huwei@tom.com> References: <20191122120624.4963-1-xavier.huwei@tom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Fri, 22 Nov 2019 15:15:52 +0100 Subject: [dpdk-dev] [PATCH 5/6] net/hns3: fix the strategy of getting link status for VF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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: Huisong Li Currently, port link status is "up" in VF driver after user calling the rte_eth_dev_stop API. This is unreasonable. Therefore, this patch adjusts the strategy of getting link status from PF driver for VF. VF drvier should stop getting link status from PF by canceling the alarm that VF driver send mailbox message to PF driver, when the rte_eth_dev_stop API is called. And VF driver should restore the alarm when the rte_eth_dev_start API is called. Fixes: a5475d61fa34 ("net/hns3: support VF") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_ethdev_vf.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index 2274ac35e..b1736e73a 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -1246,6 +1246,7 @@ hns3vf_dev_stop(struct rte_eth_dev *eth_dev) hns3_dev_release_mbufs(hns); hw->adapter_state = HNS3_NIC_CONFIGURED; } + rte_eal_alarm_cancel(hns3vf_service_handler, eth_dev); rte_spinlock_unlock(&hw->lock); } @@ -1265,7 +1266,6 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev) hns3_reset_abort(hns); hw->adapter_state = HNS3_NIC_CLOSED; rte_eal_alarm_cancel(hns3vf_keep_alive_handler, eth_dev); - rte_eal_alarm_cancel(hns3vf_service_handler, eth_dev); hns3vf_configure_all_mc_mac_addr(hns, true); hns3vf_remove_all_vlan_table(hns); hns3vf_uninit_vf(eth_dev); @@ -1286,8 +1286,6 @@ hns3vf_dev_link_update(struct rte_eth_dev *eth_dev, struct hns3_mac *mac = &hw->mac; struct rte_eth_link new_link; - hns3vf_request_link_info(hw); - memset(&new_link, 0, sizeof(new_link)); switch (mac->link_speed) { case ETH_SPEED_NUM_10M: @@ -1352,6 +1350,8 @@ hns3vf_dev_start(struct rte_eth_dev *eth_dev) rte_spinlock_unlock(&hw->lock); hns3_set_rxtx_function(eth_dev); hns3_mp_req_start_rxtx(eth_dev); + rte_eal_alarm_set(HNS3VF_SERVICE_INTERVAL, hns3vf_service_handler, + eth_dev); return 0; } @@ -1789,8 +1789,6 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) } rte_eal_alarm_set(HNS3VF_KEEP_ALIVE_INTERVAL, hns3vf_keep_alive_handler, eth_dev); - rte_eal_alarm_set(HNS3VF_SERVICE_INTERVAL, hns3vf_service_handler, - eth_dev); return 0; err_rte_zmalloc: -- 2.23.0