Re: [PATCH net-next v5] netlink: specs: devlink: add some(not all) missing attributes in devlink.yaml

swarup
2023-12-10T17:44:28Z

On Sun, Dec 10, 2023 at 12:47:25PM +0100, Jiri Pirko wrote:
> Fri, Dec 08, 2023 at 07:30:05PM CET, swarupkotikalapudi@gmail.com wrote:
> >On Wed, Dec 06, 2023 at 08:06:11AM -0800, Jakub Kicinski wrote:
> >> On Wed, 6 Dec 2023 08:51:54 +0100 Jiri Pirko wrote:
> >> > My "suggested-by" is probably fine as I suggested Swarup to make the patch :)
> >>
> >> Ah, I didn't realize, sorry :) Just mine needs to go then.
> >
> >Hi Jiri,
> >
> >Please find answer for some quesion from you.
> >
> >1. I removed the Fixes tag.
> >
> >2. I removed Jakub's name from Suggested-by tag.
> >
> >3. I added new line as suggested.
> >
> > value: ## or number, is used only if there is a gap or
> > missing attribute just above of any attribute which is not yet filled.
> >
> >4. dl-attr-stats has a value 0 as shown below for this reason:
> > name: dl-attr-stats
> > name-prefix: devlink-attr-
> > attributes:
> > - name: stats-rx-packets
> > type: u64
> > value: 0 <-- 0 is added here due to below mentioned reason
> > but mainly to match order of stats unnamed enum declared in include/uapi/linux/devlink.h
>
> So, by default, it starts with 1?
>
Hi Jiri,

Yes it seems by default it starts with 1
e.g. below is test result when value is not added

git diff Documentation/netlink/specs/devlink.yaml
diff --git a/Documentation/netlink/specs/devlink.yaml b/Documentation/netlink/specs/devlink.yaml
index c3a438197964..9d0e684da574 100644
--- a/Documentation/netlink/specs/devlink.yaml
+++ b/Documentation/netlink/specs/devlink.yaml
@@ -1191,7 +1191,6 @@ attribute-sets:
attributes:
- name: stats-rx-packets
type: u64
- value: 0
-
name: stats-rx-bytes
type: u64

sudo ./tools/net/ynl/cli.py --spec Documentation/netlink/specs/devlink.yaml --do trap-get --json '{"bus-name": "netdevsim", "dev-name": "netdevsim1", "trap-name": "ttl_value_is_too_small"}' --process-unknown
{'bus-name': 'netdevsim',
'dev-name': 'netdevsim1',
'stats': {'UnknownAttr(0)': b'iW*\x00\x00\x00\x00\x00',
'stats-rx-bytes': 62,
'stats-rx-packets': 394034238},
'trap-action': 'trap',
'trap-generic': True,
'trap-group-name': 'l3_exceptions',
'trap-metadata': {'trap-metadata-type-in-port': True},
'trap-name': 'ttl_value_is_too_small',
'trap-type': 'exception'}

Thanks,
Swarup

>
> > -
> > name: stats-rx-bytes
> > type: u64
> > -
> > name: stats-rx-dropped
> > type: u64