* group input packets byt the SA they belong to. */
| 91 | * group input packets byt the SA they belong to. |
| 92 | */ |
| 93 | static uint32_t |
| 94 | sa_group(void *sa_ptr[], struct rte_mbuf *pkts[], |
| 95 | struct rte_ipsec_group grp[], uint32_t num) |
| 96 | { |
| 97 | uint32_t i, n, spi; |
| 98 | void *sa; |
| 99 | void * const nosa = &spi; |
| 100 | |
| 101 | sa = nosa; |
| 102 | grp[0].m = pkts; |
| 103 | for (i = 0, n = 0; i != num; i++) { |
| 104 | |
| 105 | if (sa != sa_ptr[i]) { |
| 106 | grp[n].cnt = pkts + i - grp[n].m; |
| 107 | n += (sa != nosa); |
| 108 | grp[n].id.ptr = sa_ptr[i]; |
| 109 | grp[n].m = pkts + i; |
| 110 | sa = sa_ptr[i]; |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | /* terminate last group */ |
| 115 | if (sa != nosa) { |
| 116 | grp[n].cnt = pkts + i - grp[n].m; |
| 117 | n++; |
| 118 | } |
| 119 | |
| 120 | return n; |
| 121 | } |
| 122 | |
| 123 | /* |
| 124 | * helper function, splits processed packets into ipv4/ipv6 traffic. |