[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dc023486-5491-4795-8b07-4808e44c8ebb@linux.dev>
Date: Fri, 11 Jul 2025 12:45:41 +0100
From: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
To: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, netdev@...r.kernel.org
Cc: Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Wen Gu <guwen@...ux.alibaba.com>, Philo Lu <lulie@...ux.alibaba.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Lukas Bulwahn <lukas.bulwahn@...hat.com>,
Parthiban Veerasooran <Parthiban.Veerasooran@...rochip.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Alexander Duyck <alexanderduyck@...com>, Dust Li <dust.li@...ux.alibaba.com>
Subject: Re: [PATCH net-next] eea: Add basic driver framework for Alibaba
Elastic Ethernet Adaptor
On 10/07/2025 12:28, Xuan Zhuo wrote:
> +/* notify */
> +bool ering_kick(struct ering *ering)
> +{
> + union {
> + u64 data;
> + struct db db;
> + } val;
> +
> + val.db.kick_flags = EEA_IDX_PRESENT;
> + val.db.idx = cpu_to_le16(ering->sq.hw_idx);
> +
> + writeq(val.data, (void __iomem *)ering->db);
> +
> + return true;
> +}
> +
[...]
> +static inline bool ering_irq_unactive(struct ering *ering)
> +{
> + union {
> + u64 data;
> + struct db db;
> + } val;
> +
> + if (ering->mask == EEA_IRQ_MASK)
> + return true;
> +
> + ering->mask = EEA_IRQ_MASK;
> +
> + val.db.kick_flags = EEA_IRQ_MASK;
> +
> + writeq(val.data, (void __iomem *)ering->db);
> +
> + return true;
> +}
> +
> +static inline bool ering_irq_active(struct ering *ering, struct ering *tx_ering)
> +{
> + union {
> + u64 data;
> + struct db db;
> + } val;
> +
> + if (ering->mask == EEA_IRQ_UNMASK)
> + return true;
> +
> + ering->mask = EEA_IRQ_UNMASK;
> +
> + val.db.kick_flags = EEA_IRQ_UNMASK;
> +
> + val.db.tx_cq_head = cpu_to_le16(tx_ering->cq.hw_idx);
> + val.db.rx_cq_head = cpu_to_le16(ering->cq.hw_idx);
> +
> + writeq(val.data, (void __iomem *)ering->db);
> +
> + return true;
> +}
in addition to Andrew's comments, these union { ... } val will have
partial garbage values, which will later be directly sent to FW. I
believe it may cause some troubles and it's better to initialize val
before actually use it.
Powered by blists - more mailing lists