Lines Matching +full:nested +full:- +full:attributes
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
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
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
334 * This function will mark off a new nested region for encapsulating
335 * a given set of attributes. The idea is if you wish to place a secondary
338 * of the nested attributes on success.
357 * fm10k_tlv_attr_nest_stop - Stop a set of nested attributes
360 * This function closes off an existing set of nested attributes. The
374 /* locate the nested header and retrieve its length */ in fm10k_tlv_attr_nest_stop()
388 * fm10k_tlv_attr_validate - Validate attribute metadata
408 /* search through the list of attributes to find a matching ID */ in fm10k_tlv_attr_validate()
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()
446 /* nested attributes must be 4 byte aligned */ in fm10k_tlv_attr_validate()
459 * fm10k_tlv_attr_parse - Parses stream of attribute data
461 * @results: Pointer array to store pointers to attributes
462 * @tlv_attr: Type and length info for attributes
464 * This function validates a stream of attributes and parses them
468 * and 0 on success. Any attributes not found in tlv_attr will be silently
489 /* no attributes to parse if there is no length */ in fm10k_tlv_attr_parse()
493 /* no attributes to parse, just raw data, message becomes attribute */ in fm10k_tlv_attr_parse()
502 /* run through list parsing all attributes */ in fm10k_tlv_attr_parse()
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()
572 /* parse the attributes into the results list */ 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
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
636 * @attr_flags: List of flags indicating what attributes to add
670 * fm10k_tlv_msg_test_create - Create a test message testing all attributes
672 * @attr_flags: List of flags indicating what attributes to add
675 * including a nested attribute.
685 /* check for nested attributes */ 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
703 * This function does a check to verify all attributes match what the test
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()