* [dpdk-dev] Use rte_malloc in application [not found] <CGME20170803055747uscas1p15fd0c2a998cf260734f89cc48192a61c@uscas1p1.samsung.com> @ 2017-08-03 5:57 ` Rohit Saini (Stellus) 2017-08-03 6:12 ` Rohit Saini (Stellus) 0 siblings, 1 reply; 5+ messages in thread From: Rohit Saini (Stellus) @ 2017-08-03 5:57 UTC (permalink / raw) To: 'dev@dpdk.org' Hi, I have a use case in my application where I need to implement my own memory manager, rather than doing malloc/free everytime to kernel. Instead of writing my own memory manager, I am thinking to use dpdk rte_malloc or rte_mempool. Please let me know if this is a good idea. Also, my_node_t *data_ptr = (my_node_t *) (uintptr_t) rte_malloc(NULL, sizeof(my_node_t), 0); data_ptr is pointing to some invalid memory. Am I doing anything wrong here? Thanks, Rohit ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] Use rte_malloc in application 2017-08-03 5:57 ` [dpdk-dev] Use rte_malloc in application Rohit Saini (Stellus) @ 2017-08-03 6:12 ` Rohit Saini (Stellus) 2017-08-03 8:29 ` Sergio Gonzalez Monroy 2017-08-03 13:29 ` Stefan Puiu 0 siblings, 2 replies; 5+ messages in thread From: Rohit Saini (Stellus) @ 2017-08-03 6:12 UTC (permalink / raw) To: 'dev@dpdk.org' With below code, I am getting this warning. warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] my_node_t *data_ptr = (my_node_t *) rte_malloc(NULL, sizeof(my_node_t), 0); Thanks, Rohit -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Rohit Saini (Stellus) Sent: Thursday, August 03, 2017 11:28 AM To: 'dev@dpdk.org' <dev@dpdk.org> Subject: [dpdk-dev] Use rte_malloc in application Hi, I have a use case in my application where I need to implement my own memory manager, rather than doing malloc/free everytime to kernel. Instead of writing my own memory manager, I am thinking to use dpdk rte_malloc or rte_mempool. Please let me know if this is a good idea. Also, my_node_t *data_ptr = (my_node_t *) (uintptr_t) rte_malloc(NULL, sizeof(my_node_t), 0); data_ptr is pointing to some invalid memory. Am I doing anything wrong here? Thanks, Rohit ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] Use rte_malloc in application 2017-08-03 6:12 ` Rohit Saini (Stellus) @ 2017-08-03 8:29 ` Sergio Gonzalez Monroy 2017-08-10 11:19 ` Rohit Saini (Stellus) 2017-08-03 13:29 ` Stefan Puiu 1 sibling, 1 reply; 5+ messages in thread From: Sergio Gonzalez Monroy @ 2017-08-03 8:29 UTC (permalink / raw) To: Rohit Saini (Stellus), 'dev@dpdk.org' On 03/08/2017 07:12, Rohit Saini (Stellus) wrote: > With below code, I am getting this warning. > > warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] > > my_node_t *data_ptr = (my_node_t *) rte_malloc(NULL, sizeof(my_node_t), 0); As far as I can see, the syntax looks correct. How are you building/linking your application? I would suggest to modify the DPDK examples/helloworld application to just do a simple rte_malloc as a first step. Thanks, Sergio > Thanks, > Rohit > > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Rohit Saini (Stellus) > Sent: Thursday, August 03, 2017 11:28 AM > To: 'dev@dpdk.org' <dev@dpdk.org> > Subject: [dpdk-dev] Use rte_malloc in application > > Hi, > I have a use case in my application where I need to implement my own memory manager, rather than doing malloc/free everytime to kernel. > Instead of writing my own memory manager, I am thinking to use dpdk rte_malloc or rte_mempool. Please let me know if this is a good idea. > > Also, > > my_node_t *data_ptr = (my_node_t *) (uintptr_t) rte_malloc(NULL, sizeof(my_node_t), 0); > > data_ptr is pointing to some invalid memory. Am I doing anything wrong here? > > > Thanks, > Rohit ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] Use rte_malloc in application 2017-08-03 8:29 ` Sergio Gonzalez Monroy @ 2017-08-10 11:19 ` Rohit Saini (Stellus) 0 siblings, 0 replies; 5+ messages in thread From: Rohit Saini (Stellus) @ 2017-08-10 11:19 UTC (permalink / raw) To: 'Sergio Gonzalez Monroy', 'dev@dpdk.org' Thanks Sergio. It helped. There was a mistake the way I was linking dpdk with my application. Thanks, Rohit -----Original Message----- From: Sergio Gonzalez Monroy [mailto:sergio.gonzalez.monroy@intel.com] Sent: Thursday, August 03, 2017 1:59 PM To: Rohit Saini (Stellus) <rohit.saini@stellus.com>; 'dev@dpdk.org' <dev@dpdk.org> Subject: Re: [dpdk-dev] Use rte_malloc in application On 03/08/2017 07:12, Rohit Saini (Stellus) wrote: > With below code, I am getting this warning. > > warning: cast to pointer from integer of different size > [-Wint-to-pointer-cast] > > my_node_t *data_ptr = (my_node_t *) rte_malloc(NULL, > sizeof(my_node_t), 0); As far as I can see, the syntax looks correct. How are you building/linking your application? I would suggest to modify the DPDK examples/helloworld application to just do a simple rte_malloc as a first step. Thanks, Sergio > Thanks, > Rohit > > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Rohit Saini > (Stellus) > Sent: Thursday, August 03, 2017 11:28 AM > To: 'dev@dpdk.org' <dev@dpdk.org> > Subject: [dpdk-dev] Use rte_malloc in application > > Hi, > I have a use case in my application where I need to implement my own memory manager, rather than doing malloc/free everytime to kernel. > Instead of writing my own memory manager, I am thinking to use dpdk rte_malloc or rte_mempool. Please let me know if this is a good idea. > > Also, > > my_node_t *data_ptr = (my_node_t *) (uintptr_t) rte_malloc(NULL, > sizeof(my_node_t), 0); > > data_ptr is pointing to some invalid memory. Am I doing anything wrong here? > > > Thanks, > Rohit ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] Use rte_malloc in application 2017-08-03 6:12 ` Rohit Saini (Stellus) 2017-08-03 8:29 ` Sergio Gonzalez Monroy @ 2017-08-03 13:29 ` Stefan Puiu 1 sibling, 0 replies; 5+ messages in thread From: Stefan Puiu @ 2017-08-03 13:29 UTC (permalink / raw) To: Rohit Saini (Stellus); +Cc: dev Hi, This is not strictly DPDK-related, but still... On Thu, Aug 3, 2017 at 9:12 AM, Rohit Saini (Stellus) <rohit.saini@stellus.com> wrote: > With below code, I am getting this warning. > > warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] > > my_node_t *data_ptr = (my_node_t *) rte_malloc(NULL, sizeof(my_node_t), 0); I think the warning concerns the first argument passed to rte_malloc. NULL probably expands to 0 (at least that seems to happen in C++), so it gets treated as an int instead of a pointer. In C++11, there's nullptr for this; or you could simply use a non-NULL string. HTH, Stefan. > > Thanks, > Rohit > > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Rohit Saini (Stellus) > Sent: Thursday, August 03, 2017 11:28 AM > To: 'dev@dpdk.org' <dev@dpdk.org> > Subject: [dpdk-dev] Use rte_malloc in application > > Hi, > I have a use case in my application where I need to implement my own memory manager, rather than doing malloc/free everytime to kernel. > Instead of writing my own memory manager, I am thinking to use dpdk rte_malloc or rte_mempool. Please let me know if this is a good idea. > > Also, > > my_node_t *data_ptr = (my_node_t *) (uintptr_t) rte_malloc(NULL, sizeof(my_node_t), 0); > > data_ptr is pointing to some invalid memory. Am I doing anything wrong here? > > > Thanks, > Rohit ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-10 11:19 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <CGME20170803055747uscas1p15fd0c2a998cf260734f89cc48192a61c@uscas1p1.samsung.com> 2017-08-03 5:57 ` [dpdk-dev] Use rte_malloc in application Rohit Saini (Stellus) 2017-08-03 6:12 ` Rohit Saini (Stellus) 2017-08-03 8:29 ` Sergio Gonzalez Monroy 2017-08-10 11:19 ` Rohit Saini (Stellus) 2017-08-03 13:29 ` Stefan Puiu
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).