56 using mgrp_hdl_t = uintptr_t;
57 using l1_hdl_t = uintptr_t;
58 using l2_hdl_t = uintptr_t;
85 static constexpr int DEFAULT_MGID_TABLE_SIZE = 4096;
86 static constexpr int DEFAULT_L1_MAX_ENTRIES = 4096;
87 static constexpr int DEFAULT_L2_MAX_ENTRIES = 8192;
89 static constexpr size_t PORT_MAP_SIZE = 512;
90 using PortMap = McPre::Set<PORT_MAP_SIZE>;
92 static constexpr size_t LAG_MAP_SIZE = 512;
93 using LagMap = McPre::Set<LAG_MAP_SIZE>;
96 int mgid_table_size = DEFAULT_MGID_TABLE_SIZE,
97 int l1_max_entries = DEFAULT_L1_MAX_ENTRIES,
98 int l2_max_entries = DEFAULT_L2_MAX_ENTRIES)
99 : mgid_table_size(mgid_table_size),
100 l1_max_entries(l1_max_entries),
101 l2_max_entries(l2_max_entries) {}
102 McReturnCode mc_mgrp_create(
const mgrp_t, mgrp_hdl_t *);
103 McReturnCode mc_mgrp_destroy(
const mgrp_hdl_t);
104 McReturnCode mc_node_create(
const rid_t,
105 const PortMap &port_map,
107 McReturnCode mc_node_associate(
const mgrp_hdl_t,
const l1_hdl_t);
108 McReturnCode mc_node_dissociate(
const mgrp_hdl_t,
const l1_hdl_t);
109 McReturnCode mc_node_destroy(
const l1_hdl_t);
110 McReturnCode mc_node_update(
const l1_hdl_t l1_hdl,
111 const PortMap &port_map);
113 std::string mc_get_entries()
const;
158 std::vector<l1_hdl_t> l1_list{};
161 explicit MgidEntry(
mgrp_t mgid)
166 mgrp_hdl_t mgrp_hdl{};
169 bool is_associated{
false};
172 explicit L1Entry(
rid_t rid)
182 L2Entry(l1_hdl_t l1_hdl,
const PortMap &port_map)
183 : l1_hdl(l1_hdl), port_map(port_map) {}
185 L2Entry(l1_hdl_t l1_hdl,
const PortMap &port_map,
const LagMap &lag_map)
186 : l1_hdl(l1_hdl), port_map(port_map), lag_map(lag_map) {}
193 void get_entries_common(Json::Value *root)
const;
196 void node_dissociate(MgidEntry *mgid_entry, l1_hdl_t l1_hdl);
198 std::unordered_map<mgrp_hdl_t, MgidEntry> mgid_entries{};
199 std::unordered_map<l1_hdl_t, L1Entry> l1_entries{};
200 std::unordered_map<l2_hdl_t, L2Entry> l2_entries{};
201 HandleMgr l1_handles{};
202 HandleMgr l2_handles{};
203 mutable boost::shared_mutex mutex{};