| 148 | } |
| 149 | |
| 150 | static uint16_t |
| 151 | udp4_input_node_process_scalar(struct rte_graph *graph, struct rte_node *node, |
| 152 | void **objs, uint16_t nb_objs) |
| 153 | { |
| 154 | struct rte_hash *hash_tbl_handle = UDP4_INPUT_NODE_HASH(node->ctx); |
| 155 | rte_edge_t next_index, udplookup_node; |
| 156 | struct rte_udp_hdr *pkt_udp_hdr; |
| 157 | uint16_t last_spec = 0; |
| 158 | void **to_next, **from; |
| 159 | struct rte_mbuf *mbuf; |
| 160 | uint16_t held = 0; |
| 161 | uint16_t next = 0; |
| 162 | int i, rc; |
| 163 | |
| 164 | /* Speculative next */ |
| 165 | next_index = UDP4_INPUT_NODE_NEXT_INDEX(node->ctx); |
| 166 | |
| 167 | from = objs; |
| 168 | |
| 169 | to_next = rte_node_next_stream_get(graph, node, next_index, nb_objs); |
| 170 | for (i = 0; i < nb_objs; i++) { |
| 171 | struct flow_key key_port; |
| 172 | |
| 173 | mbuf = (struct rte_mbuf *)objs[i]; |
| 174 | pkt_udp_hdr = rte_pktmbuf_mtod_offset(mbuf, struct rte_udp_hdr *, |
| 175 | sizeof(struct rte_ether_hdr) + |
| 176 | sizeof(struct rte_ipv4_hdr)); |
| 177 | |
| 178 | key_port.prt_dst = rte_cpu_to_be_16(pkt_udp_hdr->dst_port); |
| 179 | rc = rte_hash_lookup_data(hash_tbl_handle, |
| 180 | &key_port.prt_dst, |
| 181 | (void **)&udplookup_node); |
| 182 | next = (rc < 0) ? RTE_NODE_UDP4_INPUT_NEXT_PKT_DROP |
| 183 | : udplookup_node; |
| 184 | |
| 185 | if (unlikely(next_index != next)) { |
| 186 | /* Copy things successfully speculated till now */ |
| 187 | rte_memcpy(to_next, from, last_spec * sizeof(from[0])); |
| 188 | from += last_spec; |
| 189 | to_next += last_spec; |
| 190 | held += last_spec; |
| 191 | last_spec = 0; |
| 192 | |
| 193 | rte_node_enqueue_x1(graph, node, next, from[0]); |
| 194 | from += 1; |
| 195 | } else { |
| 196 | last_spec += 1; |
| 197 | } |
| 198 | } |
| 199 | /* !!! Home run !!! */ |
| 200 | if (likely(last_spec == nb_objs)) { |
| 201 | rte_node_next_stream_move(graph, node, next_index); |
| 202 | return nb_objs; |
| 203 | } |
| 204 | held += last_spec; |
| 205 | rte_memcpy(to_next, from, last_spec * sizeof(from[0])); |
| 206 | rte_node_next_stream_put(graph, node, next_index, held); |
| 207 | /* Save the last next used */ |
nothing calls this directly
no test coverage detected