DPDK patches and discussions
 help / color / mirror / Atom feed
From: Marc Sune <marcdevel@gmail.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4 1/2] Added ETH_SPEED_ bitmap in rte_eth_dev_info
Date: Sat, 29 Aug 2015 02:16:12 +0200	[thread overview]
Message-ID: <1440807373-24770-2-git-send-email-marc.sune@bisdn.de> (raw)
In-Reply-To: <1440807373-24770-1-git-send-email-marc.sune@bisdn.de>

Currently there was no way to recover all the supported speeds of a certain
ether device.

This commit adds a speed capability bitmap to rte_eth_dev_info struct, to be
filled by PMDs. It also renames ETH_LINK_SPEED_XXX to ETH_SPEED, in order to
unify speed capabilities and link speeds. It also adds missing speeds to
ETH_SPEED.

The field speed in the struct rte_eth_conf is now a bitmap and therefore is
renamed to speeds. This allows to specify a list of speeds to be announced
during autonegociation, as suggested by M. Brorup. Drivers do not support (yet)
this capability.

Signed-off-by: Marc Sune <marcdevel@gmail.com>
---
 app/test-pmd/cmdline.c                    | 32 +++++++++++------------
 app/test/virtual_pmd.c                    |  2 +-
 drivers/net/bonding/rte_eth_bond_8023ad.c | 14 +++++------
 drivers/net/cxgbe/base/t4_hw.c            |  8 +++---
 drivers/net/e1000/em_ethdev.c             | 14 +++++------
 drivers/net/e1000/igb_ethdev.c            | 14 +++++------
 drivers/net/i40e/i40e_ethdev.c            | 34 ++++++++++++-------------
 drivers/net/i40e/i40e_ethdev_vf.c         |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c          | 22 ++++++++--------
 drivers/net/vmxnet3/vmxnet3_ethdev.c      |  2 +-
 examples/ip_pipeline/config_parse.c       |  2 +-
 lib/librte_ether/rte_ethdev.h             | 42 ++++++++++++++++++++++---------
 12 files changed, 103 insertions(+), 85 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 5799c9c..053acf6 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -903,7 +903,7 @@ cmd_config_speed_all_parsed(void *parsed_result,
 			__attribute__((unused)) void *data)
 {
 	struct cmd_config_speed_all *res = parsed_result;
-	uint16_t link_speed = ETH_LINK_SPEED_AUTONEG;
+	uint16_t link_speed = ETH_SPEED_AUTONEG;
 	uint16_t link_duplex = 0;
 	portid_t pid;
 
@@ -913,17 +913,17 @@ cmd_config_speed_all_parsed(void *parsed_result,
 	}
 
 	if (!strcmp(res->value1, "10"))
-		link_speed = ETH_LINK_SPEED_10;
+		link_speed = ETH_SPEED_10M;
 	else if (!strcmp(res->value1, "100"))
-		link_speed = ETH_LINK_SPEED_100;
+		link_speed = ETH_SPEED_100M;
 	else if (!strcmp(res->value1, "1000"))
-		link_speed = ETH_LINK_SPEED_1000;
+		link_speed = ETH_SPEED_1G;
 	else if (!strcmp(res->value1, "10000"))
-		link_speed = ETH_LINK_SPEED_10G;
+		link_speed = ETH_SPEED_10G;
 	else if (!strcmp(res->value1, "40000"))
-		link_speed = ETH_LINK_SPEED_40G;
+		link_speed = ETH_SPEED_40G;
 	else if (!strcmp(res->value1, "auto"))
-		link_speed = ETH_LINK_SPEED_AUTONEG;
+		link_speed = ETH_SPEED_AUTONEG;
 	else {
 		printf("Unknown parameter\n");
 		return;
@@ -941,7 +941,7 @@ cmd_config_speed_all_parsed(void *parsed_result,
 	}
 
 	FOREACH_PORT(pid, ports) {
-		ports[pid].dev_conf.link_speed = link_speed;
+		ports[pid].dev_conf.link_speeds = link_speed;
 		ports[pid].dev_conf.link_duplex = link_duplex;
 	}
 
@@ -1000,7 +1000,7 @@ cmd_config_speed_specific_parsed(void *parsed_result,
 				__attribute__((unused)) void *data)
 {
 	struct cmd_config_speed_specific *res = parsed_result;
-	uint16_t link_speed = ETH_LINK_SPEED_AUTONEG;
+	uint16_t link_speed = ETH_SPEED_AUTONEG;
 	uint16_t link_duplex = 0;
 
 	if (!all_ports_stopped()) {
@@ -1012,17 +1012,17 @@ cmd_config_speed_specific_parsed(void *parsed_result,
 		return;
 
 	if (!strcmp(res->value1, "10"))
-		link_speed = ETH_LINK_SPEED_10;
+		link_speed = ETH_SPEED_10M;
 	else if (!strcmp(res->value1, "100"))
-		link_speed = ETH_LINK_SPEED_100;
+		link_speed = ETH_SPEED_100M;
 	else if (!strcmp(res->value1, "1000"))
-		link_speed = ETH_LINK_SPEED_1000;
+		link_speed = ETH_SPEED_1G;
 	else if (!strcmp(res->value1, "10000"))
-		link_speed = ETH_LINK_SPEED_10000;
+		link_speed = ETH_SPEED_10G;
 	else if (!strcmp(res->value1, "40000"))
-		link_speed = ETH_LINK_SPEED_40G;
+		link_speed = ETH_SPEED_40G;
 	else if (!strcmp(res->value1, "auto"))
-		link_speed = ETH_LINK_SPEED_AUTONEG;
+		link_speed = ETH_SPEED_AUTONEG;
 	else {
 		printf("Unknown parameter\n");
 		return;
@@ -1039,7 +1039,7 @@ cmd_config_speed_specific_parsed(void *parsed_result,
 		return;
 	}
 
-	ports[res->id].dev_conf.link_speed = link_speed;
+	ports[res->id].dev_conf.link_speeds = link_speed;
 	ports[res->id].dev_conf.link_duplex = link_duplex;
 
 	cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);
diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index a538c8a..2167807 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -604,7 +604,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
 	TAILQ_INIT(&(eth_dev->link_intr_cbs));
 
 	eth_dev->data->dev_link.link_status = 0;
-	eth_dev->data->dev_link.link_speed = ETH_LINK_SPEED_10000;
+	eth_dev->data->dev_link.link_speed = ETH_SPEED_10G;
 	eth_dev->data->dev_link.link_duplex = ETH_LINK_FULL_DUPLEX;
 
 	eth_dev->data->mac_addrs = rte_zmalloc(name, ETHER_ADDR_LEN, 0);
diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c
index c0f0b99..c0097ec 100644
--- a/drivers/net/bonding/rte_eth_bond_8023ad.c
+++ b/drivers/net/bonding/rte_eth_bond_8023ad.c
@@ -708,25 +708,25 @@ link_speed_key(uint16_t speed) {
 	uint16_t key_speed;
 
 	switch (speed) {
-	case ETH_LINK_SPEED_AUTONEG:
+	case ETH_SPEED_AUTONEG:
 		key_speed = 0x00;
 		break;
-	case ETH_LINK_SPEED_10:
+	case ETH_SPEED_10M:
 		key_speed = BOND_LINK_SPEED_KEY_10M;
 		break;
-	case ETH_LINK_SPEED_100:
+	case ETH_SPEED_100M:
 		key_speed = BOND_LINK_SPEED_KEY_100M;
 		break;
-	case ETH_LINK_SPEED_1000:
+	case ETH_SPEED_1G:
 		key_speed = BOND_LINK_SPEED_KEY_1000M;
 		break;
-	case ETH_LINK_SPEED_10G:
+	case ETH_SPEED_10G:
 		key_speed = BOND_LINK_SPEED_KEY_10G;
 		break;
-	case ETH_LINK_SPEED_20G:
+	case ETH_SPEED_20G:
 		key_speed = BOND_LINK_SPEED_KEY_20G;
 		break;
-	case ETH_LINK_SPEED_40G:
+	case ETH_SPEED_40G:
 		key_speed = BOND_LINK_SPEED_KEY_40G;
 		break;
 	default:
diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index 884d2cf..2ce08f1 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -2159,13 +2159,13 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl)
 		if (stat & F_FW_PORT_CMD_TXPAUSE)
 			fc |= PAUSE_TX;
 		if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_100M))
-			speed = ETH_LINK_SPEED_100;
+			speed = ETH_SPEED_100M;
 		else if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_1G))
-			speed = ETH_LINK_SPEED_1000;
+			speed = ETH_SPEED_1G;
 		else if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_10G))
-			speed = ETH_LINK_SPEED_10000;
+			speed = ETH_SPEED_10G;
 		else if (stat & V_FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_40G))
-			speed = ETH_LINK_SPEED_40G;
+			speed = ETH_SPEED_40G;
 
 		for_each_port(adap, i) {
 			pi = adap2pinfo(adap, i);
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 912f5dd..f0216f9 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -547,8 +547,8 @@ eth_em_start(struct rte_eth_dev *dev)
 	E1000_WRITE_REG(hw, E1000_ITR, UINT16_MAX);
 
 	/* Setup link speed and duplex */
-	switch (dev->data->dev_conf.link_speed) {
-	case ETH_LINK_SPEED_AUTONEG:
+	switch (dev->data->dev_conf.link_speeds) {
+	case ETH_SPEED_AUTONEG:
 		if (dev->data->dev_conf.link_duplex == ETH_LINK_AUTONEG_DUPLEX)
 			hw->phy.autoneg_advertised = E1000_ALL_SPEED_DUPLEX;
 		else if (dev->data->dev_conf.link_duplex ==
@@ -560,7 +560,7 @@ eth_em_start(struct rte_eth_dev *dev)
 		else
 			goto error_invalid_config;
 		break;
-	case ETH_LINK_SPEED_10:
+	case ETH_SPEED_10M:
 		if (dev->data->dev_conf.link_duplex == ETH_LINK_AUTONEG_DUPLEX)
 			hw->phy.autoneg_advertised = E1000_ALL_10_SPEED;
 		else if (dev->data->dev_conf.link_duplex ==
@@ -572,7 +572,7 @@ eth_em_start(struct rte_eth_dev *dev)
 		else
 			goto error_invalid_config;
 		break;
-	case ETH_LINK_SPEED_100:
+	case ETH_SPEED_100M:
 		if (dev->data->dev_conf.link_duplex == ETH_LINK_AUTONEG_DUPLEX)
 			hw->phy.autoneg_advertised = E1000_ALL_100_SPEED;
 		else if (dev->data->dev_conf.link_duplex ==
@@ -584,7 +584,7 @@ eth_em_start(struct rte_eth_dev *dev)
 		else
 			goto error_invalid_config;
 		break;
-	case ETH_LINK_SPEED_1000:
+	case ETH_SPEED_1G:
 		if ((dev->data->dev_conf.link_duplex ==
 				ETH_LINK_AUTONEG_DUPLEX) ||
 			(dev->data->dev_conf.link_duplex ==
@@ -593,7 +593,7 @@ eth_em_start(struct rte_eth_dev *dev)
 		else
 			goto error_invalid_config;
 		break;
-	case ETH_LINK_SPEED_10000:
+	case ETH_SPEED_10G:
 	default:
 		goto error_invalid_config;
 	}
@@ -617,7 +617,7 @@ eth_em_start(struct rte_eth_dev *dev)
 
 error_invalid_config:
 	PMD_INIT_LOG(ERR, "Invalid link_speed/link_duplex (%u/%u) for port %u",
-		     dev->data->dev_conf.link_speed,
+		     dev->data->dev_conf.link_speeds,
 		     dev->data->dev_conf.link_duplex, dev->data->port_id);
 	em_dev_clear_queues(dev);
 	return (-EINVAL);
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index c7e6d55..25f1755 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -994,8 +994,8 @@ eth_igb_start(struct rte_eth_dev *dev)
 	}
 
 	/* Setup link speed and duplex */
-	switch (dev->data->dev_conf.link_speed) {
-	case ETH_LINK_SPEED_AUTONEG:
+	switch (dev->data->dev_conf.link_speeds) {
+	case ETH_SPEED_AUTONEG:
 		if (dev->data->dev_conf.link_duplex == ETH_LINK_AUTONEG_DUPLEX)
 			hw->phy.autoneg_advertised = E1000_ALL_SPEED_DUPLEX;
 		else if (dev->data->dev_conf.link_duplex == ETH_LINK_HALF_DUPLEX)
@@ -1005,7 +1005,7 @@ eth_igb_start(struct rte_eth_dev *dev)
 		else
 			goto error_invalid_config;
 		break;
-	case ETH_LINK_SPEED_10:
+	case ETH_SPEED_10M:
 		if (dev->data->dev_conf.link_duplex == ETH_LINK_AUTONEG_DUPLEX)
 			hw->phy.autoneg_advertised = E1000_ALL_10_SPEED;
 		else if (dev->data->dev_conf.link_duplex == ETH_LINK_HALF_DUPLEX)
@@ -1015,7 +1015,7 @@ eth_igb_start(struct rte_eth_dev *dev)
 		else
 			goto error_invalid_config;
 		break;
-	case ETH_LINK_SPEED_100:
+	case ETH_SPEED_100M:
 		if (dev->data->dev_conf.link_duplex == ETH_LINK_AUTONEG_DUPLEX)
 			hw->phy.autoneg_advertised = E1000_ALL_100_SPEED;
 		else if (dev->data->dev_conf.link_duplex == ETH_LINK_HALF_DUPLEX)
@@ -1025,14 +1025,14 @@ eth_igb_start(struct rte_eth_dev *dev)
 		else
 			goto error_invalid_config;
 		break;
-	case ETH_LINK_SPEED_1000:
+	case ETH_SPEED_1G:
 		if ((dev->data->dev_conf.link_duplex == ETH_LINK_AUTONEG_DUPLEX) ||
 				(dev->data->dev_conf.link_duplex == ETH_LINK_FULL_DUPLEX))
 			hw->phy.autoneg_advertised = ADVERTISE_1000_FULL;
 		else
 			goto error_invalid_config;
 		break;
-	case ETH_LINK_SPEED_10000:
+	case ETH_SPEED_10G:
 	default:
 		goto error_invalid_config;
 	}
@@ -1068,7 +1068,7 @@ eth_igb_start(struct rte_eth_dev *dev)
 
 error_invalid_config:
 	PMD_INIT_LOG(ERR, "Invalid link_speed/link_duplex (%u/%u) for port %u",
-		     dev->data->dev_conf.link_speed,
+		     dev->data->dev_conf.link_speeds,
 		     dev->data->dev_conf.link_duplex, dev->data->port_id);
 	igb_dev_clear_queues(dev);
 	return (-EINVAL);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 40b0526..8f340cd 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -840,19 +840,19 @@ i40e_parse_link_speed(uint16_t eth_link_speed)
 	uint8_t link_speed = I40E_LINK_SPEED_UNKNOWN;
 
 	switch (eth_link_speed) {
-	case ETH_LINK_SPEED_40G:
+	case ETH_SPEED_40G:
 		link_speed = I40E_LINK_SPEED_40GB;
 		break;
-	case ETH_LINK_SPEED_20G:
+	case ETH_SPEED_20G:
 		link_speed = I40E_LINK_SPEED_20GB;
 		break;
-	case ETH_LINK_SPEED_10G:
+	case ETH_SPEED_10G:
 		link_speed = I40E_LINK_SPEED_10GB;
 		break;
-	case ETH_LINK_SPEED_1000:
+	case ETH_SPEED_1G:
 		link_speed = I40E_LINK_SPEED_1GB;
 		break;
-	case ETH_LINK_SPEED_100:
+	case ETH_SPEED_100M:
 		link_speed = I40E_LINK_SPEED_100MB;
 		break;
 	}
@@ -924,9 +924,9 @@ i40e_apply_link_speed(struct rte_eth_dev *dev)
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
 
-	speed = i40e_parse_link_speed(conf->link_speed);
+	speed = i40e_parse_link_speed(conf->link_speeds);
 	abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
-	if (conf->link_speed == ETH_LINK_SPEED_AUTONEG)
+	if (conf->link_speeds == ETH_SPEED_AUTONEG)
 		abilities |= I40E_AQ_PHY_AN_ENABLED;
 	else
 		abilities |= I40E_AQ_PHY_LINK_ENABLED;
@@ -1209,7 +1209,7 @@ i40e_dev_link_update(struct rte_eth_dev *dev,
 		/* Get link status information from hardware */
 		status = i40e_aq_get_link_info(hw, false, &link_status, NULL);
 		if (status != I40E_SUCCESS) {
-			link.link_speed = ETH_LINK_SPEED_100;
+			link.link_speed = ETH_SPEED_100M;
 			link.link_duplex = ETH_LINK_FULL_DUPLEX;
 			PMD_DRV_LOG(ERR, "Failed to get link info");
 			goto out;
@@ -1231,22 +1231,22 @@ i40e_dev_link_update(struct rte_eth_dev *dev,
 	/* Parse the link status */
 	switch (link_status.link_speed) {
 	case I40E_LINK_SPEED_100MB:
-		link.link_speed = ETH_LINK_SPEED_100;
+		link.link_speed = ETH_SPEED_100M;
 		break;
 	case I40E_LINK_SPEED_1GB:
-		link.link_speed = ETH_LINK_SPEED_1000;
+		link.link_speed = ETH_SPEED_1G;
 		break;
 	case I40E_LINK_SPEED_10GB:
-		link.link_speed = ETH_LINK_SPEED_10G;
+		link.link_speed = ETH_SPEED_10G;
 		break;
 	case I40E_LINK_SPEED_20GB:
-		link.link_speed = ETH_LINK_SPEED_20G;
+		link.link_speed = ETH_SPEED_20G;
 		break;
 	case I40E_LINK_SPEED_40GB:
-		link.link_speed = ETH_LINK_SPEED_40G;
+		link.link_speed = ETH_SPEED_40G;
 		break;
 	default:
-		link.link_speed = ETH_LINK_SPEED_100;
+		link.link_speed = ETH_SPEED_100M;
 		break;
 	}
 
@@ -6185,15 +6185,15 @@ i40e_timesync_enable(struct rte_eth_dev *dev)
 	uint32_t tsync_inc_h;
 
 	switch (link->link_speed) {
-	case ETH_LINK_SPEED_40G:
+	case ETH_SPEED_40G:
 		tsync_inc_l = I40E_PTP_40GB_INCVAL & 0xFFFFFFFF;
 		tsync_inc_h = I40E_PTP_40GB_INCVAL >> 32;
 		break;
-	case ETH_LINK_SPEED_10G:
+	case ETH_SPEED_10G:
 		tsync_inc_l = I40E_PTP_10GB_INCVAL & 0xFFFFFFFF;
 		tsync_inc_h = I40E_PTP_10GB_INCVAL >> 32;
 		break;
-	case ETH_LINK_SPEED_1000:
+	case ETH_SPEED_1G:
 		tsync_inc_l = I40E_PTP_1GB_INCVAL & 0xFFFFFFFF;
 		tsync_inc_h = I40E_PTP_1GB_INCVAL >> 32;
 		break;
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index b694400..91a279e 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1640,7 +1640,7 @@ i40evf_dev_link_update(struct rte_eth_dev *dev,
 	else {
 		/* Always assume it's up, for Linux driver PF host */
 		new_link.link_duplex = ETH_LINK_AUTONEG_DUPLEX;
-		new_link.link_speed  = ETH_LINK_SPEED_10000;
+		new_link.link_speed  = ETH_SPEED_10G;
 		new_link.link_status = 1;
 	}
 	i40evf_dev_atomic_write_link_status(dev, &new_link);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index b8ee1e9..9b65d81 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1783,28 +1783,28 @@ ixgbe_dev_start(struct rte_eth_dev *dev)
 	if (err)
 		goto error;
 
-	switch(dev->data->dev_conf.link_speed) {
-	case ETH_LINK_SPEED_AUTONEG:
+	switch(dev->data->dev_conf.link_speeds) {
+	case ETH_SPEED_AUTONEG:
 		speed = (hw->mac.type != ixgbe_mac_82598EB) ?
 				IXGBE_LINK_SPEED_82599_AUTONEG :
 				IXGBE_LINK_SPEED_82598_AUTONEG;
 		break;
-	case ETH_LINK_SPEED_100:
+	case ETH_SPEED_100M:
 		/*
 		 * Invalid for 82598 but error will be detected by
 		 * ixgbe_setup_link()
 		 */
 		speed = IXGBE_LINK_SPEED_100_FULL;
 		break;
-	case ETH_LINK_SPEED_1000:
+	case ETH_SPEED_1G:
 		speed = IXGBE_LINK_SPEED_1GB_FULL;
 		break;
-	case ETH_LINK_SPEED_10000:
+	case ETH_SPEED_10G:
 		speed = IXGBE_LINK_SPEED_10GB_FULL;
 		break;
 	default:
 		PMD_INIT_LOG(ERR, "Invalid link_speed (%hu) for port %hhu",
-			     dev->data->dev_conf.link_speed,
+			     dev->data->dev_conf.link_speeds,
 			     dev->data->port_id);
 		goto error;
 	}
@@ -2494,7 +2494,7 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 		diag = ixgbe_check_link(hw, &link_speed, &link_up, 1);
 
 	if (diag != 0) {
-		link.link_speed = ETH_LINK_SPEED_100;
+		link.link_speed = ETH_SPEED_100M;
 		link.link_duplex = ETH_LINK_HALF_DUPLEX;
 		rte_ixgbe_dev_atomic_write_link_status(dev, &link);
 		if (link.link_status == old.link_status)
@@ -2515,19 +2515,19 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	default:
 	case IXGBE_LINK_SPEED_UNKNOWN:
 		link.link_duplex = ETH_LINK_HALF_DUPLEX;
-		link.link_speed = ETH_LINK_SPEED_100;
+		link.link_speed = ETH_SPEED_100M;
 		break;
 
 	case IXGBE_LINK_SPEED_100_FULL:
-		link.link_speed = ETH_LINK_SPEED_100;
+		link.link_speed = ETH_SPEED_100M;
 		break;
 
 	case IXGBE_LINK_SPEED_1GB_FULL:
-		link.link_speed = ETH_LINK_SPEED_1000;
+		link.link_speed = ETH_SPEED_1G;
 		break;
 
 	case IXGBE_LINK_SPEED_10GB_FULL:
-		link.link_speed = ETH_LINK_SPEED_10000;
+		link.link_speed = ETH_SPEED_10G;
 		break;
 	}
 	rte_ixgbe_dev_atomic_write_link_status(dev, &link);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index a70be5c..017241c 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -699,7 +699,7 @@ vmxnet3_dev_link_update(struct rte_eth_dev *dev, __attribute__((unused)) int wai
 	if (ret & 0x1) {
 		link.link_status = 1;
 		link.link_duplex = ETH_LINK_FULL_DUPLEX;
-		link.link_speed = ETH_LINK_SPEED_10000;
+		link.link_speed = ETH_SPEED_1G;
 	}
 
 	vmxnet3_dev_atomic_write_link_status(dev, &link);
diff --git a/examples/ip_pipeline/config_parse.c b/examples/ip_pipeline/config_parse.c
index c9b78f9..61f45df 100644
--- a/examples/ip_pipeline/config_parse.c
+++ b/examples/ip_pipeline/config_parse.c
@@ -83,7 +83,7 @@ static const struct app_link_params link_params_default = {
 	.mac_addr = 0,
 
 	.conf = {
-		.link_speed = 0,
+		.link_speeds = 0,
 		.link_duplex = 0,
 		.rxmode = {
 			.mq_mode = ETH_MQ_RX_NONE,
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 544afe0..641207f 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -238,23 +238,37 @@ struct rte_eth_stats {
 };
 
 /**
+ * Device supported speeds
+ */
+#define ETH_SPEED_AUTONEG	(0 << 0)  /*< Autonegociate speed  */
+#define ETH_SPEED_UNKNOWN	(0 << 0)  /*< No phy media  */
+#define ETH_SPEED_10M_HD	(1 << 0)  /*< 10 Mbps half-duplex */
+#define ETH_SPEED_10M		(1 << 1)  /*< 10 Mbps full-duplex */
+#define ETH_SPEED_100M_HD	(1 << 2)  /*< 100 Mbps half-duplex */
+#define ETH_SPEED_100M		(1 << 3)  /*< 100 Mbps full-duplex */
+#define ETH_SPEED_1G		(1 << 4)  /*< 1 Gbps */
+#define ETH_SPEED_2_5G		(1 << 5)  /*< 2.5 Gbps */
+#define ETH_SPEED_5G		(1 << 6)  /*< 5 Gbps */
+#define ETH_SPEED_10G		(1 << 7)  /*< 10 Mbps */
+#define ETH_SPEED_20G		(1 << 8)  /*< 20 Gbps */
+#define ETH_SPEED_25G		(1 << 9)  /*< 25 Gbps */
+#define ETH_SPEED_40G		(1 << 10)  /*< 40 Gbps */
+#define ETH_SPEED_50G		(1 << 11)  /*< 50 Gbps */
+#define ETH_SPEED_56G		(1 << 12)  /*< 56 Gbps */
+#define ETH_SPEED_100G		(1 << 13)  /*< 100 Gbps */
+
+/**
  * A structure used to retrieve link-level information of an Ethernet port.
  */
 struct rte_eth_link {
-	uint16_t link_speed;      /**< ETH_LINK_SPEED_[10, 100, 1000, 10000] */
+	uint16_t link_speed;      /**< Link speed ETH_SPEED_ */
 	uint16_t link_duplex;     /**< ETH_LINK_[HALF_DUPLEX, FULL_DUPLEX] */
 	uint8_t  link_status : 1; /**< 1 -> link up, 0 -> link down */
 }__attribute__((aligned(8)));     /**< aligned for atomic64 read/write */
 
-#define ETH_LINK_SPEED_AUTONEG  0       /**< Auto-negotiate link speed. */
-#define ETH_LINK_SPEED_10       10      /**< 10 megabits/second. */
-#define ETH_LINK_SPEED_100      100     /**< 100 megabits/second. */
-#define ETH_LINK_SPEED_1000     1000    /**< 1 gigabits/second. */
-#define ETH_LINK_SPEED_10000    10000   /**< 10 gigabits/second. */
-#define ETH_LINK_SPEED_10G      10000   /**< alias of 10 gigabits/second. */
-#define ETH_LINK_SPEED_20G      20000   /**< 20 gigabits/second. */
-#define ETH_LINK_SPEED_40G      40000   /**< 40 gigabits/second. */
-
+/**
+ * Device link status
+ */
 #define ETH_LINK_AUTONEG_DUPLEX 0       /**< Auto-negotiate duplex. */
 #define ETH_LINK_HALF_DUPLEX    1       /**< Half-duplex connection. */
 #define ETH_LINK_FULL_DUPLEX    2       /**< Full-duplex connection. */
@@ -857,8 +871,8 @@ struct rte_intr_conf {
  * configuration settings may be needed.
  */
 struct rte_eth_conf {
-	uint16_t link_speed;
-	/**< ETH_LINK_SPEED_10[0|00|000], or 0 for autonegotation */
+	uint16_t link_speeds;
+	/**< bitmap of ETH_SPEED_XXX to be announced or 0 for autonegotation */
 	uint16_t link_duplex;
 	/**< ETH_LINK_[HALF_DUPLEX|FULL_DUPLEX], or 0 for autonegotation */
 	struct rte_eth_rxmode rxmode; /**< Port RX configuration. */
@@ -921,6 +935,9 @@ struct rte_eth_conf {
 #define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000080 /**< Used for tunneling packet. */
 #define DEV_TX_OFFLOAD_QINQ_INSERT 0x00000100
 
+/**
+ * Ethernet device information
+ */
 struct rte_eth_dev_info {
 	struct rte_pci_device *pci_dev; /**< Device PCI information. */
 	const char *driver_name; /**< Device Driver name. */
@@ -947,6 +964,7 @@ struct rte_eth_dev_info {
 	uint16_t vmdq_queue_base; /**< First queue ID for VMDQ pools. */
 	uint16_t vmdq_queue_num;  /**< Queue number for VMDQ pools. */
 	uint16_t vmdq_pool_base;  /**< First ID of VMDQ pools. */
+	uint32_t speed_capa;  /**< Supported speeds bitmap (ETH_SPEED_XXX). */
 };
 
 /** Maximum name length for extended statistics counters */
-- 
2.1.4

  reply	other threads:[~2015-08-29  0:16 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11 23:45 [dpdk-dev] [RFC PATCH 0/2] ethdev: add port speed capability bitmap Marc Sune
2015-05-11 23:45 ` [dpdk-dev] [RFC PATCH 1/2] Added ETH_SPEED_CAP bitmap in rte_eth_dev_info Marc Sune
2015-05-25 17:46   ` Stephen Hemminger
2015-05-26  8:41     ` Marc Sune
2015-05-26 15:03   ` Stephen Hemminger
2015-05-26 15:09     ` Marc Sune
2015-05-11 23:45 ` [dpdk-dev] [RFC PATCH 2/2] Filling speed capability bitmaps in the PMDs Marc Sune
2015-05-25 16:32 ` [dpdk-dev] [RFC PATCH 0/2] ethdev: add port speed capability bitmap Marc Sune
2015-05-26 19:50 ` [dpdk-dev] [PATCH v2 " Marc Sune
2015-05-26 19:50   ` [dpdk-dev] [PATCH v2 1/2] Added ETH_SPEED_CAP bitmap in rte_eth_dev_info Marc Sune
2015-05-27  4:02     ` Thomas Monjalon
2015-05-27  9:15       ` Marc Sune
2015-05-29 18:23         ` Thomas Monjalon
2015-06-08  8:50           ` Marc Sune
2015-06-11  9:08             ` Thomas Monjalon
2015-06-11 14:35               ` Marc Sune
2015-05-26 19:50   ` [dpdk-dev] [PATCH v2 2/2] Filling speed capability bitmaps in the PMDs Marc Sune
2015-05-26 21:20     ` Igor Ryzhov
2015-05-27  8:59       ` Marc Sune
2015-08-28 23:20   ` [dpdk-dev] [PATCH v3 0/2] ethdev: add port speed capability bitmap Marc Sune
2015-08-28 23:20     ` [dpdk-dev] [PATCH v3 1/2] Added ETH_SPEED_ bitmap in rte_eth_dev_info Marc Sune
2015-08-28 23:20     ` [dpdk-dev] [PATCH v3 2/2] Filling speed capability bitmaps in the PMDs Marc Sune
2015-08-29  0:16     ` [dpdk-dev] [PATCH v4 0/2] ethdev: add port speed capability bitmap Marc Sune
2015-08-29  0:16       ` Marc Sune [this message]
2015-08-29  0:16       ` [dpdk-dev] [PATCH v4 2/2] Filling speed capability bitmaps in the PMDs Marc Sune
2015-09-07 20:52       ` [dpdk-dev] [PATCH v4 0/2] ethdev: add port speed capability bitmap Marc Sune
2015-09-08 10:03         ` Nélio Laranjeiro
2015-09-08 20:26           ` Marc Sune
2015-09-09 13:10           ` Nélio Laranjeiro
2015-09-09 13:33             ` Thomas Monjalon
2015-09-13 19:14               ` Marc Sune
2015-09-13 21:18                 ` Thomas Monjalon
2015-09-14 10:02                   ` Nélio Laranjeiro
2015-09-14 10:52                   ` Morten Brørup
2015-09-14 21:33                     ` Marc Sune
2015-09-14 22:50                       ` Morten Brørup
2015-09-15  8:25                         ` Nélio Laranjeiro
2015-09-15  8:48                           ` Marc Sune
2015-09-15  9:39                             ` Morten Brørup
2015-09-15 10:04                             ` Adrien Mazarguil
2015-09-15 10:24                               ` Morten Brørup
2015-09-15 21:20                               ` Marc Sune
2015-09-16 14:41                                 ` Adrien Mazarguil
2015-09-15  7:05                       ` Thomas Monjalon
2015-09-15  7:33                         ` Morten Brørup
2015-09-15  9:06                       ` Morten Brørup
2015-10-04 21:12       ` [dpdk-dev] [PATCH v5 0/4] ethdev: add speed capabilities and refactor link API Marc Sune
2015-10-04 21:12         ` [dpdk-dev] [PATCH v5 1/4] ethdev: Added ETH_SPEED_CAP bitmap for ports Marc Sune
2015-10-04 21:12         ` [dpdk-dev] [PATCH v5 2/4] ethdev: Fill speed capability bitmaps in the PMDs Marc Sune
2015-10-04 21:12         ` [dpdk-dev] [PATCH v5 3/4] ethdev: redesign link speed config API Marc Sune
2015-10-05 10:59           ` Neil Horman
2015-10-07 13:31             ` Marc Sune
2015-10-06 13:48           ` Nélio Laranjeiro
2015-10-07 13:37             ` Marc Sune
2016-01-28 17:33           ` Harish Patil
2016-02-02  2:20             ` Stephen Hemminger
2016-02-02 22:30               ` Marc
2016-02-11 15:27                 ` Nélio Laranjeiro
2016-02-11 23:23                   ` Marc
2015-10-04 21:12         ` [dpdk-dev] [PATCH v5 4/4] doc: update with link changes Marc Sune
2015-10-04 21:21         ` [dpdk-dev] [PATCH v5 0/4] ethdev: add speed capabilities and refactor link API Marc Sune

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1440807373-24770-2-git-send-email-marc.sune@bisdn.de \
    --to=marcdevel@gmail.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).