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

Function match_check

dpdk/examples/ip_pipeline/thread.c:1018–1087  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1016}
1017
1018static int
1019match_check(struct table_rule_match *match,
1020 struct pipeline *p,
1021 uint32_t table_id)
1022{
1023 struct table *table;
1024
1025 if ((match == NULL) ||
1026 (p == NULL) ||
1027 (table_id >= p->n_tables))
1028 return -1;
1029
1030 table = &p->table[table_id];
1031 if (match->match_type != table->params.match_type)
1032 return -1;
1033
1034 switch (match->match_type) {
1035 case TABLE_ACL:
1036 {
1037 struct table_acl_params *t = &table->params.match.acl;
1038 struct table_rule_match_acl *r = &match->match.acl;
1039
1040 if ((r->ip_version && (t->ip_version == 0)) ||
1041 ((r->ip_version == 0) && t->ip_version))
1042 return -1;
1043
1044 if (r->ip_version) {
1045 if ((r->sa_depth > 32) ||
1046 (r->da_depth > 32))
1047 return -1;
1048 } else {
1049 if ((r->sa_depth > 128) ||
1050 (r->da_depth > 128))
1051 return -1;
1052 }
1053 return 0;
1054 }
1055
1056 case TABLE_ARRAY:
1057 return 0;
1058
1059 case TABLE_HASH:
1060 return 0;
1061
1062 case TABLE_LPM:
1063 {
1064 struct table_lpm_params *t = &table->params.match.lpm;
1065 struct table_rule_match_lpm *r = &match->match.lpm;
1066
1067 if ((r->ip_version && (t->key_size != 4)) ||
1068 ((r->ip_version == 0) && (t->key_size != 16)))
1069 return -1;
1070
1071 if (r->ip_version) {
1072 if (r->depth > 32)
1073 return -1;
1074 } else {
1075 if (r->depth > 128)

Calls

no outgoing calls

Tested by

no test coverage detected