X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Flib%2Fgscphost%2Flfta.c;fp=src%2Flib%2Fgscphost%2Flfta.c;h=d32232ae34a063bc5705939f611899f07ccfb5f2;hb=c9783d8ea8b85d810483559e50dbf2297109e349;hp=0000000000000000000000000000000000000000;hpb=2f2369dfc58997659b3007b1cea68ad6bfc49a90;p=com%2Fgs-lite.git diff --git a/src/lib/gscphost/lfta.c b/src/lib/gscphost/lfta.c new file mode 100644 index 0000000..d32232a --- /dev/null +++ b/src/lib/gscphost/lfta.c @@ -0,0 +1,72 @@ +/* ------------------------------------------------ + Copyright 2014 AT&T Intellectual Property + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ------------------------------------------- */ +#include +#include +#include +#include +#include +#include "rdtsc.h" +#include "packet.h" +#include "gscpipc.h" + +// new +//gs_uint64_t lfta_prefilter(struct packet * p); +extern gs_uint64_t (*lfta_prefilter)(void *pkt); + +struct pr_stats { + gs_uint64_t process; + gs_uint64_t packets; +}; + +void rts_fta_process_packet(struct packet * p) +{ + struct FTA * f; + gs_uint64_t prefilter; + static gs_uint32_t t=0; + static struct pr_stats s = {0}; + gs_uint64_t s1; + gs_uint64_t s2; + prefilter=(*lfta_prefilter)(p); + + if (ftaexec_start()<0) { + gslog(LOG_EMERG,"GSCPRTS::error::could not init " + "FTA list itteration\n"); + return; + } + s1=rdtsc(); + while ((f=ftaexec_next())!=0) { + // fprintf(stderr,"%llu %llu %llu\n",f->prefilter,prefilter,~( (prefilter&(f->prefilter)) | (~(f->prefilter)) )); + if (~( (prefilter&(f->prefilter)) | (~(f->prefilter)) ) == 0) + f->accept_packet(f,0,p,0); + } + s2=rdtsc(); + s.process+=(s2-s1); + s.packets++; + intuple++; + cycles+=(s2-s1); +} + +void rts_fta_done() +{ + struct FTA * f; + if (ftaexec_start()<0) { + gslog(LOG_EMERG,"GSCPRTS::error::could not init " + "FTA list itteration\n"); + return; + } + while ((f=ftaexec_next())!=0) { + f->control_fta(f,FTA_COMMAND_FILE_DONE,0,0); + } +}