From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016ce01.pphosted.com (mx0a-0016ce01.pphosted.com [67.231.148.157]) by dpdk.org (Postfix) with ESMTP id B0C8798 for ; Thu, 10 Nov 2016 03:26:48 +0100 (CET) Received: from pps.filterd (m0095336.ppops.net [127.0.0.1]) by mx0a-0016ce01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id uAA2QKB2015155 for ; Wed, 9 Nov 2016 18:26:47 -0800 Received: from avcashub1.qlogic.com ([198.186.0.115]) by mx0a-0016ce01.pphosted.com with ESMTP id 26hdh50x20-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 09 Nov 2016 18:26:47 -0800 Received: from avluser05.qlc.com (10.1.113.115) by avcashub1.qlogic.org (10.1.4.190) with Microsoft SMTP Server (TLS) id 14.3.235.1; Wed, 9 Nov 2016 18:26:46 -0800 Received: (from rmody@localhost) by avluser05.qlc.com (8.14.4/8.14.4/Submit) id uAA2Qkfi017518; Wed, 9 Nov 2016 18:26:46 -0800 X-Authentication-Warning: avluser05.qlc.com: rmody set sender to Rasesh.Mody@cavium.com using -f From: Rasesh Mody To: CC: , Harish Patil Date: Wed, 9 Nov 2016 18:26:24 -0800 Message-ID: <1478744784-17469-1-git-send-email-Rasesh.Mody@cavium.com> X-Mailer: git-send-email 1.7.10.3 MIME-Version: 1.0 Content-Type: text/plain disclaimer: bypass X-Proofpoint-Virus-Version: vendor=nai engine=5800 definitions=8344 signatures=670701 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611100043 Subject: [dpdk-dev] [PATCH] net/qede: fix unknown speed errmsg for 25G link X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2016 02:26:49 -0000 From: Harish Patil Fix to use bitmapped values in NVM configuration for speed capability advertisement. This issue is specific to 25G NIC since it is capable of 25G and 10G speeds. Fixes: 64c239b7f8b7 ("net/qede: fix advertising link speed capability") Signed-off-by: Harish Patil --- drivers/net/qede/qede_ethdev.c | 15 ++++++++++++++- drivers/net/qede/qede_if.h | 2 +- drivers/net/qede/qede_main.c | 25 ++----------------------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 59129f2..f57f80d 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -647,6 +647,7 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev, struct qede_dev *qdev = eth_dev->data->dev_private; struct ecore_dev *edev = &qdev->edev; struct qed_link_output link; + uint32_t speed_cap = 0; PMD_INIT_FUNC_TRACE(edev); @@ -681,7 +682,19 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev, memset(&link, 0, sizeof(struct qed_link_output)); qdev->ops->common->get_link(edev, &link); - dev_info->speed_capa = rte_eth_speed_bitflag(link.adv_speed, 0); + if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_1G) + speed_cap |= ETH_LINK_SPEED_1G; + if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_10G) + speed_cap |= ETH_LINK_SPEED_10G; + if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_25G) + speed_cap |= ETH_LINK_SPEED_25G; + if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_40G) + speed_cap |= ETH_LINK_SPEED_40G; + if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_50G) + speed_cap |= ETH_LINK_SPEED_50G; + if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_BB_100G) + speed_cap |= ETH_LINK_SPEED_100G; + dev_info->speed_capa = speed_cap; } /* return 0 means link status changed, -1 means not changed */ diff --git a/drivers/net/qede/qede_if.h b/drivers/net/qede/qede_if.h index 4936349..2131fe2 100644 --- a/drivers/net/qede/qede_if.h +++ b/drivers/net/qede/qede_if.h @@ -70,7 +70,7 @@ struct qed_link_output { uint32_t advertised_caps; /* In ADVERTISED defs */ uint32_t lp_caps; /* In ADVERTISED defs */ uint32_t speed; /* In Mb/s */ - uint32_t adv_speed; /* In Mb/s */ + uint32_t adv_speed; /* Speed mask */ uint8_t duplex; /* In DUPLEX defs */ uint8_t port; /* In PORT defs */ bool autoneg; diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index d2e476c..ab22409 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -488,7 +488,6 @@ static void qed_fill_link(struct ecore_hwfn *hwfn, struct ecore_mcp_link_state link; struct ecore_mcp_link_capabilities link_caps; uint32_t media_type; - uint32_t adv_speed; uint8_t change = 0; memset(if_link, 0, sizeof(*if_link)); @@ -516,28 +515,8 @@ static void qed_fill_link(struct ecore_hwfn *hwfn, if_link->duplex = QEDE_DUPLEX_FULL; - /* Fill up the native advertised speed */ - switch (params.speed.advertised_speeds) { - case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_10G: - adv_speed = 10000; - break; - case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_25G: - adv_speed = 25000; - break; - case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_40G: - adv_speed = 40000; - break; - case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_50G: - adv_speed = 50000; - break; - case NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_BB_100G: - adv_speed = 100000; - break; - default: - DP_NOTICE(hwfn, false, "Unknown speed\n"); - adv_speed = 0; - } - if_link->adv_speed = adv_speed; + /* Fill up the native advertised speed cap mask */ + if_link->adv_speed = params.speed.advertised_speeds; if (params.speed.autoneg) if_link->supported_caps |= QEDE_SUPPORTED_AUTONEG; -- 1.8.3.1