On 07/01/15 18:41, Bill Fischofer wrote:
The intent behind the odp_structname_init() routines (following the POSIX model) is simply to initialize struct values to default values to handle things like reserved fields that the application might not know about.

In that case init() should allocate param and give application only visible / changeable block of memory.


Extending that to provide fill in for the various subfields is really beyond the scope of this abstraction. I'm not sure if there's real value in trying to do that since the application is free to set fields however it wishes and the compiler will optimize these assignments.


Yes, not really understand how that supposed to work. I.e. for example some platform adds internal y and x.
On pool_param_init() it will set .y = 1; .x = 2;

On next pool_param_init() it's supposed that values will be different. But it's not clear how that values selected. And why all that can not be in pool_create() itself. So I think that we need only to zero values or set them to invalid. In that case param->type has to be initialized to ODP_EVENT_INVALID in previous patch.

Also I'm looking to odp_pool_create() and there are real seg_len and blk_size calculations. Ho about that real info will be placed to params returned by init?

Thank you,
Maxim.

On Wed, Jul 1, 2015 at 9:57 AM, Maxim Uvarov <maxim.uva...@linaro.org <mailto:maxim.uva...@linaro.org>> wrote:

    After reading this patch it looks like buffer size is good
    parameter to init function. Also if we anyway need to set up
    seg_len, len and num, why not to pass that values to init?

    Maxim.


    On 07/01/15 04:39, Bill Fischofer wrote:

        Signed-off-by: Bill Fischofer <bill.fischo...@linaro.org
        <mailto:bill.fischo...@linaro.org>>
        ---
          example/classifier/odp_classifier.c | 2 +-
          example/generator/odp_generator.c   | 2 +-
          example/ipsec/odp_ipsec.c           | 4 ++--
          example/packet/odp_pktio.c          | 2 +-
          example/timer/odp_timer_test.c      | 1 +
          5 files changed, 6 insertions(+), 5 deletions(-)

        diff --git a/example/classifier/odp_classifier.c
        b/example/classifier/odp_classifier.c
        index ef95f95..e9b3700 100644
        --- a/example/classifier/odp_classifier.c
        +++ b/example/classifier/odp_classifier.c
        @@ -430,7 +430,7 @@ int main(int argc, char *argv[])
                printf("cpu mask:           %s\n", cpumaskstr);
                /* Create packet pool */
        -       memset(&params, 0, sizeof(params));
        +       odp_pool_param_init(&params);
                params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
                params.pkt.len     = SHM_PKT_POOL_BUF_SIZE;
                params.pkt.num     =
        SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
        diff --git a/example/generator/odp_generator.c
        b/example/generator/odp_generator.c
        index 484e6bc..47416b2 100644
        --- a/example/generator/odp_generator.c
        +++ b/example/generator/odp_generator.c
        @@ -649,7 +649,7 @@ int main(int argc, char *argv[])
                printf("cpu mask:           %s\n", cpumaskstr);
                /* Create packet pool */
        -       memset(&params, 0, sizeof(params));
        +       odp_pool_param_init(&params);
                params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
                params.pkt.len     = SHM_PKT_POOL_BUF_SIZE;
                params.pkt.num     =
        SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
        diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
        index da88b17..0924a6e 100644
        --- a/example/ipsec/odp_ipsec.c
        +++ b/example/ipsec/odp_ipsec.c
        @@ -348,7 +348,7 @@ void ipsec_init_pre(void)
                }
                /* Create output buffer pool */
        -       memset(&params, 0, sizeof(params));
        +       odp_pool_param_init(&params);
                params.pkt.seg_len = SHM_OUT_POOL_BUF_SIZE;
                params.pkt.len     = SHM_OUT_POOL_BUF_SIZE;
                params.pkt.num     = SHM_PKT_POOL_BUF_COUNT;
        @@ -1294,7 +1294,7 @@ main(int argc, char *argv[])
                odp_barrier_init(&sync_barrier, num_workers);
                /* Create packet buffer pool */
        -       memset(&params, 0, sizeof(params));
        +       odp_pool_param_init(&params);
                params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
                params.pkt.len     = SHM_PKT_POOL_BUF_SIZE;
                params.pkt.num     = SHM_PKT_POOL_BUF_COUNT;
        diff --git a/example/packet/odp_pktio.c
        b/example/packet/odp_pktio.c
        index 7430b09..c485530 100644
        --- a/example/packet/odp_pktio.c
        +++ b/example/packet/odp_pktio.c
        @@ -376,7 +376,7 @@ int main(int argc, char *argv[])
                printf("cpu mask:           %s\n", cpumaskstr);
                /* Create packet pool */
        -       memset(&params, 0, sizeof(params));
        +       odp_pool_param_init(&params);
                params.pkt.seg_len = SHM_PKT_POOL_BUF_SIZE;
                params.pkt.len     = SHM_PKT_POOL_BUF_SIZE;
                params.pkt.num     =
        SHM_PKT_POOL_SIZE/SHM_PKT_POOL_BUF_SIZE;
        diff --git a/example/timer/odp_timer_test.c
        b/example/timer/odp_timer_test.c
        index da7b208..ff1a8ce 100644
        --- a/example/timer/odp_timer_test.c
        +++ b/example/timer/odp_timer_test.c
        @@ -412,6 +412,7 @@ int main(int argc, char *argv[])
                /*
                 * Create pool for timeouts
                 */
        +       odp_pool_param_init(&params);
                params.tmo.num   = NUM_TMOS;
                params.type      = ODP_POOL_TIMEOUT;


    _______________________________________________
    lng-odp mailing list
    lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
    https://lists.linaro.org/mailman/listinfo/lng-odp



_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to