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 7F6D2A053B; Thu, 6 Feb 2020 13:06:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6B40C1C038; Thu, 6 Feb 2020 13:06:14 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 8A1A11C021; Thu, 6 Feb 2020 13:06:12 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 016C6BJi018234; Thu, 6 Feb 2020 04:06:11 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=0zjZXvIrzK/Nq2mKa/Rh+fE2lNUt5CphJ7/0m+sN1zY=; b=W7kI+hwRJtM3lQ38JWsOn0I05UxHiOqw36oDlAFp1Qf29jed32ZWV9WWZ4DOvx2cpXnp 3avbcaOo2poIQDZptoBub4qe6FsZ77Ah0gFEJa6nnTJduLI/UZpNkVM/aQ/uom+ma6NE ag6yc5PXGYfy3Bkn0y9Jl+pU1tew/eHzvwRruRYs5aAXm8/leDLPIbK2hm7Yn7RDGT2s CUFr/N6nEJLIGUCHBiPoYkO5LHmgrZmpitSGVCGiCW2Bcv1FNEYEekq+EbTTlZI3PT2t uhhrTVlkKoguOwp3tgsFcjMDCpJDS2UU+VXPELQf04/Q3/v1dq1pb39b7nUwmCSWqBsF rg== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2xyhmtfbxs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 06 Feb 2020 04:06:11 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 6 Feb 2020 04:06:10 -0800 Received: from SC-EXCH02.marvell.com (10.93.176.82) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 6 Feb 2020 04:06:09 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 6 Feb 2020 04:06:09 -0800 Received: from hyd1agupta-dt.marvell.com (hyd1agupta-dt.marvell.com [10.29.8.91]) by maili.marvell.com (Postfix) with ESMTP id B16553F703F; Thu, 6 Feb 2020 04:06:07 -0800 (PST) From: Ashish Gupta To: CC: , , Date: Thu, 6 Feb 2020 18:00:58 +0530 Message-ID: <20200206123058.9971-1-ashishg@marvell.com> X-Mailer: git-send-email 2.14.3 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-06_01:2020-02-06, 2020-02-06 signatures=0 Subject: [dpdk-dev] [dpdk-dev PATCH v1 1/1] net/octeontx2: update link information for loopback port 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" loopback devices are exposed as ethdev device in octeontx2. dpdk link update APIs updating the link information for cgx ports but skipping loopback ports. When stack uses loopback port for forwarding, packets are dropped as link status is down. Link information need to be updated for loopback ports to avoid it. Fixes: 38f566280a ("net/octeontx2: add link stats operations") Cc: stable@dpdk.org Signed-off-by: Ashish Gupta --- drivers/net/octeontx2/otx2_link.c | 49 +++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/drivers/net/octeontx2/otx2_link.c b/drivers/net/octeontx2/otx2_link.c index f5679b06e..4128f56d9 100644 --- a/drivers/net/octeontx2/otx2_link.c +++ b/drivers/net/octeontx2/otx2_link.c @@ -82,32 +82,57 @@ otx2_eth_dev_link_status_update(struct otx2_dev *dev, _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL); } +static int +lbk_link_update(struct rte_eth_link *link) +{ + link->link_status = ETH_LINK_UP; + link->link_speed = ETH_SPEED_NUM_100G; + link->link_autoneg = ETH_LINK_FIXED; + link->link_duplex = ETH_LINK_FULL_DUPLEX; + return 0; +} + +static int +cgx_link_update(struct otx2_eth_dev *dev, struct rte_eth_link *link) +{ + struct otx2_mbox *mbox = dev->mbox; + struct cgx_link_info_msg *rsp; + int rc; + otx2_mbox_alloc_msg_cgx_get_linkinfo(mbox); + rc = otx2_mbox_process_msg(mbox, (void *)&rsp); + if (rc) + return rc; + + link->link_status = rsp->link_info.link_up; + link->link_speed = rsp->link_info.speed; + link->link_autoneg = ETH_LINK_AUTONEG; + + if (rsp->link_info.full_duplex) + link->link_duplex = rsp->link_info.full_duplex; + return 0; +} + int otx2_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete) { struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev); - struct otx2_mbox *mbox = dev->mbox; - struct cgx_link_info_msg *rsp; struct rte_eth_link link; int rc; RTE_SET_USED(wait_to_complete); + memset(&link, 0, sizeof(struct rte_eth_link)); - if (otx2_dev_is_lbk(dev) || otx2_dev_is_sdp(dev)) + if (otx2_dev_is_sdp(dev)) return 0; - otx2_mbox_alloc_msg_cgx_get_linkinfo(mbox); - rc = otx2_mbox_process_msg(mbox, (void *)&rsp); + if (otx2_dev_is_lbk(dev)) + rc = lbk_link_update(&link); + else + rc = cgx_link_update(dev, &link); + if (rc) return rc; - link.link_status = rsp->link_info.link_up; - link.link_speed = rsp->link_info.speed; - link.link_autoneg = ETH_LINK_AUTONEG; - - if (rsp->link_info.full_duplex) - link.link_duplex = rsp->link_info.full_duplex; - return rte_eth_linkstatus_set(eth_dev, &link); } -- 2.14.3