patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Slava Ovsiienko <viacheslavo@mellanox.com>
To: Slava Ovsiienko <viacheslavo@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: [dpdk-stable] [PATCH v4 1/8] net/mlx5: fix flow counters creation
Date: Tue, 23 Oct 2018 10:04:10 +0000	[thread overview]
Message-ID: <1540289032-29628-2-git-send-email-viacheslavo@mellanox.com> (raw)
In-Reply-To: <1540289032-29628-1-git-send-email-viacheslavo@mellanox.com>

The Flow counter creation function contains two problems:

  - Flow counter object in Verbs is not freed in case of memory
    allocation error. The call of counter Verbs object deallocating
    function is added to fix.

  - The initial value of reference counter is set to one in order
    to provide the correct counter object freeing in the
    flow_verbs_counter_release() function. The reference counter
    field should be initialized to one.

Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action")
Cc: stable@dpdk.org

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_verbs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 4ae974b..6ddb13b 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -72,6 +72,7 @@
 			 }),
 		.hits = 0,
 		.bytes = 0,
+		.ref_cnt = 1,
 	};
 
 	if (!tmpl.cs) {
@@ -80,6 +81,7 @@
 	}
 	cnt = rte_calloc(__func__, 1, sizeof(*cnt), 0);
 	if (!cnt) {
+		claim_zero(mlx5_glue->destroy_counter_set(tmpl.cs));
 		rte_errno = ENOMEM;
 		return NULL;
 	}
-- 
1.8.3.1

       reply	other threads:[~2018-10-23 10:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1539962470-10950-1-git-send-email-viacheslavo@mellanox.com>
     [not found] ` <1540289032-29628-1-git-send-email-viacheslavo@mellanox.com>
2018-10-23 10:04   ` Slava Ovsiienko [this message]
     [not found] ` <1540289541-30019-1-git-send-email-viacheslavo@mellanox.com>
2018-10-23 10:12   ` Slava Ovsiienko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1540289032-29628-2-git-send-email-viacheslavo@mellanox.com \
    --to=viacheslavo@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).