1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#ifndef ROCKER_WORLD_H
18#define ROCKER_WORLD_H
19
20#include "rocker_hw.h"
21
22enum rocker_world_type {
23 ROCKER_WORLD_TYPE_OF_DPA = ROCKER_PORT_MODE_OF_DPA,
24 ROCKER_WORLD_TYPE_MAX,
25};
26
27typedef int (world_init)(World *world);
28typedef void (world_uninit)(World *world);
29typedef ssize_t (world_ig)(World *world, uint32_t pport,
30 const struct iovec *iov, int iovcnt);
31typedef int (world_cmd)(World *world, DescInfo *info,
32 char *buf, uint16_t cmd,
33 RockerTlv *cmd_info_tlv);
34
35typedef struct world_ops {
36 const char *name;
37 world_init *init;
38 world_uninit *uninit;
39 world_ig *ig;
40 world_cmd *cmd;
41} WorldOps;
42
43ssize_t world_ingress(World *world, uint32_t pport,
44 const struct iovec *iov, int iovcnt);
45int world_do_cmd(World *world, DescInfo *info,
46 char *buf, uint16_t cmd, RockerTlv *cmd_info_tlv);
47
48World *world_alloc(Rocker *r, size_t sizeof_private,
49 enum rocker_world_type type, WorldOps *ops);
50void world_free(World *world);
51void world_reset(World *world);
52
53void *world_private(World *world);
54Rocker *world_rocker(World *world);
55
56enum rocker_world_type world_type(World *world);
57const char *world_name(World *world);
58
59World *rocker_get_world(Rocker *r, enum rocker_world_type type);
60
61#endif
62