DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] drivers/common/octeontx2: use generic memory management
@ 2020-07-13 13:00 Sarosh Arif
  2020-09-23 10:58 ` Sunil Kumar Kori
  2020-09-24 10:39 ` [dpdk-dev] [PATCH v2] common/octeontx2: fix memory mapping API's usage Sarosh Arif
  0 siblings, 2 replies; 4+ messages in thread
From: Sarosh Arif @ 2020-07-13 13:00 UTC (permalink / raw)
  To: jerinj, ndabilpuram; +Cc: dev, Sarosh Arif

Use generic memory management calls instead of Unix memory management
calls for mempool.

Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
---
 drivers/common/octeontx2/otx2_dev.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/common/octeontx2/otx2_dev.c b/drivers/common/octeontx2/otx2_dev.c
index d61c712fa..06ff41b59 100644
--- a/drivers/common/octeontx2/otx2_dev.c
+++ b/drivers/common/octeontx2/otx2_dev.c
@@ -11,6 +11,7 @@
 #include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_memcpy.h>
+#include <rte_eal_paging.h>
 
 #include "otx2_dev.h"
 #include "otx2_mbox.h"
@@ -34,10 +35,11 @@ mbox_mem_map(off_t off, size_t size)
 	if (mem_fd < 0)
 		goto error;
 
-	va = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, mem_fd, off);
+	va = rte_mem_map(NULL, size, RTE_PROT_READ | RTE_PROT_WRITE,
+					 RTE_MAP_SHARED, mem_fd, off);
 	close(mem_fd);
 
-	if (va == MAP_FAILED)
+	if (va == NULL)
 		otx2_err("Failed to mmap sz=0x%zx, fd=%d, off=%jd",
 			 size, mem_fd, (intmax_t)off);
 error:
@@ -48,7 +50,7 @@ static void
 mbox_mem_unmap(void *va, size_t size)
 {
 	if (va)
-		munmap(va, size);
+		rte_mem_unmap(va, size);
 }
 
 static int
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] drivers/common/octeontx2: use generic memory management
  2020-07-13 13:00 [dpdk-dev] [PATCH] drivers/common/octeontx2: use generic memory management Sarosh Arif
@ 2020-09-23 10:58 ` Sunil Kumar Kori
  2020-09-24 10:39 ` [dpdk-dev] [PATCH v2] common/octeontx2: fix memory mapping API's usage Sarosh Arif
  1 sibling, 0 replies; 4+ messages in thread
From: Sunil Kumar Kori @ 2020-09-23 10:58 UTC (permalink / raw)
  To: Sarosh Arif, Jerin Jacob Kollanukkaran, Nithin Kumar Dabilpuram; +Cc: dev

Comments inline.

>-----Original Message-----
>From: dev <dev-bounces@dpdk.org> On Behalf Of Sarosh Arif
>Sent: Monday, July 13, 2020 6:31 PM
>To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Nithin Kumar
>Dabilpuram <ndabilpuram@marvell.com>
>Cc: dev@dpdk.org; Sarosh Arif <sarosh.arif@emumba.com>
>Subject: [dpdk-dev] [PATCH] drivers/common/octeontx2: use generic memory
>management
>
Change subject line to "common/ octeontx2: fix memory mapping API's usage" 

>Use generic memory management calls instead of Unix memory management
>calls for mempool.
>
IMO, generic memory management calls implies to Unix calls. Better to update the comment
accordingly.
Also please add fixes tag.

>Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
>---
> drivers/common/octeontx2/otx2_dev.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/common/octeontx2/otx2_dev.c
>b/drivers/common/octeontx2/otx2_dev.c
>index d61c712fa..06ff41b59 100644
>--- a/drivers/common/octeontx2/otx2_dev.c
>+++ b/drivers/common/octeontx2/otx2_dev.c
>@@ -11,6 +11,7 @@
> #include <rte_common.h>
> #include <rte_eal.h>
> #include <rte_memcpy.h>
>+#include <rte_eal_paging.h>
>
> #include "otx2_dev.h"
> #include "otx2_mbox.h"
>@@ -34,10 +35,11 @@ mbox_mem_map(off_t off, size_t size)
> 	if (mem_fd < 0)
> 		goto error;
>
>-	va = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
>mem_fd, off);
>+	va = rte_mem_map(NULL, size, RTE_PROT_READ | RTE_PROT_WRITE,
>+					 RTE_MAP_SHARED, mem_fd, off);
> 	close(mem_fd);
>
>-	if (va == MAP_FAILED)
>+	if (va == NULL)
> 		otx2_err("Failed to mmap sz=0x%zx, fd=%d, off=%jd",
> 			 size, mem_fd, (intmax_t)off);
> error:
>@@ -48,7 +50,7 @@ static void
> mbox_mem_unmap(void *va, size_t size)
> {
> 	if (va)
>-		munmap(va, size);
>+		rte_mem_unmap(va, size);
> }
>
> static int
>--
>2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] common/octeontx2: fix memory mapping API's usage
  2020-07-13 13:00 [dpdk-dev] [PATCH] drivers/common/octeontx2: use generic memory management Sarosh Arif
  2020-09-23 10:58 ` Sunil Kumar Kori
@ 2020-09-24 10:39 ` Sarosh Arif
  2020-09-28  6:08   ` Jerin Jacob
  1 sibling, 1 reply; 4+ messages in thread
From: Sarosh Arif @ 2020-09-24 10:39 UTC (permalink / raw)
  To: jerinj, ndabilpuram; +Cc: dev, Sarosh Arif

replace mmap() with rte_mem_map() 
and replace munmap() with rte_mem_unmap()

Fixes: e1d9a02ad8f0 ("common/octeontx2: introduce common device class")
Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
---
v2:
update description and commit message
---
 drivers/common/octeontx2/otx2_dev.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/common/octeontx2/otx2_dev.c b/drivers/common/octeontx2/otx2_dev.c
index d61c712fa..6a84df234 100644
--- a/drivers/common/octeontx2/otx2_dev.c
+++ b/drivers/common/octeontx2/otx2_dev.c
@@ -11,6 +11,7 @@
 #include <rte_common.h>
 #include <rte_eal.h>
 #include <rte_memcpy.h>
+#include <rte_eal_paging.h>
 
 #include "otx2_dev.h"
 #include "otx2_mbox.h"
@@ -34,10 +35,11 @@ mbox_mem_map(off_t off, size_t size)
 	if (mem_fd < 0)
 		goto error;
 
-	va = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, mem_fd, off);
+	va = rte_mem_map(NULL, size, RTE_PROT_READ | RTE_PROT_WRITE,
+			RTE_MAP_SHARED, mem_fd, off);
 	close(mem_fd);
 
-	if (va == MAP_FAILED)
+	if (va == NULL)
 		otx2_err("Failed to mmap sz=0x%zx, fd=%d, off=%jd",
 			 size, mem_fd, (intmax_t)off);
 error:
@@ -48,7 +50,7 @@ static void
 mbox_mem_unmap(void *va, size_t size)
 {
 	if (va)
-		munmap(va, size);
+		rte_mem_unmap(va, size);
 }
 
 static int
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] common/octeontx2: fix memory mapping API's usage
  2020-09-24 10:39 ` [dpdk-dev] [PATCH v2] common/octeontx2: fix memory mapping API's usage Sarosh Arif
@ 2020-09-28  6:08   ` Jerin Jacob
  0 siblings, 0 replies; 4+ messages in thread
From: Jerin Jacob @ 2020-09-28  6:08 UTC (permalink / raw)
  To: Sarosh Arif; +Cc: Jerin Jacob, Nithin Dabilpuram, dpdk-dev

On Thu, Sep 24, 2020 at 4:10 PM Sarosh Arif <sarosh.arif@emumba.com> wrote:
>
> replace mmap() with rte_mem_map()
> and replace munmap() with rte_mem_unmap()
>
> Fixes: e1d9a02ad8f0 ("common/octeontx2: introduce common device class")
> Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>

Updated the commit message to:
<
    common/octeontx2: fix memory mapping API usage

    Replace mmap() and munmap() APIs with EAL abstraction for the same.

    Fixes: e1d9a02ad8f0 ("common/octeontx2: introduce common device class")
    Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
>

Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-net-mrvl/master. Thanks




> ---
> v2:
> update description and commit message
> ---
>  drivers/common/octeontx2/otx2_dev.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/common/octeontx2/otx2_dev.c b/drivers/common/octeontx2/otx2_dev.c
> index d61c712fa..6a84df234 100644
> --- a/drivers/common/octeontx2/otx2_dev.c
> +++ b/drivers/common/octeontx2/otx2_dev.c
> @@ -11,6 +11,7 @@
>  #include <rte_common.h>
>  #include <rte_eal.h>
>  #include <rte_memcpy.h>
> +#include <rte_eal_paging.h>
>
>  #include "otx2_dev.h"
>  #include "otx2_mbox.h"
> @@ -34,10 +35,11 @@ mbox_mem_map(off_t off, size_t size)
>         if (mem_fd < 0)
>                 goto error;
>
> -       va = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, mem_fd, off);
> +       va = rte_mem_map(NULL, size, RTE_PROT_READ | RTE_PROT_WRITE,
> +                       RTE_MAP_SHARED, mem_fd, off);
>         close(mem_fd);
>
> -       if (va == MAP_FAILED)
> +       if (va == NULL)
>                 otx2_err("Failed to mmap sz=0x%zx, fd=%d, off=%jd",
>                          size, mem_fd, (intmax_t)off);
>  error:
> @@ -48,7 +50,7 @@ static void
>  mbox_mem_unmap(void *va, size_t size)
>  {
>         if (va)
> -               munmap(va, size);
> +               rte_mem_unmap(va, size);
>  }
>
>  static int
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-28  6:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13 13:00 [dpdk-dev] [PATCH] drivers/common/octeontx2: use generic memory management Sarosh Arif
2020-09-23 10:58 ` Sunil Kumar Kori
2020-09-24 10:39 ` [dpdk-dev] [PATCH v2] common/octeontx2: fix memory mapping API's usage Sarosh Arif
2020-09-28  6:08   ` Jerin Jacob

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).