Lines Matching +full:library +full:- +full:sel
1 // SPDX-License-Identifier: BSD-3-Clause
39 if (kslist->cnt > 0) { in test_val_keyset()
40 switch (admin->vtype) { in test_val_keyset()
42 for (idx = 0; idx < kslist->cnt; idx++) { in test_val_keyset()
43 if (kslist->keysets[idx] == VCAP_KFS_ETAG) in test_val_keyset()
44 return kslist->keysets[idx]; in test_val_keyset()
45 if (kslist->keysets[idx] == VCAP_KFS_PURE_5TUPLE_IP4) in test_val_keyset()
46 return kslist->keysets[idx]; in test_val_keyset()
47 if (kslist->keysets[idx] == VCAP_KFS_NORMAL_5TUPLE_IP4) in test_val_keyset()
48 return kslist->keysets[idx]; in test_val_keyset()
49 if (kslist->keysets[idx] == VCAP_KFS_NORMAL_7TUPLE) in test_val_keyset()
50 return kslist->keysets[idx]; in test_val_keyset()
54 for (idx = 0; idx < kslist->cnt; idx++) { in test_val_keyset()
55 if (kslist->keysets[idx] == VCAP_KFS_MAC_ETYPE) in test_val_keyset()
56 return kslist->keysets[idx]; in test_val_keyset()
57 if (kslist->keysets[idx] == VCAP_KFS_ARP) in test_val_keyset()
58 return kslist->keysets[idx]; in test_val_keyset()
59 if (kslist->keysets[idx] == VCAP_KFS_IP_7TUPLE) in test_val_keyset()
60 return kslist->keysets[idx]; in test_val_keyset()
65 __func__, __LINE__, admin->vtype); in test_val_keyset()
69 return -EINVAL; in test_val_keyset()
77 if (admin->vinst == 0 || admin->vinst == 2) in test_add_def_fields()
87 memset(admin->cache.keystream, 0, test_cache_erase_count); in test_cache_erase()
88 memset(admin->cache.maskstream, 0, test_cache_erase_count); in test_cache_erase()
89 memset(admin->cache.actionstream, 0, test_cache_erase_count); in test_cache_erase()
104 enum vcap_selection sel, u32 start, u32 count) in test_cache_read() argument
110 switch (sel) { in test_cache_read()
112 keystr = &admin->cache.keystream[start]; in test_cache_read()
113 mskstr = &admin->cache.maskstream[start]; in test_cache_read()
126 actstr = &admin->cache.actionstream[start]; in test_cache_read()
135 admin->cache.counter = test_hw_cache.counter; in test_cache_read()
136 admin->cache.sticky = test_hw_cache.sticky; in test_cache_read()
146 enum vcap_selection sel, u32 start, u32 count) in test_cache_write() argument
151 switch (sel) { in test_cache_write()
153 keystr = &admin->cache.keystream[start]; in test_cache_write()
154 mskstr = &admin->cache.maskstream[start]; in test_cache_write()
167 actstr = &admin->cache.actionstream[start]; in test_cache_write()
176 test_hw_cache.counter = admin->cache.counter; in test_cache_write()
177 test_hw_cache.sticky = admin->cache.sticky; in test_cache_write()
189 enum vcap_selection sel, u32 addr) in test_cache_update() argument
236 INIT_LIST_HEAD(&admin->list); in vcap_test_api_init()
237 INIT_LIST_HEAD(&admin->rules); in vcap_test_api_init()
238 INIT_LIST_HEAD(&admin->enabled); in vcap_test_api_init()
239 mutex_init(&admin->lock); in vcap_test_api_init()
240 list_add_tail(&admin->list, &test_vctrl.list); in vcap_test_api_init()
305 KUNIT_EXPECT_EQ(test, keyset, rule->keyset); in test_vcap_xn_rule_creator()
306 KUNIT_EXPECT_EQ(test, actionset, rule->actionset); in test_vcap_xn_rule_creator()
307 KUNIT_EXPECT_EQ(test, size, ri->size); in test_vcap_xn_rule_creator()
312 KUNIT_EXPECT_EQ(test, expected_addr, ri->addr); in test_vcap_xn_rule_creator()
556 KUNIT_EXPECT_EQ(test, 25 + 3 + 2 - sw_width, iter.reg_bitpos); in vcap_api_encode_short_field_test()
561 KUNIT_EXPECT_EQ(test, (u32)(0x5 << (25 + 3 + 2 - sw_width)), stream[1]); in vcap_api_encode_short_field_test()
570 KUNIT_EXPECT_EQ(test, (u32)((0x5 << (25 + 3 + 2 - sw_width)) + 3), stream[1]); in vcap_api_encode_short_field_test()
742 KUNIT_EXPECT_EQ(test, (u32)((0x32 << (35 + 2 + 1 - sw_width)) & 0x1fffff), actwords[1]); in vcap_api_encode_actionfield_test()
743 KUNIT_EXPECT_EQ(test, (u32)((0x32 >> ((2 * sw_width) - 38 - 1))), actwords[2]); in vcap_api_encode_actionfield_test()
898 KUNIT_EXPECT_EQ(test, -EINVAL, ret); in vcap_api_encode_rule_keyset_test()
1001 list_for_each_entry_safe(ckf, next_ckf, &rule->keyfields, ctrl.list) { in vcap_free_ckf()
1002 list_del(&ckf->ctrl.list); in vcap_free_ckf()
1028 INIT_LIST_HEAD(&rule->keyfields); in vcap_api_rule_add_keyvalue_test()
1031 ret = list_empty(&rule->keyfields); in vcap_api_rule_add_keyvalue_test()
1033 kf = list_first_entry(&rule->keyfields, struct vcap_client_keyfield, in vcap_api_rule_add_keyvalue_test()
1035 KUNIT_EXPECT_EQ(test, VCAP_KF_LOOKUP_FIRST_IS, kf->ctrl.key); in vcap_api_rule_add_keyvalue_test()
1036 KUNIT_EXPECT_EQ(test, VCAP_FIELD_BIT, kf->ctrl.type); in vcap_api_rule_add_keyvalue_test()
1037 KUNIT_EXPECT_EQ(test, 0x0, kf->data.u1.value); in vcap_api_rule_add_keyvalue_test()
1038 KUNIT_EXPECT_EQ(test, 0x1, kf->data.u1.mask); in vcap_api_rule_add_keyvalue_test()
1041 INIT_LIST_HEAD(&rule->keyfields); in vcap_api_rule_add_keyvalue_test()
1044 ret = list_empty(&rule->keyfields); in vcap_api_rule_add_keyvalue_test()
1046 kf = list_first_entry(&rule->keyfields, struct vcap_client_keyfield, in vcap_api_rule_add_keyvalue_test()
1048 KUNIT_EXPECT_EQ(test, VCAP_KF_LOOKUP_FIRST_IS, kf->ctrl.key); in vcap_api_rule_add_keyvalue_test()
1049 KUNIT_EXPECT_EQ(test, VCAP_FIELD_BIT, kf->ctrl.type); in vcap_api_rule_add_keyvalue_test()
1050 KUNIT_EXPECT_EQ(test, 0x1, kf->data.u1.value); in vcap_api_rule_add_keyvalue_test()
1051 KUNIT_EXPECT_EQ(test, 0x1, kf->data.u1.mask); in vcap_api_rule_add_keyvalue_test()
1054 INIT_LIST_HEAD(&rule->keyfields); in vcap_api_rule_add_keyvalue_test()
1058 ret = list_empty(&rule->keyfields); in vcap_api_rule_add_keyvalue_test()
1060 kf = list_first_entry(&rule->keyfields, struct vcap_client_keyfield, in vcap_api_rule_add_keyvalue_test()
1062 KUNIT_EXPECT_EQ(test, VCAP_KF_LOOKUP_FIRST_IS, kf->ctrl.key); in vcap_api_rule_add_keyvalue_test()
1063 KUNIT_EXPECT_EQ(test, VCAP_FIELD_BIT, kf->ctrl.type); in vcap_api_rule_add_keyvalue_test()
1064 KUNIT_EXPECT_EQ(test, 0x0, kf->data.u1.value); in vcap_api_rule_add_keyvalue_test()
1065 KUNIT_EXPECT_EQ(test, 0x0, kf->data.u1.mask); in vcap_api_rule_add_keyvalue_test()
1068 INIT_LIST_HEAD(&rule->keyfields); in vcap_api_rule_add_keyvalue_test()
1071 ret = list_empty(&rule->keyfields); in vcap_api_rule_add_keyvalue_test()
1073 kf = list_first_entry(&rule->keyfields, struct vcap_client_keyfield, in vcap_api_rule_add_keyvalue_test()
1075 KUNIT_EXPECT_EQ(test, VCAP_KF_TYPE, kf->ctrl.key); in vcap_api_rule_add_keyvalue_test()
1076 KUNIT_EXPECT_EQ(test, VCAP_FIELD_U32, kf->ctrl.type); in vcap_api_rule_add_keyvalue_test()
1077 KUNIT_EXPECT_EQ(test, 0x98765432, kf->data.u32.value); in vcap_api_rule_add_keyvalue_test()
1078 KUNIT_EXPECT_EQ(test, 0xff00ffab, kf->data.u32.mask); in vcap_api_rule_add_keyvalue_test()
1081 INIT_LIST_HEAD(&rule->keyfields); in vcap_api_rule_add_keyvalue_test()
1084 ret = list_empty(&rule->keyfields); in vcap_api_rule_add_keyvalue_test()
1086 kf = list_first_entry(&rule->keyfields, struct vcap_client_keyfield, in vcap_api_rule_add_keyvalue_test()
1088 KUNIT_EXPECT_EQ(test, VCAP_KF_L3_IP6_SIP, kf->ctrl.key); in vcap_api_rule_add_keyvalue_test()
1089 KUNIT_EXPECT_EQ(test, VCAP_FIELD_U128, kf->ctrl.type); in vcap_api_rule_add_keyvalue_test()
1091 KUNIT_EXPECT_EQ(test, dip.value[idx], kf->data.u128.value[idx]); in vcap_api_rule_add_keyvalue_test()
1093 KUNIT_EXPECT_EQ(test, dip.mask[idx], kf->data.u128.mask[idx]); in vcap_api_rule_add_keyvalue_test()
1102 &rule->actionfields, ctrl.list) { in vcap_free_caf()
1103 list_del(&caf->ctrl.list); in vcap_free_caf()
1123 INIT_LIST_HEAD(&rule->actionfields); in vcap_api_rule_add_actionvalue_test()
1126 ret = list_empty(&rule->actionfields); in vcap_api_rule_add_actionvalue_test()
1128 af = list_first_entry(&rule->actionfields, in vcap_api_rule_add_actionvalue_test()
1130 KUNIT_EXPECT_EQ(test, VCAP_AF_POLICE_ENA, af->ctrl.action); in vcap_api_rule_add_actionvalue_test()
1131 KUNIT_EXPECT_EQ(test, VCAP_FIELD_BIT, af->ctrl.type); in vcap_api_rule_add_actionvalue_test()
1132 KUNIT_EXPECT_EQ(test, 0x0, af->data.u1.value); in vcap_api_rule_add_actionvalue_test()
1135 INIT_LIST_HEAD(&rule->actionfields); in vcap_api_rule_add_actionvalue_test()
1138 ret = list_empty(&rule->actionfields); in vcap_api_rule_add_actionvalue_test()
1140 af = list_first_entry(&rule->actionfields, in vcap_api_rule_add_actionvalue_test()
1142 KUNIT_EXPECT_EQ(test, VCAP_AF_POLICE_ENA, af->ctrl.action); in vcap_api_rule_add_actionvalue_test()
1143 KUNIT_EXPECT_EQ(test, VCAP_FIELD_BIT, af->ctrl.type); in vcap_api_rule_add_actionvalue_test()
1144 KUNIT_EXPECT_EQ(test, 0x1, af->data.u1.value); in vcap_api_rule_add_actionvalue_test()
1147 INIT_LIST_HEAD(&rule->actionfields); in vcap_api_rule_add_actionvalue_test()
1150 ret = list_empty(&rule->actionfields); in vcap_api_rule_add_actionvalue_test()
1152 af = list_first_entry(&rule->actionfields, in vcap_api_rule_add_actionvalue_test()
1154 KUNIT_EXPECT_EQ(test, VCAP_AF_POLICE_ENA, af->ctrl.action); in vcap_api_rule_add_actionvalue_test()
1155 KUNIT_EXPECT_EQ(test, VCAP_FIELD_BIT, af->ctrl.type); in vcap_api_rule_add_actionvalue_test()
1156 KUNIT_EXPECT_EQ(test, 0x0, af->data.u1.value); in vcap_api_rule_add_actionvalue_test()
1159 INIT_LIST_HEAD(&rule->actionfields); in vcap_api_rule_add_actionvalue_test()
1162 ret = list_empty(&rule->actionfields); in vcap_api_rule_add_actionvalue_test()
1164 af = list_first_entry(&rule->actionfields, in vcap_api_rule_add_actionvalue_test()
1166 KUNIT_EXPECT_EQ(test, VCAP_AF_TYPE, af->ctrl.action); in vcap_api_rule_add_actionvalue_test()
1167 KUNIT_EXPECT_EQ(test, VCAP_FIELD_U32, af->ctrl.type); in vcap_api_rule_add_actionvalue_test()
1168 KUNIT_EXPECT_EQ(test, 0x98765432, af->data.u32.value); in vcap_api_rule_add_actionvalue_test()
1171 INIT_LIST_HEAD(&rule->actionfields); in vcap_api_rule_add_actionvalue_test()
1174 ret = list_empty(&rule->actionfields); in vcap_api_rule_add_actionvalue_test()
1176 af = list_first_entry(&rule->actionfields, in vcap_api_rule_add_actionvalue_test()
1178 KUNIT_EXPECT_EQ(test, VCAP_AF_MASK_MODE, af->ctrl.action); in vcap_api_rule_add_actionvalue_test()
1179 KUNIT_EXPECT_EQ(test, VCAP_FIELD_U32, af->ctrl.type); in vcap_api_rule_add_actionvalue_test()
1180 KUNIT_EXPECT_EQ(test, 0xaabbccdd, af->data.u32.value); in vcap_api_rule_add_actionvalue_test()
1332 /* Data used by VCAP Library callback */ in vcap_api_encode_rule_test()
1391 KUNIT_EXPECT_EQ(test, -EINVAL, ret); in vcap_api_encode_rule_test()
1419 KUNIT_EXPECT_EQ(test, VCAP_KFS_MAC_ETYPE, rule->keyset); in vcap_api_encode_rule_test()
1420 KUNIT_EXPECT_EQ(test, VCAP_AFS_BASE_TYPE, rule->actionset); in vcap_api_encode_rule_test()
1421 KUNIT_EXPECT_EQ(test, 6, ri->size); in vcap_api_encode_rule_test()
1422 KUNIT_EXPECT_EQ(test, 2, ri->keyset_sw_regs); in vcap_api_encode_rule_test()
1423 KUNIT_EXPECT_EQ(test, 4, ri->actionset_sw_regs); in vcap_api_encode_rule_test()
1427 rule->vcap_chain_id, rule->cookie, true); in vcap_api_encode_rule_test()
1443 rule->cookie, false); in vcap_api_encode_rule_test()
1563 /* Data used by VCAP Library callback */ in vcap_api_rule_insert_in_order_test()
1601 /* Data used by VCAP Library callback */ in vcap_api_rule_insert_reverse_order_test()
1651 KUNIT_EXPECT_EQ(test, exp_addr[idx], elem->addr); in vcap_api_rule_insert_reverse_order_test()
1664 /* Data used by VCAP Library callback */ in vcap_api_rule_remove_at_end_test()
1736 /* Data used by VCAP Library callback */ in vcap_api_rule_remove_in_middle_test()
1748 .last_valid_addr = 800 - 1, in vcap_api_rule_remove_in_middle_test()
1772 KUNIT_EXPECT_EQ(test, -6, test_move_offset); in vcap_api_rule_remove_in_middle_test()
1782 KUNIT_EXPECT_EQ(test, -4, test_move_offset); in vcap_api_rule_remove_in_middle_test()
1792 KUNIT_EXPECT_EQ(test, -20, test_move_offset); in vcap_api_rule_remove_in_middle_test()
1811 /* Data used by VCAP Library callback */ in vcap_api_rule_remove_in_front_test()
1823 .last_valid_addr = 800 - 1, in vcap_api_rule_remove_in_front_test()
1855 KUNIT_EXPECT_EQ(test, -8, test_move_offset); in vcap_api_rule_remove_in_front_test()
2039 ckf->ctrl.key = keylist[idx]; in vcap_api_filter_unsupported_keys_test()
2040 list_add_tail(&ckf->ctrl.list, &ri.data.keyfields); in vcap_api_filter_unsupported_keys_test()
2054 KUNIT_EXPECT_EQ(test, expected[idx], ckf->ctrl.key); in vcap_api_filter_unsupported_keys_test()
2055 list_del(&ckf->ctrl.list); in vcap_api_filter_unsupported_keys_test()
2163 ckf->ctrl.key = keylist[idx]; in vcap_api_filter_keylist_test()
2164 list_add_tail(&ckf->ctrl.list, &ri.data.keyfields); in vcap_api_filter_keylist_test()
2179 KUNIT_EXPECT_EQ(test, expected[idx], ckf->ctrl.key); in vcap_api_filter_keylist_test()
2180 list_del(&ckf->ctrl.list); in vcap_api_filter_keylist_test()