@@ -88,7 +88,7 @@ pkt_copy_or_drop(struct nm_desc *dst, const char *buf, unsigned len)
8888
8989 if (nm_ring_space (txring )) {
9090 struct netmap_slot * ts = & txring -> slot [txring -> head ];
91- char * txbuf = NETMAP_BUF (txring , ts -> buf_idx );
91+ char * txbuf = NETMAP_BUF (txring , ts -> buf_idx );
9292
9393 ts -> len = len ;
9494 memcpy (txbuf , buf , len );
@@ -112,26 +112,26 @@ route_forward(struct nm_desc *one, struct nm_desc *two, struct nm_desc *three,
112112 int nrx ;
113113
114114 rxring = NETMAP_RXRING (one -> nifp , si );
115- nrx = nm_ring_space (rxring );
115+ nrx = nm_ring_space (rxring );
116116 if (nrx == 0 ) {
117117 si ++ ;
118118 continue ;
119119 }
120120
121- rxhead = rxring -> head ;
121+ rxhead = rxring -> head ;
122122 for (; nrx > 0 ; nrx -- , rxhead = nm_ring_next (rxring , rxhead )) {
123123 struct netmap_slot * rs = & rxring -> slot [rxhead ];
124- char * rxbuf = NETMAP_BUF (rxring , rs -> buf_idx );
125- int udp_port = pkt_get_udp_port (rxbuf );
124+ char * rxbuf = NETMAP_BUF (rxring , rs -> buf_idx );
125+ int udp_port = pkt_get_udp_port (rxbuf );
126126
127127 if (udp_port == udp_port_a ) {
128128 fwda += pkt_copy_or_drop (two , rxbuf , rs -> len );
129129 } else if (udp_port == udp_port_b ) {
130130 fwdb += pkt_copy_or_drop (three , rxbuf , rs -> len );
131131 }
132- tot ++ ;
132+ tot ++ ;
133133 }
134- rxring -> head = rxring -> cur = rxhead ;
134+ rxring -> head = rxring -> cur = rxhead ;
135135 }
136136}
137137#endif /* SOLUTION */
@@ -233,9 +233,9 @@ main_loop(const char *netmap_port_one, const char *netmap_port_two,
233233 int ret ;
234234 int two_ready , three_ready ;
235235
236- pfd [0 ].fd = nmd_one -> fd ;
237- pfd [1 ].fd = nmd_two -> fd ;
238- pfd [2 ].fd = nmd_three -> fd ;
236+ pfd [0 ].fd = nmd_one -> fd ;
237+ pfd [1 ].fd = nmd_two -> fd ;
238+ pfd [2 ].fd = nmd_three -> fd ;
239239 pfd [0 ].events = POLLIN ;
240240 pfd [1 ].events = 0 ;
241241 pfd [2 ].events = 0 ;
@@ -244,7 +244,7 @@ main_loop(const char *netmap_port_one, const char *netmap_port_two,
244244 * line blocking (we don't know in advance which packets are going to
245245 * be forwarded where). As a result, unfortunately, we may end dropping
246246 * packets. */
247- two_ready = rx_ready (nmd_two );
247+ two_ready = rx_ready (nmd_two );
248248 three_ready = rx_ready (nmd_three );
249249 if (!two_ready ) {
250250 pfd [1 ].events |= POLLIN ;
@@ -270,8 +270,7 @@ main_loop(const char *netmap_port_one, const char *netmap_port_two,
270270 }
271271
272272 /* Route and forward from port one to ports two and three. */
273- route_forward (nmd_one , nmd_two , nmd_three , udp_port_a ,
274- udp_port_b );
273+ route_forward (nmd_one , nmd_two , nmd_three , udp_port_a , udp_port_b );
275274#endif /* SOLUTION */
276275
277276 /* Forward traffic from ports two and three back to port one. */
@@ -385,7 +384,7 @@ main(int argc, char **argv)
385384 main_loop (netmap_port_one , netmap_port_two , netmap_port_three , udp_port_a ,
386385 udp_port_b );
387386
388- (void ) pkt_get_udp_port ;
387+ (void )pkt_get_udp_port ;
389388
390389 return 0 ;
391390}
0 commit comments