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

Function sa_group

dpdk/examples/ipsec-secgw/ipsec_process.c:93–121  ·  view source on GitHub ↗

* group input packets byt the SA they belong to. */

Source from the content-addressed store, hash-verified

91 * group input packets byt the SA they belong to.
92 */
93static uint32_t
94sa_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.

Callers 1

ipsec_processFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected