All of lore.kernel.org
 help / color / mirror / Atom feed
* API in dpdk  to get total free physical memory
@ 2017-10-05  5:56 Venumadhav Josyula
  2017-10-05  9:02 ` Burakov, Anatoly
  0 siblings, 1 reply; 6+ messages in thread
From: Venumadhav Josyula @ 2017-10-05  5:56 UTC (permalink / raw)
  To: dev; +Cc: Venumadhav Josyula

Hi All,

Like 'rte_eal_get_physmem_size' api to the total size of the physical memory. Is there an API to get to get total free memory physical memory available ?

We want such API we are planning to implement such API for the same

/* get the total size of memory */
uint64_t
rte_eal_get_physmem_free(int socket_id)
{
                const struct rte_mem_config *mcfg;
                unsigned i = 0;
                uint64_t total_len = 0;

                /* get pointer to global configuration */
                mcfg = rte_eal_get_configuration()->mem_config;

                for (i=0; i<RTE_MAX_MEMSEG; i++) {
                                if (mcfg->free_memseg[i].addr == NULL)
                                                break;

        if (mcfg->free_memseg[i].len == 0)
                                                continue;

        /* bad socket ID */
                                if (socket_id != SOCKET_ID_ANY &&
                                    mcfg->free_memseg[i].socket_id != SOCKET_ID_ANY &&
                                    socket_id != mcfg->free_memseg[i].socket_id)
                                                continue;

                                total_len += mcfg->free_memseg[i].len;
                }

                return total_len;
}

Thanks,
Regards
Venu

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Api in dpdk to get total free physical memory
@ 2018-03-08 21:36 Venumadhav Josyula
  2018-03-09  9:05 ` Burakov, Anatoly
  0 siblings, 1 reply; 6+ messages in thread
From: Venumadhav Josyula @ 2018-03-08 21:36 UTC (permalink / raw)
  To: dev

Hi All,



Like ‘rte_eal_get_physmem_size’ api to the total size of the physical
memory. Is there an API to get to get total free memory physical memory
available ?



We want such API we are planning to implement such API for the same



/* get the total size of memory */

uint64_t

rte_eal_get_physmem_free(int socket_id)

{

const struct rte_mem_config *mcfg;

unsigned i = 0;

uint64_t total_len = 0;



/* get pointer to global configuration */

mcfg = rte_eal_get_configuration()->mem_config;



for (i=0; i<RTE_MAX_MEMSEG; i++) {

if (mcfg->free_memseg[i].addr == NULL)

break;



if (mcfg->free_memseg[i].len == 0)

continue;



/* bad socket ID */

if (socket_id != SOCKET_ID_ANY &&

mcfg->free_memseg[i].socket_id != SOCKET_ID_ANY &&

socket_id != mcfg->free_memseg[i].socket_id)

continue;



total_len += mcfg->free_memseg[i].len;

}



return total_len;

}



Thanks,

Regards

Venu

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

end of thread, other threads:[~2018-03-09 10:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05  5:56 API in dpdk to get total free physical memory Venumadhav Josyula
2017-10-05  9:02 ` Burakov, Anatoly
2018-03-08 21:36 Api " Venumadhav Josyula
2018-03-09  9:05 ` Burakov, Anatoly
2018-03-09  9:59   ` Venumadhav Josyula
2018-03-09 10:56     ` Burakov, Anatoly

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.