diff mbox series

[ovs-dev,v7,6/6] netdev-dpdk: Rename dpdk_mp_put as dpdk_mp_free.

Message ID 1508342491-21949-7-git-send-email-antonio.fischetti@intel.com
State Superseded
Headers show
Series netdev-dpdk: Fix mempool management and other cleanup. | expand

Commit Message

Fischetti, Antonio Oct. 18, 2017, 4:01 p.m. UTC
For readability purposes dpdk_mp_put is renamed as dpdk_mp_free.
Some other comments are also added to mempool functions.

CC: Mark B Kavanagh <mark.b.kavanagh@intel.com>
CC: Darrell Ball <dlu998@gmail.com>
CC: Ciara Loftus <ciara.loftus@intel.com>
CC: Kevin Traynor <ktraynor@redhat.com>
CC: Aaron Conole <aconole@redhat.com>
Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
---
 lib/netdev-dpdk.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Comments

Kevin Traynor Oct. 19, 2017, 10:34 a.m. UTC | #1
On 10/18/2017 05:01 PM, antonio.fischetti@intel.com wrote:
> For readability purposes dpdk_mp_put is renamed as dpdk_mp_free.
> Some other comments are also added to mempool functions.
> 
> CC: Mark B Kavanagh <mark.b.kavanagh@intel.com>
> CC: Darrell Ball <dlu998@gmail.com>
> CC: Ciara Loftus <ciara.loftus@intel.com>
> CC: Kevin Traynor <ktraynor@redhat.com>
> CC: Aaron Conole <aconole@redhat.com>
> Signed-off-by: Antonio Fischetti <antonio.fischetti@intel.com>
> ---
>  lib/netdev-dpdk.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index 0057e6b..411cb06 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -587,6 +587,10 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool *mp_exists)
>      return NULL;
>  }
>  
> +/* Returns a valid pointer when either of the following is true:
> + *  - a new mempool was just created
> + *  - a matching mempool already exists
> + */

This comment should have been updated when the code has changed, this is
an unrelated commit.

>  static struct dpdk_mp *
>  dpdk_mp_get(struct netdev_dpdk *dev, int mtu, bool *mp_exists)
>  {
> @@ -599,8 +603,9 @@ dpdk_mp_get(struct netdev_dpdk *dev, int mtu, bool *mp_exists)
>      return dmp;
>  }
>  
> +/* Release an existing mempool. */
>  static void
> -dpdk_mp_put(struct dpdk_mp *dmp)
> +dpdk_mp_free(struct dpdk_mp *dmp)
>  {
>      char *mp_name;
>  
> @@ -618,8 +623,8 @@ dpdk_mp_put(struct dpdk_mp *dmp)
>  }
>  
>  /* Tries to allocate a new mempool - or re-use an existing one where
> - * appropriate - on requested_socket_id with mbuf size corresponding to
> - * requested_mtu.
> + * appropriate - on requested_socket_id with a size determined by
> + * requested_mtu and requested Rx/Tx queues.

This is re-writing the comment you made in an earlier commit, and not
related to commit subject

>   * On success - or when re-using an existing mempool - the new configuration
>   * will be applied.
>   * On error, device will be left unchanged. */
> @@ -646,7 +651,8 @@ netdev_dpdk_mempool_configure(struct netdev_dpdk *dev)
>          dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu);
>          return EEXIST;
>      } else {
> -        dpdk_mp_put(dev->dpdk_mp);
> +        /* A new mempool was created, release the previous one. */
> +        dpdk_mp_free(dev->dpdk_mp);
>          dev->dpdk_mp = mp;
>          dev->mtu = dev->requested_mtu;
>          dev->socket_id = dev->requested_socket_id;
> @@ -1091,7 +1097,7 @@ common_destruct(struct netdev_dpdk *dev)
>      OVS_EXCLUDED(dev->mutex)
>  {
>      rte_free(dev->tx_q);
> -    dpdk_mp_put(dev->dpdk_mp);
> +    dpdk_mp_free(dev->dpdk_mp);
>  
>      ovs_list_remove(&dev->list_node);
>      free(ovsrcu_get_protected(struct ingress_policer *,
>
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 0057e6b..411cb06 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -587,6 +587,10 @@  dpdk_mp_create(struct netdev_dpdk *dev, int mtu, bool *mp_exists)
     return NULL;
 }
 
+/* Returns a valid pointer when either of the following is true:
+ *  - a new mempool was just created
+ *  - a matching mempool already exists
+ */
 static struct dpdk_mp *
 dpdk_mp_get(struct netdev_dpdk *dev, int mtu, bool *mp_exists)
 {
@@ -599,8 +603,9 @@  dpdk_mp_get(struct netdev_dpdk *dev, int mtu, bool *mp_exists)
     return dmp;
 }
 
+/* Release an existing mempool. */
 static void
-dpdk_mp_put(struct dpdk_mp *dmp)
+dpdk_mp_free(struct dpdk_mp *dmp)
 {
     char *mp_name;
 
@@ -618,8 +623,8 @@  dpdk_mp_put(struct dpdk_mp *dmp)
 }
 
 /* Tries to allocate a new mempool - or re-use an existing one where
- * appropriate - on requested_socket_id with mbuf size corresponding to
- * requested_mtu.
+ * appropriate - on requested_socket_id with a size determined by
+ * requested_mtu and requested Rx/Tx queues.
  * On success - or when re-using an existing mempool - the new configuration
  * will be applied.
  * On error, device will be left unchanged. */
@@ -646,7 +651,8 @@  netdev_dpdk_mempool_configure(struct netdev_dpdk *dev)
         dev->max_packet_len = MTU_TO_FRAME_LEN(dev->mtu);
         return EEXIST;
     } else {
-        dpdk_mp_put(dev->dpdk_mp);
+        /* A new mempool was created, release the previous one. */
+        dpdk_mp_free(dev->dpdk_mp);
         dev->dpdk_mp = mp;
         dev->mtu = dev->requested_mtu;
         dev->socket_id = dev->requested_socket_id;
@@ -1091,7 +1097,7 @@  common_destruct(struct netdev_dpdk *dev)
     OVS_EXCLUDED(dev->mutex)
 {
     rte_free(dev->tx_q);
-    dpdk_mp_put(dev->dpdk_mp);
+    dpdk_mp_free(dev->dpdk_mp);
 
     ovs_list_remove(&dev->list_node);
     free(ovsrcu_get_protected(struct ingress_policer *,