Lines Matching +full:array +full:- +full:nest

1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2013 - 2019 Intel Corporation. */
7 * fm10k_tlv_msg_init - Initialize message block for TLV data storage
25 * fm10k_tlv_attr_put_null_string - Place null terminated string on message
76 * fm10k_tlv_attr_get_null_string - Get null terminated string from attribute
81 * it in the array pointed by string. It will return success if provided
95 while (len--) in fm10k_tlv_attr_get_null_string()
102 * fm10k_tlv_attr_put_mac_vlan - Store MAC/VLAN attribute in message
140 * fm10k_tlv_attr_get_mac_vlan - Get MAC/VLAN stored in attribute
146 * place it in the array pointed by mac_addr. It will return success
163 * fm10k_tlv_attr_put_bool - Add header indicating value "true"
188 * fm10k_tlv_attr_put_value - Store integer value attribute in message
202 /* verify non-null msg and len is 1, 2, 4, or 8 */ in fm10k_tlv_attr_put_value()
203 if (!msg || !len || len > 8 || (len & (len - 1))) in fm10k_tlv_attr_put_value()
209 attr[1] = (u32)value & (BIT(8 * len) - 1); in fm10k_tlv_attr_put_value()
228 * fm10k_tlv_attr_get_value - Get integer value stored in attribute
260 * fm10k_tlv_attr_put_le_struct - Store little endian structure in message
268 * are valid and length is a non-zero multiple of 4.
277 /* verify non-null msg and len is in 32 bit words */ in fm10k_tlv_attr_put_le_struct()
299 * fm10k_tlv_attr_get_le_struct - Get little endian struct form attribute
323 for (i = 0; len; i++, len -= 4) in fm10k_tlv_attr_get_le_struct()
330 * fm10k_tlv_attr_nest_start - Start a set of nested attributes
352 /* return pointer to nest header */ in fm10k_tlv_attr_nest_start()
357 * fm10k_tlv_attr_nest_stop - Stop a set of nested attributes
361 * message pointer should be pointing to the parent of the nest. So in
362 * the case of a nest within the nest this would be the outer nest pointer.
378 /* only include nest if data was added to it */ in fm10k_tlv_attr_nest_stop()
388 * fm10k_tlv_attr_validate - Validate attribute metadata
409 while (tlv_attr->id < attr_id) in fm10k_tlv_attr_validate()
413 if (tlv_attr->id != attr_id) in fm10k_tlv_attr_validate()
419 switch (tlv_attr->type) { in fm10k_tlv_attr_validate()
422 (attr[(len - 1) / 4] & (0xFF << (8 * ((len - 1) % 4))))) in fm10k_tlv_attr_validate()
424 if (len > tlv_attr->len) in fm10k_tlv_attr_validate()
437 if (len != tlv_attr->len) in fm10k_tlv_attr_validate()
442 if ((len % 4) || len != tlv_attr->len) in fm10k_tlv_attr_validate()
459 * fm10k_tlv_attr_parse - Parses stream of attribute data
461 * @results: Pointer array to store pointers to attributes
465 * up into an array of pointers stored in results. The function will
467 * FM10K_NOT_IMPLEMENTED for any attribute that is outside of the array
511 ; /* silently ignore non-implemented attributes */ in fm10k_tlv_attr_parse()
532 * fm10k_tlv_msg_parse - Parses message header and calls function handler
563 while (data->id < msg_id) in fm10k_tlv_msg_parse()
567 if (data->id != msg_id) { in fm10k_tlv_msg_parse()
568 while (data->id != FM10K_TLV_ERROR) in fm10k_tlv_msg_parse()
573 err = fm10k_tlv_attr_parse(msg, results, data->attr); in fm10k_tlv_msg_parse()
577 return data->func(hw, results, mbx); in fm10k_tlv_msg_parse()
581 * fm10k_tlv_msg_error - Default handler for unrecognized TLV message IDs
583 * @results: Pointer array to message, results[0] is pointer to message
605 static const s64 test_s64 = -0x123456789abcdef0ll;
606 static const s32 test_s32 = -0x1235678;
607 static const s16 test_s16 = -0x1234;
608 static const s8 test_s8 = -0x12;
634 * fm10k_tlv_msg_test_generate_data - Stuff message with data
670 * fm10k_tlv_msg_test_create - Create a test message testing all attributes
679 u32 *nest = NULL; in fm10k_tlv_msg_test_create() local
689 nest = fm10k_tlv_attr_nest_start(msg, FM10K_TEST_MSG_NESTED); in fm10k_tlv_msg_test_create()
691 fm10k_tlv_msg_test_generate_data(nest, attr_flags); in fm10k_tlv_msg_test_create()
698 * fm10k_tlv_msg_test - Validate all results on test message receive
700 * @results: Pointer array to attributes in the message
729 &mbx->test_result); in fm10k_tlv_msg_test()
831 /* parse the nested attributes into the nest results list */ in fm10k_tlv_msg_test()
849 return mbx->ops.enqueue_tx(hw, mbx, reply); in fm10k_tlv_msg_test()