From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by dpdk.org (Postfix) with ESMTP id 093E68DA2 for ; Sat, 29 Aug 2015 02:16:22 +0200 (CEST) Received: by wicfv10 with SMTP id fv10so24658775wic.0 for ; Fri, 28 Aug 2015 17:16:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=OW7iD5T5PeNWh1+1kh6ApF/w3UIaWLflos2+33OC1BU=; b=oiCal9gt4j8Q9M2h7JViLbMeeYHvzfRb5ptxNfFg2Fv47Bv47uA5fhtXPJ01sTOOiS 3BoCVwH3JIfUhxjone0NbqBA2UWotDT7yEyHpTaBg6MiKkpfp75hR93KlHbPyYphAezk gW/LYV2V367SQsH9Uo049EAZadcnljWFo19hR/B5xEpzh+NAO9+tlCR0bdjyvqAhNN9Q 9qtlykJC5B3u09z46typhBd9XfCl2jwOvthaZXkkAGbQx2k1BGOgOhulDgahwYlnHAN1 AblSovnDbEBY87En4AUGALvgRWUzgAJEaSUwL6J0P1Xqo2yXrY4lZA12pY/3aCR0ZCso tQbg== X-Received: by 10.194.86.134 with SMTP id p6mr14968089wjz.71.1440807381912; Fri, 28 Aug 2015 17:16:21 -0700 (PDT) Received: from localhost.localdomain (103.Red-83-55-239.dynamicIP.rima-tde.net. [83.55.239.103]) by smtp.gmail.com with ESMTPSA id ev2sm6031154wib.21.2015.08.28.17.16.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Aug 2015 17:16:21 -0700 (PDT) From: Marc Sune X-Google-Original-From: Marc Sune To: dev@dpdk.org Date: Sat, 29 Aug 2015 02:16:12 +0200 Message-Id: <1440807373-24770-2-git-send-email-marc.sune@bisdn.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1440807373-24770-1-git-send-email-marc.sune@bisdn.de> References: <1440804014-30815-1-git-send-email-marc.sune@bisdn.de> <1440807373-24770-1-git-send-email-marc.sune@bisdn.de> Subject: [dpdk-dev] [PATCH v4 1/2] Added ETH_SPEED_ bitmap in rte_eth_dev_info 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: Sat, 29 Aug 2015 00:16:22 -0000 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 --- 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