[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220822184144.595d4801@kernel.org>
Date: Mon, 22 Aug 2022 18:41:44 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Andrey Zhadchenko <andrey.zhadchenko@...tuozzo.com>
Cc: netdev@...r.kernel.org, dev@...nvswitch.org, pshelar@....org,
davem@...emloft.net, edumazet@...gle.com, pabeni@...hat.com,
ptikhomirov@...tuozzo.com, alexander.mikhalitsyn@...tuozzo.com,
avagin@...gle.com, brauner@...nel.org, mark.d.gray@...hat.com,
i.maximets@....org, aconole@...hat.com
Subject: Re: [PATCH net-next v2 3/3] openvswitch: add
OVS_DP_ATTR_PER_CPU_PIDS to get requests
On Fri, 19 Aug 2022 18:30:44 +0300 Andrey Zhadchenko wrote:
> -static size_t ovs_dp_cmd_msg_size(void)
> +static size_t ovs_dp_cmd_msg_size(struct datapath *dp)
> {
> size_t msgsize = NLMSG_ALIGN(sizeof(struct ovs_header));
> + struct dp_nlsk_pids *pids = ovsl_dereference(dp->upcall_portids);
> +
>
double new line
> msgsize += nla_total_size(IFNAMSIZ);
> msgsize += nla_total_size_64bit(sizeof(struct ovs_dp_stats));
> @@ -1516,6 +1518,9 @@ static size_t ovs_dp_cmd_msg_size(void)
> msgsize += nla_total_size(sizeof(u32)); /* OVS_DP_ATTR_USER_FEATURES */
> msgsize += nla_total_size(sizeof(u32)); /* OVS_DP_ATTR_MASKS_CACHE_SIZE */
>
> + if (dp->user_features & OVS_DP_F_DISPATCH_UPCALL_PER_CPU && pids)
> + msgsize += nla_total_size_64bit(sizeof(u32) * pids->n_pids);
Can we make a safe over estimation here, like nr_cpu_ids maybe?
Would that be too large? It's fairly common to overestimate the
netlink message allocation.
Also why 64bit if the value is in u32 units?
Powered by blists - more mailing lists