Bug 120745 - ethtool reports wrong port setting for tg3
ethtool reports wrong port setting for tg3
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: kernel (Show other bugs)
2.1
ia64 Linux
medium Severity medium
: ---
: ---
Assigned To: David Miller
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-04-13 13:43 EDT by Eddie Quinteros
Modified: 2007-11-30 17:06 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-10-19 15:22:48 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Eddie Quinteros 2004-04-13 13:43:07 EDT
Problem: ethtool reports port as Twisted Pair instead of Fibre

# modinfo tg3
filename:    /lib/modules/2.4.18-e.41/kernel/drivers/net/tg3.o
description: "Broadcom Tigon3 ethernet driver"
author:      "David S. Miller (davem@redhat.com) and Jeff Garzik
(jgarzik@pobox.com)"
license:     "GPL"
parm:        tg3_debug int, description "Tigon3 bitmapped debugging
message enable value"

Settings for eth2:

Supported ports: [ FIBRE ]
Supported link modes:   1000baseT/Half 1000baseT/Full
Supports auto-negotiation? Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on

Settings for eth3:

Supported ports: [ FIBRE ]
Supported link modes:   1000baseT/Half 1000baseT/Full
Supports auto-negotiation? Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on

I have digged into the source code and I think I have found what could
cause this problem:

From ethtool we have:

   689 static void dump_supported(struct ethtool_cmd *ep)
   690 {
   691         u_int32_t mask = ep->supported;
   692         int did1;
   693
   694         fprintf(stdout, "       Supported ports: [ ");
   695         if (mask & SUPPORTED_TP)
   696                 fprintf(stdout, "TP ");
   697         if (mask & SUPPORTED_AUI)
   698                 fprintf(stdout, "AUI ");
   699         if (mask & SUPPORTED_BNC)
   700                 fprintf(stdout, "BNC ");
   701         if (mask & SUPPORTED_MII)
   702                 fprintf(stdout, "MII ");
   703         if (mask & SUPPORTED_FIBRE)
   704                 fprintf(stdout, "FIBRE ");
   705         fprintf(stdout, "]\n");

From the driver we have:

5151         case ETHTOOL_GSET: {
5152                 struct ethtool_cmd cmd = { ETHTOOL_GSET };
5153
5154                 if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) ||
5155                     tp->link_config.phy_is_low_power)
5156                         return -EAGAIN;
5157                 cmd.supported = (SUPPORTED_Autoneg);
5158
5159                 if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY))
5160                         cmd.supported |= (SUPPORTED_1000baseT_Half |
5161                                           SUPPORTED_1000baseT_Full);
5162
5163                 if (tp->phy_id != PHY_ID_SERDES)
5164                         cmd.supported |= (SUPPORTED_100baseT_Half |
5165                                           SUPPORTED_100baseT_Full |
5166                                           SUPPORTED_10baseT_Half |
5167                                           SUPPORTED_10baseT_Full |
5168                                           SUPPORTED_MII);
5169                 else
5170                         cmd.supported |= SUPPORTED_FIBRE;
5171
5172                 cmd.advertising = tp->link_config.advertising;
5173                 cmd.speed = tp->link_config.active_speed;
5174                 cmd.duplex = tp->link_config.active_duplex;
5175                 cmd.port = 0;
5176                 cmd.phy_address = PHY_ADDR;
5177                 cmd.transceiver = 0;
5178                 cmd.autoneg = tp->link_config.autoneg;
5179                 cmd.maxtxpkt = 0;
5180                 cmd.maxrxpkt = 0;
5181                 if (copy_to_user(useraddr, &cmd, sizeof(cmd)))
5182                         return -EFAULT;
5183                 return 0;
5184         }

ethtool prints:
Supported ports: [ FIBRE ]
So far so good:

Then from ethtool we have:
     port tp|aui|bnc|mii
             Select device port.



.............


  1553         ecmd.cmd = ETHTOOL_GSET;
  1554         ifr->ifr_data = (caddr_t)&ecmd;
  1555         err = ioctl(fd, SIOCETHTOOL, ifr);
  1556         if (err == 0) {
  1557                 err = dump_ecmd(&ecmd);
  1558                 if (err)
  1559                         return err;
  1560                 allfail = 0;
  1561         } else if (errno != EOPNOTSUPP) {
  1562                 perror("Cannot get device settings");
  1563         }
  1564

.........................
   788 static int dump_ecmd(struct ethtool_cmd *ep)
   789 {
........

   822         fprintf(stdout, "       Port: ");
   823         switch (ep->port) {
   824         case PORT_TP:
   825                 fprintf(stdout, "Twisted Pair\n");
   826                 break;
   827         case PORT_AUI:
   828                 fprintf(stdout, "AUI\n");
   829                 break;
   830         case PORT_BNC:
   831                 fprintf(stdout, "BNC\n");
   832                 break;
   833         case PORT_MII:
   834                 fprintf(stdout, "MII\n");
   835                 break;
   836         case PORT_FIBRE:
   837                 fprintf(stdout, "FIBRE\n");
   838                 break;
   839         default:
   840                 fprintf(stdout, "Unknown! (%i)\n", ep->port);
   841                 break;
   842         };

So somewhere it seems that ethtool reports the wrong Port type.
ethtool-copy.h:#define PORT_TP                  0x00

ethtool-copy.h:#define PORT_FIBRE               0x03

Seems that line 5175 on the driver sets the port to Twisted Pair no
matter what.
Comment 1 Ernie Petrides 2005-11-28 21:47:11 EST
Fixing version/hardware fields.
Comment 2 RHEL Product and Program Management 2007-10-19 15:22:48 EDT
This bug is filed against RHEL2.1, which is in maintenance phase.
During the maintenance phase, only security errata and select mission
critical bug fixes will be released for enterprise products.  Since
this bug does not meet that criteria, it is now being closed.

For more information of the RHEL errata support policy, please visit:
http://www.redhat.com/security/updates/errata/

If you feel this bug is indeed mission critical, please contact your
support representative.  You may be asked to provide detailed
information on how this bug is affecting you.

Note You need to log in before you can comment on or make changes to this bug.