* [dpdk-dev] [RFC PATCH 0/2] Helper function to ajdust Rx/Tx descriptor numbers
@ 2017-03-02 13:05 Andrew Rybchenko
2017-03-02 13:05 ` [dpdk-dev] [RFC PATCH 1/2] ethdev: add function to adjust number of descriptors Andrew Rybchenko
2017-03-02 13:05 ` [dpdk-dev] [RFC PATCH 2/2] examples/l3fwd: add check of Rx and Tx descriptors number Andrew Rybchenko
0 siblings, 2 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2017-03-02 13:05 UTC (permalink / raw)
To: dev; +Cc: Thomas Monjalon
Example applications have hardcoded numbers for Rx/Tx descriptors.
If PMD does not support these values, example application simply fails.
PMD provides the information about supported number of Rx/Tx descriptors
in dev_info and applications have everything required.
I think it would be good if example applications work in more cases.
Possible solutions are:
1. duplicate adjustment code in all example applications
2. add helper function and use it in all example applications (I think
it might be useful for many DPDK applications)
The patch series suggests to go the second way, but updates only one
example application only. If it is accepted, we'll update all related
example applications to use the helper function.
Roman Zhukov (2):
ethdev: add function to adjust number of descriptors
examples/l3fwd: add check of Rx and Tx descriptors number
examples/l3fwd/main.c | 11 ++++++++--
lib/librte_ether/rte_ethdev.c | 37 ++++++++++++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.h | 20 ++++++++++++++++++
lib/librte_ether/rte_ether_version.map | 7 +++++++
4 files changed, 73 insertions(+), 2 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [RFC PATCH 1/2] ethdev: add function to adjust number of descriptors
2017-03-02 13:05 [dpdk-dev] [RFC PATCH 0/2] Helper function to ajdust Rx/Tx descriptor numbers Andrew Rybchenko
@ 2017-03-02 13:05 ` Andrew Rybchenko
2017-04-24 15:13 ` Thomas Monjalon
2017-05-25 15:57 ` [dpdk-dev] [PATCH " Andrew Rybchenko
2017-03-02 13:05 ` [dpdk-dev] [RFC PATCH 2/2] examples/l3fwd: add check of Rx and Tx descriptors number Andrew Rybchenko
1 sibling, 2 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2017-03-02 13:05 UTC (permalink / raw)
To: dev; +Cc: Thomas Monjalon, Roman Zhukov
From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Check that numbers of Rx and Tx descriptors satisfy descriptors limits
from the Ethernet device information, otherwise adjust them to boundaries.
Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
lib/librte_ether/rte_ethdev.c | 37 ++++++++++++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.h | 20 ++++++++++++++++++
lib/librte_ether/rte_ether_version.map | 7 +++++++
3 files changed, 64 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index eb0a94a..67ae2d7 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3273,3 +3273,40 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
-ENOTSUP);
return (*dev->dev_ops->l2_tunnel_offload_set)(dev, l2_tunnel, mask, en);
}
+
+static void
+rte_eth_dev_adjust_nb_desc(uint16_t *nb_desc,
+ const struct rte_eth_desc_lim *desc_lim)
+{
+ if (desc_lim->nb_align != 0)
+ *nb_desc = RTE_ALIGN_CEIL(*nb_desc, desc_lim->nb_align);
+
+ if (desc_lim->nb_max != 0)
+ *nb_desc = RTE_MIN(*nb_desc, desc_lim->nb_max);
+
+ *nb_desc = RTE_MAX(*nb_desc, desc_lim->nb_min);
+}
+
+int
+rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
+ uint16_t *nb_rx_desc,
+ uint16_t *nb_tx_desc)
+{
+ struct rte_eth_dev *dev;
+ struct rte_eth_dev_info dev_info;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+ dev = &rte_eth_devices[port_id];
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+
+ rte_eth_dev_info_get(port_id, &dev_info);
+
+ if (nb_rx_desc != NULL)
+ rte_eth_dev_adjust_nb_desc(nb_rx_desc, &dev_info.rx_desc_lim);
+
+ if (nb_tx_desc != NULL)
+ rte_eth_dev_adjust_nb_desc(nb_tx_desc, &dev_info.tx_desc_lim);
+
+ return 0;
+}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 97f3e2d..b8b985c 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4421,6 +4421,26 @@ int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
*/
int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev);
+/**
+ * Check that numbers of Rx and Tx descriptors satisfy descriptors limits from
+ * the ethernet device information, otherwise adjust them to boundaries.
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param nb_rx_desc
+ * A pointer to a uint16_t where the number of receive
+ * descriptors stored.
+ * @param nb_tx_desc
+ * A pointer to a uint16_t where the number of transmit
+ * descriptors stored.
+ * @return
+ * - (0) if successful.
+ * - (-ENOTSUP, -ENODEV or -EINVAL) on failure.
+ */
+int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
+ uint16_t *nb_rx_desc,
+ uint16_t *nb_tx_desc);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index c6c9d0d..8a6696a 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -154,3 +154,10 @@ DPDK_17.02 {
rte_flow_validate;
} DPDK_16.11;
+
+DPDK_17.05 {
+ global:
+
+ rte_eth_dev_adjust_nb_rx_tx_desc;
+
+} DPDK_17.02;
--
2.9.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [RFC PATCH 2/2] examples/l3fwd: add check of Rx and Tx descriptors number
2017-03-02 13:05 [dpdk-dev] [RFC PATCH 0/2] Helper function to ajdust Rx/Tx descriptor numbers Andrew Rybchenko
2017-03-02 13:05 ` [dpdk-dev] [RFC PATCH 1/2] ethdev: add function to adjust number of descriptors Andrew Rybchenko
@ 2017-03-02 13:05 ` Andrew Rybchenko
1 sibling, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2017-03-02 13:05 UTC (permalink / raw)
To: dev; +Cc: Thomas Monjalon, Roman Zhukov
From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
examples/l3fwd/main.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index a50d628..8794154 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -522,9 +522,9 @@ static const struct option lgopts[] = {
* value of 8192
*/
#define NB_MBUF RTE_MAX( \
- (nb_ports*nb_rx_queue*RTE_TEST_RX_DESC_DEFAULT + \
+ (nb_ports*nb_rx_queue*nb_rxd + \
nb_ports*nb_lcores*MAX_PKT_BURST + \
- nb_ports*n_tx_queue*RTE_TEST_TX_DESC_DEFAULT + \
+ nb_ports*n_tx_queue*nb_txd + \
nb_lcores*MEMPOOL_CACHE_SIZE), \
(unsigned)8192)
@@ -918,6 +918,13 @@ main(int argc, char **argv)
"Cannot configure device: err=%d, port=%d\n",
ret, portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_dev_adjust_nb_desc: err=%d, port=%d\n",
+ ret, portid);
+
rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
--
2.9.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 1/2] ethdev: add function to adjust number of descriptors
2017-03-02 13:05 ` [dpdk-dev] [RFC PATCH 1/2] ethdev: add function to adjust number of descriptors Andrew Rybchenko
@ 2017-04-24 15:13 ` Thomas Monjalon
2017-04-25 7:39 ` Andrew Rybchenko
2017-05-25 15:57 ` [dpdk-dev] [PATCH " Andrew Rybchenko
1 sibling, 1 reply; 13+ messages in thread
From: Thomas Monjalon @ 2017-04-24 15:13 UTC (permalink / raw)
To: Andrew Rybchenko, dev, Roman Zhukov
Hi,
02/03/2017 14:05, Andrew Rybchenko:
> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
>
> Check that numbers of Rx and Tx descriptors satisfy descriptors limits
> from the Ethernet device information, otherwise adjust them to boundaries.
>
> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
I think this helper is OK.
We could add it in 17.08.
Is there any comment from PMD maintainers?
[...]
> +static void
> +rte_eth_dev_adjust_nb_desc(uint16_t *nb_desc,
> + const struct rte_eth_desc_lim *desc_lim)
> +{
> + if (desc_lim->nb_align != 0)
> + *nb_desc = RTE_ALIGN_CEIL(*nb_desc, desc_lim->nb_align);
> +
> + if (desc_lim->nb_max != 0)
> + *nb_desc = RTE_MIN(*nb_desc, desc_lim->nb_max);
> +
> + *nb_desc = RTE_MAX(*nb_desc, desc_lim->nb_min);
> +}
> +
> +int
> +rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
> + uint16_t *nb_rx_desc,
> + uint16_t *nb_tx_desc)
> +{
> + struct rte_eth_dev *dev;
> + struct rte_eth_dev_info dev_info;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> +
> + dev = &rte_eth_devices[port_id];
> + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
> +
> + rte_eth_dev_info_get(port_id, &dev_info);
> +
> + if (nb_rx_desc != NULL)
> + rte_eth_dev_adjust_nb_desc(nb_rx_desc, &dev_info.rx_desc_lim);
> +
> + if (nb_tx_desc != NULL)
> + rte_eth_dev_adjust_nb_desc(nb_tx_desc, &dev_info.tx_desc_lim);
> +
> + return 0;
> +}
[...]
> +/**
> + * Check that numbers of Rx and Tx descriptors satisfy descriptors limits from
> + * the ethernet device information, otherwise adjust them to boundaries.
> + *
> + * @param port_id
> + * The port identifier of the Ethernet device.
> + * @param nb_rx_desc
> + * A pointer to a uint16_t where the number of receive
> + * descriptors stored.
> + * @param nb_tx_desc
> + * A pointer to a uint16_t where the number of transmit
> + * descriptors stored.
> + * @return
> + * - (0) if successful.
> + * - (-ENOTSUP, -ENODEV or -EINVAL) on failure.
> + */
> +int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
> + uint16_t *nb_rx_desc,
> + uint16_t *nb_tx_desc);
> +
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [RFC PATCH 1/2] ethdev: add function to adjust number of descriptors
2017-04-24 15:13 ` Thomas Monjalon
@ 2017-04-25 7:39 ` Andrew Rybchenko
0 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2017-04-25 7:39 UTC (permalink / raw)
To: Thomas Monjalon, dev, Roman Zhukov
Hi,
On 04/24/2017 06:13 PM, Thomas Monjalon wrote:
> Hi,
>
> 02/03/2017 14:05, Andrew Rybchenko:
>> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
>>
>> Check that numbers of Rx and Tx descriptors satisfy descriptors limits
>> from the Ethernet device information, otherwise adjust them to boundaries.
>>
>> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> I think this helper is OK.
> We could add it in 17.08.
Thanks, we'll prepare patch series which updates alll example
applications to use the helper.
Andrew.
> Is there any comment from PMD maintainers?
>
> [...]
>> +static void
>> +rte_eth_dev_adjust_nb_desc(uint16_t *nb_desc,
>> + const struct rte_eth_desc_lim *desc_lim)
>> +{
>> + if (desc_lim->nb_align != 0)
>> + *nb_desc = RTE_ALIGN_CEIL(*nb_desc, desc_lim->nb_align);
>> +
>> + if (desc_lim->nb_max != 0)
>> + *nb_desc = RTE_MIN(*nb_desc, desc_lim->nb_max);
>> +
>> + *nb_desc = RTE_MAX(*nb_desc, desc_lim->nb_min);
>> +}
>> +
>> +int
>> +rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
>> + uint16_t *nb_rx_desc,
>> + uint16_t *nb_tx_desc)
>> +{
>> + struct rte_eth_dev *dev;
>> + struct rte_eth_dev_info dev_info;
>> +
>> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
>> +
>> + dev = &rte_eth_devices[port_id];
>> + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
>> +
>> + rte_eth_dev_info_get(port_id, &dev_info);
>> +
>> + if (nb_rx_desc != NULL)
>> + rte_eth_dev_adjust_nb_desc(nb_rx_desc, &dev_info.rx_desc_lim);
>> +
>> + if (nb_tx_desc != NULL)
>> + rte_eth_dev_adjust_nb_desc(nb_tx_desc, &dev_info.tx_desc_lim);
>> +
>> + return 0;
>> +}
> [...]
>> +/**
>> + * Check that numbers of Rx and Tx descriptors satisfy descriptors limits from
>> + * the ethernet device information, otherwise adjust them to boundaries.
>> + *
>> + * @param port_id
>> + * The port identifier of the Ethernet device.
>> + * @param nb_rx_desc
>> + * A pointer to a uint16_t where the number of receive
>> + * descriptors stored.
>> + * @param nb_tx_desc
>> + * A pointer to a uint16_t where the number of transmit
>> + * descriptors stored.
>> + * @return
>> + * - (0) if successful.
>> + * - (-ENOTSUP, -ENODEV or -EINVAL) on failure.
>> + */
>> +int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
>> + uint16_t *nb_rx_desc,
>> + uint16_t *nb_tx_desc);
>> +
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 1/2] ethdev: add function to adjust number of descriptors
2017-03-02 13:05 ` [dpdk-dev] [RFC PATCH 1/2] ethdev: add function to adjust number of descriptors Andrew Rybchenko
2017-04-24 15:13 ` Thomas Monjalon
@ 2017-05-25 15:57 ` Andrew Rybchenko
2017-05-25 15:57 ` [dpdk-dev] [PATCH 2/2] examples: adjust Rx and Tx descriptors to device limits Andrew Rybchenko
2017-05-25 17:40 ` [dpdk-dev] [PATCH 1/2] ethdev: add function to adjust number of descriptors Stephen Hemminger
1 sibling, 2 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2017-05-25 15:57 UTC (permalink / raw)
To: dev
Cc: Sergio Gonzalez Monroy, Remy Horton, Jianfeng Tan,
Declan Doherty, Ferruh Yigit, Yuanhan Liu, Maxime Coquelin,
Konstantin Ananyev, Bruce Richardson, Reshma Pattan,
Cristian Dumitrescu, Byron Marohn, Pablo de Lara Guarch,
Pawel Wodkowski, Tomasz Kantecki, John McNamara, Daniel Mrzyglod,
Roman Zhukov
From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Check that numbers of Rx and Tx descriptors satisfy descriptors limits
from the Ethernet device information, otherwise adjust them to boundaries.
Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
lib/librte_ether/rte_ethdev.c | 37 ++++++++++++++++++++++++++++++++++
lib/librte_ether/rte_ethdev.h | 20 ++++++++++++++++++
lib/librte_ether/rte_ether_version.map | 7 +++++++
3 files changed, 64 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 83898a8..35aed47 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3472,3 +3472,40 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t port_id,
-ENOTSUP);
return (*dev->dev_ops->l2_tunnel_offload_set)(dev, l2_tunnel, mask, en);
}
+
+static void
+rte_eth_dev_adjust_nb_desc(uint16_t *nb_desc,
+ const struct rte_eth_desc_lim *desc_lim)
+{
+ if (desc_lim->nb_align != 0)
+ *nb_desc = RTE_ALIGN_CEIL(*nb_desc, desc_lim->nb_align);
+
+ if (desc_lim->nb_max != 0)
+ *nb_desc = RTE_MIN(*nb_desc, desc_lim->nb_max);
+
+ *nb_desc = RTE_MAX(*nb_desc, desc_lim->nb_min);
+}
+
+int
+rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
+ uint16_t *nb_rx_desc,
+ uint16_t *nb_tx_desc)
+{
+ struct rte_eth_dev *dev;
+ struct rte_eth_dev_info dev_info;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+ dev = &rte_eth_devices[port_id];
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+
+ rte_eth_dev_info_get(port_id, &dev_info);
+
+ if (nb_rx_desc != NULL)
+ rte_eth_dev_adjust_nb_desc(nb_rx_desc, &dev_info.rx_desc_lim);
+
+ if (nb_tx_desc != NULL)
+ rte_eth_dev_adjust_nb_desc(nb_tx_desc, &dev_info.tx_desc_lim);
+
+ return 0;
+}
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index f23d116..4201cbe 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -4609,6 +4609,26 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id);
int
rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
+/**
+ * Check that numbers of Rx and Tx descriptors satisfy descriptors limits from
+ * the ethernet device information, otherwise adjust them to boundaries.
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device.
+ * @param nb_rx_desc
+ * A pointer to a uint16_t where the number of receive
+ * descriptors stored.
+ * @param nb_tx_desc
+ * A pointer to a uint16_t where the number of transmit
+ * descriptors stored.
+ * @return
+ * - (0) if successful.
+ * - (-ENOTSUP, -ENODEV or -EINVAL) on failure.
+ */
+int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id,
+ uint16_t *nb_rx_desc,
+ uint16_t *nb_tx_desc);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map
index d6726bb..21b030d 100644
--- a/lib/librte_ether/rte_ether_version.map
+++ b/lib/librte_ether/rte_ether_version.map
@@ -156,3 +156,10 @@ DPDK_17.05 {
rte_eth_xstats_get_names_by_id;
} DPDK_17.02;
+
+DPDK_17.08 {
+ global:
+
+ rte_eth_dev_adjust_nb_rx_tx_desc;
+
+} DPDK_17.05;
--
2.9.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 2/2] examples: adjust Rx and Tx descriptors to device limits
2017-05-25 15:57 ` [dpdk-dev] [PATCH " Andrew Rybchenko
@ 2017-05-25 15:57 ` Andrew Rybchenko
2017-07-08 17:05 ` Stephen Hemminger
2017-05-25 17:40 ` [dpdk-dev] [PATCH 1/2] ethdev: add function to adjust number of descriptors Stephen Hemminger
1 sibling, 1 reply; 13+ messages in thread
From: Andrew Rybchenko @ 2017-05-25 15:57 UTC (permalink / raw)
To: dev
Cc: Sergio Gonzalez Monroy, Remy Horton, Jianfeng Tan,
Declan Doherty, Ferruh Yigit, Yuanhan Liu, Maxime Coquelin,
Konstantin Ananyev, Bruce Richardson, Reshma Pattan,
Cristian Dumitrescu, Byron Marohn, Pablo de Lara Guarch,
Pawel Wodkowski, Tomasz Kantecki, John McNamara, Daniel Mrzyglod,
Roman Zhukov
From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
examples/bond/main.c | 22 ++++++++++++---
examples/distributor/main.c | 10 +++++--
examples/ethtool/ethtool-app/main.c | 10 +++++--
examples/exception_path/main.c | 13 +++++++--
examples/ip_fragmentation/main.c | 8 ++++++
examples/ip_pipeline/init.c | 32 ++++++++++++++++++++--
examples/ip_reassembly/main.c | 10 ++++++-
examples/ipsec-secgw/ipsec-secgw.c | 5 ++++
examples/ipv4_multicast/main.c | 7 +++++
examples/kni/main.c | 11 ++++++--
examples/l2fwd-cat/l2fwd-cat.c | 10 +++++--
examples/l2fwd-crypto/main.c | 8 ++++++
examples/l2fwd-jobstats/main.c | 7 +++++
examples/l2fwd-keepalive/main.c | 7 +++++
examples/l2fwd/main.c | 7 +++++
examples/l3fwd-acl/main.c | 15 +++++++---
examples/l3fwd-power/main.c | 11 ++++++--
examples/l3fwd-vf/main.c | 17 ++++++++----
examples/l3fwd/main.c | 15 +++++++---
examples/link_status_interrupt/main.c | 7 +++++
examples/load_balancer/init.c | 13 +++++++++
.../client_server_mp/mp_server/init.c | 9 ++++--
examples/multi_process/l2fwd_fork/main.c | 7 +++++
examples/multi_process/symmetric_mp/main.c | 10 +++++--
examples/netmap_compat/lib/compat_netmap.c | 9 ++++++
examples/packet_ordering/main.c | 10 +++++--
examples/performance-thread/l3fwd-thread/main.c | 15 +++++++---
examples/ptpclient/ptpclient.c | 10 +++++--
examples/qos_meter/main.c | 22 ++++++++++++---
examples/qos_sched/init.c | 11 ++++++++
examples/quota_watermark/qw/init.c | 12 ++++++--
examples/rxtx_callbacks/main.c | 10 +++++--
examples/server_node_efd/server/init.c | 9 ++++--
examples/skeleton/basicfwd.c | 10 +++++--
examples/tep_termination/vxlan_setup.c | 9 ++++--
examples/vhost/main.c | 13 +++++++++
examples/vhost_xen/main.c | 14 +++++++++-
examples/vmdq/main.c | 14 +++++++++-
examples/vmdq_dcb/main.c | 15 ++++++++--
39 files changed, 392 insertions(+), 62 deletions(-)
diff --git a/examples/bond/main.c b/examples/bond/main.c
index 9a4ec80..6859e13 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -177,6 +177,8 @@ static void
slave_port_init(uint8_t portid, struct rte_mempool *mbuf_pool)
{
int retval;
+ uint16_t nb_rxd = RTE_RX_DESC_DEFAULT;
+ uint16_t nb_txd = RTE_TX_DESC_DEFAULT;
if (portid >= rte_eth_dev_count())
rte_exit(EXIT_FAILURE, "Invalid port\n");
@@ -186,8 +188,13 @@ slave_port_init(uint8_t portid, struct rte_mempool *mbuf_pool)
rte_exit(EXIT_FAILURE, "port %u: configuration failed (res=%d)\n",
portid, retval);
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd, &nb_txd);
+ if (retval != 0)
+ rte_exit(EXIT_FAILURE, "port %u: rte_eth_dev_adjust_nb_rx_tx_desc "
+ "failed (res=%d)\n", portid, retval);
+
/* RX setup */
- retval = rte_eth_rx_queue_setup(portid, 0, RTE_RX_DESC_DEFAULT,
+ retval = rte_eth_rx_queue_setup(portid, 0, nb_rxd,
rte_eth_dev_socket_id(portid), NULL,
mbuf_pool);
if (retval < 0)
@@ -195,7 +202,7 @@ slave_port_init(uint8_t portid, struct rte_mempool *mbuf_pool)
portid, retval);
/* TX setup */
- retval = rte_eth_tx_queue_setup(portid, 0, RTE_TX_DESC_DEFAULT,
+ retval = rte_eth_tx_queue_setup(portid, 0, nb_txd,
rte_eth_dev_socket_id(portid), NULL);
if (retval < 0)
@@ -221,6 +228,8 @@ bond_port_init(struct rte_mempool *mbuf_pool)
{
int retval;
uint8_t i;
+ uint16_t nb_rxd = RTE_RX_DESC_DEFAULT;
+ uint16_t nb_txd = RTE_TX_DESC_DEFAULT;
retval = rte_eth_bond_create("bond0", BONDING_MODE_ALB,
0 /*SOCKET_ID_ANY*/);
@@ -235,8 +244,13 @@ bond_port_init(struct rte_mempool *mbuf_pool)
rte_exit(EXIT_FAILURE, "port %u: configuration failed (res=%d)\n",
BOND_PORT, retval);
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(BOND_PORT, &nb_rxd, &nb_txd);
+ if (retval != 0)
+ rte_exit(EXIT_FAILURE, "port %u: rte_eth_dev_adjust_nb_rx_tx_desc "
+ "failed (res=%d)\n", BOND_PORT, retval);
+
/* RX setup */
- retval = rte_eth_rx_queue_setup(BOND_PORT, 0, RTE_RX_DESC_DEFAULT,
+ retval = rte_eth_rx_queue_setup(BOND_PORT, 0, nb_rxd,
rte_eth_dev_socket_id(BOND_PORT), NULL,
mbuf_pool);
if (retval < 0)
@@ -244,7 +258,7 @@ bond_port_init(struct rte_mempool *mbuf_pool)
BOND_PORT, retval);
/* TX setup */
- retval = rte_eth_tx_queue_setup(BOND_PORT, 0, RTE_TX_DESC_DEFAULT,
+ retval = rte_eth_tx_queue_setup(BOND_PORT, 0, nb_txd,
rte_eth_dev_socket_id(BOND_PORT), NULL);
if (retval < 0)
diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index 8071f91..7496853 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -137,6 +137,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
const uint16_t rxRings = 1, txRings = rte_lcore_count() - 1;
int retval;
uint16_t q;
+ uint16_t nb_rxd = RX_RING_SIZE;
+ uint16_t nb_txd = TX_RING_SIZE;
if (port >= rte_eth_dev_count())
return -1;
@@ -145,8 +147,12 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
if (retval != 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);
+ if (retval != 0)
+ return retval;
+
for (q = 0; q < rxRings; q++) {
- retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE,
+ retval = rte_eth_rx_queue_setup(port, q, nb_rxd,
rte_eth_dev_socket_id(port),
NULL, mbuf_pool);
if (retval < 0)
@@ -154,7 +160,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
}
for (q = 0; q < txRings; q++) {
- retval = rte_eth_tx_queue_setup(port, q, TX_RING_SIZE,
+ retval = rte_eth_tx_queue_setup(port, q, nb_txd,
rte_eth_dev_socket_id(port),
NULL);
if (retval < 0)
diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c
index 6d50d46..011c732 100644
--- a/examples/ethtool/ethtool-app/main.c
+++ b/examples/ethtool/ethtool-app/main.c
@@ -122,6 +122,8 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports)
struct rte_eth_conf cfg_port;
struct rte_eth_dev_info dev_info;
char str_name[16];
+ uint16_t nb_rxd = PORT_RX_QUEUE_SIZE;
+ uint16_t nb_txd = PORT_TX_QUEUE_SIZE;
memset(&cfg_port, 0, sizeof(cfg_port));
cfg_port.txmode.mq_mode = ETH_MQ_TX_NONE;
@@ -154,15 +156,19 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports)
if (rte_eth_dev_configure(idx_port, 1, 1, &cfg_port) < 0)
rte_exit(EXIT_FAILURE,
"rte_eth_dev_configure failed");
+ if (rte_eth_dev_adjust_nb_rx_tx_desc(idx_port, &nb_rxd,
+ &nb_txd) < 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_dev_adjust_nb_rx_tx_desc failed");
if (rte_eth_rx_queue_setup(
- idx_port, 0, PORT_RX_QUEUE_SIZE,
+ idx_port, 0, nb_rxd,
rte_eth_dev_socket_id(idx_port), NULL,
ptr_port->pkt_pool) < 0)
rte_exit(EXIT_FAILURE,
"rte_eth_rx_queue_setup failed"
);
if (rte_eth_tx_queue_setup(
- idx_port, 0, PORT_TX_QUEUE_SIZE,
+ idx_port, 0, nb_txd,
rte_eth_dev_socket_id(idx_port), NULL) < 0)
rte_exit(EXIT_FAILURE,
"rte_eth_tx_queue_setup failed"
diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c
index 89bf1cc..10a3926 100644
--- a/examples/exception_path/main.c
+++ b/examples/exception_path/main.c
@@ -422,6 +422,8 @@ static void
init_port(uint8_t port)
{
int ret;
+ uint16_t nb_rxd = NB_RXD;
+ uint16_t nb_txd = NB_TXD;
/* Initialise device and RX/TX queues */
PRINT_INFO("Initialising port %u ...", (unsigned)port);
@@ -431,14 +433,21 @@ init_port(uint8_t port)
FATAL_ERROR("Could not configure port%u (%d)",
(unsigned)port, ret);
- ret = rte_eth_rx_queue_setup(port, 0, NB_RXD, rte_eth_dev_socket_id(port),
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);
+ if (ret < 0)
+ FATAL_ERROR("Could not adjust number of descriptors for port%u (%d)",
+ (unsigned)port, ret);
+
+ ret = rte_eth_rx_queue_setup(port, 0, nb_rxd,
+ rte_eth_dev_socket_id(port),
NULL,
pktmbuf_pool);
if (ret < 0)
FATAL_ERROR("Could not setup up RX queue for port%u (%d)",
(unsigned)port, ret);
- ret = rte_eth_tx_queue_setup(port, 0, NB_TXD, rte_eth_dev_socket_id(port),
+ ret = rte_eth_tx_queue_setup(port, 0, nb_txd,
+ rte_eth_dev_socket_id(port),
NULL);
if (ret < 0)
FATAL_ERROR("Could not setup up TX queue for port%u (%d)",
diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index 71c1d12..1119091 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -960,6 +960,14 @@ main(int argc, char **argv)
ret, portid);
}
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0) {
+ printf("\n");
+ rte_exit(EXIT_FAILURE, "Cannot adjust number of "
+ "descriptors: err=%d, port=%d\n", ret, portid);
+ }
+
/* init one RX queue */
ret = rte_eth_rx_queue_setup(portid, 0, nb_rxd,
socket, NULL,
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index be148fc..7cde49a 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -1003,16 +1003,30 @@ app_init_link(struct app_params *app)
struct app_pktq_hwq_in_params *p_rxq =
&app->hwq_in_params[j];
uint32_t rxq_link_id, rxq_queue_id;
+ uint16_t nb_rxd = p_rxq->size;
sscanf(p_rxq->name, "RXQ%" PRIu32 ".%" PRIu32,
&rxq_link_id, &rxq_queue_id);
if (rxq_link_id != link_id)
continue;
+ status = rte_eth_dev_adjust_nb_rx_tx_desc(
+ p_link->pmd_id,
+ &nb_rxd,
+ NULL);
+ if (status < 0)
+ rte_panic("%s (%" PRIu32 "): "
+ "%s adjust number of Rx descriptors "
+ "error (%" PRId32 ")\n",
+ p_link->name,
+ p_link->pmd_id,
+ p_rxq->name,
+ status);
+
status = rte_eth_rx_queue_setup(
p_link->pmd_id,
rxq_queue_id,
- p_rxq->size,
+ nb_rxd,
app_get_cpu_socket_id(p_link->pmd_id),
&p_rxq->conf,
app->mempool[p_rxq->mempool_id]);
@@ -1030,16 +1044,30 @@ app_init_link(struct app_params *app)
struct app_pktq_hwq_out_params *p_txq =
&app->hwq_out_params[j];
uint32_t txq_link_id, txq_queue_id;
+ uint16_t nb_txd = p_txq->size;
sscanf(p_txq->name, "TXQ%" PRIu32 ".%" PRIu32,
&txq_link_id, &txq_queue_id);
if (txq_link_id != link_id)
continue;
+ status = rte_eth_dev_adjust_nb_rx_tx_desc(
+ p_link->pmd_id,
+ NULL,
+ &nb_txd);
+ if (status < 0)
+ rte_panic("%s (%" PRIu32 "): "
+ "%s adjust number of Tx descriptors "
+ "error (%" PRId32 ")\n",
+ p_link->name,
+ p_link->pmd_id,
+ p_txq->name,
+ status);
+
status = rte_eth_tx_queue_setup(
p_link->pmd_id,
txq_queue_id,
- p_txq->size,
+ nb_txd,
app_get_cpu_socket_id(p_link->pmd_id),
&p_txq->conf);
if (status < 0)
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index c0f3ced..4032a69 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -904,7 +904,7 @@ setup_queue_tbl(struct rx_queue *rxq, uint32_t lcore, uint32_t queue)
nb_mbuf = RTE_MAX(max_flow_num, 2UL * MAX_PKT_BURST) * MAX_FRAG_NUM;
nb_mbuf *= (port_conf.rxmode.max_rx_pkt_len + BUF_SIZE - 1) / BUF_SIZE;
nb_mbuf *= 2; /* ipv4 and ipv6 */
- nb_mbuf += RTE_TEST_RX_DESC_DEFAULT + RTE_TEST_TX_DESC_DEFAULT;
+ nb_mbuf += nb_rxd + nb_txd;
nb_mbuf = RTE_MAX(nb_mbuf, (uint32_t)NB_MBUF);
@@ -1088,6 +1088,14 @@ main(int argc, char **argv)
rxq->portid = portid;
rxq->lpm = socket_lpm[socket];
rxq->lpm6 = socket_lpm6[socket];
+
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot adjust number of descriptors: err=%d, port=%d\n",
+ ret, portid);
+
if (setup_queue_tbl(rxq, rx_lcore_id, queueid) < 0)
rte_exit(EXIT_FAILURE, "Failed to set up queue table\n");
qconf->n_rx_queue++;
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 8cbf6ac..64ff564 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1332,6 +1332,11 @@ port_init(uint8_t portid)
rte_exit(EXIT_FAILURE, "Cannot configure device: "
"err=%d, port=%d\n", ret, portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd, &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE, "Cannot adjust number of descriptors: "
+ "err=%d, port=%d\n", ret, portid);
+
/* init one TX queue per lcore */
tx_queueid = 0;
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c
index 96a4ab6..ba4ab09 100644
--- a/examples/ipv4_multicast/main.c
+++ b/examples/ipv4_multicast/main.c
@@ -757,6 +757,13 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%d\n",
ret, portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot adjust number of descriptors: err=%d, port=%d\n",
+ ret, portid);
+
rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
diff --git a/examples/kni/main.c b/examples/kni/main.c
index 0be57d8..dd6c0c3 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -605,6 +605,8 @@ static void
init_port(uint8_t port)
{
int ret;
+ uint16_t nb_rxd = NB_RXD;
+ uint16_t nb_txd = NB_TXD;
/* Initialise device and RX/TX queues */
RTE_LOG(INFO, APP, "Initialising port %u ...\n", (unsigned)port);
@@ -614,13 +616,18 @@ init_port(uint8_t port)
rte_exit(EXIT_FAILURE, "Could not configure port%u (%d)\n",
(unsigned)port, ret);
- ret = rte_eth_rx_queue_setup(port, 0, NB_RXD,
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE, "Could not adjust number of descriptors "
+ "for port%u (%d)\n", (unsigned)port, ret);
+
+ ret = rte_eth_rx_queue_setup(port, 0, nb_rxd,
rte_eth_dev_socket_id(port), NULL, pktmbuf_pool);
if (ret < 0)
rte_exit(EXIT_FAILURE, "Could not setup up RX queue for "
"port%u (%d)\n", (unsigned)port, ret);
- ret = rte_eth_tx_queue_setup(port, 0, NB_TXD,
+ ret = rte_eth_tx_queue_setup(port, 0, nb_txd,
rte_eth_dev_socket_id(port), NULL);
if (ret < 0)
rte_exit(EXIT_FAILURE, "Could not setup up TX queue for "
diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c
index 8cce33b..c293bd9 100644
--- a/examples/l2fwd-cat/l2fwd-cat.c
+++ b/examples/l2fwd-cat/l2fwd-cat.c
@@ -65,6 +65,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
const uint16_t rx_rings = 1, tx_rings = 1;
int retval;
uint16_t q;
+ uint16_t nb_rxd = RX_RING_SIZE;
+ uint16_t nb_txd = TX_RING_SIZE;
if (port >= rte_eth_dev_count())
return -1;
@@ -74,9 +76,13 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
if (retval != 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);
+ if (retval != 0)
+ return retval;
+
/* Allocate and set up 1 RX queue per Ethernet port. */
for (q = 0; q < rx_rings; q++) {
- retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE,
+ retval = rte_eth_rx_queue_setup(port, q, nb_rxd,
rte_eth_dev_socket_id(port), NULL, mbuf_pool);
if (retval < 0)
return retval;
@@ -84,7 +90,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
/* Allocate and set up 1 TX queue per Ethernet port. */
for (q = 0; q < tx_rings; q++) {
- retval = rte_eth_tx_queue_setup(port, q, TX_RING_SIZE,
+ retval = rte_eth_tx_queue_setup(port, q, nb_txd,
rte_eth_dev_socket_id(port), NULL);
if (retval < 0)
return retval;
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 9492193..168ec5f 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -1861,6 +1861,14 @@ initialize_ports(struct l2fwd_crypto_options *options)
return -1;
}
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (retval < 0) {
+ printf("Cannot adjust number of descriptors: err=%d, port=%u\n",
+ retval, (unsigned) portid);
+ return -1;
+ }
+
/* init one RX queue */
fflush(stdout);
retval = rte_eth_rx_queue_setup(portid, 0, nb_rxd,
diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index e6e6c22..652e6f8 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -883,6 +883,13 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%u\n",
ret, (unsigned) portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot adjust number of descriptors: err=%d, port=%u\n",
+ ret, (unsigned) portid);
+
rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]);
/* init one RX queue */
diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c
index 3745348..3c6a9d3 100644
--- a/examples/l2fwd-keepalive/main.c
+++ b/examples/l2fwd-keepalive/main.c
@@ -677,6 +677,13 @@ main(int argc, char **argv)
"Cannot configure device: err=%d, port=%u\n",
ret, (unsigned) portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot adjust number of descriptors: err=%d, port=%u\n",
+ ret, (unsigned) portid);
+
rte_eth_macaddr_get(portid, &l2fwd_ports_eth_addr[portid]);
/* init one RX queue */
diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c
index f966727..00759b9 100644
--- a/examples/l2fwd/main.c
+++ b/examples/l2fwd/main.c
@@ -666,6 +666,13 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%u\n",
ret, (unsigned) portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot adjust number of descriptors: err=%d, port=%u\n",
+ ret, (unsigned) portid);
+
rte_eth_macaddr_get(portid,&l2fwd_ports_eth_addr[portid]);
/* init one RX queue */
diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index ea0b5b1..1563884 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -91,10 +91,10 @@
*/
#define NB_MBUF RTE_MAX(\
- (nb_ports * nb_rx_queue*RTE_TEST_RX_DESC_DEFAULT + \
- nb_ports * nb_lcores * MAX_PKT_BURST + \
- nb_ports * n_tx_queue * RTE_TEST_TX_DESC_DEFAULT + \
- nb_lcores * MEMPOOL_CACHE_SIZE), \
+ (nb_ports * nb_rx_queue * nb_rxd + \
+ nb_ports * nb_lcores * MAX_PKT_BURST + \
+ nb_ports * n_tx_queue * nb_txd + \
+ nb_lcores * MEMPOOL_CACHE_SIZE), \
(unsigned)8192)
#define MAX_PKT_BURST 32
@@ -1951,6 +1951,13 @@ main(int argc, char **argv)
"Cannot configure device: err=%d, port=%d\n",
ret, portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%d\n",
+ ret, portid);
+
rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 9d57fde..0a6963b 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -131,9 +131,9 @@
*/
#define NB_MBUF RTE_MAX ( \
- (nb_ports*nb_rx_queue*RTE_TEST_RX_DESC_DEFAULT + \
+ (nb_ports*nb_rx_queue*nb_rxd + \
nb_ports*nb_lcores*MAX_PKT_BURST + \
- nb_ports*n_tx_queue*RTE_TEST_TX_DESC_DEFAULT + \
+ nb_ports*n_tx_queue*nb_txd + \
nb_lcores*MEMPOOL_CACHE_SIZE), \
(unsigned)8192)
@@ -1726,6 +1726,13 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot configure device: "
"err=%d, port=%d\n", ret, portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot adjust number of descriptors: err=%d, port=%d\n",
+ ret, portid);
+
rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c
index 797f722..a49ab86 100644
--- a/examples/l3fwd-vf/main.c
+++ b/examples/l3fwd-vf/main.c
@@ -99,11 +99,11 @@
* RTE_MAX is used to ensure that NB_MBUF never goes below a minimum value of 8192
*/
-#define NB_MBUF RTE_MAX ( \
- (nb_ports*nb_rx_queue*RTE_TEST_RX_DESC_DEFAULT + \
- nb_ports*nb_lcores*MAX_PKT_BURST + \
- nb_ports*n_tx_queue*RTE_TEST_TX_DESC_DEFAULT + \
- nb_lcores*MEMPOOL_CACHE_SIZE), \
+#define NB_MBUF RTE_MAX ( \
+ (nb_ports*nb_rx_queue*nb_rxd + \
+ nb_ports*nb_lcores*MAX_PKT_BURST + \
+ nb_ports*n_tx_queue*nb_txd + \
+ nb_lcores*MEMPOOL_CACHE_SIZE), \
(unsigned)8192)
/*
@@ -1010,6 +1010,13 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%d\n",
ret, portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot adjust number of descriptors: err=%d, port=%d\n",
+ ret, portid);
+
rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index fd6605b..7094197 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -522,10 +522,10 @@ static const struct option lgopts[] = {
* value of 8192
*/
#define NB_MBUF RTE_MAX( \
- (nb_ports*nb_rx_queue*RTE_TEST_RX_DESC_DEFAULT + \
- nb_ports*nb_lcores*MAX_PKT_BURST + \
- nb_ports*n_tx_queue*RTE_TEST_TX_DESC_DEFAULT + \
- nb_lcores*MEMPOOL_CACHE_SIZE), \
+ (nb_ports*nb_rx_queue*nb_rxd + \
+ nb_ports*nb_lcores*MAX_PKT_BURST + \
+ nb_ports*n_tx_queue*nb_txd + \
+ nb_lcores*MEMPOOL_CACHE_SIZE), \
(unsigned)8192)
/* Parse the argument given in the command line of the application */
@@ -918,6 +918,13 @@ main(int argc, char **argv)
"Cannot configure device: err=%d, port=%d\n",
ret, portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot adjust number of descriptors: err=%d, "
+ "port=%d\n", ret, portid);
+
rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c
index 25da28e..a28bcfd 100644
--- a/examples/link_status_interrupt/main.c
+++ b/examples/link_status_interrupt/main.c
@@ -646,6 +646,13 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%u\n",
ret, (unsigned) portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%u\n",
+ ret, (unsigned) portid);
+
/* register lsi interrupt callback, need to be after
* rte_eth_dev_configure(). if (intr_conf.lsc == 0), no
* lsc interrupt will be present, and below callback to
diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c
index abd05a3..8fe7db4 100644
--- a/examples/load_balancer/init.c
+++ b/examples/load_balancer/init.c
@@ -430,6 +430,8 @@ app_init_nics(void)
/* Init NIC ports and queues, then start the ports */
for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
struct rte_mempool *pool;
+ uint16_t nic_rx_ring_size;
+ uint16_t nic_tx_ring_size;
n_rx_queues = app_get_nic_rx_queues_per_port(port);
n_tx_queues = app.nic_tx_port_mask[port];
@@ -450,6 +452,17 @@ app_init_nics(void)
}
rte_eth_promiscuous_enable(port);
+ nic_rx_ring_size = app.nic_rx_ring_size;
+ nic_tx_ring_size = app.nic_tx_ring_size;
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(
+ port, &nic_rx_ring_size, &nic_tx_ring_size);
+ if (ret < 0) {
+ rte_panic("Cannot adjust number of descriptors for port %u (%d)\n",
+ (unsigned) port, ret);
+ }
+ app.nic_rx_ring_size = nic_rx_ring_size;
+ app.nic_tx_ring_size = nic_tx_ring_size;
+
/* Init RX queues */
for (queue = 0; queue < APP_MAX_RX_QUEUES_PER_NIC_PORT; queue ++) {
if (app.nic_rx_queue_mask[port][queue] == 0) {
diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c
index ad941a7..0bc9292 100644
--- a/examples/multi_process/client_server_mp/mp_server/init.c
+++ b/examples/multi_process/client_server_mp/mp_server/init.c
@@ -123,8 +123,8 @@ init_port(uint8_t port_num)
}
};
const uint16_t rx_rings = 1, tx_rings = num_clients;
- const uint16_t rx_ring_size = RTE_MP_RX_DESC_DEFAULT;
- const uint16_t tx_ring_size = RTE_MP_TX_DESC_DEFAULT;
+ uint16_t rx_ring_size = RTE_MP_RX_DESC_DEFAULT;
+ uint16_t tx_ring_size = RTE_MP_TX_DESC_DEFAULT;
uint16_t q;
int retval;
@@ -138,6 +138,11 @@ init_port(uint8_t port_num)
&port_conf)) != 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port_num, &rx_ring_size,
+ &tx_ring_size);
+ if (retval != 0)
+ return retval;
+
for (q = 0; q < rx_rings; q++) {
retval = rte_eth_rx_queue_setup(port_num, q, rx_ring_size,
rte_eth_dev_socket_id(port_num),
diff --git a/examples/multi_process/l2fwd_fork/main.c b/examples/multi_process/l2fwd_fork/main.c
index 59c1024..9ef9a7b 100644
--- a/examples/multi_process/l2fwd_fork/main.c
+++ b/examples/multi_process/l2fwd_fork/main.c
@@ -1080,6 +1080,13 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%u\n",
ret, (unsigned) portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%u\n",
+ ret, (unsigned) portid);
+
rte_eth_macaddr_get(portid,&l2fwd_ports_eth_addr[portid]);
/* init one RX queue */
diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index 0990d96..208e356 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -229,6 +229,8 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues)
struct rte_eth_dev_info info;
int retval;
uint16_t q;
+ uint16_t nb_rxd = RX_RING_SIZE;
+ uint16_t nb_txd = TX_RING_SIZE;
if (rte_eal_process_type() == RTE_PROC_SECONDARY)
return 0;
@@ -246,8 +248,12 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues)
if (retval < 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);
+ if (retval < 0)
+ return retval;
+
for (q = 0; q < rx_rings; q ++) {
- retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE,
+ retval = rte_eth_rx_queue_setup(port, q, nb_rxd,
rte_eth_dev_socket_id(port),
&info.default_rxconf,
mbuf_pool);
@@ -256,7 +262,7 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues)
}
for (q = 0; q < tx_rings; q ++) {
- retval = rte_eth_tx_queue_setup(port, q, TX_RING_SIZE,
+ retval = rte_eth_tx_queue_setup(port, q, nb_txd,
rte_eth_dev_socket_id(port),
NULL);
if (retval < 0)
diff --git a/examples/netmap_compat/lib/compat_netmap.c b/examples/netmap_compat/lib/compat_netmap.c
index 112c551..c1f1f40 100644
--- a/examples/netmap_compat/lib/compat_netmap.c
+++ b/examples/netmap_compat/lib/compat_netmap.c
@@ -719,6 +719,15 @@ rte_netmap_init_port(uint8_t portid, const struct rte_netmap_port_conf *conf)
return ret;
}
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &rx_slots, &tx_slots);
+
+ if (ret < 0) {
+ RTE_LOG(ERR, USER1,
+ "Couldn't ot adjust number of descriptors for port %hhu\n",
+ portid);
+ return ret;
+ }
+
for (i = 0; i < conf->nr_tx_rings; i++) {
ret = rte_eth_tx_queue_setup(portid, i, tx_slots,
conf->socket_id, NULL);
diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c
index 49ae35b..b26c33d 100644
--- a/examples/packet_ordering/main.c
+++ b/examples/packet_ordering/main.c
@@ -290,6 +290,8 @@ configure_eth_port(uint8_t port_id)
const uint8_t nb_ports = rte_eth_dev_count();
int ret;
uint16_t q;
+ uint16_t nb_rxd = RX_DESC_PER_QUEUE;
+ uint16_t nb_txd = TX_DESC_PER_QUEUE;
if (port_id > nb_ports)
return -1;
@@ -298,8 +300,12 @@ configure_eth_port(uint8_t port_id)
if (ret != 0)
return ret;
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, &nb_txd);
+ if (ret != 0)
+ return ret;
+
for (q = 0; q < rxRings; q++) {
- ret = rte_eth_rx_queue_setup(port_id, q, RX_DESC_PER_QUEUE,
+ ret = rte_eth_rx_queue_setup(port_id, q, nb_rxd,
rte_eth_dev_socket_id(port_id), NULL,
mbuf_pool);
if (ret < 0)
@@ -307,7 +313,7 @@ configure_eth_port(uint8_t port_id)
}
for (q = 0; q < txRings; q++) {
- ret = rte_eth_tx_queue_setup(port_id, q, TX_DESC_PER_QUEUE,
+ ret = rte_eth_tx_queue_setup(port_id, q, nb_txd,
rte_eth_dev_socket_id(port_id), NULL);
if (ret < 0)
return ret;
diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index 2d98473..31d679e 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -188,10 +188,10 @@ cb_parse_ptype(__rte_unused uint8_t port, __rte_unused uint16_t queue,
*/
#define NB_MBUF RTE_MAX(\
- (nb_ports*nb_rx_queue*RTE_TEST_RX_DESC_DEFAULT + \
- nb_ports*nb_lcores*MAX_PKT_BURST + \
- nb_ports*n_tx_queue*RTE_TEST_TX_DESC_DEFAULT + \
- nb_lcores*MEMPOOL_CACHE_SIZE), \
+ (nb_ports*nb_rx_queue*nb_rxd + \
+ nb_ports*nb_lcores*MAX_PKT_BURST + \
+ nb_ports*n_tx_queue*nb_txd + \
+ nb_lcores*MEMPOOL_CACHE_SIZE), \
(unsigned)8192)
#define MAX_PKT_BURST 32
@@ -3587,6 +3587,13 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "Cannot configure device: err=%d, port=%d\n",
ret, portid);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd,
+ &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "rte_eth_dev_adjust_nb_rx_tx_desc: err=%d, port=%d\n",
+ ret, portid);
+
rte_eth_macaddr_get(portid, &ports_eth_addr[portid]);
print_ethaddr(" Address:", &ports_eth_addr[portid]);
printf(", ");
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index a80961d..ddfcdb8 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -210,6 +210,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
const uint16_t tx_rings = 1;
int retval;
uint16_t q;
+ uint16_t nb_rxd = RX_RING_SIZE;
+ uint16_t nb_txd = TX_RING_SIZE;
if (port >= rte_eth_dev_count())
return -1;
@@ -219,9 +221,13 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
if (retval != 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);
+ if (retval != 0)
+ return retval;
+
/* Allocate and set up 1 RX queue per Ethernet port. */
for (q = 0; q < rx_rings; q++) {
- retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE,
+ retval = rte_eth_rx_queue_setup(port, q, nb_rxd,
rte_eth_dev_socket_id(port), NULL, mbuf_pool);
if (retval < 0)
@@ -237,7 +243,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
txconf = &dev_info.default_txconf;
txconf->txq_flags = 0;
- retval = rte_eth_tx_queue_setup(port, q, TX_RING_SIZE,
+ retval = rte_eth_tx_queue_setup(port, q, nb_txd,
rte_eth_dev_socket_id(port), txconf);
if (retval < 0)
return retval;
diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c
index d8a2107..b0909f6 100644
--- a/examples/qos_meter/main.c
+++ b/examples/qos_meter/main.c
@@ -308,6 +308,8 @@ int
main(int argc, char **argv)
{
uint32_t lcore_id;
+ uint16_t nb_rxd = NIC_RX_QUEUE_DESC;
+ uint16_t nb_txd = NIC_TX_QUEUE_DESC;
int ret;
/* EAL init */
@@ -337,13 +339,18 @@ main(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "Port %d configuration error (%d)\n", port_rx, ret);
- ret = rte_eth_rx_queue_setup(port_rx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC,
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_rx, &nb_rxd, &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE, "Port %d adjust number of descriptors error (%d)\n",
+ port_rx, ret);
+
+ ret = rte_eth_rx_queue_setup(port_rx, NIC_RX_QUEUE, nb_rxd,
rte_eth_dev_socket_id(port_rx),
NULL, pool);
if (ret < 0)
rte_exit(EXIT_FAILURE, "Port %d RX queue setup error (%d)\n", port_rx, ret);
- ret = rte_eth_tx_queue_setup(port_rx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC,
+ ret = rte_eth_tx_queue_setup(port_rx, NIC_TX_QUEUE, nb_txd,
rte_eth_dev_socket_id(port_rx),
NULL);
if (ret < 0)
@@ -353,13 +360,20 @@ main(int argc, char **argv)
if (ret < 0)
rte_exit(EXIT_FAILURE, "Port %d configuration error (%d)\n", port_tx, ret);
- ret = rte_eth_rx_queue_setup(port_tx, NIC_RX_QUEUE, NIC_RX_QUEUE_DESC,
+ nb_rxd = NIC_RX_QUEUE_DESC;
+ nb_txd = NIC_TX_QUEUE_DESC;
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_tx, &nb_rxd, &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE, "Port %d adjust number of descriptors error (%d)\n",
+ port_tx, ret);
+
+ ret = rte_eth_rx_queue_setup(port_tx, NIC_RX_QUEUE, nb_rxd,
rte_eth_dev_socket_id(port_tx),
NULL, pool);
if (ret < 0)
rte_exit(EXIT_FAILURE, "Port %d RX queue setup error (%d)\n", port_tx, ret);
- ret = rte_eth_tx_queue_setup(port_tx, NIC_TX_QUEUE, NIC_TX_QUEUE_DESC,
+ ret = rte_eth_tx_queue_setup(port_tx, NIC_TX_QUEUE, nb_txd,
rte_eth_dev_socket_id(port_tx),
NULL);
if (ret < 0)
diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index fe0221c..a82cbd7 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -106,6 +106,8 @@ app_init_port(uint8_t portid, struct rte_mempool *mp)
struct rte_eth_link link;
struct rte_eth_rxconf rx_conf;
struct rte_eth_txconf tx_conf;
+ uint16_t rx_size;
+ uint16_t tx_size;
/* check if port already initialized (multistream configuration) */
if (app_inited_port_mask & (1u << portid))
@@ -132,6 +134,15 @@ app_init_port(uint8_t portid, struct rte_mempool *mp)
rte_exit(EXIT_FAILURE, "Cannot configure device: "
"err=%d, port=%"PRIu8"\n", ret, portid);
+ rx_size = ring_conf.rx_size;
+ tx_size = ring_conf.tx_size;
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &rx_size, &tx_size);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE, "rte_eth_dev_adjust_nb_rx_tx_desc: "
+ "err=%d, port=%"PRIu8"\n", ret, portid);
+ ring_conf.rx_size = rx_size;
+ ring_conf.tx_size = tx_size;
+
/* init one RX queue */
fflush(stdout);
ret = rte_eth_rx_queue_setup(portid, 0, (uint16_t)ring_conf.rx_size,
diff --git a/examples/quota_watermark/qw/init.c b/examples/quota_watermark/qw/init.c
index b6264fc..083a37a 100644
--- a/examples/quota_watermark/qw/init.c
+++ b/examples/quota_watermark/qw/init.c
@@ -76,6 +76,8 @@ static struct rte_eth_fc_conf fc_conf = {
void configure_eth_port(uint8_t port_id)
{
int ret;
+ uint16_t nb_rxd = RX_DESC_PER_QUEUE;
+ uint16_t nb_txd = TX_DESC_PER_QUEUE;
rte_eth_dev_stop(port_id);
@@ -84,8 +86,14 @@ void configure_eth_port(uint8_t port_id)
rte_exit(EXIT_FAILURE, "Cannot configure port %u (error %d)\n",
(unsigned int) port_id, ret);
+ ret = rte_eth_dev_adjust_nb_rx_tx_desc(port_id, &nb_rxd, &nb_txd);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE,
+ "Cannot adjust number of descriptors for port %u (error %d)\n",
+ (unsigned int) port_id, ret);
+
/* Initialize the port's RX queue */
- ret = rte_eth_rx_queue_setup(port_id, 0, RX_DESC_PER_QUEUE,
+ ret = rte_eth_rx_queue_setup(port_id, 0, nb_rxd,
rte_eth_dev_socket_id(port_id),
NULL,
mbuf_pool);
@@ -95,7 +103,7 @@ void configure_eth_port(uint8_t port_id)
(unsigned int) port_id, ret);
/* Initialize the port's TX queue */
- ret = rte_eth_tx_queue_setup(port_id, 0, TX_DESC_PER_QUEUE,
+ ret = rte_eth_tx_queue_setup(port_id, 0, nb_txd,
rte_eth_dev_socket_id(port_id),
NULL);
if (ret < 0)
diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index 048b23f..6699240 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -101,6 +101,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
{
struct rte_eth_conf port_conf = port_conf_default;
const uint16_t rx_rings = 1, tx_rings = 1;
+ uint16_t nb_rxd = RX_RING_SIZE;
+ uint16_t nb_txd = TX_RING_SIZE;
int retval;
uint16_t q;
@@ -111,15 +113,19 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
if (retval != 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);
+ if (retval != 0)
+ return retval;
+
for (q = 0; q < rx_rings; q++) {
- retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE,
+ retval = rte_eth_rx_queue_setup(port, q, nb_rxd,
rte_eth_dev_socket_id(port), NULL, mbuf_pool);
if (retval < 0)
return retval;
}
for (q = 0; q < tx_rings; q++) {
- retval = rte_eth_tx_queue_setup(port, q, TX_RING_SIZE,
+ retval = rte_eth_tx_queue_setup(port, q, nb_txd,
rte_eth_dev_socket_id(port), NULL);
if (retval < 0)
return retval;
diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/server/init.c
index 82457b4..d114e5b 100644
--- a/examples/server_node_efd/server/init.c
+++ b/examples/server_node_efd/server/init.c
@@ -130,8 +130,8 @@ init_port(uint8_t port_num)
}
};
const uint16_t rx_rings = 1, tx_rings = num_nodes;
- const uint16_t rx_ring_size = RTE_MP_RX_DESC_DEFAULT;
- const uint16_t tx_ring_size = RTE_MP_TX_DESC_DEFAULT;
+ uint16_t rx_ring_size = RTE_MP_RX_DESC_DEFAULT;
+ uint16_t tx_ring_size = RTE_MP_TX_DESC_DEFAULT;
uint16_t q;
int retval;
@@ -147,6 +147,11 @@ init_port(uint8_t port_num)
if (retval != 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port_num, &rx_ring_size,
+ &tx_ring_size);
+ if (retval != 0)
+ return retval;
+
for (q = 0; q < rx_rings; q++) {
retval = rte_eth_rx_queue_setup(port_num, q, rx_ring_size,
rte_eth_dev_socket_id(port_num),
diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c
index c89822c..b4d50de 100644
--- a/examples/skeleton/basicfwd.c
+++ b/examples/skeleton/basicfwd.c
@@ -61,6 +61,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
{
struct rte_eth_conf port_conf = port_conf_default;
const uint16_t rx_rings = 1, tx_rings = 1;
+ uint16_t nb_rxd = RX_RING_SIZE;
+ uint16_t nb_txd = TX_RING_SIZE;
int retval;
uint16_t q;
@@ -72,9 +74,13 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
if (retval != 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);
+ if (retval != 0)
+ return retval;
+
/* Allocate and set up 1 RX queue per Ethernet port. */
for (q = 0; q < rx_rings; q++) {
- retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE,
+ retval = rte_eth_rx_queue_setup(port, q, nb_rxd,
rte_eth_dev_socket_id(port), NULL, mbuf_pool);
if (retval < 0)
return retval;
@@ -82,7 +88,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
/* Allocate and set up 1 TX queue per Ethernet port. */
for (q = 0; q < tx_rings; q++) {
- retval = rte_eth_tx_queue_setup(port, q, TX_RING_SIZE,
+ retval = rte_eth_tx_queue_setup(port, q, nb_txd,
rte_eth_dev_socket_id(port), NULL);
if (retval < 0)
return retval;
diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index b57c045..050bb32 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -135,8 +135,8 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool)
uint16_t q;
struct rte_eth_dev_info dev_info;
uint16_t rx_rings, tx_rings = (uint16_t)rte_lcore_count();
- const uint16_t rx_ring_size = RTE_TEST_RX_DESC_DEFAULT;
- const uint16_t tx_ring_size = RTE_TEST_TX_DESC_DEFAULT;
+ uint16_t rx_ring_size = RTE_TEST_RX_DESC_DEFAULT;
+ uint16_t tx_ring_size = RTE_TEST_TX_DESC_DEFAULT;
struct rte_eth_udp_tunnel tunnel_udp;
struct rte_eth_rxconf *rxconf;
struct rte_eth_txconf *txconf;
@@ -166,6 +166,11 @@ vxlan_port_init(uint8_t port, struct rte_mempool *mbuf_pool)
if (retval != 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &rx_ring_size,
+ &tx_ring_size);
+ if (retval != 0)
+ return retval;
+
/* Setup the queues. */
for (q = 0; q < rx_rings; q++) {
retval = rte_eth_rx_queue_setup(port, q, rx_ring_size,
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index e07f866..518123f 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -338,6 +338,19 @@ port_init(uint8_t port)
return retval;
}
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &rx_ring_size,
+ &tx_ring_size);
+ if (retval != 0) {
+ RTE_LOG(ERR, VHOST_PORT, "Failed to adjust number of descriptors "
+ "for port %u: %s.\n", port, strerror(-retval));
+ return retval;
+ }
+ if (rx_ring_size > RTE_TEST_RX_DESC_DEFAULT) {
+ RTE_LOG(ERR, VHOST_PORT, "Mbuf pool has an insufficient size "
+ "for Rx queues on port %u.\n", port);
+ return -1;
+ }
+
/* Setup the queues. */
for (q = 0; q < rx_rings; q ++) {
retval = rte_eth_rx_queue_setup(port, q, rx_ring_size,
diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c
index d9ef140..fd91b11 100644
--- a/examples/vhost_xen/main.c
+++ b/examples/vhost_xen/main.c
@@ -278,7 +278,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
struct rte_eth_rxconf *rxconf;
struct rte_eth_conf port_conf;
uint16_t rx_rings, tx_rings = (uint16_t)rte_lcore_count();
- const uint16_t rx_ring_size = RTE_TEST_RX_DESC_DEFAULT, tx_ring_size = RTE_TEST_TX_DESC_DEFAULT;
+ uint16_t rx_ring_size = RTE_TEST_RX_DESC_DEFAULT;
+ uint16_t tx_ring_size = RTE_TEST_TX_DESC_DEFAULT;
int retval;
uint16_t q;
@@ -306,6 +307,17 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
if (retval != 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &rx_ring_size,
+ &tx_ring_size);
+ if (retval != 0)
+ return retval;
+ if (rx_ring_size > RTE_TEST_RX_DESC_DEFAULT ||
+ tx_ring_size > RTE_TEST_TX_DESC_DEFAULT) {
+ RTE_LOG(ERR, VHOST_PORT, "Mbuf pool has an insufficient size for "
+ "port %u.\n", port);
+ return -1;
+ }
+
rte_eth_dev_info_get(port, &dev_info);
rxconf = &dev_info.default_rxconf;
rxconf->rx_drop_en = 1;
diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index f639355..d096831 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -195,7 +195,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
struct rte_eth_rxconf *rxconf;
struct rte_eth_conf port_conf;
uint16_t rxRings, txRings;
- const uint16_t rxRingSize = RTE_TEST_RX_DESC_DEFAULT, txRingSize = RTE_TEST_TX_DESC_DEFAULT;
+ uint16_t rxRingSize = RTE_TEST_RX_DESC_DEFAULT;
+ uint16_t txRingSize = RTE_TEST_TX_DESC_DEFAULT;
int retval;
uint16_t q;
uint16_t queues_per_pool;
@@ -253,6 +254,17 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
if (retval != 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &rxRingSize,
+ &txRingSize);
+ if (retval != 0)
+ return retval;
+ if (RTE_MAX(rxRingSize, txRingSize) > RTE_MAX(RTE_TEST_RX_DESC_DEFAULT,
+ RTE_TEST_TX_DESC_DEFAULT)) {
+ printf("Mbuf pool has an insufficient size for port %u.\n",
+ port);
+ return -1;
+ }
+
rte_eth_dev_info_get(port, &dev_info);
rxconf = &dev_info.default_rxconf;
rxconf->rx_drop_en = 1;
diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
index 35ffffa..4f6d47e 100644
--- a/examples/vmdq_dcb/main.c
+++ b/examples/vmdq_dcb/main.c
@@ -227,8 +227,8 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
{
struct rte_eth_dev_info dev_info;
struct rte_eth_conf port_conf = {0};
- const uint16_t rxRingSize = RTE_TEST_RX_DESC_DEFAULT;
- const uint16_t txRingSize = RTE_TEST_TX_DESC_DEFAULT;
+ uint16_t rxRingSize = RTE_TEST_RX_DESC_DEFAULT;
+ uint16_t txRingSize = RTE_TEST_TX_DESC_DEFAULT;
int retval;
uint16_t q;
uint16_t queues_per_pool;
@@ -299,6 +299,17 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
if (retval != 0)
return retval;
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &rxRingSize,
+ &txRingSize);
+ if (retval != 0)
+ return retval;
+ if (RTE_MAX(rxRingSize, txRingSize) >
+ RTE_MAX(RTE_TEST_RX_DESC_DEFAULT, RTE_TEST_TX_DESC_DEFAULT)) {
+ printf("Mbuf pool has an insufficient size for port %u.\n",
+ port);
+ return -1;
+ }
+
for (q = 0; q < num_queues; q++) {
retval = rte_eth_rx_queue_setup(port, q, rxRingSize,
rte_eth_dev_socket_id(port),
--
2.9.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] ethdev: add function to adjust number of descriptors
2017-05-25 15:57 ` [dpdk-dev] [PATCH " Andrew Rybchenko
2017-05-25 15:57 ` [dpdk-dev] [PATCH 2/2] examples: adjust Rx and Tx descriptors to device limits Andrew Rybchenko
@ 2017-05-25 17:40 ` Stephen Hemminger
2017-06-14 10:37 ` Andrew Rybchenko
1 sibling, 1 reply; 13+ messages in thread
From: Stephen Hemminger @ 2017-05-25 17:40 UTC (permalink / raw)
To: Andrew Rybchenko
Cc: dev, Sergio Gonzalez Monroy, Remy Horton, Jianfeng Tan,
Declan Doherty, Ferruh Yigit, Yuanhan Liu, Maxime Coquelin,
Konstantin Ananyev, Bruce Richardson, Reshma Pattan,
Cristian Dumitrescu, Byron Marohn, Pablo de Lara Guarch,
Pawel Wodkowski, Tomasz Kantecki, John McNamara, Daniel Mrzyglod,
Roman Zhukov
On Thu, 25 May 2017 16:57:53 +0100
Andrew Rybchenko <arybchenko@solarflare.com> wrote:
> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
>
> Check that numbers of Rx and Tx descriptors satisfy descriptors limits
> from the Ethernet device information, otherwise adjust them to boundaries.
>
> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Seems like new added complexity.
Why not just allow devices to take the request as a hint and truncate or pad
as needed.
IMHO to be successful DPDK must have as simple as possible API for application.
Good enough and as little more as possible. But other people seem to think
that having the richest and most complex possible API is a good thing.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] ethdev: add function to adjust number of descriptors
2017-05-25 17:40 ` [dpdk-dev] [PATCH 1/2] ethdev: add function to adjust number of descriptors Stephen Hemminger
@ 2017-06-14 10:37 ` Andrew Rybchenko
2017-07-05 23:00 ` Thomas Monjalon
0 siblings, 1 reply; 13+ messages in thread
From: Andrew Rybchenko @ 2017-06-14 10:37 UTC (permalink / raw)
To: Stephen Hemminger, Thomas Monjalon
Cc: dev, Sergio Gonzalez Monroy, Remy Horton, Jianfeng Tan,
Declan Doherty, Ferruh Yigit, Yuanhan Liu, Maxime Coquelin,
Konstantin Ananyev, Bruce Richardson, Reshma Pattan,
Cristian Dumitrescu, Byron Marohn, Pablo de Lara Guarch,
Pawel Wodkowski, Tomasz Kantecki, John McNamara, Daniel Mrzyglod,
Roman Zhukov
On 05/25/2017 08:40 PM, Stephen Hemminger wrote:
> On Thu, 25 May 2017 16:57:53 +0100
> Andrew Rybchenko <arybchenko@solarflare.com> wrote:
>
>> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
>>
>> Check that numbers of Rx and Tx descriptors satisfy descriptors limits
>> from the Ethernet device information, otherwise adjust them to boundaries.
>>
>> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
>> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> Seems like new added complexity.
It looks like there is no more comments.
> Why not just allow devices to take the request as a hint and truncate or pad
> as needed.
Yes, it is possible solution. In this case rte_eth_rx_queue_info_get()
may be used
to get real values. If so, first of all it should be clearly documented
in the
rte_eth_rx_queue_setup()/rte_eth_tx_queue_setup() and
rte_eth_rx_queue_info_get()/rte_eth_tx_queue_info_get().
However, the problem of such approach is non-obvious modification of
values specified by the ethdev API caller. Some applications use ring sizes
to estimate mbuf pool size and other resources and if real values differ
from specified (and it is not taken into account since everything happens
silently without any errors) it could be tricky to find out root cause of
possible problems. That's why we have chosen approach with extra
helper function which does the adjustment.
> IMHO to be successful DPDK must have as simple as possible API for application.
> Good enough and as little more as possible. But other people seem to think
> that having the richest and most complex possible API is a good thing.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] ethdev: add function to adjust number of descriptors
2017-06-14 10:37 ` Andrew Rybchenko
@ 2017-07-05 23:00 ` Thomas Monjalon
2017-07-08 16:45 ` Thomas Monjalon
0 siblings, 1 reply; 13+ messages in thread
From: Thomas Monjalon @ 2017-07-05 23:00 UTC (permalink / raw)
To: dev, Stephen Hemminger
Cc: Andrew Rybchenko, Sergio Gonzalez Monroy, Remy Horton,
Jianfeng Tan, Declan Doherty, Ferruh Yigit, Yuanhan Liu,
Maxime Coquelin, Konstantin Ananyev, Bruce Richardson,
Reshma Pattan, Cristian Dumitrescu, Byron Marohn,
Pablo de Lara Guarch, Pawel Wodkowski, Tomasz Kantecki,
John McNamara, Daniel Mrzyglod, Roman Zhukov
14/06/2017 12:37, Andrew Rybchenko:
> On 05/25/2017 08:40 PM, Stephen Hemminger wrote:
> > On Thu, 25 May 2017 16:57:53 +0100
> > Andrew Rybchenko <arybchenko@solarflare.com> wrote:
> >
> >> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> >>
> >> Check that numbers of Rx and Tx descriptors satisfy descriptors limits
> >> from the Ethernet device information, otherwise adjust them to boundaries.
> >>
> >> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> >> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> > Seems like new added complexity.
>
> It looks like there is no more comments.
>
> > Why not just allow devices to take the request as a hint and truncate or pad
> > as needed.
>
> Yes, it is possible solution. In this case rte_eth_rx_queue_info_get()
> may be used
> to get real values. If so, first of all it should be clearly documented
> in the
> rte_eth_rx_queue_setup()/rte_eth_tx_queue_setup() and
> rte_eth_rx_queue_info_get()/rte_eth_tx_queue_info_get().
> However, the problem of such approach is non-obvious modification of
> values specified by the ethdev API caller. Some applications use ring sizes
> to estimate mbuf pool size and other resources and if real values differ
> from specified (and it is not taken into account since everything happens
> silently without any errors) it could be tricky to find out root cause of
> possible problems. That's why we have chosen approach with extra
> helper function which does the adjustment.
Any more comment on this?
If not, it will be applied soon.
> > IMHO to be successful DPDK must have as simple as possible API for application.
> > Good enough and as little more as possible. But other people seem to think
> > that having the richest and most complex possible API is a good thing.
I agree it is better to have a simple API.
However the community process is in favor of code writers.
We cannot reject a solution if there is no other solution proposed in
a reasonnable timeframe.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH 1/2] ethdev: add function to adjust number of descriptors
2017-07-05 23:00 ` Thomas Monjalon
@ 2017-07-08 16:45 ` Thomas Monjalon
0 siblings, 0 replies; 13+ messages in thread
From: Thomas Monjalon @ 2017-07-08 16:45 UTC (permalink / raw)
To: Andrew Rybchenko, Roman Zhukov
Cc: dev, Stephen Hemminger, Sergio Gonzalez Monroy, Remy Horton,
Jianfeng Tan, Declan Doherty, Ferruh Yigit, Yuanhan Liu,
Maxime Coquelin, Konstantin Ananyev, Bruce Richardson,
Reshma Pattan, Cristian Dumitrescu, Byron Marohn,
Pablo de Lara Guarch, Pawel Wodkowski, Tomasz Kantecki,
John McNamara, Daniel Mrzyglod
06/07/2017 01:00, Thomas Monjalon:
> 14/06/2017 12:37, Andrew Rybchenko:
> > On 05/25/2017 08:40 PM, Stephen Hemminger wrote:
> > > On Thu, 25 May 2017 16:57:53 +0100
> > > Andrew Rybchenko <arybchenko@solarflare.com> wrote:
> > >
> > >> From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> > >>
> > >> Check that numbers of Rx and Tx descriptors satisfy descriptors limits
> > >> from the Ethernet device information, otherwise adjust them to boundaries.
> > >>
> > >> Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
> > >> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> > > Seems like new added complexity.
> >
> > It looks like there is no more comments.
> >
> > > Why not just allow devices to take the request as a hint and truncate or pad
> > > as needed.
> >
> > Yes, it is possible solution. In this case rte_eth_rx_queue_info_get()
> > may be used
> > to get real values. If so, first of all it should be clearly documented
> > in the
> > rte_eth_rx_queue_setup()/rte_eth_tx_queue_setup() and
> > rte_eth_rx_queue_info_get()/rte_eth_tx_queue_info_get().
> > However, the problem of such approach is non-obvious modification of
> > values specified by the ethdev API caller. Some applications use ring sizes
> > to estimate mbuf pool size and other resources and if real values differ
> > from specified (and it is not taken into account since everything happens
> > silently without any errors) it could be tricky to find out root cause of
> > possible problems. That's why we have chosen approach with extra
> > helper function which does the adjustment.
>
> Any more comment on this?
> If not, it will be applied soon.
>
> > > IMHO to be successful DPDK must have as simple as possible API for application.
> > > Good enough and as little more as possible. But other people seem to think
> > > that having the richest and most complex possible API is a good thing.
>
> I agree it is better to have a simple API.
> However the community process is in favor of code writers.
> We cannot reject a solution if there is no other solution proposed in
> a reasonnable timeframe.
Applied, because we have no better alternative for now,
and it is discussed since March.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] examples: adjust Rx and Tx descriptors to device limits
2017-05-25 15:57 ` [dpdk-dev] [PATCH 2/2] examples: adjust Rx and Tx descriptors to device limits Andrew Rybchenko
@ 2017-07-08 17:05 ` Stephen Hemminger
2017-07-09 9:40 ` Andrew Rybchenko
0 siblings, 1 reply; 13+ messages in thread
From: Stephen Hemminger @ 2017-07-08 17:05 UTC (permalink / raw)
To: Andrew Rybchenko
Cc: dev, Sergio Gonzalez Monroy, Remy Horton, Jianfeng Tan,
Declan Doherty, Ferruh Yigit, Yuanhan Liu, Maxime Coquelin,
Konstantin Ananyev, Bruce Richardson, Reshma Pattan,
Cristian Dumitrescu, Byron Marohn, Pablo de Lara Guarch,
Pawel Wodkowski, Tomasz Kantecki, John McNamara, Daniel Mrzyglod,
Roman Zhukov
On Thu, 25 May 2017 16:57:54 +0100
Andrew Rybchenko <arybchenko@solarflare.com> wrote:
> + retval = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd, &nb_txd);
> + if (retval != 0)
> + rte_exit(EXIT_FAILURE, "port %u: rte_eth_dev_adjust_nb_rx_tx_desc "
> + "failed (res=%d)\n", portid, retval);
> +
rte_exit is equivalent to panic in kernel.
No API call should call rte_exit. Instead the error must be propogated
back to caller and/or leave the slave in a dead state.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] examples: adjust Rx and Tx descriptors to device limits
2017-07-08 17:05 ` Stephen Hemminger
@ 2017-07-09 9:40 ` Andrew Rybchenko
0 siblings, 0 replies; 13+ messages in thread
From: Andrew Rybchenko @ 2017-07-09 9:40 UTC (permalink / raw)
To: Stephen Hemminger, Declan Doherty
Cc: dev, Sergio Gonzalez Monroy, Remy Horton, Jianfeng Tan,
Ferruh Yigit, Yuanhan Liu, Maxime Coquelin, Konstantin Ananyev,
Bruce Richardson, Reshma Pattan, Cristian Dumitrescu,
Byron Marohn, Pablo de Lara Guarch, Pawel Wodkowski,
Tomasz Kantecki, John McNamara, Daniel Mrzyglod, Roman Zhukov
On 07/08/2017 08:05 PM, Stephen Hemminger wrote:
> On Thu, 25 May 2017 16:57:54 +0100
> Andrew Rybchenko <arybchenko@solarflare.com> wrote:
>
>> + retval = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd, &nb_txd);
>> + if (retval != 0)
>> + rte_exit(EXIT_FAILURE, "port %u: rte_eth_dev_adjust_nb_rx_tx_desc "
>> + "failed (res=%d)\n", portid, retval);
>> +
> rte_exit is equivalent to panic in kernel.
> No API call should call rte_exit. Instead the error must be propogated
> back to caller and/or leave the slave in a dead state.
Unfortunately the remaining context lines are not provided in the above
quote.
As I understand it is:
diff --git a/examples/bond/main.c b/examples/bond/main.c
index 9a4ec80..6859e13 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -177,6 +177,8 @@
slave_port_init(uint8_t portid, struct rte_mempool *mbuf_pool)
{
int retval;
+ uint16_t nb_rxd = RTE_RX_DESC_DEFAULT;
+ uint16_t nb_txd = RTE_TX_DESC_DEFAULT;
if (portid >= rte_eth_dev_count())
rte_exit(EXIT_FAILURE, "Invalid port\n");
@@ -186,8 +188,13 @@
rte_exit(EXIT_FAILURE, "port %u: configuration failed
(res=%d)\n",
portid, retval);
+ retval = rte_eth_dev_adjust_nb_rx_tx_desc(portid, &nb_rxd, &nb_txd);
+ if (retval != 0)
+ rte_exit(EXIT_FAILURE, "port %u:
rte_eth_dev_adjust_nb_rx_tx_desc "
+ "failed (res=%d)\n", portid, retval);
+
/* RX setup */
- retval = rte_eth_rx_queue_setup(portid, 0, RTE_RX_DESC_DEFAULT,
+ retval = rte_eth_rx_queue_setup(portid, 0, nb_rxd,
rte_eth_dev_socket_id(portid), NULL,
mbuf_pool);
if (retval < 0)
So, it is an example application (not a library API), we do not invent
rte_exit() and
just follow practice which exists in the file.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-07-09 9:40 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-02 13:05 [dpdk-dev] [RFC PATCH 0/2] Helper function to ajdust Rx/Tx descriptor numbers Andrew Rybchenko
2017-03-02 13:05 ` [dpdk-dev] [RFC PATCH 1/2] ethdev: add function to adjust number of descriptors Andrew Rybchenko
2017-04-24 15:13 ` Thomas Monjalon
2017-04-25 7:39 ` Andrew Rybchenko
2017-05-25 15:57 ` [dpdk-dev] [PATCH " Andrew Rybchenko
2017-05-25 15:57 ` [dpdk-dev] [PATCH 2/2] examples: adjust Rx and Tx descriptors to device limits Andrew Rybchenko
2017-07-08 17:05 ` Stephen Hemminger
2017-07-09 9:40 ` Andrew Rybchenko
2017-05-25 17:40 ` [dpdk-dev] [PATCH 1/2] ethdev: add function to adjust number of descriptors Stephen Hemminger
2017-06-14 10:37 ` Andrew Rybchenko
2017-07-05 23:00 ` Thomas Monjalon
2017-07-08 16:45 ` Thomas Monjalon
2017-03-02 13:05 ` [dpdk-dev] [RFC PATCH 2/2] examples/l3fwd: add check of Rx and Tx descriptors number Andrew Rybchenko
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).