[dpdk-dev] rte_eth_rx_burst only returns up to 32 packets

2015-08-29 Thread Vladislav Zolotarov
On Aug 29, 2015 16:55, "Masood Moshref Javadi" 
wrote:
>
> Thanks a lot.
>
> So I assume the only way to see if there are more than 256 packets in the
> queue is to count them using rte_eth_rx_count

Sorry for bulging in but i think Masood rose a very important general
question here, which is: how do i check if there are more pending packets
in the PMD Rx queue without actually polling them (out)?

As far as i see it the short answer is you can't. Or more specifically -
you shouldn't. Because if it happens that your code depends on it - it most
likely doesn't fit the PMD model.

The thing is that u can actually go and query the Rx ring about the number
of pending packets but the truth is that by the time u get this query
result it may already be wrong since new packets have arrived.

The only correct way to deal with PMD Rx queue is to actually go and poll
for new packets: if there are some - handle them and if there aren't any -
poll again.

This is my understanding of this.

Thanks,
Vlad

> On Aug 28, 2015 8:32 PM, "Gaohaifeng (A)" 
wrote:
>
> > Please see  _rece_raw_pkts_vec function.
> >
> > Here is part of its comments may explain this question
> > /*
> >  * vPMD receive routine, now only accept (nb_pkts ==
> > RTE_IXGBE_VPMD_RX_BURST)
> >  * in one loop
> >  *
> >  * Notice:
> >  * - nb_pkts < RTE_IXGBE_VPMD_RX_BURST, just return no packet
> >  * - nb_pkts > RTE_IXGBE_VPMD_RX_BURST, only scan
RTE_IXGBE_VPMD_RX_BURST
> >  *   numbers of DD bit
> > */
> >
> >
> >
> > Hi,
> >
> > The documentation of this method says: Applications implementing a
> > "retrieve as much received packets as possible" policy can check this
> > specific case and keep invoking the rte_eth_rx_burst() <
> >
http://dpdk.org/doc/api/rte__ethdev_8h.html#aee7daffe261e67355a78b106627c4c45
> > >function
> > until a value less than nb_pkts is returned.
> >
> > But the function returns at most 32 packets regardless of the burst size
> > parameter (nb_pkts). For example when I set the burst size to 256, it
only
> > returns 32 packets even though the queue has more packets. This means
that
> > I cannot rely on the returned value to know if there are >
> > 256 packets in the queue or not.
> >
> > Where this number 32 comes from? Is it because "PMD:
> > ixgbe_set_rx_function(): Vector rx enabled, please make sure RX burst
size
> > no less than 32." ?
> >
> > I use DPDK 2.0.0 and Intel 82599 10 G NIC.
> >
> > Thanks
> >


[dpdk-dev] rte_eth_rx_burst only returns up to 32 packets

2015-08-29 Thread Masood Moshref Javadi
Thanks a lot.

So I assume the only way to see if there are more than 256 packets in the
queue is to count them using rte_eth_rx_count
On Aug 28, 2015 8:32 PM, "Gaohaifeng (A)"  wrote:

> Please see  _rece_raw_pkts_vec function.
>
> Here is part of its comments may explain this question
> /*
>  * vPMD receive routine, now only accept (nb_pkts ==
> RTE_IXGBE_VPMD_RX_BURST)
>  * in one loop
>  *
>  * Notice:
>  * - nb_pkts < RTE_IXGBE_VPMD_RX_BURST, just return no packet
>  * - nb_pkts > RTE_IXGBE_VPMD_RX_BURST, only scan RTE_IXGBE_VPMD_RX_BURST
>  *   numbers of DD bit
> */
>
>
>
> Hi,
>
> The documentation of this method says: Applications implementing a
> "retrieve as much received packets as possible" policy can check this
> specific case and keep invoking the rte_eth_rx_burst() <
> http://dpdk.org/doc/api/rte__ethdev_8h.html#aee7daffe261e67355a78b106627c4c45
> >function
> until a value less than nb_pkts is returned.
>
> But the function returns at most 32 packets regardless of the burst size
> parameter (nb_pkts). For example when I set the burst size to 256, it only
> returns 32 packets even though the queue has more packets. This means that
> I cannot rely on the returned value to know if there are >
> 256 packets in the queue or not.
>
> Where this number 32 comes from? Is it because "PMD:
> ixgbe_set_rx_function(): Vector rx enabled, please make sure RX burst size
> no less than 32." ?
>
> I use DPDK 2.0.0 and Intel 82599 10 G NIC.
>
> Thanks
>


[dpdk-dev] rte_eth_rx_burst only returns up to 32 packets

2015-08-29 Thread Gaohaifeng (A)
Please see  _rece_raw_pkts_vec function.

Here is part of its comments may explain this question
/*
 * vPMD receive routine, now only accept (nb_pkts == RTE_IXGBE_VPMD_RX_BURST)
 * in one loop
 *
 * Notice:
 * - nb_pkts < RTE_IXGBE_VPMD_RX_BURST, just return no packet
 * - nb_pkts > RTE_IXGBE_VPMD_RX_BURST, only scan RTE_IXGBE_VPMD_RX_BURST
 *   numbers of DD bit
*/



Hi,

The documentation of this method says: Applications implementing a "retrieve as 
much received packets as possible" policy can check this specific case and keep 
invoking the rte_eth_rx_burst() 
function
until a value less than nb_pkts is returned.

But the function returns at most 32 packets regardless of the burst size 
parameter (nb_pkts). For example when I set the burst size to 256, it only 
returns 32 packets even though the queue has more packets. This means that I 
cannot rely on the returned value to know if there are >
256 packets in the queue or not.

Where this number 32 comes from? Is it because "PMD: 
ixgbe_set_rx_function(): Vector rx enabled, please make sure RX burst size no 
less than 32." ?

I use DPDK 2.0.0 and Intel 82599 10 G NIC.

Thanks


[dpdk-dev] [PATCH v4 1/2] Added ETH_SPEED_ bitmap in rte_eth_dev_info

2015-08-29 Thread Marc Sune
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, "1"))
-   link_speed = ETH_LINK_SPEED_10G;
+   link_speed = ETH_SPEED_10G;
else if (!strcmp(res->value1, "4"))
-   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, "1"))
-   link_speed = ETH_LINK_SPEED_1;
+   link_speed = ETH_SPEED_10G;
else if (!strcmp(res->value1, "4"))
-   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 

[dpdk-dev] [PATCH v4 0/2] ethdev: add port speed capability bitmap

2015-08-29 Thread Marc Sune
The current rte_eth_dev_info abstraction does not provide any mechanism to
get the supported speed(s) of an ethdev.

For some drivers (e.g. ixgbe), an educated guess can be done based on the
driver's name (driver_name in rte_eth_dev_info), see:

http://dpdk.org/ml/archives/dev/2013-August/000412.html

However, i) doing string comparisons is annoying, and can silently
break existing applications if PMDs change their names ii) it does not
provide all the supported capabilities of the ethdev iii) for some drivers it
is impossible determine correctly the (max) speed by the application
(e.g. in i40, distinguish between XL710 and X710).

This small patch adds speed_capa bitmap in rte_eth_dev_info, which is filled
by the PMDs according to the physical device capabilities.

v2: rebase, converted speed_capa into 32 bits bitmap, fixed alignment
(checkpatch).

v3: rebase to v2.1. unified ETH_LINK_SPEED and ETH_SPEED_CAP into ETH_SPEED.
Converted field speed in struct rte_eth_conf to speeds, to allow a bitmap
for defining the announced speeds, as suggested by M. Brorup. Fixed
spelling issues.

v4: fixed errata in the documentation of field speeds of rte_eth_conf, and
commit 1/2 message. rebased to v2.1.0. v3 was incorrectly based on
~2.1.0-rc1.

Marc Sune (2):
  Added ETH_SPEED_ bitmap in rte_eth_dev_info
  Filling speed capability bitmaps in the PMDs

 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 | 20 +-
 drivers/net/e1000/igb_ethdev.c| 20 +-
 drivers/net/fm10k/fm10k_ethdev.c  |  3 +++
 drivers/net/i40e/i40e_ethdev.c| 43 +++
 drivers/net/i40e/i40e_ethdev_vf.c |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c  | 32 +++
 drivers/net/mlx4/mlx4.c   |  6 +
 drivers/net/vmxnet3/vmxnet3_ethdev.c  |  2 +-
 lib/librte_ether/rte_ethdev.h | 42 +-
 13 files changed, 142 insertions(+), 84 deletions(-)

-- 
2.1.4



[dpdk-dev] [PATCH v3 2/2] Filling speed capability bitmaps in the PMDs

2015-08-29 Thread Marc Sune
Added speed capabilities to all pmds supporting physical NICs:

* e1000
* ixgbe
* i40
* mlx4
* fm10k

Signed-off-by: Marc Sune 
---
 drivers/net/e1000/em_ethdev.c|  6 ++
 drivers/net/e1000/igb_ethdev.c   |  6 ++
 drivers/net/fm10k/fm10k_ethdev.c |  3 +++
 drivers/net/i40e/i40e_ethdev.c   |  9 +
 drivers/net/ixgbe/ixgbe_ethdev.c | 10 ++
 drivers/net/mlx4/mlx4.c  |  6 ++
 6 files changed, 40 insertions(+)

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 5ca1830..cd64843 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -888,6 +888,12 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)

dev_info->max_rx_queues = 1;
dev_info->max_tx_queues = 1;
+
+   dev_info->speed_capa = ETH_SPEED_10M_HD |
+   ETH_SPEED_10M |
+   ETH_SPEED_100M_HD |
+   ETH_SPEED_100M |
+   ETH_SPEED_1G;
 }

 /* return 0 means link status changed, -1 means not changed */
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 7c5e952..d511400 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1404,6 +1404,12 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
},
.txq_flags = 0,
};
+
+   dev_info->speed_capa = ETH_SPEED_10M_HD |
+   ETH_SPEED_10M |
+   ETH_SPEED_100M_HD |
+   ETH_SPEED_100M |
+   ETH_SPEED_1G;
 }

 static void
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 4afd5ab..40b1dd1 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -791,6 +791,9 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
ETH_TXQ_FLAGS_NOOFFLOADS,
};

+   dev_info->speed_capa = ETH_SPEED_1G | ETH_SPEED_2_5G |
+   ETH_SPEED_10G | ETH_SPEED_25G |
+   ETH_SPEED_40G | ETH_SPEED_100G;
 }

 static int
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 056b081..87b1840 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1519,6 +1519,7 @@ static void
 i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+   struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct i40e_vsi *vsi = pf->main_vsi;

dev_info->max_rx_queues = vsi->nb_qps;
@@ -1574,6 +1575,14 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
dev_info->max_rx_queues += dev_info->vmdq_queue_num;
dev_info->max_tx_queues += dev_info->vmdq_queue_num;
}
+
+   if (i40e_is_40G_device(hw->device_id))
+   /* For XL710 */
+   dev_info->speed_capa = ETH_SPEED_10G | ETH_SPEED_40G;
+   else
+   /* For X710 */
+   dev_info->speed_capa = ETH_SPEED_1G | ETH_SPEED_10G;
+
 }

 static int
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index b2fcffc..2e57a7c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2060,6 +2060,16 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
};
dev_info->reta_size = ETH_RSS_RETA_SIZE_128;
dev_info->flow_type_rss_offloads = IXGBE_RSS_OFFLOAD_ALL;
+
+   dev_info->speed_capa = ETH_SPEED_1G | ETH_SPEED_10G;
+
+   if (hw->mac.type == ixgbe_mac_X540 ||
+   hw->mac.type == ixgbe_mac_X540_vf ||
+   hw->mac.type == ixgbe_mac_X550 ||
+   hw->mac.type == ixgbe_mac_X550_vf)
+
+   dev_info->speed_capa |= ETH_SPEED_100M |
+   ETH_SPEED_100M_HD;
 }

 static void
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index fde23e1..f3dbe58 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -3487,6 +3487,12 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *info)
info->max_rx_queues = max;
info->max_tx_queues = max;
info->max_mac_addrs = elemof(priv->mac);
+
+   info->speed_capa = ETH_SPEED_10G | ETH_SPEED_20G |
+   ETH_SPEED_25G | ETH_SPEED_40G |
+   ETH_SPEED_50G | ETH_SPEED_56G |
+   ETH_SPEED_100G;
+
priv_unlock(priv);
 }

-- 
2.1.4



[dpdk-dev] [PATCH v3 1/2] Added ETH_SPEED_ bitmap in rte_eth_dev_info

2015-08-29 Thread Marc Sune
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, "1"))
-   link_speed = ETH_LINK_SPEED_10G;
+   link_speed = ETH_SPEED_10G;
else if (!strcmp(res->value1, "4"))
-   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, "1"))
-   link_speed = ETH_LINK_SPEED_1;
+   link_speed = ETH_SPEED_10G;
else if (!strcmp(res->value1, "4"))
-   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
+++ 

[dpdk-dev] [PATCH v3 0/2] ethdev: add port speed capability bitmap

2015-08-29 Thread Marc Sune
From: Marc Sune 

The current rte_eth_dev_info abstraction does not provide any mechanism to
get the supported speed(s) of an ethdev.

For some drivers (e.g. ixgbe), an educated guess can be done based on the
driver's name (driver_name in rte_eth_dev_info), see:

http://dpdk.org/ml/archives/dev/2013-August/000412.html

However, i) doing string comparisons is annoying, and can silently
break existing applications if PMDs change their names ii) it does not
provide all the supported capabilities of the ethdev iii) for some drivers it
is impossible determine correctly the (max) speed by the application
(e.g. in i40, distinguish between XL710 and X710).

This small patch adds speed_capa bitmap in rte_eth_dev_info, which is filled
by the PMDs according to the physical device capabilities.

v2: rebase, converted speed_capa into 32 bits bitmap, fixed alignment
(checkpatch).

v3: rebase to v2.1. unified ETH_LINK_SPEED and ETH_SPEED_CAP into ETH_SPEED.
Converted field speed in struct rte_eth_link to speed, to allow a bitmap
for defining the announced speeds, as suggested M. Brorup. Fixed spelling
issues.

Marc Sune (2):
  Added ETH_SPEED_ bitmap in rte_eth_dev_info
  Filling speed capability bitmaps in the PMDs

 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 | 20 +--
 drivers/net/e1000/igb_ethdev.c| 20 +--
 drivers/net/fm10k/fm10k_ethdev.c  |  3 +++
 drivers/net/i40e/i40e_ethdev.c| 37 ---
 drivers/net/i40e/i40e_ethdev_vf.c |  2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c  | 32 +++
 drivers/net/mlx4/mlx4.c   |  6 +
 drivers/net/vmxnet3/vmxnet3_ethdev.c  |  2 +-
 lib/librte_ether/rte_ethdev.h | 42 ++-
 12 files changed, 135 insertions(+), 77 deletions(-)

-- 
2.1.4