[PATCH net-next v2 00/14] nexthop: Resilient next-hop groups

2021-03-11 Thread Petr Machata
for resilient NH groups nexthop: Add data structures for resilient group notifications nexthop: Allow setting "offload" and "trap" indication of nexthop buckets nexthop: Allow reporting activity of nexthop buckets Petr Machata (10): nexthop: Pass nh_config to replace_n

Re: [PATCH net-next 00/14] nexthop: Resilient next-hop groups

2021-03-11 Thread Petr Machata
David Ahern writes: > When you get to the end of the sets, it would be good to submit > documentation for resilient multipath under Documentation/networking All right.

Re: [PATCH net-next 03/14] nexthop: Add a dedicated flag for multipath next-hop groups

2021-03-11 Thread Petr Machata
David Ahern writes: > On 3/11/21 8:39 AM, Petr Machata wrote: >> >> David Ahern writes: >> >>>> diff --git a/include/net/nexthop.h b/include/net/nexthop.h >>>> index 7bc057aee40b..5062c2c08e2b 100644 >>>> --- a/include/net/nexth

Re: [PATCH net-next 04/14] nexthop: Add netlink defines and enumerators for resilient NH groups

2021-03-11 Thread Petr Machata
David Ahern writes: > On 3/11/21 8:45 AM, Petr Machata wrote: >> >> David Ahern writes: >> >>> On 3/10/21 8:02 AM, Petr Machata wrote: >>>> diff --git a/include/uapi/linux/nexthop.h b/include/uapi/linux/nexthop.h >>>> index 2d4a1e784

Re: [PATCH net-next 04/14] nexthop: Add netlink defines and enumerators for resilient NH groups

2021-03-11 Thread Petr Machata
David Ahern writes: > On 3/10/21 8:02 AM, Petr Machata wrote: >> diff --git a/include/uapi/linux/nexthop.h b/include/uapi/linux/nexthop.h >> index 2d4a1e784cf0..8efebf3cb9c7 100644 >> --- a/include/uapi/linux/nexthop.h >> +++ b/include/uapi/linux/nexthop.h

Re: [PATCH net-next 03/14] nexthop: Add a dedicated flag for multipath next-hop groups

2021-03-11 Thread Petr Machata
David Ahern writes: >> diff --git a/include/net/nexthop.h b/include/net/nexthop.h >> index 7bc057aee40b..5062c2c08e2b 100644 >> --- a/include/net/nexthop.h >> +++ b/include/net/nexthop.h >> @@ -80,6 +80,7 @@ struct nh_grp_entry { >> struct nh_group { >> struct nh_group *spare; /*

[PATCH net-next 14/14] nexthop: Enable resilient next-hop groups

2021-03-10 Thread Petr Machata
Now that all the code is in place, stop rejecting requests to create resilient next-hop groups. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 4 1 file changed, 4 deletions(-) diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index 015a47e8163a

[PATCH net-next 10/14] nexthop: Add netlink handlers for resilient nexthop groups

2021-03-10 Thread Petr Machata
Implement the netlink messages that allow creation and dumping of resilient nexthop groups. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- Notes: v1 (changes since RFC): - u32 -> u16 for bucket counts / indices net/ipv4/nexthop.c |

[PATCH net-next 11/14] nexthop: Add netlink handlers for bucket dump

2021-03-10 Thread Petr Machata
Add a dump handler for resilient next hop buckets. When next-hop group ID is given, it walks buckets of that group, otherwise it walks buckets of all groups. It then dumps the buckets whose next hops match the given filtering criteria. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel

[PATCH net-next 07/14] nexthop: Implement notifiers for resilient nexthop groups

2021-03-10 Thread Petr Machata
the transaction back. This notification allows the driver to take a look and veto the new proposed group up front, before anything is committed. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- Notes: v1 (changes since RFC): - u32 -> u16 for bucket counts / indices

[PATCH net-next 13/14] nexthop: Notify userspace about bucket migrations

2021-03-10 Thread Petr Machata
Nexthop replacements et.al. are notified through netlink, but if a delayed work migrates buckets on the background, userspace will stay oblivious. Notify these as RTM_NEWNEXTHOPBUCKET events. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- Notes: v1 (changes since RFC): - u32

[PATCH net-next 12/14] nexthop: Add netlink handlers for bucket get

2021-03-10 Thread Petr Machata
Allow getting (but not setting) individual buckets to inspect the next hop mapped therein, idle time, and flags. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- Notes: v1 (changes since RFC): - u32 -> u16 for bucket counts / indices net/ipv4/nexthop.c |

[PATCH net-next 09/14] nexthop: Allow reporting activity of nexthop buckets

2021-03-10 Thread Petr Machata
hardware. Add a function that can be periodically called by device drivers to report activity on nexthop buckets after querying it from the underlying device. Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata Signed-off-by: Petr Machata --- Notes: v1 (changes since RFC): - u32

[PATCH net-next 08/14] nexthop: Allow setting "offload" and "trap" indication of nexthop buckets

2021-03-10 Thread Petr Machata
From: Ido Schimmel Add a function that can be called by device drivers to set "offload" or "trap" indication on nexthop buckets following nexthop notifications and other changes such as a neighbour becoming invalid. Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata

[PATCH net-next 05/14] nexthop: Add implementation of resilient next-hop groups

2021-03-10 Thread Petr Machata
es not handle notifications towards drivers, which are kept as if the group were an mpath one. It does not handle netlink either. The only bit currently exposed to user space is the new next-hop group type, and that is currently bounced. There is therefore no way to actually access this code. Sign

[PATCH net-next 03/14] nexthop: Add a dedicated flag for multipath next-hop groups

2021-03-10 Thread Petr Machata
Therefore, introduce a new flag, that should be set for next-hop groups that have more than one nexthop, and should be considered multipath. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- Notes: v1 (changes since RFC): - This patch is new include/net/nexthop.h | 7 ---

[PATCH net-next 04/14] nexthop: Add netlink defines and enumerators for resilient NH groups

2021-03-10 Thread Petr Machata
type for now. Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata Signed-off-by: Petr Machata --- Notes: v1 (changes since RFC): - u32 -> u16 for bucket counts / indices include/uapi/linux/nexthop.h | 43 ++ include/uapi/linux/rtnetlink.h |

[PATCH net-next 06/14] nexthop: Add data structures for resilient group notifications

2021-03-10 Thread Petr Machata
From: Ido Schimmel Add data structures that will be used for in-kernel notifications about addition / deletion of a resilient nexthop group and about changes to a hash bucket within a resilient group. Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata Signed-off-by: Petr Machata

[PATCH net-next 00/14] nexthop: Resilient next-hop groups

2021-03-10 Thread Petr Machata
ow setting "offload" and "trap" indication of nexthop buckets nexthop: Allow reporting activity of nexthop buckets Petr Machata (10): nexthop: Pass nh_config to replace_nexthop() nexthop: __nh_notifier_single_info_init(): Make nh_info an argument nexthop: Add a dedi

[PATCH net-next 01/14] nexthop: Pass nh_config to replace_nexthop()

2021-03-10 Thread Petr Machata
replacement, propagate `cfg' to replace_nexthop() and further to replace_nexthop_grp(). Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c

[PATCH net-next 02/14] nexthop: __nh_notifier_single_info_init(): Make nh_info an argument

2021-03-10 Thread Petr Machata
function to its callers to make it possible to use a different synchronization guarantee. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index

Re: [PATCH iproute2-next v2] dcb: Fix compilation warning about reallocarray

2021-02-22 Thread Petr Machata
eeds to fit into one attribute, which limits the size to some 64K, so from UAPI direction this will never overflow. From the command-line direction, size of 'struct app' is 4 bytes, so to overflow you'd need to stuff in 1G APP entries. I think we don't need to worry about that. So this looks good. Reviewed-by: Petr Machata

Re: [RFC PATCH 04/13] nexthop: Add implementation of resilient next-hop groups

2021-02-15 Thread Petr Machata
David Ahern writes: > On 2/8/21 1:42 PM, Petr Machata wrote: >> @@ -212,7 +254,7 @@ static inline bool nexthop_is_multipath(const struct >> nexthop *nh) >> struct nh_group *nh_grp; >> >> nh_grp = rcu_dereference_rtnl(nh->nh

Re: [RFC PATCH 03/13] nexthop: Add netlink defines and enumerators for resilient NH groups

2021-02-15 Thread Petr Machata
Ido Schimmel writes: > On Sat, Feb 13, 2021 at 12:16:45PM -0700, David Ahern wrote: >> On 2/8/21 1:42 PM, Petr Machata wrote: >> > @@ -52,8 +53,50 @@ enum { >> >NHA_FDB,/* flag; nexthop belongs to a bridge fdb */ >> >/* if NHA_FDB is added,

[PATCH net-next] Revert "net-loopback: set lo dev initial state to UP"

2021-02-09 Thread Petr Machata
a duplicate address. The described change of behavior therefore constitutes a breakage. Revert it. Fixes: c9dca822c729 ("net-loopback: set lo dev initial state to UP") Signed-off-by: Petr Machata --- drivers/net/loopback.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/net/

Re: [PATCH net-next v3] net-loopback: set lo dev initial state to UP

2021-02-09 Thread Petr Machata
Jakub Kicinski writes: > Thanks for the report, could you send a revert with this explanation? Sure.

Re: [PATCH net-next v3] net-loopback: set lo dev initial state to UP

2021-02-09 Thread Petr Machata
Jian Yang writes: > From: Jian Yang > > Traditionally loopback devices come up with initial state as DOWN for > any new network-namespace. This would mean that anyone needing this > device would have to bring this UP by issuing something like 'ip link > set lo up'. This can be avoided if the i

[RFC PATCH 11/13] nexthop: Add netlink handlers for bucket get

2021-02-08 Thread Petr Machata
Allow getting (but not setting) individual buckets to inspect the next hop mapped therein, idle time, and flags. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 110 - 1 file changed, 109 insertions(+), 1 deletion

[RFC PATCH 10/13] nexthop: Add netlink handlers for bucket dump

2021-02-08 Thread Petr Machata
Add a dump handler for resilient next hop buckets. When next-hop group ID is given, it walks buckets of that group, otherwise it walks buckets of all groups. It then dumps the buckets whose next hops match the given filtering criteria. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel

[RFC PATCH 09/13] nexthop: Add netlink handlers for resilient nexthop groups

2021-02-08 Thread Petr Machata
Implement the netlink messages that allow creation and dumping of resilient nexthop groups. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 150 +++-- 1 file changed, 145 insertions(+), 5 deletions(-) diff --git a/net/ipv4

[RFC PATCH 12/13] nexthop: Notify userspace about bucket migrations

2021-02-08 Thread Petr Machata
Nexthop replacements et.al. are notified through netlink, but if a delayed work migrates buckets on the background, userspace will stay oblivious. Notify these as RTM_NEWNEXTHOPBUCKET events. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 45

[RFC PATCH 13/13] nexthop: Enable resilient next-hop groups

2021-02-08 Thread Petr Machata
Now that all the code is in place, stop rejecting requests to create resilient next-hop groups. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 4 1 file changed, 4 deletions(-) diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index 4d89522fed4b

[RFC PATCH 08/13] nexthop: Allow reporting activity of nexthop buckets

2021-02-08 Thread Petr Machata
hardware. Add a function that can be periodically called by device drivers to report activity on nexthop buckets after querying it from the underlying device. Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata Signed-off-by: Petr Machata --- include/net/nexthop.h | 2 ++ net/ipv4/nexthop.c

[RFC PATCH 06/13] nexthop: Implement notifiers for resilient nexthop groups

2021-02-08 Thread Petr Machata
the transaction back. This notification allows the driver to take a look and veto the new proposed group up front, before anything is committed. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 320 +++-- 1 file changed

[RFC PATCH 05/13] nexthop: Add data structures for resilient group notifications

2021-02-08 Thread Petr Machata
From: Ido Schimmel Add data structures that will be used for in-kernel notifications about addition / deletion of a resilient nexthop group and about changes to a hash bucket within a resilient group. Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata Signed-off-by: Petr Machata

[RFC PATCH 07/13] nexthop: Allow setting "offload" and "trap" indication of nexthop buckets

2021-02-08 Thread Petr Machata
From: Ido Schimmel Add a function that can be called by device drivers to set "offload" or "trap" indication on nexthop buckets following nexthop notifications and other changes such as a neighbour becoming invalid. Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata

[RFC PATCH 03/13] nexthop: Add netlink defines and enumerators for resilient NH groups

2021-02-08 Thread Petr Machata
type for now. Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata Signed-off-by: Petr Machata --- include/uapi/linux/nexthop.h | 43 ++ include/uapi/linux/rtnetlink.h | 7 ++ net/ipv4/nexthop.c | 2 ++ security/selinux/nlmsgtab.c| 5

[RFC PATCH 04/13] nexthop: Add implementation of resilient next-hop groups

2021-02-08 Thread Petr Machata
es not handle notifications towards drivers, which are kept as if the group were an mpath one. It does not handle netlink either. The only bit currently exposed to user space is the new next-hop group type, and that is currently bounced. There is therefore no way to actually access this code. Sign

[RFC PATCH 02/13] nexthop: __nh_notifier_single_info_init(): Make nh_info an argument

2021-02-08 Thread Petr Machata
function to its callers to make it possible to use a different synchronization guarantee. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index

[RFC PATCH 00/13] nexthop: Resilient next-hop groups

2021-02-08 Thread Petr Machata
for resilient group notifications nexthop: Allow setting "offload" and "trap" indication of nexthop buckets nexthop: Allow reporting activity of nexthop buckets Petr Machata (9): nexthop: Pass nh_config to replace_nexthop() nexthop: __nh_notifier_single_info_init(

[RFC PATCH 01/13] nexthop: Pass nh_config to replace_nexthop()

2021-02-08 Thread Petr Machata
replacement, propagate `cfg' to replace_nexthop() and further to replace_nexthop_grp(). Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c

[PATCH net-next 12/12] nexthop: Extract a helper for validation of get/del RTNL requests

2021-01-28 Thread Petr Machata
. Propagate the constness to nh_valid_get_del_req(). Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 43 +-- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index

[PATCH net-next 11/12] nexthop: Add a callback parameter to rtm_dump_walk_nexthops()

2021-01-28 Thread Petr Machata
In order to allow different handling for next-hop tree dumper and for bucket dumper, parameterize the next-hop tree walker with a callback. Add rtm_dump_nexthop_cb() with just the bits relevant for next-hop tree dumping. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4

[PATCH net-next 09/12] nexthop: Strongly-type context of rtm_dump_nexthop()

2021-01-28 Thread Petr Machata
helper struct with a NH index, and instead of using the .args array directly, use it through this structure. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/net/ipv4/nexthop.c b/net

[PATCH net-next 07/12] nexthop: Extract dump filtering parameters into a single structure

2021-01-28 Thread Petr Machata
one. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 44 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index 7149b12c4703..ad48e5d71bf9 100644 --- a/net/ipv4

[PATCH net-next 10/12] nexthop: Extract a helper for walking the next-hop tree

2021-01-28 Thread Petr Machata
Extract from rtm_dump_nexthop() a helper to walk the next hop tree. A separate function for this will be reusable from the bucket dumper. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 52 +- 1 file changed, 33

[PATCH net-next 08/12] nexthop: Extract a common helper for parsing dump attributes

2021-01-28 Thread Petr Machata
thin wrapper around it. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 31 +++ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c index ad48e5d71bf9..1c4f10fe3b4e 100644 --- a/net/ipv4

[PATCH net-next 03/12] nexthop: Introduce to struct nh_grp_entry a per-type union

2021-01-28 Thread Petr Machata
The values that a next-hop group needs to keep track of depend on the group type. Introduce a union to separate fields specific to the mpath groups from fields specific to other group types. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- include/net/nexthop.h | 7 ++- net/ipv4

[PATCH net-next 01/12] nexthop: Rename nexthop_free_mpath

2021-01-28 Thread Petr Machata
From: David Ahern nexthop_free_mpath really should be nexthop_free_group. Rename it. Signed-off-by: David Ahern Reviewed-by: Ido Schimmel Signed-off-by: Petr Machata --- net/ipv4/nexthop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/nexthop.c b/net/ipv4

[PATCH net-next 00/12] nexthop: Preparations for resilient next-hop groups

2021-01-28 Thread Petr Machata
chimmel (1): nexthop: Use enum to encode notification type Petr Machata (10): nexthop: Dispatch nexthop_select_path() by group type nexthop: Introduce to struct nh_grp_entry a per-type union nexthop: Assert the invariant that a NH group is of only one type nexthop: Dispatch notifier init()/fini(

[PATCH net-next 06/12] nexthop: Dispatch notifier init()/fini() by group type

2021-01-28 Thread Petr Machata
After there are several next-hop group types, initialization and finalization of notifier type needs to reflect the actual type. Transform nh_notifier_grp_info_init() and _fini() to make extending them easier. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 25

[PATCH net-next 05/12] nexthop: Use enum to encode notification type

2021-01-28 Thread Petr Machata
extensible interface. Instead, convert it to an enum. Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata Signed-off-by: Petr Machata --- .../ethernet/mellanox/mlxsw/spectrum_router.c | 54 ++- drivers/net/netdevsim/fib.c | 23 i

[PATCH net-next 02/12] nexthop: Dispatch nexthop_select_path() by group type

2021-01-28 Thread Petr Machata
The logic for selecting path depends on the next-hop group type. Adapt the nexthop_select_path() to dispatch according to the group type. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 22 -- 1 file changed, 16 insertions(+), 6 deletions

[PATCH net-next 04/12] nexthop: Assert the invariant that a NH group is of only one type

2021-01-28 Thread Petr Machata
such place into nexthop_create_group(), such that the check is done before the code that relies on that invariant is invoked. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/ipv4/nexthop.c

Re: [PATCH resend net] net: switchdev: don't set port_obj_info->handled true when -EOPNOTSUPP

2021-01-22 Thread Petr Machata
or > any error distinct from -EOPNOTSUPP. But if all the callbacks return > -EOPNOTSUPP, make sure that ->handled stays false, so the logic in > switchdev_port_obj_notify() can propagate that information. > > Fixes: f30f0601eb93 ("switchdev: Add helpers to aid traversal through lower > devices") > Signed-off-by: Rasmus Villemoes Looks good. Reviewed-by: Petr Machata Thanks!

[PATCH net-next v2 3/3] nexthop: Specialize rtm_nh_policy

2021-01-20 Thread Petr Machata
replace NHA_MAX for ARRAY_SIZE as appropriate. Note that with this commit, NHA_MAX and __NHA_MAX are not used anymore. Leave them in purely as a user API. Signed-off-by: Petr Machata --- Notes: v2: - Do not specify size of the policy array. Use ARRAY_SIZE instead of NHA_MAX net

[PATCH net-next v2 1/3] nexthop: Use a dedicated policy for nh_valid_get_del_req()

2021-01-20 Thread Petr Machata
This function uses the global nexthop policy only to then bounce all arguments except for NHA_ID. Instead, just create a new policy that only includes the one allowed attribute. Signed-off-by: Petr Machata --- Notes: v2: - Do not specify size of the policy array. Use ARRAY_SIZE instead

[PATCH net-next v2 2/3] nexthop: Use a dedicated policy for nh_valid_dump_req()

2021-01-20 Thread Petr Machata
This function uses the global nexthop policy, but only accepts four particular attributes. Create a new policy that only includes the four supported attributes, and use it. Convert the loop to a series of ifs. Signed-off-by: Petr Machata --- Notes: v2: - Do not specify size of the

[PATCH net-next v2 0/3] nexthop: More fine-grained policies for netlink message validation

2021-01-20 Thread Petr Machata
ZE instead of NHA_MAX - Patch #2: - Convert manual setting of true to nla_get_flag(). Petr Machata (3): nexthop: Use a dedicated policy for nh_valid_get_del_req() nexthop: Use a dedicated policy for nh_valid_dump_req() nexthop: Specialize rtm_nh_policy net/ipv4/nexth

Re: [PATCH net-next 2/3] nexthop: Use a dedicated policy for nh_valid_dump_req()

2021-01-20 Thread Petr Machata
Jakub Kicinski writes: > On Mon, 18 Jan 2021 15:05:24 +0100 Petr Machata wrote: >> +if (tb[NHA_GROUPS]) >> +*group_filter = true; >> +if (tb[NHA_FDB]) >> +*fdb_filter = true; > > nla_get_flag() OK.

Re: [PATCH net-next 1/3] nexthop: Use a dedicated policy for nh_valid_get_del_req()

2021-01-20 Thread Petr Machata
David Ahern writes: > On 1/19/21 1:55 PM, Jakub Kicinski wrote: >>> diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c >>> index e53e43aef785..d5d88f7c5c11 100644 >>> --- a/net/ipv4/nexthop.c >>> +++ b/net/ipv4/nexthop.c >>> @@ -36,6 +36,10 @@ static const struct nla_policy rtm_nh_policy[NHA_

[PATCH net-next 3/3] nexthop: Specialize rtm_nh_policy

2021-01-18 Thread Petr Machata
This policy is currently only used for creation of new next hops and new next hop groups. Rename it accordingly and remove the two attributes that are not valid in that context: NHA_GROUPS and NHA_MASTER. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 11

[PATCH net-next 1/3] nexthop: Use a dedicated policy for nh_valid_get_del_req()

2021-01-18 Thread Petr Machata
This function uses the global nexthop policy only to then bounce all arguments except for NHA_ID. Instead, just create a new policy that only includes the one allowed attribute. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 21 ++--- 1 file

[PATCH net-next 2/3] nexthop: Use a dedicated policy for nh_valid_dump_req()

2021-01-18 Thread Petr Machata
This function uses the global nexthop policy, but only accepts four particular attributes. Create a new policy that only includes the four supported attributes, and use it. Convert the loop to a series of ifs. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel --- net/ipv4/nexthop.c | 57

[PATCH net-next 0/3] nexthop: More fine-grained policies for netlink message validation

2021-01-18 Thread Petr Machata
From: Petr Machata There is currently one policy that covers all attributes for next hop object management. Actual validation is then done in code, which makes it unobvious which attributes are acceptable when, and indeed that everything is rejected as necessary. In this series, split

Re: [PATCH iproute2 v4 1/1] build: Fix link errors on some systems

2021-01-12 Thread Petr Machata
) > Fixes: 44396bdfcc0a ("lib: Move get_size() from tc here") > Fixes: adbe5de96662 ("lib: Move sprint_size() from tc here, add print_size()") > > Signed-off-by: Roi Dayan Looking good: $ ldd ip/ip | grep libm.so $ ldd dcb/dcb | grep libm.so libm.so.6 => /lib64/libm.so.6 (0x7f204d0c2000) Reviewed-by: Petr Machata Tested-by: Petr Machata

[PATCH iproute2] include: uapi: Carry dcbnl.h

2021-01-12 Thread Petr Machata
To allow building a new suite of DCB tools on an older kernel, carry a copy of dcbnl.h. Signed-off-by: Petr Machata --- include/uapi/linux/dcbnl.h | 769 + 1 file changed, 769 insertions(+) create mode 100644 include/uapi/linux/dcbnl.h diff --git a/include

[PATCH net] net: dcb: Accept RTM_GETDCB messages carrying set-like DCB commands

2021-01-11 Thread Petr Machata
g backward compatibility. Fixes: 2f90b8657ec9 ("ixgbe: this patch adds support for DCB to the kernel and ixgbe driver") Fixes: 826f328e2b7e ("net: dcb: Validate netlink message in DCB handler") Signed-off-by: Petr Machata --- net/dcb/dcbnl.c | 2 +- 1 file changed, 1 insertion

Re: [PATCH iproute2 v3 1/1] build: Fix link errors on some systems

2021-01-11 Thread Petr Machata
Roi Dayan writes: > diff --git a/lib/json_print_math.c b/lib/json_print_math.c > new file mode 100644 > index ..3d560defcd3e > --- /dev/null > +++ b/lib/json_print_math.c > @@ -0,0 +1,46 @@ > +/* > + * json_print_math.c "print regular or json output, based on > json_writer"

Re: [PATCH iproute2 v2 1/1] build: Fix link errors on some systems

2021-01-08 Thread Petr Machata
Stephen Hemminger writes: > On Thu, 7 Jan 2021 09:13:34 +0200 > Roi Dayan wrote: > >> +#define _IS_JSON_CONTEXT(type) ((type & PRINT_JSON || type & PRINT_ANY) && >> is_json_context()) >> +#define _IS_FP_CONTEXT(type) (!is_json_context() && (type & PRINT_FP || >> type & PRINT_ANY)) > > You c

Re: [PATCH v3 net-next 03/11] net: switchdev: remove the transaction structure from port object notifiers

2021-01-07 Thread Petr Machata
Ido Schimmel writes: > +Petr > > On Thu, Jan 07, 2021 at 01:17:20AM +0200, Vladimir Oltean wrote: >> static int mlxsw_sp_port_obj_add(struct net_device *dev, >> const struct switchdev_obj *obj, >> - struct switchdev_trans *trans, >>

Re: [PATCH iproute2] build: Fix link errors on some systems

2021-01-06 Thread Petr Machata
Stephen Hemminger writes: > On Wed, 6 Jan 2021 10:42:35 +0200 > Roi Dayan wrote: > >> > >> > I think that just adding an unnecessary -lm is more of a tidiness issue >> > than anything else. One way to avoid it is to split the -lm deps out >> > from util.c / json_print.c to like util_math.c /

Re: [PATCH iproute2] build: Fix link errors on some systems

2021-01-06 Thread Petr Machata
Roi Dayan writes: > On 2021-01-06 3:16 PM, Petr Machata wrote: >> Regarding the publishing, the _jw reference can be changed to a call to >> is_json_context(), which does the same thing. Then _jw can stay private >> in json_print.c. >> Exposing an _IS_JSON_CONTEXT /

Re: [PATCH iproute2] build: Fix link errors on some systems

2021-01-06 Thread Petr Machata
Roi Dayan writes: > On 2021-01-06 10:42 AM, Roi Dayan wrote: >> >> On 2021-01-04 6:07 PM, Petr Machata wrote: >>> >>> I think that just adding an unnecessary -lm is more of a tidiness issue >>> than anything else. One way to avoid it is to split the -

Re: [PATCH iproute2] build: Fix link errors on some systems

2021-01-04 Thread Petr Machata
Roi Dayan writes: > Since moving get_rate() and get_size() from tc to lib, on some > systems we fail to link because of missing the math lib. > Move the link flag from tc makefile to the main makefile. Hmm, yeah, it gets optimized out on x86-64. The issue is reproducible on any platform with -

[PATCH iproute2 v2 3/3] dcb: Change --Netns/-N to --netns/-n

2021-01-03 Thread Petr Machata
This to keep compatible with the major tools, ip and tc. Also document the option in the man page, which was neglected. Fixes: 67033d1c1c8a ("Add skeleton of a new tool, dcb") Signed-off-by: Petr Machata --- Notes: v2: - Add Fixes: tag. dcb/dcb.c | 8 man/man8

[PATCH iproute2 v2 2/3] dcb: Plug a leaking DCB socket buffer

2021-01-03 Thread Petr Machata
DCB socket buffer is allocated in dcb_init(), but never freed(). Free it in dcb_fini(). Fixes: 67033d1c1c8a ("Add skeleton of a new tool, dcb") Signed-off-by: Petr Machata --- Notes: v2: - Add Fixes: tag. dcb/dcb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dcb/d

[PATCH iproute2 v2 1/3] dcb: Set values with RTM_SETDCB type

2021-01-03 Thread Petr Machata
dcb currently sends all netlink messages with a type RTM_GETDCB, even the set ones. Change to the appropriate type. Fixes: 67033d1c1c8a ("Add skeleton of a new tool, dcb") Signed-off-by: Petr Machata --- Notes: v2: - Add Fixes: tag. dcb/dcb.c | 2 +- 1 file changed, 1 inser

[PATCH iproute2 v2 0/3] dcb: Fixes

2021-01-03 Thread Petr Machata
: - Add Fixes: tag. Petr Machata (3): dcb: Set values with RTM_SETDCB type dcb: Plug a leaking DCB socket buffer dcb: Change --Netns/-N to --netns/-n dcb/dcb.c | 11 ++- man/man8/dcb.8 | 7 +++ 2 files changed, 13 insertions(+), 5 deletions(-) -- 2.26.2

Re: [PATCH iproute2 1/3] dcb: Set values with RTM_SETDCB type

2021-01-03 Thread Petr Machata
Stephen Hemminger writes: > On Sat, 2 Jan 2021 00:25:50 +0100 > Petr Machata wrote: > >> dcb currently sends all netlink messages with a type RTM_GETDCB, even the >> set ones. Change to the appropriate type. >> >> Signed-off-by: Petr Machata >> ---

[PATCH iproute2-next v2 3/7] dcb: Generalize dcb_set_attribute()

2021-01-01 Thread Petr Machata
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 --- dcb/dcb.c | 99 ++- dcb/dcb.h | 7 2 files

[PATCH iproute2-next v2 6/7] dcb: Add a subtool for the DCB APP object

2021-01-01 Thread Petr Machata
dev eni1np1 dscp-prio 0:0 CS3:3 CS6:6 # dcb app add dev eni1np1 dscp-prio CS3:4 # dcb app show dev eni1np1 dscp-prio 0:0 CS3:3 CS3:4 CS6:6 # dcb app replace dev eni1np1 dscp-prio CS3:5 # dcb app show dev eni1np1 dscp-prio 0:0 CS3:5 CS6:6 Signed-off-by: Petr Machata

[PATCH iproute2-next v2 5/7] dcb: Support -N to suppress translation to human-readable names

2021-01-01 Thread Petr Machata
Some DSCP values can be translated to symbolic names. That may not be always desirable. Introduce a command-line option similar to other tools, -N or --Numeric, to suppress this translation. Signed-off-by: Petr Machata --- Notes: v2: - Make it -N / --Numeric instead of -n / --no-nice

[PATCH iproute2-next v2 1/7] lib: rt_names: Add rtnl_dsfield_get_name()

2021-01-01 Thread Petr Machata
For formatting DSCP (not full dsfield), it would be handy to be able to just get the name from the name table, and not get any of the remaining cruft related to formatting. Add a new entry point to just fetch the name table string uninterpreted. Use it from rtnl_dsfield_n2a(). Signed-off-by: Petr

[PATCH iproute2-next v2 2/7] lib: Generalize parse_mapping()

2021-01-01 Thread Petr Machata
l". Publish the latter as well. Signed-off-by: Petr Machata --- include/utils.h | 5 + lib/utils.c | 37 +++-- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/include/utils.h b/include/utils.h index 1704392525a2..f1403f7306a0 100644 --- a

[PATCH iproute2-next v2 7/7] dcb: Add a subtool for the DCBX object

2021-01-01 Thread Petr Machata
ieee # dcb dcbx show dev eni1np1 host ieee Signed-off-by: Petr Machata --- dcb/Makefile| 1 + dcb/dcb.c | 4 +- dcb/dcb.h | 4 + dcb/dcb_dcbx.c | 192 man/man8/dcb-dcbx.8 | 108

[PATCH iproute2-next v2 0/7] dcb: Support APP, DCBX objects

2021-01-01 Thread Petr Machata
- Patch #6: - Adjust to s/no_nice_names/numeric/ from another patch. Petr Machata (7): lib: rt_names: Add rtnl_dsfield_get_name() lib: Generalize parse_mapping() dcb: Generalize dcb_set_attribute() dcb: Generalize dcb_get_attribute() dcb: Support -N to suppress translation to human-readable n

[PATCH iproute2-next v2 4/7] dcb: Generalize dcb_get_attribute()

2021-01-01 Thread Petr Machata
() 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 --- dcb/dcb.c | 79 --- dcb/dcb.h | 4 +++ 2 files changed, 68 insertions(+), 15 deletions(-) diff

[PATCH iproute2 0/3] dcb: Fixes

2021-01-01 Thread Petr Machata
dcb currently sends all netlink messages with a type RTM_GETDCB, even the set ones. In patch #1, send the setters as RTM_SETDCB. In patch #2, plug a leak. In patch #3, change the command line option for namespace change from devlink-like -N / --Netns to ip-like -n / --netns. Petr Machata (3

[PATCH iproute2 3/3] dcb: Change --Netns/-N to --netns/-n

2021-01-01 Thread Petr Machata
This to keep compatible with the major tools, ip and tc. Also document the option in the man page, which was neglected. Signed-off-by: Petr Machata --- dcb/dcb.c | 8 man/man8/dcb.8 | 7 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dcb/dcb.c b/dcb/dcb.c

[PATCH iproute2 2/3] dcb: Plug a leaking DCB socket buffer

2021-01-01 Thread Petr Machata
DCB socket buffer is allocated in dcb_init(), but never freed(). Free it in dcb_fini(). Signed-off-by: Petr Machata --- dcb/dcb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dcb/dcb.c b/dcb/dcb.c index f5c62790e27e..0e3c87484f2a 100644 --- a/dcb/dcb.c +++ b/dcb/dcb.c @@ -38,6 +38,7

[PATCH iproute2 1/3] dcb: Set values with RTM_SETDCB type

2021-01-01 Thread Petr Machata
dcb currently sends all netlink messages with a type RTM_GETDCB, even the set ones. Change to the appropriate type. Signed-off-by: Petr Machata --- dcb/dcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcb/dcb.c b/dcb/dcb.c index adec57476e1d..f5c62790e27e 100644 --- a

Re: [PATCH iproute2-next 7/9] dcb: Support -n to suppress translation to nice names

2021-01-01 Thread Petr Machata
David Ahern writes: > On 12/23/20 11:25 AM, Petr Machata wrote: >> diff --git a/dcb/dcb.c b/dcb/dcb.c >> index a59b63ac9159..e6cda7337924 100644 >> --- a/dcb/dcb.c >> +++ b/dcb/dcb.c >> @@ -467,7 +467,8 @@ static void dcb_help(void) >> &quo

[PATCH iproute2-next 4/9] lib: Generalize parse_mapping()

2020-12-23 Thread Petr Machata
l". Publish the latter as well. Signed-off-by: Petr Machata --- include/utils.h | 5 + lib/utils.c | 37 +++-- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/include/utils.h b/include/utils.h index 1704392525a2..f1403f7306a0 100644 --- a

[PATCH iproute2-next 9/9] dcb: Add a subtool for the DCBX object

2020-12-23 Thread Petr Machata
ieee # dcb dcbx show dev eni1np1 host ieee Signed-off-by: Petr Machata --- dcb/Makefile| 1 + dcb/dcb.c | 4 +- dcb/dcb.h | 4 + dcb/dcb_dcbx.c | 192 man/man8/dcb-dcbx.8 | 108

[PATCH iproute2-next 1/9] dcb: Set values with RTM_SETDCB type

2020-12-23 Thread Petr Machata
dcb currently sends all netlink messages with a type RTM_GETDCB, even the set ones. Change to the appropriate type. Signed-off-by: Petr Machata --- dcb/dcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcb/dcb.c b/dcb/dcb.c index adec57476e1d..f5c62790e27e 100644 --- a

[PATCH iproute2-next 8/9] dcb: Add a subtool for the DCB APP object

2020-12-23 Thread Petr Machata
dev eni1np1 dscp-prio 0:0 CS3:3 CS6:6 # dcb app add dev eni1np1 dscp-prio CS3:4 # dcb app show dev eni1np1 dscp-prio 0:0 CS3:3 CS3:4 CS6:6 # dcb app replace dev eni1np1 dscp-prio CS3:5 # dcb app show dev eni1np1 dscp-prio 0:0 CS3:5 CS6:6 Signed-off-by: Petr Machata

[PATCH iproute2-next 0/9] dcb: Support APP, DCBX objects

2020-12-23 Thread Petr Machata
strings or as plain numbers. Patches #8 and #9 add the subtools themselves and their man pages. Petr Machata (9): dcb: Set values with RTM_SETDCB type dcb: Plug a leaking DCB socket buffer lib: rt_names: Add rtnl_dsfield_get_name() lib: Generalize parse_mapping() dcb: Generalize

[PATCH iproute2-next 3/9] lib: rt_names: Add rtnl_dsfield_get_name()

2020-12-23 Thread Petr Machata
For formatting DSCP (not full dsfield), it would be handy to be able to just get the name from the name table, and not get any of the remaining cruft related to formatting. Add a new entry point to just fetch the name table string uninterpreted. Use it from rtnl_dsfield_n2a(). Signed-off-by: Petr

[PATCH iproute2-next 5/9] dcb: Generalize dcb_set_attribute()

2020-12-23 Thread Petr Machata
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 --- dcb/dcb.c | 99 ++- dcb/dcb.h | 7 2 files

<    1   2   3   4   5   6   7   8   9   10   >