patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 02/10] vdpa/nfp: fix logic in hardware init
       [not found] <20240426074831.1729792-1-chaoyong.he@corigine.com>
@ 2024-04-26  7:48 ` Chaoyong He
  2024-06-13 11:41   ` Maxime Coquelin
  2024-04-26  7:48 ` [PATCH 03/10] vdpa/nfp: fix the logic of reconfiguration Chaoyong He
       [not found] ` <20240614070120.2663160-1-chaoyong.he@corigine.com>
  2 siblings, 1 reply; 11+ messages in thread
From: Chaoyong He @ 2024-04-26  7:48 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Xinying Yu, chaoyong.he, stable, Long Wu, Peng Zhang

From: Xinying Yu <xinying.yu@corigine.com>

Reconfigure the NIC will fail because lack of the
initialization logic of queue configuration pointer.
Fix this by adding the correct initialization logic.

Fixes: d89f4990c14e ("vdpa/nfp: add hardware init")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

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/vdpa/nfp/nfp_vdpa_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/vdpa/nfp/nfp_vdpa_core.c b/drivers/vdpa/nfp/nfp_vdpa_core.c
index 7b877605e4..291798196c 100644
--- a/drivers/vdpa/nfp/nfp_vdpa_core.c
+++ b/drivers/vdpa/nfp/nfp_vdpa_core.c
@@ -55,7 +55,10 @@ nfp_vdpa_hw_init(struct nfp_vdpa_hw *vdpa_hw,
 		struct rte_pci_device *pci_dev)
 {
 	uint32_t queue;
+	uint8_t *tx_bar;
+	uint32_t start_q;
 	struct nfp_hw *hw;
+	uint32_t tx_bar_off;
 	uint8_t *notify_base;
 
 	hw = &vdpa_hw->super;
@@ -82,6 +85,12 @@ nfp_vdpa_hw_init(struct nfp_vdpa_hw *vdpa_hw,
 				idx + 1, vdpa_hw->notify_addr[idx + 1]);
 	}
 
+	/* NFP vDPA cfg queue setup */
+	start_q = nn_cfg_readl(hw, NFP_NET_CFG_START_TXQ);
+	tx_bar_off = start_q * NFP_QCP_QUEUE_ADDR_SZ;
+	tx_bar = (uint8_t *)pci_dev->mem_resource[2].addr + tx_bar_off;
+	hw->qcp_cfg = tx_bar + NFP_QCP_QUEUE_ADDR_SZ;
+
 	vdpa_hw->features = (1ULL << VIRTIO_F_VERSION_1) |
 			(1ULL << VIRTIO_F_IN_ORDER) |
 			(1ULL << VHOST_USER_F_PROTOCOL_FEATURES);
-- 
2.39.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 03/10] vdpa/nfp: fix the logic of reconfiguration
       [not found] <20240426074831.1729792-1-chaoyong.he@corigine.com>
  2024-04-26  7:48 ` [PATCH 02/10] vdpa/nfp: fix logic in hardware init Chaoyong He
@ 2024-04-26  7:48 ` Chaoyong He
  2024-06-13 11:43   ` Maxime Coquelin
       [not found] ` <20240614070120.2663160-1-chaoyong.he@corigine.com>
  2 siblings, 1 reply; 11+ messages in thread
From: Chaoyong He @ 2024-04-26  7:48 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Xinying Yu, chaoyong.he, stable, Long Wu, Peng Zhang

From: Xinying Yu <xinying.yu@corigine.com>

The ctrl words of vDPA is locate on the extend word, so should
use the 'nfp_ext_reconfig()' rather than 'nfp_reconfig()'.

Also replace the misuse of 'NFP_NET_CFG_CTRL_SCATTER' macro
with 'NFP_NET_CFG_CTRL_VIRTIO'.

Fixes: b47a0373903f ("vdpa/nfp: add datapath update")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

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 |  1 +
 drivers/vdpa/nfp/nfp_vdpa_core.c     | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h
index 6badf769fc..a0e62b063d 100644
--- a/drivers/common/nfp/nfp_common_ctrl.h
+++ b/drivers/common/nfp/nfp_common_ctrl.h
@@ -184,6 +184,7 @@ struct nfp_net_fw_ver {
 #define NFP_NET_CFG_CTRL_IPSEC_LM_LOOKUP  (0x1 << 4) /**< SA long match lookup */
 #define NFP_NET_CFG_CTRL_MULTI_PF         (0x1 << 5)
 #define NFP_NET_CFG_CTRL_FLOW_STEER       (0x1 << 8) /**< Flow Steering */
+#define NFP_NET_CFG_CTRL_VIRTIO           (0x1 << 10) /**< Virtio offload */
 #define NFP_NET_CFG_CTRL_IN_ORDER         (0x1 << 11) /**< Virtio in-order flag */
 #define NFP_NET_CFG_CTRL_USO              (0x1 << 16) /**< UDP segmentation offload */
 
diff --git a/drivers/vdpa/nfp/nfp_vdpa_core.c b/drivers/vdpa/nfp/nfp_vdpa_core.c
index 291798196c..6d07356581 100644
--- a/drivers/vdpa/nfp/nfp_vdpa_core.c
+++ b/drivers/vdpa/nfp/nfp_vdpa_core.c
@@ -101,7 +101,7 @@ nfp_vdpa_hw_init(struct nfp_vdpa_hw *vdpa_hw,
 static uint32_t
 nfp_vdpa_check_offloads(void)
 {
-	return NFP_NET_CFG_CTRL_SCATTER |
+	return NFP_NET_CFG_CTRL_VIRTIO  |
 			NFP_NET_CFG_CTRL_IN_ORDER;
 }
 
@@ -112,6 +112,7 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw,
 	int ret;
 	uint32_t update;
 	uint32_t new_ctrl;
+	uint32_t new_ext_ctrl;
 	struct timespec wait_tst;
 	struct nfp_hw *hw = &vdpa_hw->super;
 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
@@ -131,8 +132,6 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw,
 	nfp_disable_queues(hw);
 	nfp_enable_queues(hw, NFP_VDPA_MAX_QUEUES, NFP_VDPA_MAX_QUEUES);
 
-	new_ctrl = nfp_vdpa_check_offloads();
-
 	nn_cfg_writel(hw, NFP_NET_CFG_MTU, 9216);
 	nn_cfg_writel(hw, NFP_NET_CFG_FLBUFSZ, 10240);
 
@@ -147,8 +146,17 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw,
 	/* Writing new MAC to the specific port BAR address */
 	nfp_write_mac(hw, (uint8_t *)mac_addr);
 
+	new_ext_ctrl = nfp_vdpa_check_offloads();
+
+	update = NFP_NET_CFG_UPDATE_GEN;
+	ret = nfp_ext_reconfig(hw, new_ext_ctrl, update);
+	if (ret != 0)
+		return -EIO;
+
+	hw->ctrl_ext = new_ext_ctrl;
+
 	/* Enable device */
-	new_ctrl |= NFP_NET_CFG_CTRL_ENABLE;
+	new_ctrl = NFP_NET_CFG_CTRL_ENABLE;
 
 	/* Signal the NIC about the change */
 	update = NFP_NET_CFG_UPDATE_MACADDR |
-- 
2.39.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 02/10] vdpa/nfp: fix logic in hardware init
  2024-04-26  7:48 ` [PATCH 02/10] vdpa/nfp: fix logic in hardware init Chaoyong He
@ 2024-06-13 11:41   ` Maxime Coquelin
  0 siblings, 0 replies; 11+ messages in thread
From: Maxime Coquelin @ 2024-06-13 11:41 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, Xinying Yu, stable, Long Wu, Peng Zhang



On 4/26/24 09:48, Chaoyong He wrote:
> From: Xinying Yu <xinying.yu@corigine.com>
> 
> Reconfigure the NIC will fail because lack of the
> initialization logic of queue configuration pointer.
> Fix this by adding the correct initialization logic.
> 
> Fixes: d89f4990c14e ("vdpa/nfp: add hardware init")
> Cc: chaoyong.he@corigine.com
> Cc: stable@dpdk.org
> 
> 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/vdpa/nfp/nfp_vdpa_core.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 03/10] vdpa/nfp: fix the logic of reconfiguration
  2024-04-26  7:48 ` [PATCH 03/10] vdpa/nfp: fix the logic of reconfiguration Chaoyong He
@ 2024-06-13 11:43   ` Maxime Coquelin
  2024-06-14  2:30     ` Chaoyong He
  0 siblings, 1 reply; 11+ messages in thread
From: Maxime Coquelin @ 2024-06-13 11:43 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, Xinying Yu, stable, Long Wu, Peng Zhang



On 4/26/24 09:48, Chaoyong He wrote:
> From: Xinying Yu <xinying.yu@corigine.com>
> 
> The ctrl words of vDPA is locate on the extend word, so should
> use the 'nfp_ext_reconfig()' rather than 'nfp_reconfig()'.

located*
extended*

so it should*

> 
> Also replace the misuse of 'NFP_NET_CFG_CTRL_SCATTER' macro
> with 'NFP_NET_CFG_CTRL_VIRTIO'.
> 
> Fixes: b47a0373903f ("vdpa/nfp: add datapath update")
> Cc: chaoyong.he@corigine.com
> Cc: stable@dpdk.org
> 
> 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 |  1 +
>   drivers/vdpa/nfp/nfp_vdpa_core.c     | 16 ++++++++++++----
>   2 files changed, 13 insertions(+), 4 deletions(-)
> 

With commit message fixed (I can do it if only change needed in the
series):

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH 03/10] vdpa/nfp: fix the logic of reconfiguration
  2024-06-13 11:43   ` Maxime Coquelin
@ 2024-06-14  2:30     ` Chaoyong He
  0 siblings, 0 replies; 11+ messages in thread
From: Chaoyong He @ 2024-06-14  2:30 UTC (permalink / raw)
  To: Maxime Coquelin, dev; +Cc: oss-drivers, Xinying Yu, stable, Long Wu, Nole Zhang

> On 4/26/24 09:48, Chaoyong He wrote:
> > From: Xinying Yu <xinying.yu@corigine.com>
> >
> > The ctrl words of vDPA is locate on the extend word, so should use the
> > 'nfp_ext_reconfig()' rather than 'nfp_reconfig()'.
> 
> located*
> extended*
> 
> so it should*
> 

Will fix in the v2 patch series.
Thanks for your review.

> >
> > Also replace the misuse of 'NFP_NET_CFG_CTRL_SCATTER' macro with
> > 'NFP_NET_CFG_CTRL_VIRTIO'.
> >
> > Fixes: b47a0373903f ("vdpa/nfp: add datapath update")
> > Cc: chaoyong.he@corigine.com
> > Cc: stable@dpdk.org
> >
> > 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 |  1 +
> >   drivers/vdpa/nfp/nfp_vdpa_core.c     | 16 ++++++++++++----
> >   2 files changed, 13 insertions(+), 4 deletions(-)
> >
> 
> With commit message fixed (I can do it if only change needed in the
> series):
> 
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> Thanks,
> Maxime


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 02/11] vdpa/nfp: fix logic in hardware init
       [not found] ` <20240614070120.2663160-1-chaoyong.he@corigine.com>
@ 2024-06-14  7:01   ` Chaoyong He
  2024-06-14  7:01   ` [PATCH v2 03/11] vdpa/nfp: fix the logic of reconfiguration Chaoyong He
       [not found]   ` <20240617062708.2932037-1-chaoyong.he@corigine.com>
  2 siblings, 0 replies; 11+ messages in thread
From: Chaoyong He @ 2024-06-14  7:01 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Xinying Yu, chaoyong.he, stable, Long Wu, Peng Zhang

From: Xinying Yu <xinying.yu@corigine.com>

Reconfigure the NIC will fail because lack of the
initialization logic of queue configuration pointer.
Fix this by adding the correct initialization logic.

Fixes: d89f4990c14e ("vdpa/nfp: add hardware init")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

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/vdpa/nfp/nfp_vdpa_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/vdpa/nfp/nfp_vdpa_core.c b/drivers/vdpa/nfp/nfp_vdpa_core.c
index 7b877605e4..291798196c 100644
--- a/drivers/vdpa/nfp/nfp_vdpa_core.c
+++ b/drivers/vdpa/nfp/nfp_vdpa_core.c
@@ -55,7 +55,10 @@ nfp_vdpa_hw_init(struct nfp_vdpa_hw *vdpa_hw,
 		struct rte_pci_device *pci_dev)
 {
 	uint32_t queue;
+	uint8_t *tx_bar;
+	uint32_t start_q;
 	struct nfp_hw *hw;
+	uint32_t tx_bar_off;
 	uint8_t *notify_base;
 
 	hw = &vdpa_hw->super;
@@ -82,6 +85,12 @@ nfp_vdpa_hw_init(struct nfp_vdpa_hw *vdpa_hw,
 				idx + 1, vdpa_hw->notify_addr[idx + 1]);
 	}
 
+	/* NFP vDPA cfg queue setup */
+	start_q = nn_cfg_readl(hw, NFP_NET_CFG_START_TXQ);
+	tx_bar_off = start_q * NFP_QCP_QUEUE_ADDR_SZ;
+	tx_bar = (uint8_t *)pci_dev->mem_resource[2].addr + tx_bar_off;
+	hw->qcp_cfg = tx_bar + NFP_QCP_QUEUE_ADDR_SZ;
+
 	vdpa_hw->features = (1ULL << VIRTIO_F_VERSION_1) |
 			(1ULL << VIRTIO_F_IN_ORDER) |
 			(1ULL << VHOST_USER_F_PROTOCOL_FEATURES);
-- 
2.39.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 03/11] vdpa/nfp: fix the logic of reconfiguration
       [not found] ` <20240614070120.2663160-1-chaoyong.he@corigine.com>
  2024-06-14  7:01   ` [PATCH v2 02/11] vdpa/nfp: fix logic in hardware init Chaoyong He
@ 2024-06-14  7:01   ` Chaoyong He
       [not found]   ` <20240617062708.2932037-1-chaoyong.he@corigine.com>
  2 siblings, 0 replies; 11+ messages in thread
From: Chaoyong He @ 2024-06-14  7:01 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Xinying Yu, chaoyong.he, stable, Long Wu, Peng Zhang

From: Xinying Yu <xinying.yu@corigine.com>

The ctrl words of vDPA is located on the extended word, so it
should use the 'nfp_ext_reconfig()' rather than 'nfp_reconfig()'.

Also replace the misuse of 'NFP_NET_CFG_CTRL_SCATTER' macro
with 'NFP_NET_CFG_CTRL_VIRTIO'.

Fixes: b47a0373903f ("vdpa/nfp: add datapath update")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

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 |  1 +
 drivers/vdpa/nfp/nfp_vdpa_core.c     | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h
index 6badf769fc..a0e62b063d 100644
--- a/drivers/common/nfp/nfp_common_ctrl.h
+++ b/drivers/common/nfp/nfp_common_ctrl.h
@@ -184,6 +184,7 @@ struct nfp_net_fw_ver {
 #define NFP_NET_CFG_CTRL_IPSEC_LM_LOOKUP  (0x1 << 4) /**< SA long match lookup */
 #define NFP_NET_CFG_CTRL_MULTI_PF         (0x1 << 5)
 #define NFP_NET_CFG_CTRL_FLOW_STEER       (0x1 << 8) /**< Flow Steering */
+#define NFP_NET_CFG_CTRL_VIRTIO           (0x1 << 10) /**< Virtio offload */
 #define NFP_NET_CFG_CTRL_IN_ORDER         (0x1 << 11) /**< Virtio in-order flag */
 #define NFP_NET_CFG_CTRL_USO              (0x1 << 16) /**< UDP segmentation offload */
 
diff --git a/drivers/vdpa/nfp/nfp_vdpa_core.c b/drivers/vdpa/nfp/nfp_vdpa_core.c
index 291798196c..6d07356581 100644
--- a/drivers/vdpa/nfp/nfp_vdpa_core.c
+++ b/drivers/vdpa/nfp/nfp_vdpa_core.c
@@ -101,7 +101,7 @@ nfp_vdpa_hw_init(struct nfp_vdpa_hw *vdpa_hw,
 static uint32_t
 nfp_vdpa_check_offloads(void)
 {
-	return NFP_NET_CFG_CTRL_SCATTER |
+	return NFP_NET_CFG_CTRL_VIRTIO  |
 			NFP_NET_CFG_CTRL_IN_ORDER;
 }
 
@@ -112,6 +112,7 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw,
 	int ret;
 	uint32_t update;
 	uint32_t new_ctrl;
+	uint32_t new_ext_ctrl;
 	struct timespec wait_tst;
 	struct nfp_hw *hw = &vdpa_hw->super;
 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
@@ -131,8 +132,6 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw,
 	nfp_disable_queues(hw);
 	nfp_enable_queues(hw, NFP_VDPA_MAX_QUEUES, NFP_VDPA_MAX_QUEUES);
 
-	new_ctrl = nfp_vdpa_check_offloads();
-
 	nn_cfg_writel(hw, NFP_NET_CFG_MTU, 9216);
 	nn_cfg_writel(hw, NFP_NET_CFG_FLBUFSZ, 10240);
 
@@ -147,8 +146,17 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw,
 	/* Writing new MAC to the specific port BAR address */
 	nfp_write_mac(hw, (uint8_t *)mac_addr);
 
+	new_ext_ctrl = nfp_vdpa_check_offloads();
+
+	update = NFP_NET_CFG_UPDATE_GEN;
+	ret = nfp_ext_reconfig(hw, new_ext_ctrl, update);
+	if (ret != 0)
+		return -EIO;
+
+	hw->ctrl_ext = new_ext_ctrl;
+
 	/* Enable device */
-	new_ctrl |= NFP_NET_CFG_CTRL_ENABLE;
+	new_ctrl = NFP_NET_CFG_CTRL_ENABLE;
 
 	/* Signal the NIC about the change */
 	update = NFP_NET_CFG_UPDATE_MACADDR |
-- 
2.39.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v3 02/11] vdpa/nfp: fix logic in hardware init
       [not found]   ` <20240617062708.2932037-1-chaoyong.he@corigine.com>
@ 2024-06-17  6:26     ` Chaoyong He
  2024-06-18  7:50       ` Maxime Coquelin
  2024-06-17  6:27     ` [PATCH v3 03/11] vdpa/nfp: fix the logic of reconfiguration Chaoyong He
  1 sibling, 1 reply; 11+ messages in thread
From: Chaoyong He @ 2024-06-17  6:26 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Xinying Yu, chaoyong.he, stable, Long Wu, Peng Zhang

From: Xinying Yu <xinying.yu@corigine.com>

Reconfigure the NIC will fail because lack of the
initialization logic of queue configuration pointer.
Fix this by adding the correct initialization logic.

Fixes: d89f4990c14e ("vdpa/nfp: add hardware init")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

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/vdpa/nfp/nfp_vdpa_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/vdpa/nfp/nfp_vdpa_core.c b/drivers/vdpa/nfp/nfp_vdpa_core.c
index 7b877605e4..291798196c 100644
--- a/drivers/vdpa/nfp/nfp_vdpa_core.c
+++ b/drivers/vdpa/nfp/nfp_vdpa_core.c
@@ -55,7 +55,10 @@ nfp_vdpa_hw_init(struct nfp_vdpa_hw *vdpa_hw,
 		struct rte_pci_device *pci_dev)
 {
 	uint32_t queue;
+	uint8_t *tx_bar;
+	uint32_t start_q;
 	struct nfp_hw *hw;
+	uint32_t tx_bar_off;
 	uint8_t *notify_base;
 
 	hw = &vdpa_hw->super;
@@ -82,6 +85,12 @@ nfp_vdpa_hw_init(struct nfp_vdpa_hw *vdpa_hw,
 				idx + 1, vdpa_hw->notify_addr[idx + 1]);
 	}
 
+	/* NFP vDPA cfg queue setup */
+	start_q = nn_cfg_readl(hw, NFP_NET_CFG_START_TXQ);
+	tx_bar_off = start_q * NFP_QCP_QUEUE_ADDR_SZ;
+	tx_bar = (uint8_t *)pci_dev->mem_resource[2].addr + tx_bar_off;
+	hw->qcp_cfg = tx_bar + NFP_QCP_QUEUE_ADDR_SZ;
+
 	vdpa_hw->features = (1ULL << VIRTIO_F_VERSION_1) |
 			(1ULL << VIRTIO_F_IN_ORDER) |
 			(1ULL << VHOST_USER_F_PROTOCOL_FEATURES);
-- 
2.39.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v3 03/11] vdpa/nfp: fix the logic of reconfiguration
       [not found]   ` <20240617062708.2932037-1-chaoyong.he@corigine.com>
  2024-06-17  6:26     ` [PATCH v3 02/11] vdpa/nfp: fix logic in hardware init Chaoyong He
@ 2024-06-17  6:27     ` Chaoyong He
  2024-06-18  7:51       ` Maxime Coquelin
  1 sibling, 1 reply; 11+ messages in thread
From: Chaoyong He @ 2024-06-17  6:27 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Xinying Yu, chaoyong.he, stable, Long Wu, Peng Zhang

From: Xinying Yu <xinying.yu@corigine.com>

The ctrl words of vDPA is located on the extended word, so it
should use the 'nfp_ext_reconfig()' rather than 'nfp_reconfig()'.

Also replace the misuse of 'NFP_NET_CFG_CTRL_SCATTER' macro
with 'NFP_NET_CFG_CTRL_VIRTIO'.

Fixes: b47a0373903f ("vdpa/nfp: add datapath update")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

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 |  1 +
 drivers/vdpa/nfp/nfp_vdpa_core.c     | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h
index 6badf769fc..a0e62b063d 100644
--- a/drivers/common/nfp/nfp_common_ctrl.h
+++ b/drivers/common/nfp/nfp_common_ctrl.h
@@ -184,6 +184,7 @@ struct nfp_net_fw_ver {
 #define NFP_NET_CFG_CTRL_IPSEC_LM_LOOKUP  (0x1 << 4) /**< SA long match lookup */
 #define NFP_NET_CFG_CTRL_MULTI_PF         (0x1 << 5)
 #define NFP_NET_CFG_CTRL_FLOW_STEER       (0x1 << 8) /**< Flow Steering */
+#define NFP_NET_CFG_CTRL_VIRTIO           (0x1 << 10) /**< Virtio offload */
 #define NFP_NET_CFG_CTRL_IN_ORDER         (0x1 << 11) /**< Virtio in-order flag */
 #define NFP_NET_CFG_CTRL_USO              (0x1 << 16) /**< UDP segmentation offload */
 
diff --git a/drivers/vdpa/nfp/nfp_vdpa_core.c b/drivers/vdpa/nfp/nfp_vdpa_core.c
index 291798196c..6d07356581 100644
--- a/drivers/vdpa/nfp/nfp_vdpa_core.c
+++ b/drivers/vdpa/nfp/nfp_vdpa_core.c
@@ -101,7 +101,7 @@ nfp_vdpa_hw_init(struct nfp_vdpa_hw *vdpa_hw,
 static uint32_t
 nfp_vdpa_check_offloads(void)
 {
-	return NFP_NET_CFG_CTRL_SCATTER |
+	return NFP_NET_CFG_CTRL_VIRTIO  |
 			NFP_NET_CFG_CTRL_IN_ORDER;
 }
 
@@ -112,6 +112,7 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw,
 	int ret;
 	uint32_t update;
 	uint32_t new_ctrl;
+	uint32_t new_ext_ctrl;
 	struct timespec wait_tst;
 	struct nfp_hw *hw = &vdpa_hw->super;
 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
@@ -131,8 +132,6 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw,
 	nfp_disable_queues(hw);
 	nfp_enable_queues(hw, NFP_VDPA_MAX_QUEUES, NFP_VDPA_MAX_QUEUES);
 
-	new_ctrl = nfp_vdpa_check_offloads();
-
 	nn_cfg_writel(hw, NFP_NET_CFG_MTU, 9216);
 	nn_cfg_writel(hw, NFP_NET_CFG_FLBUFSZ, 10240);
 
@@ -147,8 +146,17 @@ nfp_vdpa_hw_start(struct nfp_vdpa_hw *vdpa_hw,
 	/* Writing new MAC to the specific port BAR address */
 	nfp_write_mac(hw, (uint8_t *)mac_addr);
 
+	new_ext_ctrl = nfp_vdpa_check_offloads();
+
+	update = NFP_NET_CFG_UPDATE_GEN;
+	ret = nfp_ext_reconfig(hw, new_ext_ctrl, update);
+	if (ret != 0)
+		return -EIO;
+
+	hw->ctrl_ext = new_ext_ctrl;
+
 	/* Enable device */
-	new_ctrl |= NFP_NET_CFG_CTRL_ENABLE;
+	new_ctrl = NFP_NET_CFG_CTRL_ENABLE;
 
 	/* Signal the NIC about the change */
 	update = NFP_NET_CFG_UPDATE_MACADDR |
-- 
2.39.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 02/11] vdpa/nfp: fix logic in hardware init
  2024-06-17  6:26     ` [PATCH v3 02/11] vdpa/nfp: fix logic in hardware init Chaoyong He
@ 2024-06-18  7:50       ` Maxime Coquelin
  0 siblings, 0 replies; 11+ messages in thread
From: Maxime Coquelin @ 2024-06-18  7:50 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, Xinying Yu, stable, Long Wu, Peng Zhang



On 6/17/24 08:26, Chaoyong He wrote:
> From: Xinying Yu <xinying.yu@corigine.com>
> 
> Reconfigure the NIC will fail because lack of the
> initialization logic of queue configuration pointer.
> Fix this by adding the correct initialization logic.
> 
> Fixes: d89f4990c14e ("vdpa/nfp: add hardware init")
> Cc: chaoyong.he@corigine.com
> Cc: stable@dpdk.org
> 
> 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/vdpa/nfp/nfp_vdpa_core.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 03/11] vdpa/nfp: fix the logic of reconfiguration
  2024-06-17  6:27     ` [PATCH v3 03/11] vdpa/nfp: fix the logic of reconfiguration Chaoyong He
@ 2024-06-18  7:51       ` Maxime Coquelin
  0 siblings, 0 replies; 11+ messages in thread
From: Maxime Coquelin @ 2024-06-18  7:51 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, Xinying Yu, stable, Long Wu, Peng Zhang



On 6/17/24 08:27, Chaoyong He wrote:
> From: Xinying Yu <xinying.yu@corigine.com>
> 
> The ctrl words of vDPA is located on the extended word, so it
> should use the 'nfp_ext_reconfig()' rather than 'nfp_reconfig()'.
> 
> Also replace the misuse of 'NFP_NET_CFG_CTRL_SCATTER' macro
> with 'NFP_NET_CFG_CTRL_VIRTIO'.
> 
> Fixes: b47a0373903f ("vdpa/nfp: add datapath update")
> Cc: chaoyong.he@corigine.com
> Cc: stable@dpdk.org
> 
> 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 |  1 +
>   drivers/vdpa/nfp/nfp_vdpa_core.c     | 16 ++++++++++++----
>   2 files changed, 13 insertions(+), 4 deletions(-)
> 
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-06-18  7:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20240426074831.1729792-1-chaoyong.he@corigine.com>
2024-04-26  7:48 ` [PATCH 02/10] vdpa/nfp: fix logic in hardware init Chaoyong He
2024-06-13 11:41   ` Maxime Coquelin
2024-04-26  7:48 ` [PATCH 03/10] vdpa/nfp: fix the logic of reconfiguration Chaoyong He
2024-06-13 11:43   ` Maxime Coquelin
2024-06-14  2:30     ` Chaoyong He
     [not found] ` <20240614070120.2663160-1-chaoyong.he@corigine.com>
2024-06-14  7:01   ` [PATCH v2 02/11] vdpa/nfp: fix logic in hardware init Chaoyong He
2024-06-14  7:01   ` [PATCH v2 03/11] vdpa/nfp: fix the logic of reconfiguration Chaoyong He
     [not found]   ` <20240617062708.2932037-1-chaoyong.he@corigine.com>
2024-06-17  6:26     ` [PATCH v3 02/11] vdpa/nfp: fix logic in hardware init Chaoyong He
2024-06-18  7:50       ` Maxime Coquelin
2024-06-17  6:27     ` [PATCH v3 03/11] vdpa/nfp: fix the logic of reconfiguration Chaoyong He
2024-06-18  7:51       ` Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).