examples/l3fwd: modularize
[dpdk.git] / examples / l3fwd / l3fwd_lpm_sse.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Intel Corporation nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef __L3FWD_LPM_SSE_H__
35 #define __L3FWD_LPM_SSE_H__
36
37 static inline __attribute__((always_inline)) void
38 send_packetsx4(struct lcore_conf *qconf, uint8_t port,
39         struct rte_mbuf *m[], uint32_t num)
40 {
41         uint32_t len, j, n;
42
43         len = qconf->tx_mbufs[port].len;
44
45         /*
46          * If TX buffer for that queue is empty, and we have enough packets,
47          * then send them straightway.
48          */
49         if (num >= MAX_TX_BURST && len == 0) {
50                 n = rte_eth_tx_burst(port, qconf->tx_queue_id[port], m, num);
51                 if (unlikely(n < num)) {
52                         do {
53                                 rte_pktmbuf_free(m[n]);
54                         } while (++n < num);
55                 }
56                 return;
57         }
58
59         /*
60          * Put packets into TX buffer for that queue.
61          */
62
63         n = len + num;
64         n = (n > MAX_PKT_BURST) ? MAX_PKT_BURST - len : num;
65
66         j = 0;
67         switch (n % FWDSTEP) {
68         while (j < n) {
69         case 0:
70                 qconf->tx_mbufs[port].m_table[len + j] = m[j];
71                 j++;
72         case 3:
73                 qconf->tx_mbufs[port].m_table[len + j] = m[j];
74                 j++;
75         case 2:
76                 qconf->tx_mbufs[port].m_table[len + j] = m[j];
77                 j++;
78         case 1:
79                 qconf->tx_mbufs[port].m_table[len + j] = m[j];
80                 j++;
81         }
82         }
83
84         len += n;
85
86         /* enough pkts to be sent */
87         if (unlikely(len == MAX_PKT_BURST)) {
88
89                 send_burst(qconf, MAX_PKT_BURST, port);
90
91                 /* copy rest of the packets into the TX buffer. */
92                 len = num - n;
93                 j = 0;
94                 switch (len % FWDSTEP) {
95                 while (j < len) {
96                 case 0:
97                         qconf->tx_mbufs[port].m_table[j] = m[n + j];
98                         j++;
99                 case 3:
100                         qconf->tx_mbufs[port].m_table[j] = m[n + j];
101                         j++;
102                 case 2:
103                         qconf->tx_mbufs[port].m_table[j] = m[n + j];
104                         j++;
105                 case 1:
106                         qconf->tx_mbufs[port].m_table[j] = m[n + j];
107                         j++;
108                 }
109                 }
110         }
111
112         qconf->tx_mbufs[port].len = len;
113 }
114
115 #ifdef DO_RFC_1812_CHECKS
116
117 #define IPV4_MIN_VER_IHL        0x45
118 #define IPV4_MAX_VER_IHL        0x4f
119 #define IPV4_MAX_VER_IHL_DIFF   (IPV4_MAX_VER_IHL - IPV4_MIN_VER_IHL)
120
121 /* Minimum value of IPV4 total length (20B) in network byte order. */
122 #define IPV4_MIN_LEN_BE (sizeof(struct ipv4_hdr) << 8)
123
124 /*
125  * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2:
126  * - The IP version number must be 4.
127  * - The IP header length field must be large enough to hold the
128  *    minimum length legal IP datagram (20 bytes = 5 words).
129  * - The IP total length field must be large enough to hold the IP
130  *   datagram header, whose length is specified in the IP header length
131  *   field.
132  * If we encounter invalid IPV4 packet, then set destination port for it
133  * to BAD_PORT value.
134  */
135 static inline __attribute__((always_inline)) void
136 rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype)
137 {
138         uint8_t ihl;
139
140         if (RTE_ETH_IS_IPV4_HDR(ptype)) {
141                 ihl = ipv4_hdr->version_ihl - IPV4_MIN_VER_IHL;
142
143                 ipv4_hdr->time_to_live--;
144                 ipv4_hdr->hdr_checksum++;
145
146                 if (ihl > IPV4_MAX_VER_IHL_DIFF ||
147                                 ((uint8_t)ipv4_hdr->total_length == 0 &&
148                                 ipv4_hdr->total_length < IPV4_MIN_LEN_BE)) {
149                         dp[0] = BAD_PORT;
150                 }
151         }
152 }
153
154 #else
155 #define rfc1812_process(mb, dp) do { } while (0)
156 #endif /* DO_RFC_1812_CHECKS */
157
158 static inline __attribute__((always_inline)) uint16_t
159 get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt,
160         uint32_t dst_ipv4, uint8_t portid)
161 {
162         uint8_t next_hop;
163         struct ipv6_hdr *ipv6_hdr;
164         struct ether_hdr *eth_hdr;
165
166         if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) {
167                 if (rte_lpm_lookup(qconf->ipv4_lookup_struct, dst_ipv4,
168                                 &next_hop) != 0)
169                         next_hop = portid;
170         } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) {
171                 eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
172                 ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1);
173                 if (rte_lpm6_lookup(qconf->ipv6_lookup_struct,
174                                 ipv6_hdr->dst_addr, &next_hop) != 0)
175                         next_hop = portid;
176         } else {
177                 next_hop = portid;
178         }
179
180         return next_hop;
181 }
182
183 static inline void
184 process_packet(struct lcore_conf *qconf, struct rte_mbuf *pkt,
185         uint16_t *dst_port, uint8_t portid)
186 {
187         struct ether_hdr *eth_hdr;
188         struct ipv4_hdr *ipv4_hdr;
189         uint32_t dst_ipv4;
190         uint16_t dp;
191         __m128i te, ve;
192
193         eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
194         ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
195
196         dst_ipv4 = ipv4_hdr->dst_addr;
197         dst_ipv4 = rte_be_to_cpu_32(dst_ipv4);
198         dp = get_dst_port(qconf, pkt, dst_ipv4, portid);
199
200         te = _mm_loadu_si128((__m128i *)eth_hdr);
201         ve = val_eth[dp];
202
203         dst_port[0] = dp;
204         rfc1812_process(ipv4_hdr, dst_port, pkt->packet_type);
205
206         te =  _mm_blend_epi16(te, ve, MASK_ETH);
207         _mm_storeu_si128((__m128i *)eth_hdr, te);
208 }
209
210 /*
211  * Read packet_type and destination IPV4 addresses from 4 mbufs.
212  */
213 static inline void
214 processx4_step1(struct rte_mbuf *pkt[FWDSTEP],
215                 __m128i *dip,
216                 uint32_t *ipv4_flag)
217 {
218         struct ipv4_hdr *ipv4_hdr;
219         struct ether_hdr *eth_hdr;
220         uint32_t x0, x1, x2, x3;
221
222         eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *);
223         ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
224         x0 = ipv4_hdr->dst_addr;
225         ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4;
226
227         eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *);
228         ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
229         x1 = ipv4_hdr->dst_addr;
230         ipv4_flag[0] &= pkt[1]->packet_type;
231
232         eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *);
233         ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
234         x2 = ipv4_hdr->dst_addr;
235         ipv4_flag[0] &= pkt[2]->packet_type;
236
237         eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *);
238         ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1);
239         x3 = ipv4_hdr->dst_addr;
240         ipv4_flag[0] &= pkt[3]->packet_type;
241
242         dip[0] = _mm_set_epi32(x3, x2, x1, x0);
243 }
244
245 /*
246  * Lookup into LPM for destination port.
247  * If lookup fails, use incoming port (portid) as destination port.
248  */
249 static inline void
250 processx4_step2(const struct lcore_conf *qconf,
251                 __m128i dip,
252                 uint32_t ipv4_flag,
253                 uint8_t portid,
254                 struct rte_mbuf *pkt[FWDSTEP],
255                 uint16_t dprt[FWDSTEP])
256 {
257         rte_xmm_t dst;
258         const  __m128i bswap_mask = _mm_set_epi8(12, 13, 14, 15, 8, 9, 10, 11,
259                                                 4, 5, 6, 7, 0, 1, 2, 3);
260
261         /* Byte swap 4 IPV4 addresses. */
262         dip = _mm_shuffle_epi8(dip, bswap_mask);
263
264         /* if all 4 packets are IPV4. */
265         if (likely(ipv4_flag)) {
266                 rte_lpm_lookupx4(qconf->ipv4_lookup_struct, dip, dprt, portid);
267         } else {
268                 dst.x = dip;
269                 dprt[0] = get_dst_port(qconf, pkt[0], dst.u32[0], portid);
270                 dprt[1] = get_dst_port(qconf, pkt[1], dst.u32[1], portid);
271                 dprt[2] = get_dst_port(qconf, pkt[2], dst.u32[2], portid);
272                 dprt[3] = get_dst_port(qconf, pkt[3], dst.u32[3], portid);
273         }
274 }
275
276 /*
277  * Update source and destination MAC addresses in the ethernet header.
278  * Perform RFC1812 checks and updates for IPV4 packets.
279  */
280 static inline void
281 processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP])
282 {
283         __m128i te[FWDSTEP];
284         __m128i ve[FWDSTEP];
285         __m128i *p[FWDSTEP];
286
287         p[0] = rte_pktmbuf_mtod(pkt[0], __m128i *);
288         p[1] = rte_pktmbuf_mtod(pkt[1], __m128i *);
289         p[2] = rte_pktmbuf_mtod(pkt[2], __m128i *);
290         p[3] = rte_pktmbuf_mtod(pkt[3], __m128i *);
291
292         ve[0] = val_eth[dst_port[0]];
293         te[0] = _mm_loadu_si128(p[0]);
294
295         ve[1] = val_eth[dst_port[1]];
296         te[1] = _mm_loadu_si128(p[1]);
297
298         ve[2] = val_eth[dst_port[2]];
299         te[2] = _mm_loadu_si128(p[2]);
300
301         ve[3] = val_eth[dst_port[3]];
302         te[3] = _mm_loadu_si128(p[3]);
303
304         /* Update first 12 bytes, keep rest bytes intact. */
305         te[0] =  _mm_blend_epi16(te[0], ve[0], MASK_ETH);
306         te[1] =  _mm_blend_epi16(te[1], ve[1], MASK_ETH);
307         te[2] =  _mm_blend_epi16(te[2], ve[2], MASK_ETH);
308         te[3] =  _mm_blend_epi16(te[3], ve[3], MASK_ETH);
309
310         _mm_storeu_si128(p[0], te[0]);
311         _mm_storeu_si128(p[1], te[1]);
312         _mm_storeu_si128(p[2], te[2]);
313         _mm_storeu_si128(p[3], te[3]);
314
315         rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1),
316                 &dst_port[0], pkt[0]->packet_type);
317         rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1),
318                 &dst_port[1], pkt[1]->packet_type);
319         rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1),
320                 &dst_port[2], pkt[2]->packet_type);
321         rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1),
322                 &dst_port[3], pkt[3]->packet_type);
323 }
324
325 /*
326  * We group consecutive packets with the same destionation port into one burst.
327  * To avoid extra latency this is done together with some other packet
328  * processing, but after we made a final decision about packet's destination.
329  * To do this we maintain:
330  * pnum - array of number of consecutive packets with the same dest port for
331  * each packet in the input burst.
332  * lp - pointer to the last updated element in the pnum.
333  * dlp - dest port value lp corresponds to.
334  */
335
336 #define GRPSZ   (1 << FWDSTEP)
337 #define GRPMSK  (GRPSZ - 1)
338
339 #define GROUP_PORT_STEP(dlp, dcp, lp, pn, idx)  do { \
340         if (likely((dlp) == (dcp)[(idx)])) {         \
341                 (lp)[0]++;                           \
342         } else {                                     \
343                 (dlp) = (dcp)[idx];                  \
344                 (lp) = (pn) + (idx);                 \
345                 (lp)[0] = 1;                         \
346         }                                            \
347 } while (0)
348
349 /*
350  * Group consecutive packets with the same destination port in bursts of 4.
351  * Suppose we have array of destionation ports:
352  * dst_port[] = {a, b, c, d,, e, ... }
353  * dp1 should contain: <a, b, c, d>, dp2: <b, c, d, e>.
354  * We doing 4 comparisions at once and the result is 4 bit mask.
355  * This mask is used as an index into prebuild array of pnum values.
356  */
357 static inline uint16_t *
358 port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, __m128i dp1, __m128i dp2)
359 {
360         static const struct {
361                 uint64_t pnum; /* prebuild 4 values for pnum[]. */
362                 int32_t  idx;  /* index for new last updated elemnet. */
363                 uint16_t lpv;  /* add value to the last updated element. */
364         } gptbl[GRPSZ] = {
365         {
366                 /* 0: a != b, b != c, c != d, d != e */
367                 .pnum = UINT64_C(0x0001000100010001),
368                 .idx = 4,
369                 .lpv = 0,
370         },
371         {
372                 /* 1: a == b, b != c, c != d, d != e */
373                 .pnum = UINT64_C(0x0001000100010002),
374                 .idx = 4,
375                 .lpv = 1,
376         },
377         {
378                 /* 2: a != b, b == c, c != d, d != e */
379                 .pnum = UINT64_C(0x0001000100020001),
380                 .idx = 4,
381                 .lpv = 0,
382         },
383         {
384                 /* 3: a == b, b == c, c != d, d != e */
385                 .pnum = UINT64_C(0x0001000100020003),
386                 .idx = 4,
387                 .lpv = 2,
388         },
389         {
390                 /* 4: a != b, b != c, c == d, d != e */
391                 .pnum = UINT64_C(0x0001000200010001),
392                 .idx = 4,
393                 .lpv = 0,
394         },
395         {
396                 /* 5: a == b, b != c, c == d, d != e */
397                 .pnum = UINT64_C(0x0001000200010002),
398                 .idx = 4,
399                 .lpv = 1,
400         },
401         {
402                 /* 6: a != b, b == c, c == d, d != e */
403                 .pnum = UINT64_C(0x0001000200030001),
404                 .idx = 4,
405                 .lpv = 0,
406         },
407         {
408                 /* 7: a == b, b == c, c == d, d != e */
409                 .pnum = UINT64_C(0x0001000200030004),
410                 .idx = 4,
411                 .lpv = 3,
412         },
413         {
414                 /* 8: a != b, b != c, c != d, d == e */
415                 .pnum = UINT64_C(0x0002000100010001),
416                 .idx = 3,
417                 .lpv = 0,
418         },
419         {
420                 /* 9: a == b, b != c, c != d, d == e */
421                 .pnum = UINT64_C(0x0002000100010002),
422                 .idx = 3,
423                 .lpv = 1,
424         },
425         {
426                 /* 0xa: a != b, b == c, c != d, d == e */
427                 .pnum = UINT64_C(0x0002000100020001),
428                 .idx = 3,
429                 .lpv = 0,
430         },
431         {
432                 /* 0xb: a == b, b == c, c != d, d == e */
433                 .pnum = UINT64_C(0x0002000100020003),
434                 .idx = 3,
435                 .lpv = 2,
436         },
437         {
438                 /* 0xc: a != b, b != c, c == d, d == e */
439                 .pnum = UINT64_C(0x0002000300010001),
440                 .idx = 2,
441                 .lpv = 0,
442         },
443         {
444                 /* 0xd: a == b, b != c, c == d, d == e */
445                 .pnum = UINT64_C(0x0002000300010002),
446                 .idx = 2,
447                 .lpv = 1,
448         },
449         {
450                 /* 0xe: a != b, b == c, c == d, d == e */
451                 .pnum = UINT64_C(0x0002000300040001),
452                 .idx = 1,
453                 .lpv = 0,
454         },
455         {
456                 /* 0xf: a == b, b == c, c == d, d == e */
457                 .pnum = UINT64_C(0x0002000300040005),
458                 .idx = 0,
459                 .lpv = 4,
460         },
461         };
462
463         union {
464                 uint16_t u16[FWDSTEP + 1];
465                 uint64_t u64;
466         } *pnum = (void *)pn;
467
468         int32_t v;
469
470         dp1 = _mm_cmpeq_epi16(dp1, dp2);
471         dp1 = _mm_unpacklo_epi16(dp1, dp1);
472         v = _mm_movemask_ps((__m128)dp1);
473
474         /* update last port counter. */
475         lp[0] += gptbl[v].lpv;
476
477         /* if dest port value has changed. */
478         if (v != GRPMSK) {
479                 lp = pnum->u16 + gptbl[v].idx;
480                 lp[0] = 1;
481                 pnum->u64 = gptbl[v].pnum;
482         }
483
484         return lp;
485 }
486
487 /*
488  * Buffer optimized handling of packets, invoked
489  * from main_loop.
490  */
491 static inline void
492 l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst,
493                         uint8_t portid, struct lcore_conf *qconf)
494 {
495         int32_t j, k;
496         uint16_t dlp;
497         uint16_t *lp;
498         uint16_t dst_port[MAX_PKT_BURST];
499         __m128i dip[MAX_PKT_BURST / FWDSTEP];
500         uint32_t ipv4_flag[MAX_PKT_BURST / FWDSTEP];
501         uint16_t pnum[MAX_PKT_BURST + 1];
502
503         k = RTE_ALIGN_FLOOR(nb_rx, FWDSTEP);
504         for (j = 0; j != k; j += FWDSTEP) {
505                 processx4_step1(&pkts_burst[j],
506                         &dip[j / FWDSTEP],
507                         &ipv4_flag[j / FWDSTEP]);
508         }
509
510         k = RTE_ALIGN_FLOOR(nb_rx, FWDSTEP);
511         for (j = 0; j != k; j += FWDSTEP) {
512                 processx4_step2(qconf, dip[j / FWDSTEP],
513                         ipv4_flag[j / FWDSTEP], portid,
514                         &pkts_burst[j], &dst_port[j]);
515         }
516
517         /*
518          * Finish packet processing and group consecutive
519          * packets with the same destination port.
520          */
521         k = RTE_ALIGN_FLOOR(nb_rx, FWDSTEP);
522         if (k != 0) {
523                 __m128i dp1, dp2;
524
525                 lp = pnum;
526                 lp[0] = 1;
527
528                 processx4_step3(pkts_burst, dst_port);
529
530                 /* dp1: <d[0], d[1], d[2], d[3], ... > */
531                 dp1 = _mm_loadu_si128((__m128i *)dst_port);
532
533                 for (j = FWDSTEP; j != k; j += FWDSTEP) {
534                         processx4_step3(&pkts_burst[j], &dst_port[j]);
535
536                         /*
537                          * dp2:
538                          * <d[j-3], d[j-2], d[j-1], d[j], ... >
539                          */
540                         dp2 = _mm_loadu_si128((__m128i *)
541                                         &dst_port[j - FWDSTEP + 1]);
542                         lp  = port_groupx4(&pnum[j - FWDSTEP], lp, dp1, dp2);
543
544                         /*
545                          * dp1:
546                          * <d[j], d[j+1], d[j+2], d[j+3], ... >
547                          */
548                         dp1 = _mm_srli_si128(dp2, (FWDSTEP - 1) *
549                                                 sizeof(dst_port[0]));
550                 }
551
552                 /*
553                  * dp2: <d[j-3], d[j-2], d[j-1], d[j-1], ... >
554                  */
555                 dp2 = _mm_shufflelo_epi16(dp1, 0xf9);
556                 lp  = port_groupx4(&pnum[j - FWDSTEP], lp, dp1, dp2);
557
558                 /*
559                  * remove values added by the last repeated
560                  * dst port.
561                  */
562                 lp[0]--;
563                 dlp = dst_port[j - 1];
564         } else {
565                 /* set dlp and lp to the never used values. */
566                 dlp = BAD_PORT - 1;
567                 lp = pnum + MAX_PKT_BURST;
568         }
569
570         /* Process up to last 3 packets one by one. */
571         switch (nb_rx % FWDSTEP) {
572         case 3:
573                 process_packet(qconf, pkts_burst[j], dst_port + j, portid);
574                 GROUP_PORT_STEP(dlp, dst_port, lp, pnum, j);
575                 j++;
576         case 2:
577                 process_packet(qconf, pkts_burst[j], dst_port + j, portid);
578                 GROUP_PORT_STEP(dlp, dst_port, lp, pnum, j);
579                 j++;
580         case 1:
581                 process_packet(qconf, pkts_burst[j], dst_port + j, portid);
582                 GROUP_PORT_STEP(dlp, dst_port, lp, pnum, j);
583                 j++;
584         }
585
586         /*
587          * Send packets out, through destination port.
588          * Consecuteve pacekts with the same destination port
589          * are already grouped together.
590          * If destination port for the packet equals BAD_PORT,
591          * then free the packet without sending it out.
592          */
593         for (j = 0; j < nb_rx; j += k) {
594
595                 int32_t m;
596                 uint16_t pn;
597
598                 pn = dst_port[j];
599                 k = pnum[j];
600
601                 if (likely(pn != BAD_PORT)) {
602                         send_packetsx4(qconf, pn, pkts_burst + j, k);
603                 } else {
604                         for (m = j; m != j + k; m++)
605                                 rte_pktmbuf_free(pkts_burst[m]);
606                 }
607         }
608 }
609
610 #endif /* __L3FWD_LPM_SSE_H__ */