Thread (15 messages) flat view 15 messages, 4 authors, 2021-01-20

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

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-01-20 03:22:22

On Tue, 19 Jan 2021 19:28:40 -0700 David Ahern wrote:
On 1/19/21 1:55 PM, Jakub Kicinski wrote:
quoted
quoted
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_MAX + 1] = {
 	[NHA_FDB]		= { .type = NLA_FLAG },
 };
 
+static const struct nla_policy rtm_nh_policy_get[NHA_MAX + 1] = {  
This is an unnecessary waste of memory if you ask me.

NHA_ID is 1, so we're creating an array of 10 extra NULL elements.

Can you leave the size to the compiler and use ARRAY_SIZE() below?  
interesting suggestion in general for netlink attributes.
According to tags on commit ff419afa4310 ("ethtool: trim policy
tables") the credit goes to Johannes :)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help