]> git.proxmox.com Git - mirror_iproute2.git/commit
dcb: Generalize dcb_get_attribute()
authorPetr Machata <me@pmachata.org>
Sat, 2 Jan 2021 00:03:38 +0000 (01:03 +0100)
committerDavid Ahern <dsahern@kernel.org>
Mon, 18 Jan 2021 04:09:29 +0000 (04:09 +0000)
commite59876ff556bc796eee7f6e68984a44e8f2d837b
tree9ea7e7237f48f3da79e818616e75f57a0ee8f2de
parent69290c32dca82368ab74f23aaca7866d506c7cde
dcb: Generalize dcb_get_attribute()

The function dcb_get_attribute() assumes that the caller knows the exact
size of the looked-for payload. It also assumes that the response comes
wrapped in an DCB_ATTR_IEEE nest. The former assumption does not hold for
the IEEE APP table, which has variable size. The latter one does not hold
for DCBX, which is not IEEE-nested, and also for any CEE attributes, which
would come CEE-nested.

Factor out the payload extractor from the current dcb_get_attribute() code,
and put into a helper. Then rewrite dcb_get_attribute() compatibly in terms
of the new function. Introduce dcb_get_attribute_va() as a thin wrapper for
IEEE-nested access, and dcb_get_attribute_bare() for access to attributes
that are not nested.

Signed-off-by: Petr Machata <me@pmachata.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
dcb/dcb.c
dcb/dcb.h