diff mbox series

igb: Debugging for setting rate negotiation settings.

Message ID 20190402181747.2899-1-greearb@candelatech.com
State Awaiting Upstream
Delegated to: David Miller
Headers show
Series igb: Debugging for setting rate negotiation settings. | expand

Commit Message

Ben Greear April 2, 2019, 6:17 p.m. UTC
From: Ben Greear <greearb@candelatech.com>

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

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

Comments

kernel test robot April 5, 2019, 2:18 a.m. UTC | #1
Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on jkirsher-next-queue/dev-queue]
[also build test WARNING on v5.1-rc3 next-20190404]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/greearb-candelatech-com/igb-Debugging-for-setting-rate-negotiation-settings/20190405-090219
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue
config: x86_64-lkp (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/dma-mapping.h:7:0,
                    from include/linux/skbuff.h:34,
                    from include/linux/if_ether.h:23,
                    from include/uapi/linux/ethtool.h:19,
                    from include/linux/ethtool.h:18,
                    from include/linux/netdevice.h:41,
                    from drivers/net/ethernet/intel/igb/igb_main.c:12:
   drivers/net/ethernet/intel/igb/igb_main.c: In function 'igb_set_spd_dplx':
>> drivers/net/ethernet/intel/igb/igb_main.c:8730:23: warning: too many arguments for format [-Wformat-extra-args]
      dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration:  1Gbps HD not supported\n",
                          ^
   include/linux/device.h:1402:22: note: in definition of macro 'dev_fmt'
    #define dev_fmt(fmt) fmt
                         ^~~
   drivers/net/ethernet/intel/igb/igb_main.c:8730:3: note: in expansion of macro 'dev_err'
      dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration:  1Gbps HD not supported\n",
      ^~~~~~~

vim +8730 drivers/net/ethernet/intel/igb/igb_main.c

  8679	
  8680	int igb_set_spd_dplx(struct igb_adapter *adapter, u32 spd, u8 dplx)
  8681	{
  8682		struct pci_dev *pdev = adapter->pdev;
  8683		struct e1000_mac_info *mac = &adapter->hw.mac;
  8684	
  8685		mac->autoneg = 0;
  8686	
  8687		/* Make sure dplx is at most 1 bit and lsb of speed is not set
  8688		 * for the switch() below to work
  8689		 */
  8690		if ((spd & 1) || (dplx & ~1)) {
  8691			dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration, bit-mismatch, spd: 0x%x  dplx: 0x%x\n",
  8692				spd, dplx);
  8693			goto err_inval;
  8694		}
  8695	
  8696		/* Fiber NIC's only allow 1000 gbps Full duplex
  8697		 * and 100Mbps Full duplex for 100baseFx sfp
  8698		 */
  8699		if (adapter->hw.phy.media_type == e1000_media_type_internal_serdes) {
  8700			switch (spd + dplx) {
  8701			case SPEED_10 + DUPLEX_HALF:
  8702			case SPEED_10 + DUPLEX_FULL:
  8703			case SPEED_100 + DUPLEX_HALF:
  8704				dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration, fiber does not support HD, spd: 0x%x  dplx: 0x%x\n",
  8705					spd, dplx);
  8706				goto err_inval;
  8707			default:
  8708				break;
  8709			}
  8710		}
  8711	
  8712		switch (spd + dplx) {
  8713		case SPEED_10 + DUPLEX_HALF:
  8714			mac->forced_speed_duplex = ADVERTISE_10_HALF;
  8715			break;
  8716		case SPEED_10 + DUPLEX_FULL:
  8717			mac->forced_speed_duplex = ADVERTISE_10_FULL;
  8718			break;
  8719		case SPEED_100 + DUPLEX_HALF:
  8720			mac->forced_speed_duplex = ADVERTISE_100_HALF;
  8721			break;
  8722		case SPEED_100 + DUPLEX_FULL:
  8723			mac->forced_speed_duplex = ADVERTISE_100_FULL;
  8724			break;
  8725		case SPEED_1000 + DUPLEX_FULL:
  8726			mac->autoneg = 1;
  8727			adapter->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL;
  8728			break;
  8729		case SPEED_1000 + DUPLEX_HALF: /* not supported */
> 8730			dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration:  1Gbps HD not supported\n",
  8731				spd, dplx);
  8732			goto err_inval;
  8733		default:
  8734			dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration, case not handled, spd: 0x%x  dplx: 0x%x\n",
  8735				spd, dplx);
  8736			goto err_inval;
  8737		}
  8738	
  8739		dev_info(&pdev->dev, "Set Speed: %d  dplx: %d  autoneg: %d  forced-speed-duplex: %d\n",
  8740			 spd, dplx, mac->autoneg, mac->forced_speed_duplex);
  8741	
  8742		/* clear MDI, MDI(-X) override is only allowed when autoneg enabled */
  8743		adapter->hw.phy.mdix = AUTO_ALL_MODES;
  8744	
  8745		return 0;
  8746	
  8747	err_inval:
  8748		return -EINVAL;
  8749	}
  8750	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot April 5, 2019, 3:16 a.m. UTC | #2
Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on jkirsher-next-queue/dev-queue]
[also build test WARNING on v5.1-rc3 next-20190404]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/greearb-candelatech-com/igb-Debugging-for-setting-rate-negotiation-settings/20190405-090219
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git dev-queue
config: x86_64-kexec (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/dma-mapping.h:7:0,
                    from include/linux/skbuff.h:34,
                    from include/linux/if_ether.h:23,
                    from include/uapi/linux/ethtool.h:19,
                    from include/linux/ethtool.h:18,
                    from include/linux/netdevice.h:41,
                    from drivers/net//ethernet/intel/igb/igb_main.c:12:
   drivers/net//ethernet/intel/igb/igb_main.c: In function 'igb_set_spd_dplx':
   drivers/net//ethernet/intel/igb/igb_main.c:8730:23: warning: too many arguments for format [-Wformat-extra-args]
      dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration:  1Gbps HD not supported\n",
                          ^
   include/linux/device.h:1402:22: note: in definition of macro 'dev_fmt'
    #define dev_fmt(fmt) fmt
                         ^~~
>> drivers/net//ethernet/intel/igb/igb_main.c:8730:3: note: in expansion of macro 'dev_err'
      dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration:  1Gbps HD not supported\n",
      ^~~~~~~

vim +/dev_err +8730 drivers/net//ethernet/intel/igb/igb_main.c

  8679	
  8680	int igb_set_spd_dplx(struct igb_adapter *adapter, u32 spd, u8 dplx)
  8681	{
  8682		struct pci_dev *pdev = adapter->pdev;
  8683		struct e1000_mac_info *mac = &adapter->hw.mac;
  8684	
  8685		mac->autoneg = 0;
  8686	
  8687		/* Make sure dplx is at most 1 bit and lsb of speed is not set
  8688		 * for the switch() below to work
  8689		 */
  8690		if ((spd & 1) || (dplx & ~1)) {
  8691			dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration, bit-mismatch, spd: 0x%x  dplx: 0x%x\n",
  8692				spd, dplx);
  8693			goto err_inval;
  8694		}
  8695	
  8696		/* Fiber NIC's only allow 1000 gbps Full duplex
  8697		 * and 100Mbps Full duplex for 100baseFx sfp
  8698		 */
  8699		if (adapter->hw.phy.media_type == e1000_media_type_internal_serdes) {
  8700			switch (spd + dplx) {
  8701			case SPEED_10 + DUPLEX_HALF:
  8702			case SPEED_10 + DUPLEX_FULL:
  8703			case SPEED_100 + DUPLEX_HALF:
  8704				dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration, fiber does not support HD, spd: 0x%x  dplx: 0x%x\n",
  8705					spd, dplx);
  8706				goto err_inval;
  8707			default:
  8708				break;
  8709			}
  8710		}
  8711	
  8712		switch (spd + dplx) {
  8713		case SPEED_10 + DUPLEX_HALF:
  8714			mac->forced_speed_duplex = ADVERTISE_10_HALF;
  8715			break;
  8716		case SPEED_10 + DUPLEX_FULL:
  8717			mac->forced_speed_duplex = ADVERTISE_10_FULL;
  8718			break;
  8719		case SPEED_100 + DUPLEX_HALF:
  8720			mac->forced_speed_duplex = ADVERTISE_100_HALF;
  8721			break;
  8722		case SPEED_100 + DUPLEX_FULL:
  8723			mac->forced_speed_duplex = ADVERTISE_100_FULL;
  8724			break;
  8725		case SPEED_1000 + DUPLEX_FULL:
  8726			mac->autoneg = 1;
  8727			adapter->hw.phy.autoneg_advertised = ADVERTISE_1000_FULL;
  8728			break;
  8729		case SPEED_1000 + DUPLEX_HALF: /* not supported */
> 8730			dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration:  1Gbps HD not supported\n",
  8731				spd, dplx);
  8732			goto err_inval;
  8733		default:
  8734			dev_err(&pdev->dev, "Unsupported Speed/Duplex configuration, case not handled, spd: 0x%x  dplx: 0x%x\n",
  8735				spd, dplx);
  8736			goto err_inval;
  8737		}
  8738	
  8739		dev_info(&pdev->dev, "Set Speed: %d  dplx: %d  autoneg: %d  forced-speed-duplex: %d\n",
  8740			 spd, dplx, mac->autoneg, mac->forced_speed_duplex);
  8741	
  8742		/* clear MDI, MDI(-X) override is only allowed when autoneg enabled */
  8743		adapter->hw.phy.mdix = AUTO_ALL_MODES;
  8744	
  8745		return 0;
  8746	
  8747	err_inval:
  8748		return -EINVAL;
  8749	}
  8750	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

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;
 }