From: Ben Greear <gree...@candelatech.com>

I found this useful while debugging an issue setting igb to
fixed rates.

Signed-off-by: Ben Greear <gree...@candelatech.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index 350a2f120fc4..0f86b4eb5e30 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -8711,8 +8711,11 @@ int igb_set_spd_dplx(struct igb_adapter *adapter, u32 
spd, u8 dplx)
        /* Make sure dplx is at most 1 bit and lsb of speed is not set
         * for the switch() below to work
         */
-       if ((spd & 1) || (dplx & ~1))
+       if ((spd & 1) || (dplx & ~1)) {
+               dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration, 
bit-mismatch, spd: 0x%x  dplx: 0x%x\n",
+                       spd, dplx);
                goto err_inval;
+       }
 
        /* Fiber NIC's only allow 1000 gbps Full duplex
         * and 100Mbps Full duplex for 100baseFx sfp
@@ -8722,6 +8725,8 @@ int igb_set_spd_dplx(struct igb_adapter *adapter, u32 
spd, u8 dplx)
                case SPEED_10 + DUPLEX_HALF:
                case SPEED_10 + DUPLEX_FULL:
                case SPEED_100 + DUPLEX_HALF:
+                       dev_err(&pdev->dev, "Unsupported Speed/Duplex 
configuration, fiber does not support HD, spd: 0x%x  dplx: 0x%x\n",
+                               spd, dplx);
                        goto err_inval;
                default:
                        break;
@@ -8746,17 +8751,24 @@ int igb_set_spd_dplx(struct igb_adapter *adapter, u32 
spd, u8 dplx)
                adapter->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL;
                break;
        case SPEED_1000 + DUPLEX_HALF: /* not supported */
+               dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration:  
1Gbps HD not supported\n",
+                       spd, dplx);
+               goto err_inval;
        default:
+               dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration, 
case not handled, spd: 0x%x  dplx: 0x%x\n",
+                       spd, dplx);
                goto err_inval;
        }
 
+       dev_info(&pdev->dev, "Set Speed: %d  dplx: %d  autoneg: %d  
forced-speed-duplex: %d\n",
+                spd, dplx, mac->autoneg, mac->forced_speed_duplex);
+
        /* clear MDI, MDI(-X) override is only allowed when autoneg enabled */
        adapter->hw.phy.mdix = AUTO_ALL_MODES;
 
        return 0;
 
 err_inval:
-       dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration\n");
        return -EINVAL;
 }
 
-- 
2.20.1

Reply via email to