DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ferruh Yigit <ferruh.yigit@amd.com>
Cc: dev@dpdk.org
Subject: Re: getting rid of type argument to rte_malloc().
Date: Wed, 24 Apr 2024 12:06:37 -0700	[thread overview]
Message-ID: <20240424120637.67385c62@hermes.local> (raw)
In-Reply-To: <6e2e5f6e-7ff0-404e-991b-836d496ad164@amd.com>

On Wed, 24 Apr 2024 11:29:51 +0100
Ferruh Yigit <ferruh.yigit@amd.com> wrote:

> On 4/24/2024 5:08 AM, Stephen Hemminger wrote:
> > For the 24.11 release, I want to remove the unused type string argument
> > that shows up in rte_malloc() and related functions, then percolates down
> > through.  It was a idea in the 1.0 release of DPDK, never implemented and
> > never removed.  Yes it will cause API breakage, a large sweeping change;
> > probably easily scripted with coccinelle.
> > 
> > Maybe doing ABI version now?
> >  
> 
> Won't this impact many applications, is there big enough motivation to
> force many DPDK applications to update their code, living with it looks
> simpler.
> 


Something like this script, and fix up the result.

From 13ec14dff523f6e896ab55a17a3c66b45bd90bbc Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Wed, 24 Apr 2024 09:39:27 -0700
Subject: [PATCH] devtools/cocci: add script to find unnecessary malloc type

The malloc type argument is unused and should be NULL.
This script finds and fixes those places.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 devtools/cocci/malloc-type.cocci | 33 ++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 devtools/cocci/malloc-type.cocci

diff --git a/devtools/cocci/malloc-type.cocci b/devtools/cocci/malloc-type.cocci
new file mode 100644
index 0000000000..cd74797ecb
--- /dev/null
+++ b/devtools/cocci/malloc-type.cocci
@@ -0,0 +1,33 @@
+//
+// The Ting type field in malloc routines was never
+// implemented and should be NULL
+//
+@@
+expression T != NULL;
+expression num, socket, size, align;
+@@
+(
+- rte_malloc(T, size, align)
++ rte_malloc(NULL, size, align)
+|
+- rte_zmalloc(T, size, align)
++ rte_zmalloc(NULL,  size, align)
+|
+- rte_calloc(T, num, size, align)
++ rte_calloc(NULL, num, size, align)
+|
+- rte_realloc(T, size, align)
++ rte_realloc(NULL, size, align)
+|
+- rte_realloc_socket(T, size, align, socket)
++ rte_realloc_socket(NULL, size, align, socket)
+|
+- rte_malloc_socket(T, size, align, socket)
++ rte_malloc_socket(NULL, size, align, socket)
+|
+- rte_zmalloc_socket(T, size, align, socket)
++ rte_zmalloc_socket(NULL, size, align, socket)
+|
+- rte_calloc_socket(T, num, size, align, socket)
++ rte_calloc_socket(NULL, num, size, align, socket)
+)
-- 
2.43.0


      parent reply	other threads:[~2024-04-24 19:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24  4:08 Stephen Hemminger
2024-04-24 10:29 ` Ferruh Yigit
2024-04-24 16:23   ` Stephen Hemminger
2024-04-24 16:23     ` Stephen Hemminger
2024-04-24 17:09     ` Morten Brørup
2024-04-24 19:05       ` Stephen Hemminger
2024-04-24 19:06   ` Stephen Hemminger [this message]

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=20240424120637.67385c62@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    /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).