From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by dpdk.org (Postfix) with ESMTP id 8681E8D3D for ; Sat, 29 Aug 2015 01:20:28 +0200 (CEST) Received: by wicfv10 with SMTP id fv10so24077556wic.0 for ; Fri, 28 Aug 2015 16:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A+NhHIHdUnF7+N1SiSaq6TRLXndpHwz3scAbwfR60d0=; b=Nh7WXfNiYlE6aoXtRwOCocpxioaV9fwcfgo8ET6JZn4Z3o0iFYz2dZf+AEeW+lNUrI TG/ZXlccEaxBzdHtmDT1WEubRlTcyeHAasafMIYGzJ++FWX25XrJ+6Gzkch3zDoJ6lNC +r52wt8cuscJnBCTgZgbhDrF3985N6nJ7Eb8iS6VZIoZUO9TxsEvLzA7BRigMueVULFy GwQnEeKPVDaBI1DPqhgor1rnmJLYl4R8aOWeFyqK7V6R/0mq5mH1Oe0xET1LZc8cb958 4/KdnRgndyI60dotfTOLVEhN6LgHNM8GRccmSsCgQZT1QgQLnEkRmt6Wo6LPlqDCKtAI soUA== X-Received: by 10.194.121.131 with SMTP id lk3mr13264873wjb.77.1440804028401; Fri, 28 Aug 2015 16:20:28 -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 r8sm5868803wik.16.2015.08.28.16.20.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Aug 2015 16:20:27 -0700 (PDT) From: Marc Sune X-Google-Original-From: Marc Sune To: dev@dpdk.org Date: Sat, 29 Aug 2015 01:20:13 +0200 Message-Id: <1440804014-30815-2-git-send-email-marc.sune@bisdn.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1440804014-30815-1-git-send-email-marc.sune@bisdn.de> References: <1432669843-15672-1-git-send-email-marc.sune@bisdn.de> <1440804014-30815-1-git-send-email-marc.sune@bisdn.de> Cc: Marc Sune Subject: [dpdk-dev] [PATCH v3 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: Fri, 28 Aug 2015 23:20:28 -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_link 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. Driver do not support yet this capabilities. 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/e1000/em_ethdev.c | 14 +++++------ drivers/net/e1000/igb_ethdev.c | 14 +++++------ drivers/net/i40e/i40e_ethdev.c | 28 ++++++++++----------- drivers/net/i40e/i40e_ethdev_vf.c | 2 +- drivers/net/ixgbe/ixgbe_ethdev.c | 22 ++++++++-------- drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +- lib/librte_ether/rte_ethdev.h | 42 ++++++++++++++++++++++--------- 10 files changed, 95 insertions(+), 77 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 8142910..8e131c7 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -898,7 +898,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; @@ -908,17 +908,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; @@ -936,7 +936,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; } @@ -995,7 +995,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()) { @@ -1007,17 +1007,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; @@ -1034,7 +1034,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 97a828e..202d811 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/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index a306c55..5ca1830 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -508,8 +508,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 == @@ -521,7 +521,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 == @@ -533,7 +533,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 == @@ -545,7 +545,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 == @@ -554,7 +554,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; } @@ -576,7 +576,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 24c7510..7c5e952 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -857,8 +857,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) @@ -868,7 +868,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) @@ -878,7 +878,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) @@ -888,14 +888,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; } @@ -914,7 +914,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 2ada502..056b081 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -756,19 +756,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; } @@ -840,9 +840,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; @@ -1104,7 +1104,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; @@ -1126,22 +1126,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; } diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index f7332e7..013e358 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1592,7 +1592,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 7414a2e..b2fcffc 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1534,28 +1534,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; } @@ -2134,7 +2134,7 @@ ixgbe_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete) else 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) @@ -2161,19 +2161,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 59e3122..15af283 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -664,7 +664,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_10G; rte_vmxnet3_dev_atomic_write_link_status(dev, &link); diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 04c192d..39ba789 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -227,23 +227,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; /**< ETH_SPEED_ bitmap (announce speeds) */ 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. */ @@ -838,8 +852,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. */ @@ -900,6 +914,9 @@ struct rte_eth_conf { #define DEV_TX_OFFLOAD_UDP_TSO 0x00000040 #define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000080 /**< Used for tunneling packet. */ +/** + * Ethernet device information + */ struct rte_eth_dev_info { struct rte_pci_device *pci_dev; /**< Device PCI information. */ const char *driver_name; /**< Device Driver name. */ @@ -925,6 +942,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