[v3,08/11] vdpa/nfp: recover the ring index on new host
Checks
Commit Message
From: Xinying Yu <xinying.yu@corigine.com>
After migrating to new host, the vring information is
recovered by the value in offset 'NFP_NET_CFG_TX_USED_INDEX'
and 'NFP_NET_CFG_RX_USED_INDEX'.
Signed-off-by: Xinying Yu <xinying.yu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/common/nfp/nfp_common_ctrl.h | 7 +++++--
drivers/vdpa/nfp/nfp_vdpa_core.c | 13 +++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)
Comments
On 6/17/24 08:27, Chaoyong He wrote:
> From: Xinying Yu <xinying.yu@corigine.com>
>
> After migrating to new host, the vring information is
> recovered by the value in offset 'NFP_NET_CFG_TX_USED_INDEX'
> and 'NFP_NET_CFG_RX_USED_INDEX'.
>
> Signed-off-by: Xinying Yu <xinying.yu@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> ---
> drivers/common/nfp/nfp_common_ctrl.h | 7 +++++--
> drivers/vdpa/nfp/nfp_vdpa_core.c | 13 +++++++++++++
> 2 files changed, 18 insertions(+), 2 deletions(-)
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
@@ -193,8 +193,11 @@ struct nfp_net_fw_ver {
#define NFP_NET_CFG_CAP_WORD1 0x00a4
-/* 16B reserved for future use (0x00b0 - 0x00c0). */
-#define NFP_NET_CFG_RESERVED 0x00b0
+#define NFP_NET_CFG_TX_USED_INDEX 0x00b0
+#define NFP_NET_CFG_RX_USED_INDEX 0x00b4
+
+/* 16B reserved for future use (0x00b8 - 0x0010). */
+#define NFP_NET_CFG_RESERVED 0x00b8
#define NFP_NET_CFG_RESERVED_SZ 0x0010
/*
@@ -100,6 +100,16 @@ nfp_vdpa_hw_init(struct nfp_vdpa_hw *vdpa_hw,
return 0;
}
+static void
+nfp_vdpa_hw_queue_init(struct nfp_vdpa_hw *vdpa_hw)
+{
+ /* Distribute ring information to firmware */
+ nn_cfg_writel(&vdpa_hw->super, NFP_NET_CFG_TX_USED_INDEX,
+ vdpa_hw->vring[1].last_used_idx);
+ nn_cfg_writel(&vdpa_hw->super, NFP_NET_CFG_RX_USED_INDEX,
+ vdpa_hw->vring[0].last_used_idx);
+}
+
static uint32_t
nfp_vdpa_check_offloads(void)
{
@@ -198,6 +208,9 @@ nfp_vdpa_queue_config(struct nfp_vdpa_hw *vdpa_hw,
nn_cfg_writeq(hw, NFP_NET_CFG_RXR_ADDR(2), vdpa_hw->vring[0].used);
+ if (!relay)
+ nfp_vdpa_hw_queue_init(vdpa_hw);
+
rte_wmb();
}