Re: [RFC PATCH net-next 04/10] net: hibmcge: Add interrupt supported in this module

From: Jijie Shao
Date: Thu Aug 01 2024 - 07:32:18 EST



on 2024/7/31 21:14, Joe Damato wrote:
+ dev_err(&priv->pdev->dev,
+ "failed to allocate MSI vectors, vectors = %d\n", ret);
+ return ret;
+ }
+
+ if (ret != HBG_VECTOR_NUM) {
+ dev_err(&priv->pdev->dev,
+ "requested %u MSI, but allocated %d MSI\n",
+ HBG_VECTOR_NUM, ret);
+ ret = -EINVAL;
+ goto free_vectors;
+ }
+
+ vectors->irqs = devm_kcalloc(&priv->pdev->dev, HBG_VECTOR_NUM,
+ sizeof(struct hbg_irq), GFP_KERNEL);
+ if (!vectors->irqs) {
+ ret = -ENOMEM;
+ goto free_vectors;
+ }
+
+ /* mdio irq not request */
+ vectors->irq_count = HBG_VECTOR_NUM - 1;
Here the comment says mdio is not requested? But it does seem like
the IRQ is allocated above, it's just unused?

Yes, not request_irq only alloc


Maybe above you should remove mdio completely if its not in use?

Or is it used later in some other patch or something?

MDIO is required because the PHY is used.

However, the mdio interrupt provided by the hardware is not used.


If only 3 interrupts are alloc, an error is reported
when the driver is loaded and unloaded again,

log:
insmod hibmcge.ko
Generic PHY mii-0000:83:00.1:02: attached PHY driver (mii_bus:phy_addr=mii-0000:83:00.1:02, irq=POLL)
hibmcge 0000:83:00.1 enp131s0f1: renamed from eth0
IPv6: ADDRCONF(NETDEV_CHANGE): enp131s0f1: link becomes ready
hibmcge 0000:83:00.1: link up!

rmmod hibmcge.ko
insmod hibmcge.ko
hibmcge 0000:83:00.1: failed to allocate MSI vectors, vectors = -28
hibmcge: probe of 0000:83:00.1 failed with error -28


+ for (i = 0; i < vectors->irq_count; i++) {

Therefore, only three interrupts are requested by request_irq
because "vectors->irq_count = HBG_VECTOR_NUM - 1"


Thanks,

Jijie Shao