[ovs-dev] [PATCH v2] netdev-dpdk: Use different constant for ring size

Pravin Shelar pshelar at nicira.com
Wed Aug 6 22:30:51 UTC 2014


On Wed, Jul 30, 2014 at 8:51 AM, Daniele Di Proietto
<ddiproietto at vmware.com> wrote:
> DPDK rings must have a power-of-two size.
>
> Signed-off-by: Daniele Di Proietto <ddiproietto at vmware.com>
> ---
>  lib/netdev-dpdk.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index b45e367..a779833 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -125,6 +125,8 @@ static const struct rte_eth_txconf tx_conf = {
>
>  enum { MAX_RX_QUEUE_LEN = 192 };
>  enum { MAX_TX_QUEUE_LEN = 384 };
Is there any benefit of keeping separate RX and TX QUEUE size ?


> +enum { DPDK_RING_SIZE = 256 };
> +BUILD_ASSERT_DECL(IS_POW2(DPDK_RING_SIZE));
>  enum { DRAIN_TSC = 200000ULL };
>
>  static int rte_eal_init_ret = ENODEV;
> @@ -1236,7 +1238,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no,
>          return -err;
>      }
>
> -    ivshmem->cring_tx = rte_ring_create(ring_name, MAX_RX_QUEUE_LEN, SOCKET0, 0);
> +    ivshmem->cring_tx = rte_ring_create(ring_name, DPDK_RING_SIZE, SOCKET0, 0);
>      if (ivshmem->cring_tx == NULL) {
>          rte_free(ivshmem);
>          return ENOMEM;
> @@ -1247,7 +1249,7 @@ dpdk_ring_create(const char dev_name[], unsigned int port_no,
>          return -err;
>      }
>
> -    ivshmem->cring_rx = rte_ring_create(ring_name, MAX_RX_QUEUE_LEN, SOCKET0, 0);
> +    ivshmem->cring_rx = rte_ring_create(ring_name, DPDK_RING_SIZE, SOCKET0, 0);
>      if (ivshmem->cring_rx == NULL) {
>          rte_free(ivshmem);
>          return ENOMEM;
> --
> 2.0.1
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list