Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
No build reason found for SLE-Module-Public-Cloud:ppc64le
SUSE:SLE-12:Update
gnome-nettool
gnome-nettool-add-gige-support.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gnome-nettool-add-gige-support.patch of Package gnome-nettool
Index: gnome-nettool-3.8.1/src/util-mii.c =================================================================== --- gnome-nettool-3.8.1.orig/src/util-mii.c +++ gnome-nettool-3.8.1/src/util-mii.c @@ -8,7 +8,7 @@ * Copyright (C) 2000 David A. Hinds -- dhinds@pcmcia.sourceforge.org * Copyright (C) 2003 German Poo-Caaman~o <gpoo@ubiobio.cl> * - * mii-tool is written/copyright 2000 by David A. Hinds + * mii-tool is written/copyright 2000 by David A. Hinds * -- dhinds@pcmcia.sourceforge.org * mii-diag is written/copyright 1997-2000 by Donald Becker * <becker@scyld.com> @@ -86,17 +86,21 @@ mdio_read (int skfd, int location) const struct { char *name; - unsigned short value; + short value[2]; } media[] = { /* The order through 100baseT4 matches bits in the BMSR */ - { - "10baseT-HD", MII_AN_10BASET_HD}, { - "10baseT-FD", MII_AN_10BASET_FD}, { - "100baseTx-HD", MII_AN_100BASETX_HD}, { - "100baseTx-FD", MII_AN_100BASETX_FD}, { - "100baseT4", MII_AN_100BASET4}, { - "100baseTx", MII_AN_100BASETX_FD | MII_AN_100BASETX_HD}, { -"10baseT", MII_AN_10BASET_FD | MII_AN_10BASET_HD},}; + { "10baseT-HD", {MII_AN_10BASET_HD} }, + { "10baseT-FD", {MII_AN_10BASET_FD} }, + { "100baseTx-HD", {MII_AN_100BASETX_HD} }, + { "100baseTx-FD", {MII_AN_100BASETX_FD} }, + { "100baseT4", {MII_AN_100BASET4} }, + { "100baseTx", {MII_AN_100BASETX_FD | MII_AN_100BASETX_HD} }, + { "10baseT", {MII_AN_10BASET_FD | MII_AN_10BASET_HD} }, + + { "1000baseT-HD", {0, MII_BMCR2_1000HALF} }, + { "1000baseT-FD", {0, MII_BMCR2_1000FULL} }, + { "1000baseT", {0, MII_BMCR2_1000HALF|MII_BMCR2_1000FULL} }, +}; static void get_legible_bits (gchar *buffer, gint bitrate) @@ -113,12 +117,25 @@ get_legible_bits (gchar *buffer, gint bi /*--------------------------------------------------------------------*/ -static char * -media_list (int mask, int best) +static const char * +media_list (unsigned mask, unsigned mask2, int best) { static char buf[100]; int i; *buf = '\0'; + + if (mask & MII_BMCR_SPEED1000) { + if (mask2 & MII_BMCR2_1000HALF) { + strcat(buf, "1000baseT-HD"); + if (best) + goto out; + } + if (mask2 & MII_BMCR2_1000FULL) { + strcat(buf, "1000baseT-FD"); + if (best) + goto out; + } + } mask >>= 5; for (i = 4; i >= 0; i--) { if (mask & (1 << i)) { @@ -127,6 +144,10 @@ media_list (int mask, int best) break; } } +out: + if (mask & (1<<5)) + strcat(buf, " flow-control"); + return buf; } @@ -147,7 +168,7 @@ media_list (int mask, int best) * We will call all the classical wireless ioctl on the driver through * the socket to know what is supported and to get the settings... */ -static mii_data_result +static mii_data_result mii_get_basic_wireless (int skfd, const char *ifname) { struct iwreq wrq; @@ -157,7 +178,7 @@ mii_get_basic_wireless (int skfd, const /* Set device name */ g_strlcpy (wrq.ifr_name, ifname, IFNAMSIZ); - + /* Get bit rate */ if (ioctl (skfd, SIOCGIWRATE, &wrq) >= 0) { info.has_data = 1; @@ -168,11 +189,11 @@ mii_get_basic_wireless (int skfd, const return info; } -mii_data_result +mii_data_result mii_get_basic (const char *ifname) { int i, mii_val[32]; - int bmcr, bmsr, advert, lkpar; + unsigned bmcr, bmsr, advert, lkpar, bmcr2, lpa2; unsigned short autonegotiate = 0; mii_data_result data; int sock; @@ -185,7 +206,7 @@ mii_get_basic (const char *ifname) data.has_data = 0; return data; } - + /* Get the vitals from the interface. */ strncpy (ifr.ifr_name, ifname, IFNAMSIZ); if (ioctl (sock, SIOCGMIIPHY, &ifr) < 0) { @@ -203,38 +224,42 @@ mii_get_basic (const char *ifname) return data; } data.has_data = 1; - + /* Some bits in the BMSR are latched, but we can't rely on being the only reader, so only the current values are meaningful */ mdio_read (sock, MII_BMSR); - for (i = 0; i < 8; i++) + for (i = 0; i < MII_BASIC_MAX; i++) mii_val[i] = mdio_read (sock, i); - if (mii_val[MII_BMCR] == 0xffff) { - data.has_data = 0; + if (mii_val[MII_BMCR] == 0xffff) { + data.has_data = 0; close (sock); - return data; - } + return data; + } /* Descriptive rename. */ bmcr = mii_val[MII_BMCR]; bmsr = mii_val[MII_BMSR]; advert = mii_val[MII_ANAR]; lkpar = mii_val[MII_ANLPAR]; + bmcr2 = mii_val[MII_CTRL1000]; + lpa2 = mii_val[MII_STAT1000]; sprintf (data.iface, "%s", ifr.ifr_name); if (bmcr & MII_BMCR_AN_ENA) { if (bmsr & MII_BMSR_AN_COMPLETE) { if (advert & lkpar) { - strcat (data.media, media_list (advert & lkpar, 1)); + strcat(data.media, media_list (advert & lkpar, bmcr2 & lpa2>>2, 1)); autonegotiate = 1; } } } if (! autonegotiate) { sprintf (data.media, "%s Mbit %sD", - (bmcr & MII_BMCR_100MBIT) ? "100" : "10", - (bmcr & MII_BMCR_DUPLEX) ? "F" : "H"); + ((bmcr2 & (MII_BMCR2_1000HALF | MII_BMCR2_1000FULL)) & lpa2 >> 2) + ? "1000" + : (bmcr & MII_BMCR_100MBIT) ? "100" : "10", + (bmcr & MII_BMCR_DUPLEX) ? "full" : "half"); } data.state = (bmsr & MII_BMSR_LINK_VALID); Index: gnome-nettool-3.8.1/src/mii.h =================================================================== --- gnome-nettool-3.8.1.orig/src/mii.h +++ gnome-nettool-3.8.1/src/mii.h @@ -31,6 +31,7 @@ struct mii_data { #define MII_BMCR_RESTART 0x0200 #define MII_BMCR_DUPLEX 0x0100 #define MII_BMCR_COLTEST 0x0080 +#define MII_BMCR_SPEED1000 0x0040 /* Basic Mode Status Register */ #define MII_BMSR 0x01 @@ -76,4 +77,17 @@ struct mii_data { #define MII_ANER_PAGE_RX 0x0002 #define MII_ANER_LP_AN_ABLE 0x0001 +#define MII_CTRL1000 0x09 +#define MII_BMCR2_1000FULL 0x0200 +#define MII_BMCR2_1000HALF 0x0100 + +#define MII_STAT1000 0x0a +#define MII_LPA2_1000LOCALOK 0x2000 +#define MII_LPA2_1000REMRXOK 0x1000 +#define MII_LPA2_1000FULL 0x0800 +#define MII_LPA2_1000HALF 0x0400 + +/* Last register we need for show_basic_mii() */ +#define MII_BASIC_MAX (MII_STAT1000+1) + #endif /* _LINUX_MII_H */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor