Message ID | 20210113192730.280656-3-saeed@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,V6,01/14] devlink: Prepare code to fill multiple port function attributes | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | warning | Series does not have a cover letter |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 4 of 4 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 486 this patch: 486 |
netdev/kdoc | fail | Errors and warnings before: 16 this patch: 17 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: line length of 85 exceeds 80 columns |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 676 this patch: 676 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Wed, 13 Jan 2021 11:27:18 -0800 Saeed Mahameed wrote: > /** > * struct devlink_port_attrs - devlink port object > * @flavour: flavour of the port > @@ -114,6 +126,7 @@ struct devlink_port_attrs { > struct devlink_port_phys_attrs phys; > struct devlink_port_pci_pf_attrs pci_pf; > struct devlink_port_pci_vf_attrs pci_vf; > + struct devlink_port_pci_sf_attrs pci_sf; > }; > }; include/net/devlink.h:131: warning: Function parameter or member 'pci_sf' not described in 'devlink_port_attrs'
> From: Jakub Kicinski <kuba@kernel.org> > Sent: Thursday, January 14, 2021 11:13 PM > > On Wed, 13 Jan 2021 11:27:18 -0800 Saeed Mahameed wrote: > > /** > > * struct devlink_port_attrs - devlink port object > > * @flavour: flavour of the port > > @@ -114,6 +126,7 @@ struct devlink_port_attrs { > > struct devlink_port_phys_attrs phys; > > struct devlink_port_pci_pf_attrs pci_pf; > > struct devlink_port_pci_vf_attrs pci_vf; > > + struct devlink_port_pci_sf_attrs pci_sf; > > }; > > }; > > include/net/devlink.h:131: warning: Function parameter or member 'pci_sf' > not described in 'devlink_port_attrs' Wasn't reported till v5. Can you please share, which script catches this? So that I can run next time early.
On Thu, 14 Jan 2021 17:53:09 +0000 Parav Pandit wrote: > > From: Jakub Kicinski <kuba@kernel.org> > > Sent: Thursday, January 14, 2021 11:13 PM > > > > On Wed, 13 Jan 2021 11:27:18 -0800 Saeed Mahameed wrote: > > > /** > > > * struct devlink_port_attrs - devlink port object > > > * @flavour: flavour of the port > > > @@ -114,6 +126,7 @@ struct devlink_port_attrs { > > > struct devlink_port_phys_attrs phys; > > > struct devlink_port_pci_pf_attrs pci_pf; > > > struct devlink_port_pci_vf_attrs pci_vf; > > > + struct devlink_port_pci_sf_attrs pci_sf; > > > }; > > > }; > > > > include/net/devlink.h:131: warning: Function parameter or member 'pci_sf' > > not described in 'devlink_port_attrs' > Wasn't reported till v5. > Can you please share, which script catches this? So that I can run next time early. This is just scripts/kernel-doc from the tree. All the tests are here: https://github.com/kuba-moo/nipa/blob/master/tests/
> From: Jakub Kicinski <kuba@kernel.org> > Sent: Thursday, January 14, 2021 11:52 PM > > On Thu, 14 Jan 2021 17:53:09 +0000 Parav Pandit wrote: > > > From: Jakub Kicinski <kuba@kernel.org> > > > Sent: Thursday, January 14, 2021 11:13 PM > > > > > > On Wed, 13 Jan 2021 11:27:18 -0800 Saeed Mahameed wrote: > > > > /** > > > > * struct devlink_port_attrs - devlink port object > > > > * @flavour: flavour of the port > > > > @@ -114,6 +126,7 @@ struct devlink_port_attrs { > > > > struct devlink_port_phys_attrs phys; > > > > struct devlink_port_pci_pf_attrs pci_pf; > > > > struct devlink_port_pci_vf_attrs pci_vf; > > > > + struct devlink_port_pci_sf_attrs pci_sf; > > > > }; > > > > }; > > > > > > include/net/devlink.h:131: warning: Function parameter or member > 'pci_sf' > > > not described in 'devlink_port_attrs' > > Wasn't reported till v5. > > Can you please share, which script catches this? So that I can run next time > early. > > This is just scripts/kernel-doc from the tree. > Ok. Got it. This is helpful. Will wait to gather other comments. Otherwise better to do bulk conversion for all the below one in include/net/devlink.h apart from this SF one. ./scripts/kernel-doc -none include/net/devlink.h include/net/devlink.h:217: warning: Function parameter or member 'field_id' not described in 'devlink_dpipe_match' include/net/devlink.h:232: warning: Function parameter or member 'field_id' not described in 'devlink_dpipe_action' include/net/devlink.h:275: warning: Function parameter or member 'match_values_count' not described in 'devlink_dpipe_entry' include/net/devlink.h:320: warning: Function parameter or member 'list' not described in 'devlink_dpipe_table' include/net/devlink.h:339: warning: Function parameter or member 'actions_dump' not described in 'devlink_dpipe_table_ops' include/net/devlink.h:339: warning: Function parameter or member 'matches_dump' not described in 'devlink_dpipe_table_ops' include/net/devlink.h:339: warning: Function parameter or member 'entries_dump' not described in 'devlink_dpipe_table_ops' include/net/devlink.h:339: warning: Function parameter or member 'counters_set_update' not described in 'devlink_dpipe_table_ops' include/net/devlink.h:339: warning: Function parameter or member 'size_get' not described in 'devlink_dpipe_table_ops' include/net/devlink.h:349: warning: Function parameter or member 'headers' not described in 'devlink_dpipe_headers' include/net/devlink.h:349: warning: Function parameter or member 'headers_count' not described in 'devlink_dpipe_headers' include/net/devlink.h:363: warning: Function parameter or member 'unit' not described in 'devlink_resource_size_params' include/net/devlink.h:404: warning: Function parameter or member 'occ_get' not described in 'devlink_resource' include/net/devlink.h:404: warning: Function parameter or member 'occ_get_priv' not described in 'devlink_resource' include/net/devlink.h:477: warning: Function parameter or member 'id' not described in 'devlink_param' include/net/devlink.h:606: warning: Function parameter or member 'overwrite_mask' not described in 'devlink_flash_update_params' > All the tests are here: > > https://github.com/kuba-moo/nipa/blob/master/tests/
diff --git a/include/net/devlink.h b/include/net/devlink.h index f466819cc477..b6ebb516f1b0 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -93,6 +93,18 @@ struct devlink_port_pci_vf_attrs { u8 external:1; }; +/** + * struct devlink_port_pci_sf_attrs - devlink port's PCI SF attributes + * @controller: Associated controller number + * @sf: Associated PCI SF for of the PCI PF for this port. + * @pf: Associated PCI PF number for this port. + */ +struct devlink_port_pci_sf_attrs { + u32 controller; + u32 sf; + u16 pf; +}; + /** * struct devlink_port_attrs - devlink port object * @flavour: flavour of the port @@ -114,6 +126,7 @@ struct devlink_port_attrs { struct devlink_port_phys_attrs phys; struct devlink_port_pci_pf_attrs pci_pf; struct devlink_port_pci_vf_attrs pci_vf; + struct devlink_port_pci_sf_attrs pci_sf; }; }; @@ -1404,6 +1417,8 @@ void devlink_port_attrs_pci_pf_set(struct devlink_port *devlink_port, u32 contro u16 pf, bool external); void devlink_port_attrs_pci_vf_set(struct devlink_port *devlink_port, u32 controller, u16 pf, u16 vf, bool external); +void devlink_port_attrs_pci_sf_set(struct devlink_port *devlink_port, + u32 controller, u16 pf, u32 sf); int devlink_sb_register(struct devlink *devlink, unsigned int sb_index, u32 size, u16 ingress_pools_count, u16 egress_pools_count, u16 ingress_tc_count, diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h index cf89c318f2ac..1a241b09a7f8 100644 --- a/include/uapi/linux/devlink.h +++ b/include/uapi/linux/devlink.h @@ -200,6 +200,10 @@ enum devlink_port_flavour { DEVLINK_PORT_FLAVOUR_UNUSED, /* Port which exists in the switch, but * is not used in any way. */ + DEVLINK_PORT_FLAVOUR_PCI_SF, /* Represents eswitch port + * for the PCI SF. It is an internal + * port that faces the PCI SF. + */ }; enum devlink_param_cmode { @@ -529,6 +533,7 @@ enum devlink_attr { DEVLINK_ATTR_RELOAD_ACTION_INFO, /* nested */ DEVLINK_ATTR_RELOAD_ACTION_STATS, /* nested */ + DEVLINK_ATTR_PORT_PCI_SF_NUMBER, /* u32 */ /* add new attributes above here, update the policy in devlink.c */ __DEVLINK_ATTR_MAX, diff --git a/net/core/devlink.c b/net/core/devlink.c index c39496311b71..4cbc02fb602d 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -690,6 +690,15 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg, if (nla_put_u8(msg, DEVLINK_ATTR_PORT_EXTERNAL, attrs->pci_vf.external)) return -EMSGSIZE; break; + case DEVLINK_PORT_FLAVOUR_PCI_SF: + if (nla_put_u32(msg, DEVLINK_ATTR_PORT_CONTROLLER_NUMBER, + attrs->pci_sf.controller) || + nla_put_u16(msg, DEVLINK_ATTR_PORT_PCI_PF_NUMBER, + attrs->pci_sf.pf) || + nla_put_u32(msg, DEVLINK_ATTR_PORT_PCI_SF_NUMBER, + attrs->pci_sf.sf)) + return -EMSGSIZE; + break; case DEVLINK_PORT_FLAVOUR_PHYSICAL: case DEVLINK_PORT_FLAVOUR_CPU: case DEVLINK_PORT_FLAVOUR_DSA: @@ -8374,6 +8383,32 @@ void devlink_port_attrs_pci_vf_set(struct devlink_port *devlink_port, u32 contro } EXPORT_SYMBOL_GPL(devlink_port_attrs_pci_vf_set); +/** + * devlink_port_attrs_pci_sf_set - Set PCI SF port attributes + * + * @devlink_port: devlink port + * @controller: associated controller number for the devlink port instance + * @pf: associated PF for the devlink port instance + * @sf: associated SF of a PF for the devlink port instance + */ +void devlink_port_attrs_pci_sf_set(struct devlink_port *devlink_port, u32 controller, + u16 pf, u32 sf) +{ + struct devlink_port_attrs *attrs = &devlink_port->attrs; + int ret; + + if (WARN_ON(devlink_port->registered)) + return; + ret = __devlink_port_attrs_set(devlink_port, + DEVLINK_PORT_FLAVOUR_PCI_SF); + if (ret) + return; + attrs->pci_sf.controller = controller; + attrs->pci_sf.pf = pf; + attrs->pci_sf.sf = sf; +} +EXPORT_SYMBOL_GPL(devlink_port_attrs_pci_sf_set); + static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port, char *name, size_t len) { @@ -8422,6 +8457,10 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port, n = snprintf(name, len, "pf%uvf%u", attrs->pci_vf.pf, attrs->pci_vf.vf); break; + case DEVLINK_PORT_FLAVOUR_PCI_SF: + n = snprintf(name, len, "pf%usf%u", attrs->pci_sf.pf, + attrs->pci_sf.sf); + break; } if (n >= len)