NDN-DPDK
High-Speed Named Data Networking Forwarder
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
rxmatch.h
Go to the documentation of this file.
1 #ifndef NDNDPDK_ETHFACE_RXMATCH_H
2 #define NDNDPDK_ETHFACE_RXMATCH_H
3 
6 #include "locator.h"
7 
8 typedef enum EthRxMatchAct {
16 
18 typedef enum EthRxMatchResult {
19  EthRxMatchResultHit = RTE_BIT32(1),
20  EthRxMatchResultGtp = RTE_BIT32(2),
22 
23 typedef struct EthRxMatch EthRxMatch;
24 typedef EthRxMatchResult (*EthRxMatch_MatchFunc)(const EthRxMatch* match, const struct rte_mbuf* m);
26 
28 struct EthRxMatch {
30  uint8_t len;
31  uint8_t l2len;
32  uint8_t l3matchOff;
33  uint8_t l3matchLen;
34  uint8_t udpOff;
36 };
37 
39 __attribute__((nonnull)) void
40 EthRxMatch_Prepare(EthRxMatch* match, const EthLocator* loc);
41 
46 __attribute__((nonnull)) static inline EthRxMatchResult
47 EthRxMatch_Match(const EthRxMatch* match, const struct rte_mbuf* m) {
48  if (m->data_len < match->len) {
49  return 0;
50  }
51  return EthRxMatch_MatchJmp[match->act](match, m);
52 }
53 
59 __attribute__((nonnull)) EthRxMatchResult
60 EthRxMatch_MatchGtpInner(const EthRxMatch* match, const struct rte_mbuf* m);
61 
62 #endif // NDNDPDK_ETHFACE_RXMATCH_H
struct vlanhdr __rte_packed
@ EthLocator_MaxHdrLen
EthLocator derived header buffer length.
Definition: locator.h:52
EthRxMatchResult EthRxMatch_MatchGtpInner(const EthRxMatch *match, const struct rte_mbuf *m)
Check GTP-U inner headers only.
Definition: rxmatch.c:102
EthRxMatchAct
Definition: rxmatch.h:8
@ EthRxMatchActVxlan
Definition: rxmatch.h:13
@ EthRxMatchActEtherMulticast
Definition: rxmatch.h:11
@ EthRxMatchActGtp
Definition: rxmatch.h:14
@ EthRxMatchActEtherUnicast
Definition: rxmatch.h:10
@ EthRxMatchActAlways
Definition: rxmatch.h:9
@ EthRxMatchActUdp
Definition: rxmatch.h:12
const EthRxMatch_MatchFunc EthRxMatch_MatchJmp[]
Definition: rxmatch.c:108
void EthRxMatch_Prepare(EthRxMatch *match, const EthLocator *loc)
Prepare RX matcher from locator.
Definition: rxmatch.c:118
EthRxMatchResult
Bit flags in EthRxMatch_Match return value.
Definition: rxmatch.h:18
@ EthRxMatchResultGtp
GTP-U tunnel matched.
Definition: rxmatch.h:20
@ EthRxMatchResultHit
fully matched
Definition: rxmatch.h:19
EthRxMatchResult(* EthRxMatch_MatchFunc)(const EthRxMatch *match, const struct rte_mbuf *m)
Definition: rxmatch.h:24
EthFace address information.
Definition: locator.h:10
EthFace RX matcher.
Definition: rxmatch.h:28
uint8_t len
total header length
Definition: rxmatch.h:30
uint8_t l3matchOff
offset of outer IPv4/IPv6 src
Definition: rxmatch.h:32
EthRxMatchAct act
EthRxMatch_MatchJmp index.
Definition: rxmatch.h:29
uint8_t udpOff
offset of outer UDP header
Definition: rxmatch.h:34
uint8_t buf[EthLocator_MaxHdrLen]
Definition: rxmatch.h:35
uint8_t l3matchLen
length of IP src+dst, plus UDP src+dst if checked
Definition: rxmatch.h:33
uint8_t l2len
outer Ethernet+VLAN length
Definition: rxmatch.h:31