diff mbox

netdev-odp: Use VLOG_ERR instead of ODP_ERR

Message ID 1416931223-16807-1-git-send-email-zoltan.kiss@linaro.org
State New
Headers show

Commit Message

Zoltan Kiss Nov. 25, 2014, 4 p.m. UTC
OVS usually ditches stderr and stdout after startup, so logging there won't be
effective. Use instead the proper OVS logging facilities.

Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
---
 lib/netdev-odp.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Comments

Mike Holmes Nov. 25, 2014, 4:54 p.m. UTC | #1
Taras is submitting a patch that allows you to replace the output stream
for ODP_ERR etc with the applications prefered stream - see
https://mail.google.com/mail/u/1/#inbox/149e780e4e57d70c

On 25 November 2014 at 11:00, Zoltan Kiss <zoltan.kiss@linaro.org> wrote:

> OVS usually ditches stderr and stdout after startup, so logging there
> won't be
> effective. Use instead the proper OVS logging facilities.
>
> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
> ---
>  lib/netdev-odp.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/lib/netdev-odp.c b/lib/netdev-odp.c
> index 59de46d..96126a1 100644
> --- a/lib/netdev-odp.c
> +++ b/lib/netdev-odp.c
> @@ -111,13 +111,13 @@ odp_init(int argc, char *argv[])
>
>      result = odp_init_global(NULL, NULL);
>      if (result) {
> -        ODP_ERR("Error: ODP global init failed\n");
> +        VLOG_ERR("Error: ODP global init failed\n");
>          return result;
>      }
>
>      /* Init this thread */
>      if (odp_init_local()) {
> -        ODP_ERR("Error: ODP local init failed.\n");
> +        VLOG_ERR("Error: ODP local init failed.\n");
>          exit(EXIT_FAILURE);
>      }
>
> @@ -139,7 +139,7 @@ odp_class_init(void)
>      pool_base = odp_shm_addr(shm);
>
>      if (odp_unlikely(pool_base == NULL)) {
> -        ODP_ERR("Error: ODP packet pool mem alloc failed\n");
> +        VLOG_ERR("Error: ODP packet pool mem alloc failed\n");
>          out_of_memory();
>          return -1;
>      }
> @@ -151,7 +151,7 @@ odp_class_init(void)
>                                    ODP_BUFFER_TYPE_PACKET);
>
>      if (pool == ODP_BUFFER_POOL_INVALID) {
> -            ODP_ERR("Error: packet pool create failed.\n");
> +            VLOG_ERR("Error: packet pool create failed.\n");
>              return -1;
>      }
>      odp_buffer_pool_print(pool);
> @@ -162,7 +162,7 @@ odp_class_init(void)
>      pool_base = odp_shm_addr(shm);
>
>      if (odp_unlikely(pool_base == NULL)) {
> -        ODP_ERR("Error: ODP packet pool mem alloc failed\n");
> +        VLOG_ERR("Error: ODP packet pool mem alloc failed\n");
>          out_of_memory();
>          return -1;
>      }
> @@ -174,7 +174,7 @@ odp_class_init(void)
>                                           ODP_BUFFER_TYPE_RAW);
>
>      if (ofpbuf_pool == ODP_BUFFER_POOL_INVALID) {
> -            ODP_ERR("Error: ofpbuf pool create failed.\n");
> +            VLOG_ERR("Error: ofpbuf pool create failed.\n");
>              return -1;
>      }
>      odp_buffer_pool_print(ofpbuf_pool);
> @@ -185,7 +185,7 @@ odp_class_init(void)
>      pool_base = odp_shm_addr(shm);
>
>      if (odp_unlikely(pool_base == NULL)) {
> -        ODP_ERR("Error: ODP packet pool mem alloc failed\n");
> +        VLOG_ERR("Error: ODP packet pool mem alloc failed\n");
>          out_of_memory();
>          return -1;
>      }
> @@ -197,7 +197,7 @@ odp_class_init(void)
>                                           ODP_BUFFER_TYPE_RAW);
>
>      if (struct_pool == ODP_BUFFER_POOL_INVALID) {
> -            ODP_ERR("Error: packet pool create failed.\n");
> +            VLOG_ERR("Error: packet pool create failed.\n");
>              return -1;
>      }
>      odp_buffer_pool_print(struct_pool);
> @@ -241,7 +241,7 @@ netdev_odp_construct(struct netdev *netdev_)
>      netdev->pktio = odp_pktio_open(odp_if, pool);
>
>      if (netdev->pktio == ODP_PKTIO_INVALID) {
> -        ODP_ERR("Error: odp pktio failed\n");
> +        VLOG_ERR("Error: odp pktio failed\n");
>          err = ENODEV;
>          goto out_err;
>      }
> @@ -633,7 +633,7 @@ netdev_odp_rxq_recv(struct netdev_rxq *rxq_, struct
> dpif_packet **packets,
>      if (pkts > 0) {
>          pkts_ok = drop_err_pkts(pkt_tbl, pkts);
>          if (odp_unlikely(pkts_ok != pkts))
> -            ODP_ERR("Dropped frames:%u - err_cnt:%lu\n",
> +            VLOG_ERR("Dropped frames:%u - err_cnt:%lu\n",
>                      pkts-pkts_ok, ++err_cnt);
>          if (!pkts_ok) {
>              ret = EAGAIN;
> --
> 1.9.1
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Mike Holmes Nov. 25, 2014, 4:55 p.m. UTC | #2
That link might not work  this thread [lng-odp] [PATCHv2 1/2] platform:
debug: replace fprintf() with odp_override_log()

On 25 November 2014 at 11:54, Mike Holmes <mike.holmes@linaro.org> wrote:

> Taras is submitting a patch that allows you to replace the output stream
> for ODP_ERR etc with the applications prefered stream - see
> https://mail.google.com/mail/u/1/#inbox/149e780e4e57d70c
>
> On 25 November 2014 at 11:00, Zoltan Kiss <zoltan.kiss@linaro.org> wrote:
>
>> OVS usually ditches stderr and stdout after startup, so logging there
>> won't be
>> effective. Use instead the proper OVS logging facilities.
>>
>> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
>> ---
>>  lib/netdev-odp.c | 20 ++++++++++----------
>>  1 file changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/lib/netdev-odp.c b/lib/netdev-odp.c
>> index 59de46d..96126a1 100644
>> --- a/lib/netdev-odp.c
>> +++ b/lib/netdev-odp.c
>> @@ -111,13 +111,13 @@ odp_init(int argc, char *argv[])
>>
>>      result = odp_init_global(NULL, NULL);
>>      if (result) {
>> -        ODP_ERR("Error: ODP global init failed\n");
>> +        VLOG_ERR("Error: ODP global init failed\n");
>>          return result;
>>      }
>>
>>      /* Init this thread */
>>      if (odp_init_local()) {
>> -        ODP_ERR("Error: ODP local init failed.\n");
>> +        VLOG_ERR("Error: ODP local init failed.\n");
>>          exit(EXIT_FAILURE);
>>      }
>>
>> @@ -139,7 +139,7 @@ odp_class_init(void)
>>      pool_base = odp_shm_addr(shm);
>>
>>      if (odp_unlikely(pool_base == NULL)) {
>> -        ODP_ERR("Error: ODP packet pool mem alloc failed\n");
>> +        VLOG_ERR("Error: ODP packet pool mem alloc failed\n");
>>          out_of_memory();
>>          return -1;
>>      }
>> @@ -151,7 +151,7 @@ odp_class_init(void)
>>                                    ODP_BUFFER_TYPE_PACKET);
>>
>>      if (pool == ODP_BUFFER_POOL_INVALID) {
>> -            ODP_ERR("Error: packet pool create failed.\n");
>> +            VLOG_ERR("Error: packet pool create failed.\n");
>>              return -1;
>>      }
>>      odp_buffer_pool_print(pool);
>> @@ -162,7 +162,7 @@ odp_class_init(void)
>>      pool_base = odp_shm_addr(shm);
>>
>>      if (odp_unlikely(pool_base == NULL)) {
>> -        ODP_ERR("Error: ODP packet pool mem alloc failed\n");
>> +        VLOG_ERR("Error: ODP packet pool mem alloc failed\n");
>>          out_of_memory();
>>          return -1;
>>      }
>> @@ -174,7 +174,7 @@ odp_class_init(void)
>>                                           ODP_BUFFER_TYPE_RAW);
>>
>>      if (ofpbuf_pool == ODP_BUFFER_POOL_INVALID) {
>> -            ODP_ERR("Error: ofpbuf pool create failed.\n");
>> +            VLOG_ERR("Error: ofpbuf pool create failed.\n");
>>              return -1;
>>      }
>>      odp_buffer_pool_print(ofpbuf_pool);
>> @@ -185,7 +185,7 @@ odp_class_init(void)
>>      pool_base = odp_shm_addr(shm);
>>
>>      if (odp_unlikely(pool_base == NULL)) {
>> -        ODP_ERR("Error: ODP packet pool mem alloc failed\n");
>> +        VLOG_ERR("Error: ODP packet pool mem alloc failed\n");
>>          out_of_memory();
>>          return -1;
>>      }
>> @@ -197,7 +197,7 @@ odp_class_init(void)
>>                                           ODP_BUFFER_TYPE_RAW);
>>
>>      if (struct_pool == ODP_BUFFER_POOL_INVALID) {
>> -            ODP_ERR("Error: packet pool create failed.\n");
>> +            VLOG_ERR("Error: packet pool create failed.\n");
>>              return -1;
>>      }
>>      odp_buffer_pool_print(struct_pool);
>> @@ -241,7 +241,7 @@ netdev_odp_construct(struct netdev *netdev_)
>>      netdev->pktio = odp_pktio_open(odp_if, pool);
>>
>>      if (netdev->pktio == ODP_PKTIO_INVALID) {
>> -        ODP_ERR("Error: odp pktio failed\n");
>> +        VLOG_ERR("Error: odp pktio failed\n");
>>          err = ENODEV;
>>          goto out_err;
>>      }
>> @@ -633,7 +633,7 @@ netdev_odp_rxq_recv(struct netdev_rxq *rxq_, struct
>> dpif_packet **packets,
>>      if (pkts > 0) {
>>          pkts_ok = drop_err_pkts(pkt_tbl, pkts);
>>          if (odp_unlikely(pkts_ok != pkts))
>> -            ODP_ERR("Dropped frames:%u - err_cnt:%lu\n",
>> +            VLOG_ERR("Dropped frames:%u - err_cnt:%lu\n",
>>                      pkts-pkts_ok, ++err_cnt);
>>          if (!pkts_ok) {
>>              ret = EAGAIN;
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>
>
>
> --
> *Mike Holmes*
> Linaro  Sr Technical Manager
> LNG - ODP
>
Zoltan Kiss Nov. 25, 2014, 5:08 p.m. UTC | #3
Indeed, that's better! Then ignore this patch, I'll create a new one 
when Taras's patch is final.

Zoli

On 25/11/14 16:55, Mike Holmes wrote:
> That link might not work  this thread [lng-odp] [PATCHv2 1/2] platform:
> debug: replace fprintf() with odp_override_log()
>
> On 25 November 2014 at 11:54, Mike Holmes <mike.holmes@linaro.org
> <mailto:mike.holmes@linaro.org>> wrote:
>
>     Taras is submitting a patch that allows you to replace the output
>     stream for ODP_ERR etc with the applications prefered stream - see
>     https://mail.google.com/mail/u/1/#inbox/149e780e4e57d70c
>
>     On 25 November 2014 at 11:00, Zoltan Kiss <zoltan.kiss@linaro.org
>     <mailto:zoltan.kiss@linaro.org>> wrote:
>
>         OVS usually ditches stderr and stdout after startup, so logging
>         there won't be
>         effective. Use instead the proper OVS logging facilities.
>
>         Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org
>         <mailto:zoltan.kiss@linaro.org>>
>         ---
>           lib/netdev-odp.c | 20 ++++++++++----------
>           1 file changed, 10 insertions(+), 10 deletions(-)
>
>         diff --git a/lib/netdev-odp.c b/lib/netdev-odp.c
>         index 59de46d..96126a1 100644
>         --- a/lib/netdev-odp.c
>         +++ b/lib/netdev-odp.c
>         @@ -111,13 +111,13 @@ odp_init(int argc, char *argv[])
>
>               result = odp_init_global(NULL, NULL);
>               if (result) {
>         -        ODP_ERR("Error: ODP global init failed\n");
>         +        VLOG_ERR("Error: ODP global init failed\n");
>                   return result;
>               }
>
>               /* Init this thread */
>               if (odp_init_local()) {
>         -        ODP_ERR("Error: ODP local init failed.\n");
>         +        VLOG_ERR("Error: ODP local init failed.\n");
>                   exit(EXIT_FAILURE);
>               }
>
>         @@ -139,7 +139,7 @@ odp_class_init(void)
>               pool_base = odp_shm_addr(shm);
>
>               if (odp_unlikely(pool_base == NULL)) {
>         -        ODP_ERR("Error: ODP packet pool mem alloc failed\n");
>         +        VLOG_ERR("Error: ODP packet pool mem alloc failed\n");
>                   out_of_memory();
>                   return -1;
>               }
>         @@ -151,7 +151,7 @@ odp_class_init(void)
>                                             ODP_BUFFER_TYPE_PACKET);
>
>               if (pool == ODP_BUFFER_POOL_INVALID) {
>         -            ODP_ERR("Error: packet pool create failed.\n");
>         +            VLOG_ERR("Error: packet pool create failed.\n");
>                       return -1;
>               }
>               odp_buffer_pool_print(pool);
>         @@ -162,7 +162,7 @@ odp_class_init(void)
>               pool_base = odp_shm_addr(shm);
>
>               if (odp_unlikely(pool_base == NULL)) {
>         -        ODP_ERR("Error: ODP packet pool mem alloc failed\n");
>         +        VLOG_ERR("Error: ODP packet pool mem alloc failed\n");
>                   out_of_memory();
>                   return -1;
>               }
>         @@ -174,7 +174,7 @@ odp_class_init(void)
>                                                    ODP_BUFFER_TYPE_RAW);
>
>               if (ofpbuf_pool == ODP_BUFFER_POOL_INVALID) {
>         -            ODP_ERR("Error: ofpbuf pool create failed.\n");
>         +            VLOG_ERR("Error: ofpbuf pool create failed.\n");
>                       return -1;
>               }
>               odp_buffer_pool_print(ofpbuf_pool);
>         @@ -185,7 +185,7 @@ odp_class_init(void)
>               pool_base = odp_shm_addr(shm);
>
>               if (odp_unlikely(pool_base == NULL)) {
>         -        ODP_ERR("Error: ODP packet pool mem alloc failed\n");
>         +        VLOG_ERR("Error: ODP packet pool mem alloc failed\n");
>                   out_of_memory();
>                   return -1;
>               }
>         @@ -197,7 +197,7 @@ odp_class_init(void)
>                                                    ODP_BUFFER_TYPE_RAW);
>
>               if (struct_pool == ODP_BUFFER_POOL_INVALID) {
>         -            ODP_ERR("Error: packet pool create failed.\n");
>         +            VLOG_ERR("Error: packet pool create failed.\n");
>                       return -1;
>               }
>               odp_buffer_pool_print(struct_pool);
>         @@ -241,7 +241,7 @@ netdev_odp_construct(struct netdev *netdev_)
>               netdev->pktio = odp_pktio_open(odp_if, pool);
>
>               if (netdev->pktio == ODP_PKTIO_INVALID) {
>         -        ODP_ERR("Error: odp pktio failed\n");
>         +        VLOG_ERR("Error: odp pktio failed\n");
>                   err = ENODEV;
>                   goto out_err;
>               }
>         @@ -633,7 +633,7 @@ netdev_odp_rxq_recv(struct netdev_rxq *rxq_,
>         struct dpif_packet **packets,
>               if (pkts > 0) {
>                   pkts_ok = drop_err_pkts(pkt_tbl, pkts);
>                   if (odp_unlikely(pkts_ok != pkts))
>         -            ODP_ERR("Dropped frames:%u - err_cnt:%lu\n",
>         +            VLOG_ERR("Dropped frames:%u - err_cnt:%lu\n",
>                               pkts-pkts_ok, ++err_cnt);
>                   if (!pkts_ok) {
>                       ret = EAGAIN;
>         --
>         1.9.1
>
>
>         _______________________________________________
>         lng-odp mailing list
>         lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>         http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
>     --
>     *Mike Holmes*
>     Linaro  Sr Technical Manager
>     LNG - ODP
>
>
>
>
> --
> *Mike Holmes*
> Linaro  Sr Technical Manager
> LNG - ODP
Taras Kondratiuk Nov. 26, 2014, 10:47 a.m. UTC | #4
On 11/25/2014 06:54 PM, Mike Holmes wrote:
> Taras is submitting a patch that allows you to replace the output stream
> for ODP_ERR etc with the applications prefered stream - see
> https://mail.google.com/mail/u/1/#inbox/149e780e4e57d70c

Taking into account that ODP_ERR() is not a part of public API Zoltan's
patch looks correct. OVS should not use ODP_ERR().
Zoltan Kiss Nov. 26, 2014, 12:54 p.m. UTC | #5
But independent from this, OVS should overwrite the log function, right? 
So ODP internal log messages won't be lost.

Regards,

Zoli

On 26/11/14 10:47, Taras Kondratiuk wrote:
> On 11/25/2014 06:54 PM, Mike Holmes wrote:
>> Taras is submitting a patch that allows you to replace the output stream
>> for ODP_ERR etc with the applications prefered stream - see
>> https://mail.google.com/mail/u/1/#inbox/149e780e4e57d70c
>
> Taking into account that ODP_ERR() is not a part of public API Zoltan's
> patch looks correct. OVS should not use ODP_ERR().
Taras Kondratiuk Nov. 26, 2014, 1 p.m. UTC | #6
On 11/26/2014 02:54 PM, Zoltan Kiss wrote:
> But independent from this, OVS should overwrite the log function, right?
> So ODP internal log messages won't be lost.

Right.
I assume it should direct log messages into its own logging subsystem.
diff mbox

Patch

diff --git a/lib/netdev-odp.c b/lib/netdev-odp.c
index 59de46d..96126a1 100644
--- a/lib/netdev-odp.c
+++ b/lib/netdev-odp.c
@@ -111,13 +111,13 @@  odp_init(int argc, char *argv[])
 
     result = odp_init_global(NULL, NULL);
     if (result) {
-        ODP_ERR("Error: ODP global init failed\n");
+        VLOG_ERR("Error: ODP global init failed\n");
         return result;
     }
 
     /* Init this thread */
     if (odp_init_local()) {
-        ODP_ERR("Error: ODP local init failed.\n");
+        VLOG_ERR("Error: ODP local init failed.\n");
         exit(EXIT_FAILURE);
     }
 
@@ -139,7 +139,7 @@  odp_class_init(void)
     pool_base = odp_shm_addr(shm);
 
     if (odp_unlikely(pool_base == NULL)) {
-        ODP_ERR("Error: ODP packet pool mem alloc failed\n");
+        VLOG_ERR("Error: ODP packet pool mem alloc failed\n");
         out_of_memory();
         return -1;
     }
@@ -151,7 +151,7 @@  odp_class_init(void)
                                   ODP_BUFFER_TYPE_PACKET);
 
     if (pool == ODP_BUFFER_POOL_INVALID) {
-            ODP_ERR("Error: packet pool create failed.\n");
+            VLOG_ERR("Error: packet pool create failed.\n");
             return -1;
     }
     odp_buffer_pool_print(pool);
@@ -162,7 +162,7 @@  odp_class_init(void)
     pool_base = odp_shm_addr(shm);
 
     if (odp_unlikely(pool_base == NULL)) {
-        ODP_ERR("Error: ODP packet pool mem alloc failed\n");
+        VLOG_ERR("Error: ODP packet pool mem alloc failed\n");
         out_of_memory();
         return -1;
     }
@@ -174,7 +174,7 @@  odp_class_init(void)
                                          ODP_BUFFER_TYPE_RAW);
 
     if (ofpbuf_pool == ODP_BUFFER_POOL_INVALID) {
-            ODP_ERR("Error: ofpbuf pool create failed.\n");
+            VLOG_ERR("Error: ofpbuf pool create failed.\n");
             return -1;
     }
     odp_buffer_pool_print(ofpbuf_pool);
@@ -185,7 +185,7 @@  odp_class_init(void)
     pool_base = odp_shm_addr(shm);
 
     if (odp_unlikely(pool_base == NULL)) {
-        ODP_ERR("Error: ODP packet pool mem alloc failed\n");
+        VLOG_ERR("Error: ODP packet pool mem alloc failed\n");
         out_of_memory();
         return -1;
     }
@@ -197,7 +197,7 @@  odp_class_init(void)
                                          ODP_BUFFER_TYPE_RAW);
 
     if (struct_pool == ODP_BUFFER_POOL_INVALID) {
-            ODP_ERR("Error: packet pool create failed.\n");
+            VLOG_ERR("Error: packet pool create failed.\n");
             return -1;
     }
     odp_buffer_pool_print(struct_pool);
@@ -241,7 +241,7 @@  netdev_odp_construct(struct netdev *netdev_)
     netdev->pktio = odp_pktio_open(odp_if, pool);
 
     if (netdev->pktio == ODP_PKTIO_INVALID) {
-        ODP_ERR("Error: odp pktio failed\n");
+        VLOG_ERR("Error: odp pktio failed\n");
         err = ENODEV;
         goto out_err;
     }
@@ -633,7 +633,7 @@  netdev_odp_rxq_recv(struct netdev_rxq *rxq_, struct dpif_packet **packets,
     if (pkts > 0) {
         pkts_ok = drop_err_pkts(pkt_tbl, pkts);
         if (odp_unlikely(pkts_ok != pkts))
-            ODP_ERR("Dropped frames:%u - err_cnt:%lu\n",
+            VLOG_ERR("Dropped frames:%u - err_cnt:%lu\n",
                     pkts-pkts_ok, ++err_cnt);
         if (!pkts_ok) {
             ret = EAGAIN;