Lines Matching refs:attr
57 struct fbnic_tlv_msg *attr; in fbnic_tlv_attr_put_flag() local
60 if (attr_max_len < sizeof(*attr)) in fbnic_tlv_attr_put_flag()
64 attr = &msg[le16_to_cpu(msg->hdr.len)]; in fbnic_tlv_attr_put_flag()
70 attr->hdr = hdr; in fbnic_tlv_attr_put_flag()
99 struct fbnic_tlv_msg *attr; in fbnic_tlv_attr_put_value() local
102 if (attr_max_len < sizeof(*attr) + len) in fbnic_tlv_attr_put_value()
106 attr = &msg[le16_to_cpu(msg->hdr.len)]; in fbnic_tlv_attr_put_value()
114 attr->value[len / sizeof(hdr)] = 0; in fbnic_tlv_attr_put_value()
117 memcpy(attr->value, value, len); in fbnic_tlv_attr_put_value()
119 attr->hdr = hdr; in fbnic_tlv_attr_put_value()
202 u64 fbnic_tlv_attr_get_unsigned(struct fbnic_tlv_msg *attr) in fbnic_tlv_attr_get_unsigned() argument
206 memcpy(&le64_value, &attr->value[0], in fbnic_tlv_attr_get_unsigned()
207 le16_to_cpu(attr->hdr.len) - sizeof(*attr)); in fbnic_tlv_attr_get_unsigned()
218 s64 fbnic_tlv_attr_get_signed(struct fbnic_tlv_msg *attr) in fbnic_tlv_attr_get_signed() argument
220 int shift = (8 + sizeof(*attr) - le16_to_cpu(attr->hdr.len)) * 8; in fbnic_tlv_attr_get_signed()
225 memcpy(&le64_value, &attr->value[0], in fbnic_tlv_attr_get_signed()
226 le16_to_cpu(attr->hdr.len) - sizeof(*attr)); in fbnic_tlv_attr_get_signed()
241 size_t fbnic_tlv_attr_get_string(struct fbnic_tlv_msg *attr, char *str, in fbnic_tlv_attr_get_string() argument
245 (le16_to_cpu(attr->hdr.len) * 4) - sizeof(*attr)); in fbnic_tlv_attr_get_string()
246 memcpy(str, &attr->value, max_size); in fbnic_tlv_attr_get_string()
265 struct fbnic_tlv_msg *attr = &msg[le16_to_cpu(msg->hdr.len)]; in fbnic_tlv_attr_nest_start() local
270 if (attr_max_len < sizeof(*attr) * 2) in fbnic_tlv_attr_nest_start()
282 attr->hdr = hdr; in fbnic_tlv_attr_nest_start()
284 return attr; in fbnic_tlv_attr_nest_start()
296 struct fbnic_tlv_msg *attr = &msg[le16_to_cpu(msg->hdr.len)]; in fbnic_tlv_attr_nest_stop() local
297 u16 len = le16_to_cpu(attr->hdr.len); in fbnic_tlv_attr_nest_stop()
306 attr->hdr.len = cpu_to_le16(len * sizeof(u32)); in fbnic_tlv_attr_nest_stop()
310 fbnic_tlv_attr_validate(struct fbnic_tlv_msg *attr, in fbnic_tlv_attr_validate() argument
313 u16 len = le16_to_cpu(attr->hdr.len) - sizeof(*attr); in fbnic_tlv_attr_validate()
314 u16 attr_id = attr->hdr.type; in fbnic_tlv_attr_validate()
315 __le32 *value = &attr->value[0]; in fbnic_tlv_attr_validate()
317 if (attr->hdr.is_msg) in fbnic_tlv_attr_validate()
325 if (attr->hdr.cannot_ignore) in fbnic_tlv_attr_validate()
327 return le16_to_cpu(attr->hdr.len); in fbnic_tlv_attr_validate()
333 if (offset_in_page(attr) + len > PAGE_SIZE - sizeof(*attr)) in fbnic_tlv_attr_validate()
382 int fbnic_tlv_attr_parse_array(struct fbnic_tlv_msg *attr, int len, in fbnic_tlv_attr_parse_array() argument
398 u16 attr_id = attr->hdr.type; in fbnic_tlv_attr_parse_array()
406 err = fbnic_tlv_attr_validate(attr, tlv_index); in fbnic_tlv_attr_parse_array()
413 results[i++] = attr; in fbnic_tlv_attr_parse_array()
415 attr_len = FBNIC_TLV_MSG_SIZE(le16_to_cpu(attr->hdr.len)); in fbnic_tlv_attr_parse_array()
417 attr += attr_len; in fbnic_tlv_attr_parse_array()
435 int fbnic_tlv_attr_parse(struct fbnic_tlv_msg *attr, int len, in fbnic_tlv_attr_parse() argument
448 int err = fbnic_tlv_attr_validate(attr, tlv_index); in fbnic_tlv_attr_parse()
449 u16 attr_id = attr->hdr.type; in fbnic_tlv_attr_parse()
462 results[attr_id] = attr; in fbnic_tlv_attr_parse()
465 attr_len = FBNIC_TLV_MSG_SIZE(le16_to_cpu(attr->hdr.len)); in fbnic_tlv_attr_parse()
467 attr += attr_len; in fbnic_tlv_attr_parse()
504 results, parser->attr); in fbnic_tlv_msg_parse()