summaryrefslogtreecommitdiffstats
path: root/stacks/lwip_stack/src/include/common_mem_buf.h
blob: 9ba000843477363290b4ab597dd67831f72fc617 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
*
* Copyright (c) 2018 Huawei Technologies Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef _COMMON_MEM_BUF_H_
#define _COMMON_MEM_BUF_H_

#ifdef HAL_LIB
#else

#include "nsfw_mem_api.h"
#include "common_mem_base_type.h"
#include "types.h"

typedef enum __DMM_PROC_TYPE
{
    DMM_PROC_T_AUTO = 0,        /*auto detect */
    DMM_PROC_T_PRIMARY = 1,     /* set to primary */
    DMM_PROC_T_SECONDARY = 2,   /* set to secondary */
    DMM_PROC_T_INVALID
} DMM_PROC_TYPE;

#define  DMM_MBUF_RET_OK    0
#define  DMM_MBUF_RET_ERR   1

#define LCORE_MAX        128
#define LCORE_MASK_PER   (sizeof(int) * 8)
#define LCORE_MASK_MAX   (LCORE_MAX/LCORE_MASK_PER)

#define LCORE_MASK_SET(ilcoremask, value) \
    if (value < LCORE_MAX) \
    { \
       ilcoremask[(value/LCORE_MASK_PER)] = (int) ( (ilcoremask[(value/LCORE_MASK_PER)]) | (1< (value%LCORE_MASK_PER))); \
    } \

#define  DMM_HUGTBL_ENABLE   0
#define  DMM_HUGTBL_DISABLE  1

typedef struct __common_pal_module_info
{
    int ishare_mem_size;        /*shared memory size */
    int ilcoremask[LCORE_MASK_MAX];
      /**/ unsigned char uchugeflag;
    unsigned char ucproctype;
    unsigned char ucinstance;
    unsigned char ucresrv2;
} common_mem_pal_module_info;

/**
 * rte pal module init.
 *
 *
 * @param name
 *   The name of the buf pool.
 */
int nscomm_pal_module_init(nsfw_mem_para * para,
                           common_mem_pal_module_info * pinfo, u8 app_mode);

void *nscomm_memzone_data_reserve_name(const char *name, size_t len,
                                       int socket_id);

void *nscomm_memzone_data_lookup_name(const char *name);

#endif

#endif /* _COMMON_MEM_BUF_H_ */