From: Ralph Eastwood Date: Thu, 28 Sep 2023 17:19:10 +0000 (+0200) Subject: napatech: remove deprecated hba support X-Git-Tag: suricata-8.0.0-beta1~2089 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b0a5dae6049cc49fee8f04a245a309aed7eaff3;p=thirdparty%2Fsuricata.git napatech: remove deprecated hba support --- diff --git a/src/runmode-napatech.c b/src/runmode-napatech.c index cb8f560ea3..3d503b9655 100644 --- a/src/runmode-napatech.c +++ b/src/runmode-napatech.c @@ -194,14 +194,6 @@ static void *NapatechConfigParser(const char *device) return NULL; } - /* Set the host buffer allowance for this stream - * Right now we just look at the global default - there is no per-stream hba configuration - */ - if (ConfGetInt("napatech.hba", &conf->hba) == 0) { - conf->hba = -1; - } else { - SCLogWarning("Napatech Host Buffer Allocation (hba) will be deprecated in Suricata v7.0."); - } return (void *) conf; } @@ -235,10 +227,6 @@ static int NapatechInit(int runmode) FatalError("Failed to allocate memory for NAPATECH device."); } - if ((ConfGetInt("napatech.hba", &conf->hba) != 0) && (conf->hba > 0)) { - SCLogInfo("Host Buffer Allowance: %d", (int) conf->hba); - } - if (use_hw_bypass) { #ifdef NAPATECH_ENABLE_BYPASS if (NapatechVerifyBypassSupport()) { diff --git a/src/source-napatech.c b/src/source-napatech.c index 5d5e1f674d..572fa748ec 100644 --- a/src/source-napatech.c +++ b/src/source-napatech.c @@ -88,7 +88,6 @@ typedef struct NapatechThreadVars_ ThreadVars *tv; NtNetStreamRx_t rx_stream; uint16_t stream_id; - int hba; TmSlot *slot; } NapatechThreadVars; @@ -685,7 +684,6 @@ TmEcode NapatechStreamThreadInit(ThreadVars *tv, const void *initdata, void **da memset(ntv, 0, sizeof (NapatechThreadVars)); ntv->stream_id = stream_id; ntv->tv = tv; - ntv->hba = conf->hba; DatalinkSetGlobalType(LINKTYPE_ETHERNET); @@ -800,9 +798,6 @@ TmEcode NapatechPacketLoop(ThreadVars *tv, void *data, void *slot) uint64_t pkt_ts; NtNetBuf_t packet_buffer; NapatechThreadVars *ntv = (NapatechThreadVars *) data; - uint64_t hba_pkt_drops = 0; - uint64_t hba_byte_drops = 0; - uint16_t hba_pkt = 0; int numa_node = -1; int set_cpu_affinity = 0; int closer = 0; @@ -880,20 +875,10 @@ TmEcode NapatechPacketLoop(ThreadVars *tv, void *data, void *slot) "Napatech Packet Loop Started - cpu: %3d, cpu_numa: %3d stream: %3u ", sched_getcpu(), numa_node, ntv->stream_id); - if (ntv->hba > 0) { - char *s_hbad_pkt = SCCalloc(1, 32); - if (unlikely(s_hbad_pkt == NULL)) { - FatalError("Failed to allocate memory for NAPATECH stream counter."); - } - snprintf(s_hbad_pkt, 32, "nt%d.hba_drop", ntv->stream_id); - hba_pkt = StatsRegisterCounter(s_hbad_pkt, tv); - StatsSetupPrivate(tv); - StatsSetUI64(tv, hba_pkt, 0); - } SCLogDebug("Opening NAPATECH Stream: %u for processing", ntv->stream_id); if ((status = NT_NetRxOpen(&(ntv->rx_stream), "SuricataStream", - NT_NET_INTERFACE_PACKET, ntv->stream_id, ntv->hba)) != NT_SUCCESS) { + NT_NET_INTERFACE_PACKET, ntv->stream_id, -1)) != NT_SUCCESS) { NAPATECH_ERROR(status); SCFree(ntv); @@ -969,22 +954,6 @@ TmEcode NapatechPacketLoop(ThreadVars *tv, void *data, void *slot) SCReturnInt(TM_ECODE_FAILED); } - if (unlikely(ntv->hba > 0)) { - NtNetRx_t stat_cmd; - stat_cmd.cmd = NT_NETRX_READ_CMD_STREAM_DROP; - /* Update drop counter */ - if (unlikely((status = NT_NetRxRead(ntv->rx_stream, &stat_cmd)) != NT_SUCCESS)) { - NAPATECH_ERROR(status); - SCLogInfo("Couldn't retrieve drop statistics from the RX stream: %u", - ntv->stream_id); - } else { - hba_pkt_drops = stat_cmd.u.streamDrop.pktsDropped; - - StatsSetUI64(tv, hba_pkt, hba_pkt_drops); - } - StatsSyncCountersIfSignalled(tv); - } - #ifdef NAPATECH_ENABLE_BYPASS p->ntpv.dyn3 = _NT_NET_GET_PKT_DESCR_PTR_DYN3(packet_buffer); p->BypassPacketsFlow = (NapatechIsBypassSupported() ? NapatechBypassCallback : NULL); @@ -1019,10 +988,6 @@ TmEcode NapatechPacketLoop(ThreadVars *tv, void *data, void *slot) NapatechDeleteFilters(); } - if (unlikely(ntv->hba > 0)) { - SCLogInfo("Host Buffer Allowance Drops - pkts: %ld, bytes: %ld", hba_pkt_drops, hba_byte_drops); - } - SCReturnInt(TM_ECODE_OK); } diff --git a/src/source-napatech.h b/src/source-napatech.h index 2e3fb9462f..c638f89dae 100644 --- a/src/source-napatech.h +++ b/src/source-napatech.h @@ -34,7 +34,6 @@ void TmModuleNapatechDecodeRegister(void); struct NapatechStreamDevConf { uint16_t stream_id; - intmax_t hba; }; int NapatechSetPortmap(int port, int peer);