summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChenmin Sun <chenmin.sun@intel.com>2019-03-29 17:53:51 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2019-03-29 18:03:52 +0100
commit0f4cff5af20a8def244e5327b860afdf556e0c24 (patch)
tree9ab31c11041bd520c7757d64ec935242b97fb355
parent5c67301273fff63d81c343cee164a3d87918b567 (diff)
downloaddpdk-0f4cff5af20a8def244e5327b860afdf556e0c24.zip
dpdk-0f4cff5af20a8def244e5327b860afdf556e0c24.tar.gz
dpdk-0f4cff5af20a8def244e5327b860afdf556e0c24.tar.xz
net/ice: fix speed capability
Device speed capability should be specified based on different PHY types instead of a fixed value, this patch fix the issue. Fixes: 690175ee51bf ("net/ice: support getting device information") Cc: stable@dpdk.org Signed-off-by: Chenmin Sun <chenmin.sun@intel.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
-rw-r--r--drivers/net/ice/ice_ethdev.c17
-rw-r--r--drivers/net/ice/ice_ethdev.h40
2 files changed, 53 insertions, 4 deletions
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 85311dd..1482ced 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1946,6 +1946,8 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
struct ice_vsi *vsi = pf->main_vsi;
struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev->device);
bool is_safe_mode = pf->adapter->is_safe_mode;
+ u64 phy_type_low;
+ u64 phy_type_high;
dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN;
dev_info->max_rx_pktlen = ICE_FRAME_SIZE_MAX;
@@ -2032,10 +2034,17 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
ETH_LINK_SPEED_5G |
ETH_LINK_SPEED_10G |
ETH_LINK_SPEED_20G |
- ETH_LINK_SPEED_25G |
- ETH_LINK_SPEED_40G |
- ETH_LINK_SPEED_50G |
- ETH_LINK_SPEED_100G;
+ ETH_LINK_SPEED_25G;
+
+ phy_type_low = hw->port_info->phy.phy_type_low;
+ phy_type_high = hw->port_info->phy.phy_type_high;
+
+ if (ICE_PHY_TYPE_SUPPORT_50G(phy_type_low))
+ dev_info->speed_capa |= ETH_LINK_SPEED_50G;
+
+ if (ICE_PHY_TYPE_SUPPORT_100G_LOW(phy_type_low) ||
+ ICE_PHY_TYPE_SUPPORT_100G_HIGH(phy_type_high))
+ dev_info->speed_capa |= ETH_LINK_SPEED_100G;
dev_info->nb_rx_queues = dev->data->nb_rx_queues;
dev_info->nb_tx_queues = dev->data->nb_tx_queues;
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index 1516cf6..9c29f22 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -318,4 +318,44 @@ ice_align_floor(int n)
return 0;
return 1 << (sizeof(n) * CHAR_BIT - 1 - __builtin_clz(n));
}
+
+#define ICE_PHY_TYPE_SUPPORT_50G(phy_type) \
+ (((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_CR2) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_SR2) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_LR2) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_KR2) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50G_LAUI2_AOC_ACC) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50G_LAUI2) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50G_AUI2_AOC_ACC) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50G_AUI2) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_CP) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_SR) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_FR) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_LR) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50GBASE_KR_PAM4) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50G_AUI1_AOC_ACC) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_50G_AUI1))
+
+#define ICE_PHY_TYPE_SUPPORT_100G_LOW(phy_type) \
+ (((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_CR4) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_SR4) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_LR4) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_KR4) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_100G_CAUI4_AOC_ACC) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_100G_CAUI4) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_100G_AUI4_AOC_ACC) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_100G_AUI4) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_CR_PAM4) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_KR_PAM4) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_CP2) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_SR2) || \
+ ((phy_type) & ICE_PHY_TYPE_LOW_100GBASE_DR))
+
+#define ICE_PHY_TYPE_SUPPORT_100G_HIGH(phy_type) \
+ (((phy_type) & ICE_PHY_TYPE_HIGH_100GBASE_KR2_PAM4) || \
+ ((phy_type) & ICE_PHY_TYPE_HIGH_100G_CAUI2_AOC_ACC) || \
+ ((phy_type) & ICE_PHY_TYPE_HIGH_100G_CAUI2) || \
+ ((phy_type) & ICE_PHY_TYPE_HIGH_100G_AUI2_AOC_ACC) || \
+ ((phy_type) & ICE_PHY_TYPE_HIGH_100G_AUI2))
+
#endif /* _ICE_ETHDEV_H_ */