Lines Matching refs:sr_iov
13 SRIOV *sr_iov; in sr_iov_new() local
17 sr_iov = new(SRIOV, 1); in sr_iov_new()
18 if (!sr_iov) in sr_iov_new()
21 *sr_iov = (SRIOV) { in sr_iov_new()
30 *ret = TAKE_PTR(sr_iov); in sr_iov_new()
37 _cleanup_(sr_iov_freep) SRIOV *sr_iov = NULL; in sr_iov_new_static()
56 r = sr_iov_new(&sr_iov); in sr_iov_new_static()
60 r = ordered_hashmap_ensure_put(sr_iov_by_section, &config_section_hash_ops, n, sr_iov); in sr_iov_new_static()
64 sr_iov->section = TAKE_PTR(n); in sr_iov_new_static()
65 sr_iov->sr_iov_by_section = *sr_iov_by_section; in sr_iov_new_static()
67 *ret = TAKE_PTR(sr_iov); in sr_iov_new_static()
71 SRIOV *sr_iov_free(SRIOV *sr_iov) { in sr_iov_free() argument
72 if (!sr_iov) in sr_iov_free()
75 if (sr_iov->sr_iov_by_section && sr_iov->section) in sr_iov_free()
76 ordered_hashmap_remove(sr_iov->sr_iov_by_section, sr_iov->section); in sr_iov_free()
78 config_section_free(sr_iov->section); in sr_iov_free()
80 return mfree(sr_iov); in sr_iov_free()
83 void sr_iov_hash_func(const SRIOV *sr_iov, struct siphash *state) { in sr_iov_hash_func() argument
84 assert(sr_iov); in sr_iov_hash_func()
87 siphash24_compress(&sr_iov->vf, sizeof(sr_iov->vf), state); in sr_iov_hash_func()
103 int sr_iov_set_netlink_message(SRIOV *sr_iov, sd_netlink_message *req) { in sr_iov_set_netlink_message() argument
106 assert(sr_iov); in sr_iov_set_netlink_message()
117 if (!ether_addr_is_null(&sr_iov->mac)) { in sr_iov_set_netlink_message()
119 .vf = sr_iov->vf, in sr_iov_set_netlink_message()
122 memcpy(ivm.mac, &sr_iov->mac, ETH_ALEN); in sr_iov_set_netlink_message()
128 if (sr_iov->vf_spoof_check_setting >= 0) { in sr_iov_set_netlink_message()
130 .vf = sr_iov->vf, in sr_iov_set_netlink_message()
131 .setting = sr_iov->vf_spoof_check_setting, in sr_iov_set_netlink_message()
139 if (sr_iov->query_rss >= 0) { in sr_iov_set_netlink_message()
141 .vf = sr_iov->vf, in sr_iov_set_netlink_message()
142 .setting = sr_iov->query_rss, in sr_iov_set_netlink_message()
150 if (sr_iov->trust >= 0) { in sr_iov_set_netlink_message()
152 .vf = sr_iov->vf, in sr_iov_set_netlink_message()
153 .setting = sr_iov->trust, in sr_iov_set_netlink_message()
161 if (sr_iov->link_state >= 0) { in sr_iov_set_netlink_message()
163 .vf = sr_iov->vf, in sr_iov_set_netlink_message()
164 .link_state = sr_iov->link_state, in sr_iov_set_netlink_message()
172 if (sr_iov->vlan > 0) { in sr_iov_set_netlink_message()
175 ivvi.vf = sr_iov->vf; in sr_iov_set_netlink_message()
176 ivvi.vlan = sr_iov->vlan; in sr_iov_set_netlink_message()
177 ivvi.qos = sr_iov->qos; in sr_iov_set_netlink_message()
178 ivvi.vlan_proto = htobe16(sr_iov->vlan_proto); in sr_iov_set_netlink_message()
233 SRIOV *sr_iov; in sr_iov_set_num_vfs() local
238 ORDERED_HASHMAP_FOREACH(sr_iov, sr_iov_by_section) in sr_iov_set_num_vfs()
239 num_vfs = MAX(num_vfs, sr_iov->vf + 1); in sr_iov_set_num_vfs()
297 static int sr_iov_section_verify(uint32_t num_vfs, SRIOV *sr_iov) { in sr_iov_section_verify() argument
298 assert(sr_iov); in sr_iov_section_verify()
300 if (section_is_invalid(sr_iov->section)) in sr_iov_section_verify()
303 if (sr_iov->vf == UINT32_MAX) in sr_iov_section_verify()
307 sr_iov->section->filename, sr_iov->section->line); in sr_iov_section_verify()
309 if (sr_iov->vf >= num_vfs) in sr_iov_section_verify()
313 sr_iov->section->filename, sr_iov->section->line); in sr_iov_section_verify()
320 SRIOV *sr_iov; in sr_iov_drop_invalid_sections() local
323 ORDERED_HASHMAP_FOREACH(sr_iov, sr_iov_by_section) { in sr_iov_drop_invalid_sections()
326 if (sr_iov_section_verify(num_vfs, sr_iov) < 0) { in sr_iov_drop_invalid_sections()
327 sr_iov_free(sr_iov); in sr_iov_drop_invalid_sections()
331 dup = set_remove(set, sr_iov); in sr_iov_drop_invalid_sections()
335 dup->section->filename, sr_iov->section->line, in sr_iov_drop_invalid_sections()
340 r = set_ensure_put(&set, &sr_iov_hash_ops, sr_iov); in sr_iov_drop_invalid_sections()
361 _cleanup_(sr_iov_free_or_set_invalidp) SRIOV *sr_iov = NULL; in config_parse_sr_iov_uint32()
371 r = sr_iov_new_static(sr_iov_by_section, filename, section_line, &sr_iov); in config_parse_sr_iov_uint32()
377 sr_iov->vf = UINT32_MAX; in config_parse_sr_iov_uint32()
379 sr_iov->vlan = 0; in config_parse_sr_iov_uint32()
381 sr_iov->qos = 0; in config_parse_sr_iov_uint32()
385 TAKE_PTR(sr_iov); in config_parse_sr_iov_uint32()
401 sr_iov->vlan = k; in config_parse_sr_iov_uint32()
407 sr_iov->vf = k; in config_parse_sr_iov_uint32()
409 sr_iov->qos = k; in config_parse_sr_iov_uint32()
413 TAKE_PTR(sr_iov); in config_parse_sr_iov_uint32()
429 _cleanup_(sr_iov_free_or_set_invalidp) SRIOV *sr_iov = NULL; in config_parse_sr_iov_vlan_proto()
438 r = sr_iov_new_static(sr_iov_by_section, filename, section_line, &sr_iov); in config_parse_sr_iov_vlan_proto()
443 sr_iov->vlan_proto = ETH_P_8021Q; in config_parse_sr_iov_vlan_proto()
445 sr_iov->vlan_proto = ETH_P_8021AD; in config_parse_sr_iov_vlan_proto()
452 TAKE_PTR(sr_iov); in config_parse_sr_iov_vlan_proto()
468 _cleanup_(sr_iov_free_or_set_invalidp) SRIOV *sr_iov = NULL; in config_parse_sr_iov_link_state()
477 r = sr_iov_new_static(sr_iov_by_section, filename, section_line, &sr_iov); in config_parse_sr_iov_link_state()
485 sr_iov->link_state = _SR_IOV_LINK_STATE_INVALID; in config_parse_sr_iov_link_state()
486 TAKE_PTR(sr_iov); in config_parse_sr_iov_link_state()
491 sr_iov->link_state = SR_IOV_LINK_STATE_AUTO; in config_parse_sr_iov_link_state()
492 TAKE_PTR(sr_iov); in config_parse_sr_iov_link_state()
503 sr_iov->link_state = r ? SR_IOV_LINK_STATE_ENABLE : SR_IOV_LINK_STATE_DISABLE; in config_parse_sr_iov_link_state()
504 TAKE_PTR(sr_iov); in config_parse_sr_iov_link_state()
520 _cleanup_(sr_iov_free_or_set_invalidp) SRIOV *sr_iov = NULL; in config_parse_sr_iov_boolean()
529 r = sr_iov_new_static(sr_iov_by_section, filename, section_line, &sr_iov); in config_parse_sr_iov_boolean()
535 sr_iov->vf_spoof_check_setting = -1; in config_parse_sr_iov_boolean()
537 sr_iov->query_rss = -1; in config_parse_sr_iov_boolean()
539 sr_iov->trust = -1; in config_parse_sr_iov_boolean()
543 TAKE_PTR(sr_iov); in config_parse_sr_iov_boolean()
554 sr_iov->vf_spoof_check_setting = r; in config_parse_sr_iov_boolean()
556 sr_iov->query_rss = r; in config_parse_sr_iov_boolean()
558 sr_iov->trust = r; in config_parse_sr_iov_boolean()
562 TAKE_PTR(sr_iov); in config_parse_sr_iov_boolean()
578 _cleanup_(sr_iov_free_or_set_invalidp) SRIOV *sr_iov = NULL; in config_parse_sr_iov_mac()
587 r = sr_iov_new_static(sr_iov_by_section, filename, section_line, &sr_iov); in config_parse_sr_iov_mac()
592 sr_iov->mac = ETHER_ADDR_NULL; in config_parse_sr_iov_mac()
593 TAKE_PTR(sr_iov); in config_parse_sr_iov_mac()
597 r = parse_ether_addr(rvalue, &sr_iov->mac); in config_parse_sr_iov_mac()
604 TAKE_PTR(sr_iov); in config_parse_sr_iov_mac()