Thread (65 messages) 65 messages, 6 authors, 2025-07-25

Re: [PATCH v2 03/15] net: rnpgbe: Add basic mbx ops support

From: Yibo Dong <dong100@mucse.com>
Date: 2025-07-23 10:29:02
Also in: linux-doc, lkml

On Tue, Jul 22, 2025 at 03:50:01PM +0200, Andrew Lunn wrote:
On Tue, Jul 22, 2025 at 02:45:30PM +0800, Yibo Dong wrote:
quoted
On Mon, Jul 21, 2025 at 05:43:41PM +0200, Andrew Lunn wrote:
quoted
quoted
 #define MAX_VF_NUM (8)
quoted
+	hw->max_vfs = 7;
???
This is mistake, max vfs is 7. 8 is '7 vfs + 1 pf'.
So it seems like you need to add a new #define for MAX_FUNCS_NUM, and
set MAX_VF_NUM to 7. And then actually use MAX_VP_NUM. When reviewing
your own code, seeing the number 7, not a define, should of been a
warning, something is wrong....
Got it, I'll update this.
quoted
quoted
quoted
+static int mucse_obtain_mbx_lock_pf(struct mucse_hw *hw, enum MBX_ID mbx_id)
+{
+	struct mucse_mbx_info *mbx = &hw->mbx;
+	int try_cnt = 5000, ret;
+	u32 reg;
+
+	reg = (mbx_id == MBX_FW) ? PF2FW_MBOX_CTRL(mbx) :
+				   PF2VF_MBOX_CTRL(mbx, mbx_id);
+	while (try_cnt-- > 0) {
+		/* Take ownership of the buffer */
+		mbx_wr32(hw, reg, MBOX_PF_HOLD);
+		/* force write back before check */
+		wmb();
+		if (mbx_rd32(hw, reg) & MBOX_PF_HOLD)
+			return 0;
+		udelay(100);
+	}
+	return ret;
I've not compiled this, but isn't ret uninitialized here? I would also
expect it to return -ETIMEDOUT?

	Andrew
Yes, ret is uninitialized. I will fix this.
Did the compiler give a warning? Code should be warning free. We also
expect networking code to be W=1 warning free.

	Andrew
I can get this warning with 'make CC=clang-16 W=1' now.
I did't make with clang before, I'll add this step for future patches.

Thanks for your feedback.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help