Hi, Stephen,
Volatile is used here to prevent compiler optimization (deleting the reg
write operation).
By the way, this is an initialization process and does not involve
multi-thread synchronization.
Therefore no need to use the barrier.
在 2021/6/15 10:37, Stephen Hemminger 写道:
On Tue, 15 Jun 2021 09:34:29 +0800
"Min Hu (Connor)" <humi...@huawei.com> wrote:
+void
+hns3_tx_push_init(struct rte_eth_dev *dev)
+{
+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ volatile uint32_t *reg;
+ uint32_t val;
+
+ if (!hns3_dev_tx_push_supported(hw))
+ return;
+
+ reg = (volatile uint32_t *)hns3_tx_push_get_queue_tail_reg(dev, 0);
Better to use proper barrier function than using volatile.
.