rtnl_link: add new IFLA_XDP_* attributes

Introduced by Linux commit v4.19-rc1~140^2~364^2~6^2~6.

* xlat/rtnl_ifla_xdp_attrs.in (IFLA_XDP_DRV_PROG_ID,
IFLA_XDP_SKB_PROG_ID, IFLA_XDP_HW_PROG_ID): New constants.
* rtnl_link.c (ifla_xdp_nla_decoders): Add decoders for
IFLA_XDP_DRV_PROG_ID, IFLA_XDP_SKB_PROG_ID, and IFLA_XDP_HW_PROG_ID.
* tests/nlattr_ifla_xdp.c: Add checks for new attributes.
This commit is contained in:
Eugene Syromyatnikov 2018-08-19 11:14:27 +02:00 committed by Dmitry V. Levin
parent 9624d9f09d
commit eded21f5c0
3 changed files with 42 additions and 1 deletions

View File

@ -578,7 +578,10 @@ static const nla_decoder_t ifla_xdp_nla_decoders[] = {
[IFLA_XDP_FD] = decode_nla_fd,
[IFLA_XDP_ATTACHED] = decode_nla_u8,
[IFLA_XDP_FLAGS] = decode_ifla_xdp_flags,
[IFLA_XDP_PROG_ID] = decode_nla_u32
[IFLA_XDP_PROG_ID] = decode_nla_u32,
[IFLA_XDP_DRV_PROG_ID] = decode_nla_u32,
[IFLA_XDP_SKB_PROG_ID] = decode_nla_u32,
[IFLA_XDP_HW_PROG_ID] = decode_nla_u32,
};
static bool

View File

@ -44,6 +44,22 @@ enum { IFLA_XDP = 43 };
# define IFLA_XDP_FD 1
#endif
#ifndef IFLA_XDP_PROG_ID
# define IFLA_XDP_PROG_ID 4
#endif
#ifndef IFLA_XDP_DRV_PROG_ID
# define IFLA_XDP_DRV_PROG_ID 5
#endif
#ifndef IFLA_XDP_SKB_PROG_ID
# define IFLA_XDP_SKB_PROG_ID 6
#endif
#ifndef IFLA_XDP_HW_PROG_ID
# define IFLA_XDP_HW_PROG_ID 7
#endif
#define IFLA_ATTR IFLA_XDP
#include "nlattr_ifla.h"
@ -73,6 +89,25 @@ main(void)
printf("XDP_FLAGS_UPDATE_IF_NOEXIST"));
#endif
static const struct {
uint32_t val;
const char *str;
} attrs[] = {
{ ARG_STR(IFLA_XDP_PROG_ID) },
{ ARG_STR(IFLA_XDP_DRV_PROG_ID) },
{ ARG_STR(IFLA_XDP_SKB_PROG_ID) },
{ ARG_STR(IFLA_XDP_HW_PROG_ID) },
};
for (size_t i = 0; i < ARRAY_SIZE(attrs); i++) {
TEST_NESTED_NLATTR_OBJECT_EX_(fd, nlh0, hdrlen,
init_ifinfomsg, print_ifinfomsg,
attrs[i].val, attrs[i].str,
pattern, num,
print_quoted_hex, 1,
printf("%u", num));
}
puts("+++ exited with 0 +++");
return 0;
}

View File

@ -3,3 +3,6 @@ IFLA_XDP_FD 1
IFLA_XDP_ATTACHED 2
IFLA_XDP_FLAGS 3
IFLA_XDP_PROG_ID 4
IFLA_XDP_DRV_PROG_ID 5
IFLA_XDP_SKB_PROG_ID 6
IFLA_XDP_HW_PROG_ID 7