Subject: Re: BUG(?): igc link up and XDP program init fails

From: Vinicius Costa Gomes <[email-masked]>
Date: Fri, 25 Aug 2023 16:51:16 -0700

Hi Ferenc,

Vinicius Costa Gomes <[email-masked]> writes:

> Hi Ferenc,
>
> Ferenc Fejes <[email-masked]> writes:
>

[...]

> I don't think there's anything wrong with your setup.
>
> I am considering this a bug, I don't have any patches from the top of my
> head for you to try, but taking a look.
>

See if the following patch works. Doesn't look too bad, but I have to
think a bit more about it.

--8<---------------cut here---------------start------------->8---
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index e7701866d8b4..d1b3c897c3ac 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -6462,7 +6462,7 @@ static int igc_xdp_xmit(struct net_device *dev, int num_frames,
 	struct igc_ring *ring;
 	int i, drops;
 
-	if (unlikely(test_bit(__IGC_DOWN, &adapter->state)))
+	if (unlikely(!netif_carrier_ok(dev)))
 		return -ENETDOWN;
 
 	if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))
--8<---------------cut here---------------end--------------->8---

Cheers,
-- 
Vinicius