Lines Matching refs:attrs

33 						 struct nlattr **attrs)  in devlink_port_get_from_attrs()  argument
35 if (attrs[DEVLINK_ATTR_PORT_INDEX]) { in devlink_port_get_from_attrs()
36 u32 port_index = nla_get_u32(attrs[DEVLINK_ATTR_PORT_INDEX]); in devlink_port_get_from_attrs()
50 return devlink_port_get_from_attrs(devlink, info->attrs); in devlink_port_get_from_info()
91 devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_PCI_VF) in devlink_port_fn_migratable_fill()
114 devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_PCI_VF) in devlink_port_fn_ipsec_crypto_fill()
136 devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_PCI_VF) in devlink_port_fn_ipsec_packet_fill()
206 struct devlink_port_attrs *attrs = &devlink_port->attrs; in devlink_nl_port_attrs_put() local
210 if (attrs->lanes) { in devlink_nl_port_attrs_put()
211 if (nla_put_u32(msg, DEVLINK_ATTR_PORT_LANES, attrs->lanes)) in devlink_nl_port_attrs_put()
214 if (nla_put_u8(msg, DEVLINK_ATTR_PORT_SPLITTABLE, attrs->splittable)) in devlink_nl_port_attrs_put()
216 if (nla_put_u16(msg, DEVLINK_ATTR_PORT_FLAVOUR, attrs->flavour)) in devlink_nl_port_attrs_put()
218 switch (devlink_port->attrs.flavour) { in devlink_nl_port_attrs_put()
221 attrs->pci_pf.controller) || in devlink_nl_port_attrs_put()
222 nla_put_u16(msg, DEVLINK_ATTR_PORT_PCI_PF_NUMBER, attrs->pci_pf.pf)) in devlink_nl_port_attrs_put()
224 if (nla_put_u8(msg, DEVLINK_ATTR_PORT_EXTERNAL, attrs->pci_pf.external)) in devlink_nl_port_attrs_put()
229 attrs->pci_vf.controller) || in devlink_nl_port_attrs_put()
230 nla_put_u16(msg, DEVLINK_ATTR_PORT_PCI_PF_NUMBER, attrs->pci_vf.pf) || in devlink_nl_port_attrs_put()
231 nla_put_u16(msg, DEVLINK_ATTR_PORT_PCI_VF_NUMBER, attrs->pci_vf.vf)) in devlink_nl_port_attrs_put()
233 if (nla_put_u8(msg, DEVLINK_ATTR_PORT_EXTERNAL, attrs->pci_vf.external)) in devlink_nl_port_attrs_put()
238 attrs->pci_sf.controller) || in devlink_nl_port_attrs_put()
240 attrs->pci_sf.pf) || in devlink_nl_port_attrs_put()
242 attrs->pci_sf.sf)) in devlink_nl_port_attrs_put()
249 attrs->phys.port_number)) in devlink_nl_port_attrs_put()
251 if (!attrs->split) in devlink_nl_port_attrs_put()
254 attrs->phys.port_number)) in devlink_nl_port_attrs_put()
257 attrs->phys.split_subport_number)) in devlink_nl_port_attrs_put()
689 if (devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_PCI_VF) { in devlink_port_function_validate()
701 if (devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_PCI_VF) { in devlink_port_function_validate()
713 if (devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_PCI_VF) { in devlink_port_function_validate()
773 if (info->attrs[DEVLINK_ATTR_PORT_TYPE]) { in devlink_nl_cmd_port_set_doit()
776 port_type = nla_get_u16(info->attrs[DEVLINK_ATTR_PORT_TYPE]); in devlink_nl_cmd_port_set_doit()
782 if (info->attrs[DEVLINK_ATTR_PORT_FUNCTION]) { in devlink_nl_cmd_port_set_doit()
783 struct nlattr *attr = info->attrs[DEVLINK_ATTR_PORT_FUNCTION]; in devlink_nl_cmd_port_set_doit()
805 count = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_SPLIT_COUNT]); in devlink_nl_cmd_port_split_doit()
807 if (!devlink_port->attrs.splittable) { in devlink_nl_cmd_port_split_doit()
809 if (devlink_port->attrs.split) in devlink_nl_cmd_port_split_doit()
816 if (count < 2 || !is_power_of_2(count) || count > devlink_port->attrs.lanes) { in devlink_nl_cmd_port_split_doit()
848 if (!info->attrs[DEVLINK_ATTR_PORT_FLAVOUR] || in devlink_nl_cmd_port_new_doit()
849 !info->attrs[DEVLINK_ATTR_PORT_PCI_PF_NUMBER]) { in devlink_nl_cmd_port_new_doit()
853 new_attrs.flavour = nla_get_u16(info->attrs[DEVLINK_ATTR_PORT_FLAVOUR]); in devlink_nl_cmd_port_new_doit()
855 nla_get_u16(info->attrs[DEVLINK_ATTR_PORT_PCI_PF_NUMBER]); in devlink_nl_cmd_port_new_doit()
857 if (info->attrs[DEVLINK_ATTR_PORT_INDEX]) { in devlink_nl_cmd_port_new_doit()
860 nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_INDEX]); in devlink_nl_cmd_port_new_doit()
863 if (info->attrs[DEVLINK_ATTR_PORT_CONTROLLER_NUMBER]) { in devlink_nl_cmd_port_new_doit()
865 nla_get_u16(info->attrs[DEVLINK_ATTR_PORT_CONTROLLER_NUMBER]); in devlink_nl_cmd_port_new_doit()
869 info->attrs[DEVLINK_ATTR_PORT_PCI_SF_NUMBER]) { in devlink_nl_cmd_port_new_doit()
870 new_attrs.sfnum = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_PCI_SF_NUMBER]); in devlink_nl_cmd_port_new_doit()
923 return devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_CPU && in devlink_port_type_should_warn()
924 devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_DSA && in devlink_port_type_should_warn()
925 devlink_port->attrs.flavour != DEVLINK_PORT_FLAVOUR_UNUSED; in devlink_port_type_should_warn()
1278 struct devlink_port_attrs *attrs = &devlink_port->attrs; in __devlink_port_attrs_set() local
1281 attrs->flavour = flavour; in __devlink_port_attrs_set()
1282 if (attrs->switch_id.id_len) { in __devlink_port_attrs_set()
1284 if (WARN_ON(attrs->switch_id.id_len > MAX_PHYS_ITEM_ID_LEN)) in __devlink_port_attrs_set()
1285 attrs->switch_id.id_len = MAX_PHYS_ITEM_ID_LEN; in __devlink_port_attrs_set()
1299 struct devlink_port_attrs *attrs) in devlink_port_attrs_set() argument
1305 devlink_port->attrs = *attrs; in devlink_port_attrs_set()
1306 ret = __devlink_port_attrs_set(devlink_port, attrs->flavour); in devlink_port_attrs_set()
1309 WARN_ON(attrs->splittable && attrs->split); in devlink_port_attrs_set()
1324 struct devlink_port_attrs *attrs = &devlink_port->attrs; in devlink_port_attrs_pci_pf_set() local
1333 attrs->pci_pf.controller = controller; in devlink_port_attrs_pci_pf_set()
1334 attrs->pci_pf.pf = pf; in devlink_port_attrs_pci_pf_set()
1335 attrs->pci_pf.external = external; in devlink_port_attrs_pci_pf_set()
1351 struct devlink_port_attrs *attrs = &devlink_port->attrs; in devlink_port_attrs_pci_vf_set() local
1360 attrs->pci_vf.controller = controller; in devlink_port_attrs_pci_vf_set()
1361 attrs->pci_vf.pf = pf; in devlink_port_attrs_pci_vf_set()
1362 attrs->pci_vf.vf = vf; in devlink_port_attrs_pci_vf_set()
1363 attrs->pci_vf.external = external; in devlink_port_attrs_pci_vf_set()
1379 struct devlink_port_attrs *attrs = &devlink_port->attrs; in devlink_port_attrs_pci_sf_set() local
1388 attrs->pci_sf.controller = controller; in devlink_port_attrs_pci_sf_set()
1389 attrs->pci_sf.pf = pf; in devlink_port_attrs_pci_sf_set()
1390 attrs->pci_sf.sf = sf; in devlink_port_attrs_pci_sf_set()
1391 attrs->pci_sf.external = external; in devlink_port_attrs_pci_sf_set()
1413 struct devlink_port_attrs *attrs = &devlink_port->attrs; in __devlink_port_phys_port_name_get() local
1419 switch (attrs->flavour) { in __devlink_port_phys_port_name_get()
1426 attrs->phys.port_number); in __devlink_port_phys_port_name_get()
1427 if (n < len && attrs->split) in __devlink_port_phys_port_name_get()
1429 attrs->phys.split_subport_number); in __devlink_port_phys_port_name_get()
1440 if (attrs->pci_pf.external) { in __devlink_port_phys_port_name_get()
1441 n = snprintf(name, len, "c%u", attrs->pci_pf.controller); in __devlink_port_phys_port_name_get()
1447 n = snprintf(name, len, "pf%u", attrs->pci_pf.pf); in __devlink_port_phys_port_name_get()
1450 if (attrs->pci_vf.external) { in __devlink_port_phys_port_name_get()
1451 n = snprintf(name, len, "c%u", attrs->pci_vf.controller); in __devlink_port_phys_port_name_get()
1458 attrs->pci_vf.pf, attrs->pci_vf.vf); in __devlink_port_phys_port_name_get()
1461 if (attrs->pci_sf.external) { in __devlink_port_phys_port_name_get()
1462 n = snprintf(name, len, "c%u", attrs->pci_sf.controller); in __devlink_port_phys_port_name_get()
1468 n = snprintf(name, len, "pf%usf%u", attrs->pci_sf.pf, in __devlink_port_phys_port_name_get()
1469 attrs->pci_sf.sf); in __devlink_port_phys_port_name_get()
1512 memcpy(ppid, &devlink_port->attrs.switch_id, sizeof(*ppid)); in devlink_compat_switch_id_get()