在 2024/8/2 10:42, Stephen Hemminger 写道:
On Fri, 2 Aug 2024 10:23:12 +0800
"lihuisong (C)" <lihuis...@huawei.com> wrote:
void
-virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf)
+virtio_update_packet_stats(struct virtnet_stats *const stats,
+ const struct rte_mbuf *const mbuf)
The two const is also for performace? Is there gain?
If you look at resulting code (ie godbolt.org) the resulting code never
changes when const is added. The compiler already
knows what is modified. Const is only a programmer and correctness thing.
I know this. Thanks for your clarifying and recommending the site that
is good to use.😁
This patch is just for optimizing stats counters performance.
And the new added const has nothing to do with this optimization.
But it's ok for me.
.