Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/ixgbe - Remove half-duplex setting for more than...



details:   https://anonhg.NetBSD.org/src/rev/fc6bf8125873
branches:  trunk
changeset: 826888:fc6bf8125873
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Oct 04 07:13:00 2017 +0000

description:
- Remove half-duplex setting for more than 1000Mbps in ixgbe_add_media_types()
  because those medias are not in the spec.
- Add 2.5GBASE-T and 5GBASE-T support. Tested with X550-T1.

Example:
ixg0: flags=0x8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        capabilities=fff80<TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx>
        capabilities=fff80<TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Rx>
        capabilities=fff80<TCP6CSUM_Tx,UDP6CSUM_Rx,UDP6CSUM_Tx,TSO6,LRO>
        enabled=7ff80<TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx>
        enabled=7ff80<TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Rx>
        enabled=7ff80<TCP6CSUM_Tx,UDP6CSUM_Rx,UDP6CSUM_Tx,TSO6>
        ec_capabilities=7<VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU>
        ec_enabled=7<VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU>
        address: a0:36:9f:b0:f5:b0
        media: Ethernet 2.5GBASE-T full-duplex
        status: active
        supported Ethernet media:
                media 10Gbase-T
                media 10Gbase-T mediaopt full-duplex
                media 1000baseT
                media 1000baseT mediaopt full-duplex
                media 100baseTX
                media 100baseTX mediaopt full-duplex
                media 2.5GBASE-T mediaopt full-duplex
                media 5GBASE-T mediaopt full-duplex
                media autoselect
        inet 172.16.0.1/24 broadcast 172.16.0.255 flags 0x0
        inet6 fe80::a236:9fff:feb0:f5b0%ixg0/64 flags 0x0 scopeid 0x1

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  83 +++++++++++++++++++++++++++++++---------------
 1 files changed, 56 insertions(+), 27 deletions(-)

diffs (206 lines):

diff -r b39cbf7f1698 -r fc6bf8125873 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Wed Oct 04 07:08:01 2017 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Wed Oct 04 07:13:00 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.102 2017/10/04 06:19:47 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.103 2017/10/04 07:13:00 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -1303,7 +1303,6 @@
 
        /* Media types with matching NetBSD media defines */
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T) {
-               ADD(IFM_10G_T, 0);
                ADD(IFM_10G_T | IFM_FDX, 0);
        }
        if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_T) {
@@ -1321,54 +1320,43 @@
 
        if (layer & IXGBE_PHYSICAL_LAYER_SFP_PLUS_CU ||
            layer & IXGBE_PHYSICAL_LAYER_SFP_ACTIVE_DA) {
-               ADD(IFM_10G_TWINAX, 0);
                ADD(IFM_10G_TWINAX | IFM_FDX, 0);
        }
 
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_LR) {
-               ADD(IFM_10G_LR, 0);
                ADD(IFM_10G_LR | IFM_FDX, 0);
                if (hw->phy.multispeed_fiber) {
-                       ADD(IFM_1000_LX, 0);
                        ADD(IFM_1000_LX | IFM_FDX, 0);
                }
        }
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_SR) {
-               ADD(IFM_10G_SR, 0);
                ADD(IFM_10G_SR | IFM_FDX, 0);
                if (hw->phy.multispeed_fiber) {
-                       ADD(IFM_1000_SX, 0);
                        ADD(IFM_1000_SX | IFM_FDX, 0);
                }
        } else if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_SX) {
-               ADD(IFM_1000_SX, 0);
                ADD(IFM_1000_SX | IFM_FDX, 0);
        }
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_CX4) {
-               ADD(IFM_10G_CX4, 0);
                ADD(IFM_10G_CX4 | IFM_FDX, 0);
        }
 
 #ifdef IFM_ETH_XTYPE
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) {
-               ADD(IFM_10G_KR, 0);
                ADD(IFM_10G_KR | IFM_FDX, 0);
        }
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) {
-               ADD(AIFM_10G_KX4, 0);
                ADD(AIFM_10G_KX4 | IFM_FDX, 0);
        }
 #else
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) {
                device_printf(dev, "Media supported: 10GbaseKR\n");
                device_printf(dev, "10GbaseKR mapped to 10GbaseSR\n");
-               ADD(IFM_10G_SR, 0);
                ADD(IFM_10G_SR | IFM_FDX, 0);
        }
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) {
                device_printf(dev, "Media supported: 10GbaseKX4\n");
                device_printf(dev, "10GbaseKX4 mapped to 10GbaseCX4\n");
-               ADD(IFM_10G_CX4, 0);
                ADD(IFM_10G_CX4 | IFM_FDX, 0);
        }
 #endif
@@ -1377,9 +1365,14 @@
                ADD(IFM_1000_KX | IFM_FDX, 0);
        }
        if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_KX) {
-               ADD(IFM_2500_KX, 0);
                ADD(IFM_2500_KX | IFM_FDX, 0);
        }
+       if (layer & IXGBE_PHYSICAL_LAYER_2500BASE_T) {
+               ADD(IFM_2500_T | IFM_FDX, 0);
+       }
+       if (layer & IXGBE_PHYSICAL_LAYER_5GBASE_T) {
+               ADD(IFM_5000_T | IFM_FDX, 0);
+       }
        if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_BX)
                device_printf(dev, "Media supported: 1000baseBX\n");
        /* XXX no ifmedia_set? */
@@ -2490,6 +2483,8 @@
        layer = adapter->phy_layer;
 
        if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T ||
+           layer & IXGBE_PHYSICAL_LAYER_5GBASE_T ||
+           layer & IXGBE_PHYSICAL_LAYER_2500BASE_T ||
            layer & IXGBE_PHYSICAL_LAYER_1000BASE_T ||
            layer & IXGBE_PHYSICAL_LAYER_100BASE_TX ||
            layer & IXGBE_PHYSICAL_LAYER_10BASE_T)
@@ -2497,6 +2492,12 @@
                case IXGBE_LINK_SPEED_10GB_FULL:
                        ifmr->ifm_active |= IFM_10G_T | IFM_FDX;
                        break;
+               case IXGBE_LINK_SPEED_5GB_FULL:
+                       ifmr->ifm_active |= IFM_5000_T | IFM_FDX;
+                       break;
+               case IXGBE_LINK_SPEED_2_5GB_FULL:
+                       ifmr->ifm_active |= IFM_2500_T | IFM_FDX;
+                       break;
                case IXGBE_LINK_SPEED_1GB_FULL:
                        ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
                        break;
@@ -2660,6 +2661,10 @@
 #endif
                speed |= IXGBE_LINK_SPEED_10GB_FULL;
                break;
+       case IFM_5000_T:
+               speed |= IXGBE_LINK_SPEED_5GB_FULL;
+               break;
+       case IFM_2500_T:
        case IFM_2500_KX:
                speed |= IXGBE_LINK_SPEED_2_5GB_FULL;
                break;
@@ -2692,6 +2697,10 @@
                        adapter->advertise |= 1 << 0;
                if ((speed & IXGBE_LINK_SPEED_10_FULL) != 0)
                        adapter->advertise |= 1 << 3;
+               if ((speed & IXGBE_LINK_SPEED_2_5GB_FULL) != 0)
+                       adapter->advertise |= 1 << 4;
+               if ((speed & IXGBE_LINK_SPEED_5GB_FULL) != 0)
+                       adapter->advertise |= 1 << 5;
        }
 
        return (0);
@@ -4728,11 +4737,13 @@
  * ixgbe_set_advertise - Control advertised link speed
  *
  *   Flags:
- *     0x0 - Default (all capable link speed)
- *     0x1 - advertise 100 Mb
- *     0x2 - advertise 1G
- *     0x4 - advertise 10G
- *     0x8 - advertise 10 Mb (yes, Mb)
+ *     0x00 - Default (all capable link speed)
+ *     0x01 - advertise 100 Mb
+ *     0x02 - advertise 1G
+ *     0x04 - advertise 10G
+ *     0x08 - advertise 10 Mb
+ *     0x10 - advertise 2.5G
+ *     0x20 - advertise 5G
  ************************************************************************/
 static int
 ixgbe_set_advertise(struct adapter *adapter, int advertise)
@@ -4807,6 +4818,20 @@
                }
                speed |= IXGBE_LINK_SPEED_10_FULL;
        }
+       if (advertise & 0x10) {
+               if (!(link_caps & IXGBE_LINK_SPEED_2_5GB_FULL)) {
+                       device_printf(dev, "Interface does not support 2.5Gb advertised speed\n");
+                       return (EINVAL);
+               }
+               speed |= IXGBE_LINK_SPEED_2_5GB_FULL;
+       }
+       if (advertise & 0x20) {
+               if (!(link_caps & IXGBE_LINK_SPEED_5GB_FULL)) {
+                       device_printf(dev, "Interface does not support 5Gb advertised speed\n");
+                       return (EINVAL);
+               }
+               speed |= IXGBE_LINK_SPEED_5GB_FULL;
+       }
        if (advertise == 0)
                speed = link_caps; /* All capable link speed */
 
@@ -4822,10 +4847,12 @@
  *
  *   Formatted for sysctl usage.
  *   Flags:
- *     0x1 - advertise 100 Mb
- *     0x2 - advertise 1G
- *     0x4 - advertise 10G
- *     0x8 - advertise 10 Mb (yes, Mb)
+ *     0x01 - advertise 100 Mb
+ *     0x02 - advertise 1G
+ *     0x04 - advertise 10G
+ *     0x08 - advertise 10 Mb (yes, Mb)
+ *     0x10 - advertise 2.5G
+ *     0x20 - advertise 5G
  ************************************************************************/
 static int
 ixgbe_get_advertise(struct adapter *adapter)
@@ -4849,10 +4876,12 @@
                return (0);
 
        speed =
-           ((link_caps & IXGBE_LINK_SPEED_10GB_FULL) ? 4 : 0) |
-           ((link_caps & IXGBE_LINK_SPEED_1GB_FULL)  ? 2 : 0) |
-           ((link_caps & IXGBE_LINK_SPEED_100_FULL)  ? 1 : 0) |
-           ((link_caps & IXGBE_LINK_SPEED_10_FULL)   ? 8 : 0);
+           ((link_caps & IXGBE_LINK_SPEED_10GB_FULL)  ? 0x04 : 0) |
+           ((link_caps & IXGBE_LINK_SPEED_1GB_FULL)   ? 0x02 : 0) |
+           ((link_caps & IXGBE_LINK_SPEED_100_FULL)   ? 0x01 : 0) |
+           ((link_caps & IXGBE_LINK_SPEED_10_FULL)    ? 0x08 : 0) |
+           ((link_caps & IXGBE_LINK_SPEED_2_5GB_FULL) ? 0x10 : 0) |
+           ((link_caps & IXGBE_LINK_SPEED_5GB_FULL)   ? 0x20 : 0);
 
        return speed;
 } /* ixgbe_get_advertise */



Home | Main Index | Thread Index | Old Index