diff mbox series

[10/37] net/dpaa: add 2.5G support

Message ID 20200527132326.1382-11-hemant.agrawal@nxp.com
State Superseded
Headers show
Series NXP DPAAx enhancements | expand

Commit Message

Hemant Agrawal May 27, 2020, 1:22 p.m. UTC
From: Sachin Saxena <sachin.saxena@nxp.com>


Handle 2.5Gbps ethernet ports as well.

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>

---
 doc/guides/nics/features/dpaa.ini         | 2 +-
 drivers/bus/dpaa/base/fman/fman.c         | 6 ++++--
 drivers/bus/dpaa/base/fman/netcfg_layer.c | 3 ++-
 drivers/bus/dpaa/include/fman.h           | 1 +
 drivers/net/dpaa/dpaa_ethdev.c            | 9 ++++++++-
 5 files changed, 16 insertions(+), 5 deletions(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/doc/guides/nics/features/dpaa.ini b/doc/guides/nics/features/dpaa.ini
index 24cfd8566..b00f46a97 100644
--- a/doc/guides/nics/features/dpaa.ini
+++ b/doc/guides/nics/features/dpaa.ini
@@ -4,7 +4,7 @@ 
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
-Speed capabilities   = P
+Speed capabilities   = Y
 Link status          = Y
 Jumbo frame          = Y
 MTU update           = Y
diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index 6d77a7e39..ae26041ca 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -263,7 +263,7 @@  fman_if_init(const struct device_node *dpa_node)
 		fman_dealloc_bufs_mask_hi = 0;
 		fman_dealloc_bufs_mask_lo = 0;
 	}
-	/* Is the MAC node 1G, 10G? */
+	/* Is the MAC node 1G, 2.5G, 10G? */
 	__if->__if.is_memac = 0;
 
 	if (of_device_is_compatible(mac_node, "fsl,fman-1g-mac"))
@@ -279,7 +279,9 @@  fman_if_init(const struct device_node *dpa_node)
 			/* Right now forcing memac to 1g in case of error*/
 			__if->__if.mac_type = fman_mac_1g;
 		} else {
-			if (strstr(char_prop, "sgmii"))
+			if (strstr(char_prop, "sgmii-2500"))
+				__if->__if.mac_type = fman_mac_2_5g;
+			else if (strstr(char_prop, "sgmii"))
 				__if->__if.mac_type = fman_mac_1g;
 			else if (strstr(char_prop, "rgmii")) {
 				__if->__if.mac_type = fman_mac_1g;
diff --git a/drivers/bus/dpaa/base/fman/netcfg_layer.c b/drivers/bus/dpaa/base/fman/netcfg_layer.c
index 36eca88cd..b7009f229 100644
--- a/drivers/bus/dpaa/base/fman/netcfg_layer.c
+++ b/drivers/bus/dpaa/base/fman/netcfg_layer.c
@@ -44,7 +44,8 @@  dump_netcfg(struct netcfg_info *cfg_ptr)
 
 		printf("\n+ Fman %d, MAC %d (%s);\n",
 		       __if->fman_idx, __if->mac_idx,
-		       (__if->mac_type == fman_mac_1g) ? "1G" : "10G");
+		       (__if->mac_type == fman_mac_1g) ? "1G" :
+		       (__if->mac_type == fman_mac_2_5g) ? "2.5G" : "10G");
 
 		printf("\tmac_addr: %02x:%02x:%02x:%02x:%02x:%02x\n",
 		       (&__if->mac_addr)->addr_bytes[0],
diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h
index c02d32d22..b6293b61c 100644
--- a/drivers/bus/dpaa/include/fman.h
+++ b/drivers/bus/dpaa/include/fman.h
@@ -72,6 +72,7 @@  enum fman_mac_type {
 	fman_offline = 0,
 	fman_mac_1g,
 	fman_mac_10g,
+	fman_mac_2_5g,
 };
 
 struct mac_addr {
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 9448615ab..2b14bd712 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -358,8 +358,13 @@  static int dpaa_eth_dev_info(struct rte_eth_dev *dev,
 
 	if (dpaa_intf->fif->mac_type == fman_mac_1g) {
 		dev_info->speed_capa = ETH_LINK_SPEED_1G;
+	} else if (dpaa_intf->fif->mac_type == fman_mac_2_5g) {
+		dev_info->speed_capa = ETH_LINK_SPEED_1G
+					| ETH_LINK_SPEED_2_5G;
 	} else if (dpaa_intf->fif->mac_type == fman_mac_10g) {
-		dev_info->speed_capa = (ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G);
+		dev_info->speed_capa = ETH_LINK_SPEED_1G
+					| ETH_LINK_SPEED_2_5G
+					| ETH_LINK_SPEED_10G;
 	} else {
 		DPAA_PMD_ERR("invalid link_speed: %s, %d",
 			     dpaa_intf->name, dpaa_intf->fif->mac_type);
@@ -390,6 +395,8 @@  static int dpaa_eth_link_update(struct rte_eth_dev *dev,
 
 	if (dpaa_intf->fif->mac_type == fman_mac_1g)
 		link->link_speed = ETH_SPEED_NUM_1G;
+	else if (dpaa_intf->fif->mac_type == fman_mac_2_5g)
+		link->link_speed = ETH_SPEED_NUM_2_5G;
 	else if (dpaa_intf->fif->mac_type == fman_mac_10g)
 		link->link_speed = ETH_SPEED_NUM_10G;
 	else