Lines Matching refs:attr
38 u32 *attr; in fm10k_tlv_attr_put_null_string() local
44 attr = &msg[FM10K_TLV_DWORD_LEN(*msg)]; in fm10k_tlv_attr_put_null_string()
50 attr[len / 4] = attr_data; in fm10k_tlv_attr_put_null_string()
62 attr[(len + 3) / 4] = attr_data; in fm10k_tlv_attr_put_null_string()
66 attr[0] = len | attr_id; in fm10k_tlv_attr_put_null_string()
84 static s32 fm10k_tlv_attr_get_null_string(u32 *attr, unsigned char *string) in fm10k_tlv_attr_get_null_string() argument
89 if (!string || !attr) in fm10k_tlv_attr_get_null_string()
92 len = *attr >> FM10K_TLV_LEN_SHIFT; in fm10k_tlv_attr_get_null_string()
93 attr++; in fm10k_tlv_attr_get_null_string()
96 string[len] = (u8)(attr[len / 4] >> (8 * (len % 4))); in fm10k_tlv_attr_get_null_string()
116 u32 *attr; in fm10k_tlv_attr_put_mac_vlan() local
122 attr = &msg[FM10K_TLV_DWORD_LEN(*msg)]; in fm10k_tlv_attr_put_mac_vlan()
125 attr[0] = len | attr_id; in fm10k_tlv_attr_put_mac_vlan()
128 attr[1] = le32_to_cpu(*(const __le32 *)&mac_addr[0]); in fm10k_tlv_attr_put_mac_vlan()
129 attr[2] = le16_to_cpu(*(const __le16 *)&mac_addr[4]); in fm10k_tlv_attr_put_mac_vlan()
130 attr[2] |= (u32)vlan << 16; in fm10k_tlv_attr_put_mac_vlan()
149 s32 fm10k_tlv_attr_get_mac_vlan(u32 *attr, u8 *mac_addr, u16 *vlan) in fm10k_tlv_attr_get_mac_vlan() argument
152 if (!mac_addr || !attr) in fm10k_tlv_attr_get_mac_vlan()
155 *(__le32 *)&mac_addr[0] = cpu_to_le32(attr[1]); in fm10k_tlv_attr_get_mac_vlan()
156 *(__le16 *)&mac_addr[4] = cpu_to_le16((u16)(attr[2])); in fm10k_tlv_attr_get_mac_vlan()
157 *vlan = (u16)(attr[2] >> 16); in fm10k_tlv_attr_get_mac_vlan()
200 u32 *attr; in fm10k_tlv_attr_put_value() local
206 attr = &msg[FM10K_TLV_DWORD_LEN(*msg)]; in fm10k_tlv_attr_put_value()
209 attr[1] = (u32)value & (BIT(8 * len) - 1); in fm10k_tlv_attr_put_value()
211 attr[1] = (u32)value; in fm10k_tlv_attr_put_value()
213 attr[2] = (u32)(value >> 32); in fm10k_tlv_attr_put_value()
218 attr[0] = len | attr_id; in fm10k_tlv_attr_put_value()
238 s32 fm10k_tlv_attr_get_value(u32 *attr, void *value, u32 len) in fm10k_tlv_attr_get_value() argument
241 if (!attr || !value) in fm10k_tlv_attr_get_value()
244 if ((*attr >> FM10K_TLV_LEN_SHIFT) != len) in fm10k_tlv_attr_get_value()
248 *(u64 *)value = ((u64)attr[2] << 32) | attr[1]; in fm10k_tlv_attr_get_value()
250 *(u32 *)value = attr[1]; in fm10k_tlv_attr_get_value()
252 *(u16 *)value = (u16)attr[1]; in fm10k_tlv_attr_get_value()
254 *(u8 *)value = (u8)attr[1]; in fm10k_tlv_attr_get_value()
274 u32 *attr; in fm10k_tlv_attr_put_le_struct() local
281 attr = &msg[FM10K_TLV_DWORD_LEN(*msg)]; in fm10k_tlv_attr_put_le_struct()
285 attr[i + 1] = le32_to_cpu(le32_ptr[i]); in fm10k_tlv_attr_put_le_struct()
289 attr[0] = len | attr_id; in fm10k_tlv_attr_put_le_struct()
309 s32 fm10k_tlv_attr_get_le_struct(u32 *attr, void *le_struct, u32 len) in fm10k_tlv_attr_get_le_struct() argument
315 if (!le_struct || !attr) in fm10k_tlv_attr_get_le_struct()
318 if ((*attr >> FM10K_TLV_LEN_SHIFT) != len) in fm10k_tlv_attr_get_le_struct()
321 attr++; in fm10k_tlv_attr_get_le_struct()
324 le32_ptr[i] = cpu_to_le32(attr[i]); in fm10k_tlv_attr_get_le_struct()
342 u32 *attr; in fm10k_tlv_attr_nest_start() local
348 attr = &msg[FM10K_TLV_DWORD_LEN(*msg)]; in fm10k_tlv_attr_nest_start()
350 attr[0] = attr_id; in fm10k_tlv_attr_nest_start()
353 return attr; in fm10k_tlv_attr_nest_start()
367 u32 *attr; in fm10k_tlv_attr_nest_stop() local
375 attr = &msg[FM10K_TLV_DWORD_LEN(*msg)]; in fm10k_tlv_attr_nest_stop()
376 len = (attr[0] >> FM10K_TLV_LEN_SHIFT) << FM10K_TLV_LEN_SHIFT; in fm10k_tlv_attr_nest_stop()
398 static s32 fm10k_tlv_attr_validate(u32 *attr, in fm10k_tlv_attr_validate() argument
401 u32 attr_id = *attr & FM10K_TLV_ID_MASK; in fm10k_tlv_attr_validate()
402 u16 len = *attr >> FM10K_TLV_LEN_SHIFT; in fm10k_tlv_attr_validate()
405 if (*attr & (FM10K_TLV_FLAGS_MSG << FM10K_TLV_FLAGS_SHIFT)) in fm10k_tlv_attr_validate()
417 attr++; in fm10k_tlv_attr_validate()
422 (attr[(len - 1) / 4] & (0xFF << (8 * ((len - 1) % 4))))) in fm10k_tlv_attr_validate()
471 static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results, in fm10k_tlv_attr_parse() argument
479 if (!attr || !results) in fm10k_tlv_attr_parse()
487 len = *attr >> FM10K_TLV_LEN_SHIFT; in fm10k_tlv_attr_parse()
495 results[0] = attr; in fm10k_tlv_attr_parse()
500 attr++; in fm10k_tlv_attr_parse()
504 attr_id = *attr & FM10K_TLV_ID_MASK; in fm10k_tlv_attr_parse()
509 err = fm10k_tlv_attr_validate(attr, tlv_attr); in fm10k_tlv_attr_parse()
515 results[attr_id] = attr; in fm10k_tlv_attr_parse()
518 offset += FM10K_TLV_DWORD_LEN(*attr) * 4; in fm10k_tlv_attr_parse()
521 attr = &attr[FM10K_TLV_DWORD_LEN(*attr)]; in fm10k_tlv_attr_parse()
573 err = fm10k_tlv_attr_parse(msg, results, data->attr); in fm10k_tlv_msg_parse()