MCPcopy Create free account
hub / github.com/F-Stack/f-stack / app_pkt_handle

Function app_pkt_handle

dpdk/examples/qos_meter/main.c:142–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142static inline int
143app_pkt_handle(struct rte_mbuf *pkt, uint64_t time)
144{
145 uint8_t input_color, output_color;
146 uint8_t *pkt_data = rte_pktmbuf_mtod(pkt, uint8_t *);
147 uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) -
148 sizeof(struct rte_ether_hdr);
149 uint8_t flow_id = (uint8_t)(pkt_data[APP_PKT_FLOW_POS] & (APP_FLOWS_MAX - 1));
150 input_color = pkt_data[APP_PKT_COLOR_POS];
151 enum policer_action action;
152
153 /* color input is not used for blind modes */
154 output_color = (uint8_t) FUNC_METER(&app_flows[flow_id],
155 &PROFILE,
156 time,
157 pkt_len,
158 (enum rte_color) input_color);
159
160 /* Apply policing and set the output color */
161 action = policer_table[input_color][output_color];
162 app_set_pkt_color(pkt_data, action);
163
164 return action;
165}
166
167
168static __rte_noreturn int

Callers 1

main_loopFunction · 0.85

Calls 1

app_set_pkt_colorFunction · 0.85

Tested by

no test coverage detected