Commit 083476a2 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'ynl-couple-of-unrelated-fixes'

Stanislav Fomichev says:

====================
ynl: couple of unrelated fixes

- spelling of xdp-features
- s/xdp_zc_max_segs/xdp-zc-max-segs/
- expose xdp-zc-max-segs
- add /* private: */
- regenerate headers
- print xdp_zc_max_segs from sample
====================

Link: https://lore.kernel.org/r/20230727163001.3952878-1-sdf@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents f5fbd324 26fdb67e
...@@ -14,7 +14,7 @@ definitions: ...@@ -14,7 +14,7 @@ definitions:
- -
name: basic name: basic
doc: doc:
XDP feautues set supported by all drivers XDP features set supported by all drivers
(XDP_ABORTED, XDP_DROP, XDP_PASS, XDP_TX) (XDP_ABORTED, XDP_DROP, XDP_PASS, XDP_TX)
- -
name: redirect name: redirect
...@@ -63,7 +63,7 @@ attribute-sets: ...@@ -63,7 +63,7 @@ attribute-sets:
enum: xdp-act enum: xdp-act
enum-as-flags: true enum-as-flags: true
- -
name: xdp_zc_max_segs name: xdp-zc-max-segs
doc: max fragment count supported by ZC driver doc: max fragment count supported by ZC driver
type: u32 type: u32
checks: checks:
...@@ -83,6 +83,7 @@ operations: ...@@ -83,6 +83,7 @@ operations:
attributes: attributes:
- ifindex - ifindex
- xdp-features - xdp-features
- xdp-zc-max-segs
dump: dump:
reply: *dev-all reply: *dev-all
- -
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
/** /**
* enum netdev_xdp_act * enum netdev_xdp_act
* @NETDEV_XDP_ACT_BASIC: XDP feautues set supported by all drivers * @NETDEV_XDP_ACT_BASIC: XDP features set supported by all drivers
* (XDP_ABORTED, XDP_DROP, XDP_PASS, XDP_TX) * (XDP_ABORTED, XDP_DROP, XDP_PASS, XDP_TX)
* @NETDEV_XDP_ACT_REDIRECT: The netdev supports XDP_REDIRECT * @NETDEV_XDP_ACT_REDIRECT: The netdev supports XDP_REDIRECT
* @NETDEV_XDP_ACT_NDO_XMIT: This feature informs if netdev implements * @NETDEV_XDP_ACT_NDO_XMIT: This feature informs if netdev implements
...@@ -34,6 +34,7 @@ enum netdev_xdp_act { ...@@ -34,6 +34,7 @@ enum netdev_xdp_act {
NETDEV_XDP_ACT_RX_SG = 32, NETDEV_XDP_ACT_RX_SG = 32,
NETDEV_XDP_ACT_NDO_XMIT_SG = 64, NETDEV_XDP_ACT_NDO_XMIT_SG = 64,
/* private: */
NETDEV_XDP_ACT_MASK = 127, NETDEV_XDP_ACT_MASK = 127,
}; };
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
/** /**
* enum netdev_xdp_act * enum netdev_xdp_act
* @NETDEV_XDP_ACT_BASIC: XDP feautues set supported by all drivers * @NETDEV_XDP_ACT_BASIC: XDP features set supported by all drivers
* (XDP_ABORTED, XDP_DROP, XDP_PASS, XDP_TX) * (XDP_ABORTED, XDP_DROP, XDP_PASS, XDP_TX)
* @NETDEV_XDP_ACT_REDIRECT: The netdev supports XDP_REDIRECT * @NETDEV_XDP_ACT_REDIRECT: The netdev supports XDP_REDIRECT
* @NETDEV_XDP_ACT_NDO_XMIT: This feature informs if netdev implements * @NETDEV_XDP_ACT_NDO_XMIT: This feature informs if netdev implements
...@@ -34,6 +34,7 @@ enum netdev_xdp_act { ...@@ -34,6 +34,7 @@ enum netdev_xdp_act {
NETDEV_XDP_ACT_RX_SG = 32, NETDEV_XDP_ACT_RX_SG = 32,
NETDEV_XDP_ACT_NDO_XMIT_SG = 64, NETDEV_XDP_ACT_NDO_XMIT_SG = 64,
/* private: */
NETDEV_XDP_ACT_MASK = 127, NETDEV_XDP_ACT_MASK = 127,
}; };
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
SUBDIRS = lib generated samples SUBDIRS = lib generated samples
all: $(SUBDIRS) all: $(SUBDIRS)
./ynl-regen.sh -f -p $(PWD)/../../../
$(SUBDIRS): $(SUBDIRS):
@if [ -f "$@/Makefile" ] ; then \ @if [ -f "$@/Makefile" ] ; then \
......
...@@ -50,6 +50,7 @@ struct ynl_policy_attr netdev_dev_policy[NETDEV_A_DEV_MAX + 1] = { ...@@ -50,6 +50,7 @@ struct ynl_policy_attr netdev_dev_policy[NETDEV_A_DEV_MAX + 1] = {
[NETDEV_A_DEV_IFINDEX] = { .name = "ifindex", .type = YNL_PT_U32, }, [NETDEV_A_DEV_IFINDEX] = { .name = "ifindex", .type = YNL_PT_U32, },
[NETDEV_A_DEV_PAD] = { .name = "pad", .type = YNL_PT_IGNORE, }, [NETDEV_A_DEV_PAD] = { .name = "pad", .type = YNL_PT_IGNORE, },
[NETDEV_A_DEV_XDP_FEATURES] = { .name = "xdp-features", .type = YNL_PT_U64, }, [NETDEV_A_DEV_XDP_FEATURES] = { .name = "xdp-features", .type = YNL_PT_U64, },
[NETDEV_A_DEV_XDP_ZC_MAX_SEGS] = { .name = "xdp-zc-max-segs", .type = YNL_PT_U32, },
}; };
struct ynl_policy_nest netdev_dev_nest = { struct ynl_policy_nest netdev_dev_nest = {
...@@ -91,6 +92,11 @@ int netdev_dev_get_rsp_parse(const struct nlmsghdr *nlh, void *data) ...@@ -91,6 +92,11 @@ int netdev_dev_get_rsp_parse(const struct nlmsghdr *nlh, void *data)
return MNL_CB_ERROR; return MNL_CB_ERROR;
dst->_present.xdp_features = 1; dst->_present.xdp_features = 1;
dst->xdp_features = mnl_attr_get_u64(attr); dst->xdp_features = mnl_attr_get_u64(attr);
} else if (type == NETDEV_A_DEV_XDP_ZC_MAX_SEGS) {
if (ynl_attr_validate(yarg, attr))
return MNL_CB_ERROR;
dst->_present.xdp_zc_max_segs = 1;
dst->xdp_zc_max_segs = mnl_attr_get_u32(attr);
} }
} }
......
...@@ -47,10 +47,12 @@ struct netdev_dev_get_rsp { ...@@ -47,10 +47,12 @@ struct netdev_dev_get_rsp {
struct { struct {
__u32 ifindex:1; __u32 ifindex:1;
__u32 xdp_features:1; __u32 xdp_features:1;
__u32 xdp_zc_max_segs:1;
} _present; } _present;
__u32 ifindex; __u32 ifindex;
__u64 xdp_features; __u64 xdp_features;
__u32 xdp_zc_max_segs;
}; };
void netdev_dev_get_rsp_free(struct netdev_dev_get_rsp *rsp); void netdev_dev_get_rsp_free(struct netdev_dev_get_rsp *rsp);
......
...@@ -38,6 +38,8 @@ static void netdev_print_device(struct netdev_dev_get_rsp *d, unsigned int op) ...@@ -38,6 +38,8 @@ static void netdev_print_device(struct netdev_dev_get_rsp *d, unsigned int op)
printf(" %s", netdev_xdp_act_str(1 << i)); printf(" %s", netdev_xdp_act_str(1 << i));
} }
printf(" xdp-zc-max-segs=%u", d->xdp_zc_max_segs);
name = netdev_op_str(op); name = netdev_op_str(op);
if (name) if (name)
printf(" (ntf: %s)", name); printf(" (ntf: %s)", name);
......
...@@ -2125,6 +2125,7 @@ def render_uapi(family, cw): ...@@ -2125,6 +2125,7 @@ def render_uapi(family, cw):
if const.get('render-max', False): if const.get('render-max', False):
cw.nl() cw.nl()
cw.p('/* private: */')
if const['type'] == 'flags': if const['type'] == 'flags':
max_name = c_upper(name_pfx + 'mask') max_name = c_upper(name_pfx + 'mask')
max_val = f' = {enum.get_mask()},' max_val = f' = {enum.get_mask()},'
......
...@@ -4,15 +4,18 @@ ...@@ -4,15 +4,18 @@
TOOL=$(dirname $(realpath $0))/ynl-gen-c.py TOOL=$(dirname $(realpath $0))/ynl-gen-c.py
force= force=
search=
while [ ! -z "$1" ]; do while [ ! -z "$1" ]; do
case "$1" in case "$1" in
-f ) force=yes; shift ;; -f ) force=yes; shift ;;
-p ) search=$2; shift 2 ;;
* ) echo "Unrecognized option '$1'"; exit 1 ;; * ) echo "Unrecognized option '$1'"; exit 1 ;;
esac esac
done done
KDIR=$(dirname $(dirname $(dirname $(dirname $(realpath $0))))) KDIR=$(dirname $(dirname $(dirname $(dirname $(realpath $0)))))
pushd ${search:-$KDIR} >>/dev/null
files=$(git grep --files-with-matches '^/\* YNL-GEN \(kernel\|uapi\|user\)') files=$(git grep --files-with-matches '^/\* YNL-GEN \(kernel\|uapi\|user\)')
for f in $files; do for f in $files; do
...@@ -30,3 +33,5 @@ for f in $files; do ...@@ -30,3 +33,5 @@ for f in $files; do
$TOOL --mode ${params[2]} --${params[3]} --spec $KDIR/${params[0]} \ $TOOL --mode ${params[2]} --${params[3]} --spec $KDIR/${params[0]} \
$args -o $f $args -o $f
done done
popd >>/dev/null
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment