diff mbox

[OVS,v2,4/4] netdev, ofpbuf: Adjust OVS implementation to the latest ODP

Message ID 1414589046-16214-5-git-send-email-zoltan.kiss@linaro.org
State New
Headers show

Commit Message

Zoltan Kiss Oct. 29, 2014, 1:24 p.m. UTC
---
 lib/netdev-odp.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

Comments

Anders Roxell Oct. 31, 2014, 7:38 p.m. UTC | #1
On 2014-10-29 13:24, Zoltan Kiss wrote:
> ---
>  lib/netdev-odp.c | 32 +++++++++++++++++---------------
>  1 file changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/netdev-odp.c b/lib/netdev-odp.c
> index 74fbac9..59de46d 100644
> --- a/lib/netdev-odp.c
> +++ b/lib/netdev-odp.c
> @@ -102,7 +102,6 @@ int
>  odp_init(int argc, char *argv[])
>  {
>      int result;
> -    int thr_id;
>  
>      if (strcmp(argv[1], "--odp"))
>          return 0;
> @@ -110,14 +109,17 @@ odp_init(int argc, char *argv[])
>      argc--;
>      argv++;
>  
> -    result = odp_init_global();
> +    result = odp_init_global(NULL, NULL);
>      if (result) {
>          ODP_ERR("Error: ODP global init failed\n");
>          return result;
>      }
>  
> -    thr_id = odp_thread_create(0);
> -    odp_init_local(thr_id);
> +    /* Init this thread */
> +    if (odp_init_local()) {
> +        ODP_ERR("Error: ODP local init failed.\n");

This should be some OVS specific error call.
This goes for the reset of the instances in the file.

Cheers,
Anders

> +        exit(EXIT_FAILURE);
> +    }
>  
>      odp_initialized = 1;
>  
> @@ -128,11 +130,13 @@ static int
>  odp_class_init(void)
>  {
>      void *pool_base;
> +    odp_shm_t shm;
>      int result = 0;
>  
>      /* create packet pool */
> -    pool_base = odp_shm_reserve("shm_packet_pool", SHM_PKT_POOL_SIZE,
> -                                ODP_CACHE_LINE_SIZE);
> +    shm = odp_shm_reserve("shm_packet_pool", SHM_PKT_POOL_SIZE,
> +                          ODP_CACHE_LINE_SIZE, 0);
> +    pool_base = odp_shm_addr(shm);
>  
>      if (odp_unlikely(pool_base == NULL)) {
>          ODP_ERR("Error: ODP packet pool mem alloc failed\n");
> @@ -153,8 +157,9 @@ odp_class_init(void)
>      odp_buffer_pool_print(pool);
>  
>      /* create ofpbuf pool */
> -    pool_base = odp_shm_reserve("shm_ofpbuf_pool", SHM_OFPBUF_POOL_SIZE,
> -                                ODP_CACHE_LINE_SIZE);
> +    shm = odp_shm_reserve("shm_ofpbuf_pool", SHM_OFPBUF_POOL_SIZE,
> +                          ODP_CACHE_LINE_SIZE, 0);
> +    pool_base = odp_shm_addr(shm);
>  
>      if (odp_unlikely(pool_base == NULL)) {
>          ODP_ERR("Error: ODP packet pool mem alloc failed\n");
> @@ -175,8 +180,9 @@ odp_class_init(void)
>      odp_buffer_pool_print(ofpbuf_pool);
>  
>      /* create pool for structures */
> -    pool_base = odp_shm_reserve("shm_struct_pool", SHM_STRUCT_POOL_SIZE,
> -                                ODP_CACHE_LINE_SIZE);
> +    shm = odp_shm_reserve("shm_struct_pool", SHM_STRUCT_POOL_SIZE,
> +                          ODP_CACHE_LINE_SIZE, 0);
> +    pool_base = odp_shm_addr(shm);
>  
>      if (odp_unlikely(pool_base == NULL)) {
>          ODP_ERR("Error: ODP packet pool mem alloc failed\n");
> @@ -222,8 +228,6 @@ netdev_odp_construct(struct netdev *netdev_)
>  {
>      int err = 0;
>      char *odp_if;
> -    odp_pktio_params_t params;
> -    socket_params_t *sock_params = &params.sock_params;
>      struct netdev_odp *netdev = netdev_odp_cast(netdev_);
>      odp_packet_t pkt;
>  
> @@ -234,9 +238,7 @@ netdev_odp_construct(struct netdev *netdev_)
>          goto out_err;
>      }
>  
> -    sock_params->type = ODP_PKTIO_TYPE_SOCKET_BASIC;
> -
> -    netdev->pktio = odp_pktio_open(odp_if, pool, &params);
> +    netdev->pktio = odp_pktio_open(odp_if, pool);
>  
>      if (netdev->pktio == ODP_PKTIO_INVALID) {
>          ODP_ERR("Error: odp pktio failed\n");
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/lib/netdev-odp.c b/lib/netdev-odp.c
index 74fbac9..59de46d 100644
--- a/lib/netdev-odp.c
+++ b/lib/netdev-odp.c
@@ -102,7 +102,6 @@  int
 odp_init(int argc, char *argv[])
 {
     int result;
-    int thr_id;
 
     if (strcmp(argv[1], "--odp"))
         return 0;
@@ -110,14 +109,17 @@  odp_init(int argc, char *argv[])
     argc--;
     argv++;
 
-    result = odp_init_global();
+    result = odp_init_global(NULL, NULL);
     if (result) {
         ODP_ERR("Error: ODP global init failed\n");
         return result;
     }
 
-    thr_id = odp_thread_create(0);
-    odp_init_local(thr_id);
+    /* Init this thread */
+    if (odp_init_local()) {
+        ODP_ERR("Error: ODP local init failed.\n");
+        exit(EXIT_FAILURE);
+    }
 
     odp_initialized = 1;
 
@@ -128,11 +130,13 @@  static int
 odp_class_init(void)
 {
     void *pool_base;
+    odp_shm_t shm;
     int result = 0;
 
     /* create packet pool */
-    pool_base = odp_shm_reserve("shm_packet_pool", SHM_PKT_POOL_SIZE,
-                                ODP_CACHE_LINE_SIZE);
+    shm = odp_shm_reserve("shm_packet_pool", SHM_PKT_POOL_SIZE,
+                          ODP_CACHE_LINE_SIZE, 0);
+    pool_base = odp_shm_addr(shm);
 
     if (odp_unlikely(pool_base == NULL)) {
         ODP_ERR("Error: ODP packet pool mem alloc failed\n");
@@ -153,8 +157,9 @@  odp_class_init(void)
     odp_buffer_pool_print(pool);
 
     /* create ofpbuf pool */
-    pool_base = odp_shm_reserve("shm_ofpbuf_pool", SHM_OFPBUF_POOL_SIZE,
-                                ODP_CACHE_LINE_SIZE);
+    shm = odp_shm_reserve("shm_ofpbuf_pool", SHM_OFPBUF_POOL_SIZE,
+                          ODP_CACHE_LINE_SIZE, 0);
+    pool_base = odp_shm_addr(shm);
 
     if (odp_unlikely(pool_base == NULL)) {
         ODP_ERR("Error: ODP packet pool mem alloc failed\n");
@@ -175,8 +180,9 @@  odp_class_init(void)
     odp_buffer_pool_print(ofpbuf_pool);
 
     /* create pool for structures */
-    pool_base = odp_shm_reserve("shm_struct_pool", SHM_STRUCT_POOL_SIZE,
-                                ODP_CACHE_LINE_SIZE);
+    shm = odp_shm_reserve("shm_struct_pool", SHM_STRUCT_POOL_SIZE,
+                          ODP_CACHE_LINE_SIZE, 0);
+    pool_base = odp_shm_addr(shm);
 
     if (odp_unlikely(pool_base == NULL)) {
         ODP_ERR("Error: ODP packet pool mem alloc failed\n");
@@ -222,8 +228,6 @@  netdev_odp_construct(struct netdev *netdev_)
 {
     int err = 0;
     char *odp_if;
-    odp_pktio_params_t params;
-    socket_params_t *sock_params = &params.sock_params;
     struct netdev_odp *netdev = netdev_odp_cast(netdev_);
     odp_packet_t pkt;
 
@@ -234,9 +238,7 @@  netdev_odp_construct(struct netdev *netdev_)
         goto out_err;
     }
 
-    sock_params->type = ODP_PKTIO_TYPE_SOCKET_BASIC;
-
-    netdev->pktio = odp_pktio_open(odp_if, pool, &params);
+    netdev->pktio = odp_pktio_open(odp_if, pool);
 
     if (netdev->pktio == ODP_PKTIO_INVALID) {
         ODP_ERR("Error: odp pktio failed\n");