diff mbox series

[ovs-dev] vconn: Count vconn_sent regardless of log level.

Message ID 1704376429-28541-1-git-send-email-lic121@chinatelecom.cn
State Superseded
Delegated to: Ilya Maximets
Headers show
Series [ovs-dev] vconn: Count vconn_sent regardless of log level. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Cheng Li Jan. 4, 2024, 1:53 p.m. UTC
vconn_sent counter is supposed to increase each time send() is
called, no matter if the vconn log debug is on or off.

Signed-off-by: Cheng Li <lic121@chinatelecom.cn>
---
 lib/vconn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ilya Maximets Jan. 4, 2024, 2:16 p.m. UTC | #1
On 1/4/24 14:53, Cheng Li wrote:
> vconn_sent counter is supposed to increase each time send() is
> called, no matter if the vconn log debug is on or off.

Good catch!  But I think the intention was fr it to be increased
each time we successfully sent something, not when the function
was called.  This will match the behavior of the vconn_received
counter.  i.e. we should probably put the counter under if (!retval).

What do you think?

Best regards, Ilya Maximets.

> 
> Signed-off-by: Cheng Li <lic121@chinatelecom.cn>
> ---
>  lib/vconn.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/vconn.c b/lib/vconn.c
> index b556762..2513b03 100644
> --- a/lib/vconn.c
> +++ b/lib/vconn.c
> @@ -681,8 +681,8 @@ do_send(struct vconn *vconn, struct ofpbuf *msg)
>      ovs_assert(msg->size >= sizeof(struct ofp_header));
>  
>      ofpmsg_update_length(msg);
> +    COVERAGE_INC(vconn_sent);
>      if (!VLOG_IS_DBG_ENABLED()) {
> -        COVERAGE_INC(vconn_sent);
>          retval = (vconn->vclass->send)(vconn, msg);
>      } else {
>          char *s = ofp_to_string(msg->data, msg->size, NULL, NULL, 1);
Cheng Li Jan. 6, 2024, 6:54 a.m. UTC | #2
On Thu, Jan 04, 2024 at 03:16:59PM +0100, Maximets wrote:
> On 1/4/24 14:53, Cheng Li wrote:
> > vconn_sent counter is supposed to increase each time send() is
> > called, no matter if the vconn log debug is on or off.
> 
> Good catch!  But I think the intention was fr it to be increased
> each time we successfully sent something, not when the function
> was called.  This will match the behavior of the vconn_received
> counter.  i.e. we should probably put the counter under if (!retval).
> 
> What do you think?

Make sense. I will send a v2.

> 
> Best regards, Ilya Maximets.
> 
> > 
> > Signed-off-by: Cheng Li <lic121@chinatelecom.cn>
> > ---
> >  lib/vconn.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/lib/vconn.c b/lib/vconn.c
> > index b556762..2513b03 100644
> > --- a/lib/vconn.c
> > +++ b/lib/vconn.c
> > @@ -681,8 +681,8 @@ do_send(struct vconn *vconn, struct ofpbuf *msg)
> >      ovs_assert(msg->size >= sizeof(struct ofp_header));
> >  
> >      ofpmsg_update_length(msg);
> > +    COVERAGE_INC(vconn_sent);
> >      if (!VLOG_IS_DBG_ENABLED()) {
> > -        COVERAGE_INC(vconn_sent);
> >          retval = (vconn->vclass->send)(vconn, msg);
> >      } else {
> >          char *s = ofp_to_string(msg->data, msg->size, NULL, NULL, 1);
>
diff mbox series

Patch

diff --git a/lib/vconn.c b/lib/vconn.c
index b556762..2513b03 100644
--- a/lib/vconn.c
+++ b/lib/vconn.c
@@ -681,8 +681,8 @@  do_send(struct vconn *vconn, struct ofpbuf *msg)
     ovs_assert(msg->size >= sizeof(struct ofp_header));
 
     ofpmsg_update_length(msg);
+    COVERAGE_INC(vconn_sent);
     if (!VLOG_IS_DBG_ENABLED()) {
-        COVERAGE_INC(vconn_sent);
         retval = (vconn->vclass->send)(vconn, msg);
     } else {
         char *s = ofp_to_string(msg->data, msg->size, NULL, NULL, 1);