From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>, netdev@vger.kernel.org
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Wen Gu <guwen@linux.alibaba.com>,
Philo Lu <lulie@linux.alibaba.com>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Lukas Bulwahn <lukas.bulwahn@redhat.com>,
Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Alexander Duyck <alexanderduyck@fb.com>,
Dust Li <dust.li@linux.alibaba.com>
Subject: Re: [PATCH net-next] eea: Add basic driver framework for Alibaba Elastic Ethernet Adaptor
Date: Fri, 11 Jul 2025 12:45:41 +0100 [thread overview]
Message-ID: <dc023486-5491-4795-8b07-4808e44c8ebb@linux.dev> (raw)
In-Reply-To: <20250710112817.85741-1-xuanzhuo@linux.alibaba.com>
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.
prev parent reply other threads:[~2025-07-11 11:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 11:28 [PATCH net-next] eea: Add basic driver framework for Alibaba Elastic Ethernet Adaptor Xuan Zhuo
2025-07-10 13:45 ` Andrew Lunn
2025-07-16 5:47 ` Xuan Zhuo
2025-07-16 16:25 ` Andrew Lunn
2025-07-17 6:17 ` Xuan Zhuo
2025-07-17 17:27 ` Andrew Lunn
2025-07-18 1:54 ` Xuan Zhuo
2025-07-18 16:59 ` Andrew Lunn
2025-07-22 10:53 ` Xuan Zhuo
2025-07-11 10:55 ` Simon Horman
2025-07-16 6:02 ` Xuan Zhuo
2025-07-16 16:32 ` Andrew Lunn
2025-07-17 6:55 ` Xuan Zhuo
2025-07-11 11:45 ` Vadim Fedorenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dc023486-5491-4795-8b07-4808e44c8ebb@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=Parthiban.Veerasooran@microchip.com \
--cc=alexanderduyck@fb.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dust.li@linux.alibaba.com \
--cc=edumazet@google.com \
--cc=geert+renesas@glider.be \
--cc=guwen@linux.alibaba.com \
--cc=kuba@kernel.org \
--cc=lorenzo@kernel.org \
--cc=lukas.bulwahn@redhat.com \
--cc=lulie@linux.alibaba.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.