Re: [PATCH net-next v12 3/5] eth fbnic: Add msix self test

From: Mike Marciniszyn

Date: Tue Feb 10 2026 - 13:06:28 EST


On Tue, Feb 10, 2026 at 04:06:23PM +0100, Paolo Abeni wrote:
> On 2/6/26 4:42 PM, mike.marciniszyn@xxxxxxxxx wrote:
> > +/**
> > + * fbnic_msix_test - Verify behavior of NIC interrupts
> > + * @fbd: device to test
> > + *
> > + * This function is meant to test the global interrupt registers and the
> > + * PCIe IP MSI-X functionality. It essentially goes through and tests
> > + * test various combinations of the set, clear, and mask bits in order to
> > + * verify the behavior is as we expect it to be from the driver.
> > + *
> > + * Return: non-zero on failure.
> > + **/
> > +int fbnic_msix_test(struct fbnic_dev *fbd)
> > +{
> > + struct pci_dev *pdev = to_pci_dev(fbd->dev);
> > + struct fbnic_msix_test_data *test_data;
> > + int result = 0;
> > + u32 mask = 0;
> > + int i;
> > +
> > + /* Allocate bitmap and IRQ vector table */
> > + test_data = kzalloc(sizeof(*test_data), GFP_KERNEL);
> > +
> > + /* Result = 5 for memory allocation failure */
> > + if (!test_data)
> > + return 5;
>
> Instead of magic numbers you could define some macros, or simply return
> a boolean success/failures value (as the caller ignores the error code).
>
> /P
>

It is not ignored.

The returned u64 value for all the tests is assigned into a per
test array:

static int fbnic_ethtool_mbx_self_test(struct net_device *netdev, u64 *data)
{
struct fbnic_net *fbn = netdev_priv(netdev);
struct fbnic_dev *fbd = fbn->fbd;

*data = fbnic_fw_mbx_self_test(fbd); <--- stored here

return !!*data;
}

The rval could be a set of test specific define, but regardless, it is
meant to refer to a failure point in the test.

Mike