Skip to contentSkip to conversation

raw/ntb: clear all valid DB bits when DB init

PATCH Superseded Junfeng Guo 3 participants 8 messages Feb 9, 2022 – Feb 13, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 raw/ntb: clear all valid DB bits when DB init

Before registering the doorbell interrupt handler callback function, all the valid doorbell bits within the NTB private data struct should be cleared to aviod the confusion of the handshake timing sequence diagram when setting up the NTB connection in back-to-back mode.

Fixes 62012a76811e ("raw/ntb: add handshake process")
---
 drivers/raw/ntb/ntb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/raw/ntb/ntb.c +2 -0
index 46ac02e5ab..6f15b13585 100644
@@ -1398,6 +1398,8 @@ ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev)
 
 	/* Init doorbell. */
 	hw->db_valid_mask = RTE_LEN2MASK(hw->db_cnt, uint64_t);
+	/* Clear all valid doorbell bits before registering intr handler*/
+	(*hw->ntb_ops->db_clear)(dev, hw->db_valid_mask);
 
 	intr_handle = pci_dev->intr_handle;
 	/* Register callback func to eal lib */
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/1 raw/ntb: clear all valid DB bits when DB init

Before registering the doorbell interrupt handler callback function, all the valid doorbell bits within the NTB private data struct should be cleared to avoid the confusion of the handshake timing sequence diagram when setting up the NTB connection in back-to-back mode.

Fixes 62012a76811e ("raw/ntb: add handshake process")
---
 drivers/raw/ntb/ntb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/raw/ntb/ntb.c +2 -0
index 46ac02e5ab..6f15b13585 100644
@@ -1398,6 +1398,8 @@ ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev)
 
 	/* Init doorbell. */
 	hw->db_valid_mask = RTE_LEN2MASK(hw->db_cnt, uint64_t);
+	/* Clear all valid doorbell bits before registering intr handler*/
+	(*hw->ntb_ops->db_clear)(dev, hw->db_valid_mask);
 
 	intr_handle = pci_dev->intr_handle;
 	/* Register callback func to eal lib */
Signature · 1 line
2.25.1
#2 lore raw

PATCH v3 1/1 raw/ntb: clear all valid DB bits when DB init

Before registering the doorbell interrupt handler callback function, all the valid doorbell bits within the NTB private data struct should be cleared to avoid the confusion of the handshake timing sequence diagram when setting up the NTB connection in back-to-back mode.

Fixes 62012a76811e ("raw/ntb: add handshake process")
---
 drivers/raw/ntb/ntb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/raw/ntb/ntb.c +2 -0
index 46ac02e5ab..cc611dfbb9 100644
@@ -1398,6 +1398,8 @@ ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev)
 
 	/* Init doorbell. */
 	hw->db_valid_mask = RTE_LEN2MASK(hw->db_cnt, uint64_t);
+	/* Clear all valid doorbell bits before registering intr handler */
+	(*hw->ntb_ops->db_clear)(dev, hw->db_valid_mask);
 
 	intr_handle = pci_dev->intr_handle;
 	/* Register callback func to eal lib */
Signature · 1 line
2.25.1
#3 lore raw
Quoted 14 lines

-----Original Message-----
From: Guo, Junfeng <[email protected]>
Sent: Wednesday, February 9, 2022 12:47 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]; Guo, Junfeng <[email protected]>
Subject: [PATCH v3] raw/ntb: clear all valid DB bits when DB init

Before registering the doorbell interrupt handler callback function, all the valid doorbell bits within the NTB private data struct should be cleared to avoid the confusion of the handshake timing sequence diagram when setting up the NTB connection in back-to-back mode.

Quoted 8 lines
Fixes 62012a76811e ("raw/ntb: add handshake process")
---
 drivers/raw/ntb/ntb.c | 2 ++
 1 file changed, 2 insertions(+)

Better to add changes compared to previous version, which would help reviewers.

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device · line 1403

Quoted 11 lines
drivers/raw/ntb/ntb.c +2 -0
index 46ac02e5ab..cc611dfbb9 100644
@@ -1398,6 +1398,8 @@ ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device
 *pci_dev)
 
 	/* Init doorbell. */
 	hw->db_valid_mask = RTE_LEN2MASK(hw->db_cnt, uint64_t);
+	/* Clear all valid doorbell bits before registering intr handler */
+	(*hw->ntb_ops->db_clear)(dev, hw->db_valid_mask);

Check if hw->ntb_ops->db_clear is NULL before call it.

Quoted 5 lines
drivers/raw/ntb/ntb.c +0 -1
 	intr_handle = pci_dev->intr_handle;
 	/* Register callback func to eal lib */
--

2.25.1

#4 lore raw
Quoted 27 lines

-----Original Message-----
From: Wu, Jingjing <[email protected]>
Sent: Thursday, February 10, 2022 14:51
To: Guo, Junfeng <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH v3] raw/ntb: clear all valid DB bits when DB init

Quoted 5 lines

-----Original Message-----
From: Guo, Junfeng <[email protected]>
Sent: Wednesday, February 9, 2022 12:47 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]; Guo, Junfeng

<[email protected]>

Quoted 10 lines

Subject: [PATCH v3] raw/ntb: clear all valid DB bits when DB init

Before registering the doorbell interrupt handler callback function, all the valid doorbell bits within the NTB private data struct should be cleared to avoid the confusion of the handshake timing sequence diagram when setting up the NTB connection in back-to-back mode.

Fixes 62012a76811e ("raw/ntb: add handshake process")
Quoted 7 lines
Quoted 5 lines
---
 drivers/raw/ntb/ntb.c | 2 ++
 1 file changed, 2 insertions(+)

Better to add changes compared to previous version, which would help reviewers.

Sure, I'll add the version change commit in the coming version. Thanks!

Quoted 7 lines

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct

Quoted 6 lines
drivers/raw/ntb/ntb.c +0 -0
index 46ac02e5ab..cc611dfbb9 100644
@@ -1398,6 +1398,8 @@ ntb_init_hw(struct rte_rawdev *dev, struct

rte_pci_device

Quoted 8 lines

drivers/raw/ntb/ntb.c ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev) · line 1402

Quoted 6 lines
drivers/raw/ntb/ntb.c +2 -0
 *pci_dev)
 
 	/* Init doorbell. */
 	hw->db_valid_mask = RTE_LEN2MASK(hw->db_cnt, uint64_t);
+	/* Clear all valid doorbell bits before registering intr handler */
+	(*hw->ntb_ops->db_clear)(dev, hw->db_valid_mask);

Check if hw->ntb_ops->db_clear is NULL before call it.

OK, will add it in the coming version. Thanks for review!

Quoted 6 lines
Quoted 6 lines
drivers/raw/ntb/ntb.c +0 -1
 	intr_handle = pci_dev->intr_handle;
 	/* Register callback func to eal lib */
--

2.25.1

#5 lore raw

PATCH v4 1/1 raw/ntb: clear all valid DB bits when DB init

In reply to Junfeng Guo

Before registering the doorbell interrupt handler callback function, all the valid doorbell bits within the NTB private data struct should be cleared to avoid the confusion of the handshake timing sequence diagram when setting up the NTB connection in back-to-back mode.

Fixes 62012a76811e ("raw/ntb: add handshake process")

v2: fix typo
v3: fix coding style issue
v4: add ops check before calling it

---
 drivers/raw/ntb/ntb.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/raw/ntb/ntb.c +4 -0
index 46ac02e5ab..f5e773c53b 100644
@@ -1398,6 +1398,10 @@ ntb_init_hw(struct rte_rawdev *dev, struct rte_pci_device *pci_dev)
 
 	/* Init doorbell. */
 	hw->db_valid_mask = RTE_LEN2MASK(hw->db_cnt, uint64_t);
+	/* Clear all valid doorbell bits before registering intr handler */
+	if (hw->ntb_ops->db_clear == NULL)
+		return -ENOTSUP;
+	(*hw->ntb_ops->db_clear)(dev, hw->db_valid_mask);
 
 	intr_handle = pci_dev->intr_handle;
 	/* Register callback func to eal lib */
Signature · 1 line
2.25.1
Acked-by on v4 1/1
#6 lore raw
Quoted 14 lines

-----Original Message-----
From: Guo, Junfeng <[email protected]>
Sent: Thursday, February 10, 2022 3:07 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; [email protected]; Guo, Junfeng <[email protected]>
Subject: [PATCH v4] raw/ntb: clear all valid DB bits when DB init

Before registering the doorbell interrupt handler callback function, all the valid doorbell bits within the NTB private data struct should be cleared to avoid the confusion of the handshake timing sequence diagram when setting up the NTB connection in back-to-back mode.

Quoted 8 lines
Fixes 62012a76811e ("raw/ntb: add handshake process")

v2: fix typo
v3: fix coding style issue
v4: add ops check before calling it

#7 lore raw
Quoted 11 lines
Quoted 11 lines

Before registering the doorbell interrupt handler callback function, all the valid doorbell bits within the NTB private data struct should be cleared to avoid the confusion of the handshake timing sequence diagram when setting up the NTB connection in back-to-back mode.

Fixes 62012a76811e ("raw/ntb: add handshake process")

v2: fix typo
v3: fix coding style issue
v4: add ops check before calling it

The changelog should be below line of ---

Quoted 2 lines
Quoted 1 line

Applied, thanks.