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

The function dcb_set_attribute() takes a fully-formed payload as an
argument. For callers that need to build a nested attribute, such as is the
case for DCB APP table, this is not great, because with libmnl, they would
need to construct a separate netlink message just to pluck out the payload
and hand it over to this function.

Currently, dcb_set_attribute() also always wraps the payload in an
DCB_ATTR_IEEE container, because that is what all the dcb subtools so far
needed. But that is not appropriate for DCBX in particular, and in fact a
handful other attributes, as well as any CEE payloads.

Instead, generalize this code by adding parameters for constructing a
custom payload and for fetching the response from a custom response
attribute. Then add dcb_set_attribute_va(), which takes a callback to
invoke in the right place for the nest to be built, and
dcb_set_attribute_bare(), which is similar to dcb_set_attribute(), but does
not encapsulate the payload in an IEEE container. Rewrite
dcb_set_attribute() compatibly in terms of the new functions.

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