Print this page
9095 ixgbe MAC_CAPAB_LED support
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Sebastian Wiedenroth <sebastian.wiedenroth@skylime.net>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Dan McDonald <danmcd@joyent.com>
SUP-479 10 Gigabit CX4 Dual Port Server Adapter EXPX9502CX4 unresponsive to external pings after upgrade from 3.1.2 to 3.1.3.5

@@ -23,11 +23,11 @@
  * Copyright(c) 2007-2010 Intel Corporation. All rights reserved.
  */
 
 /*
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  * Copyright 2016 OmniTI Computer Consulting, Inc. All rights reserved.
  * Copyright (c) 2017, Joyent, Inc.
  */
 
 #include "ixgbe_sw.h"

@@ -218,10 +218,65 @@
                 qreply(q, mp);
                 break;
         }
 }
 
+static int
+ixgbe_led_set(void *arg, mac_led_mode_t mode, uint_t flags)
+{
+        ixgbe_t *ixgbe = arg;
+        struct ixgbe_hw *hw = &ixgbe->hw;
+        uint32_t lidx = ixgbe->ixgbe_led_index;
+
+        if (flags != 0)
+                return (EINVAL);
+
+        if (mode != MAC_LED_DEFAULT &&
+            mode != MAC_LED_IDENT &&
+            mode != MAC_LED_OFF &&
+            mode != MAC_LED_ON)
+                return (ENOTSUP);
+
+        if (ixgbe->ixgbe_led_blink && mode != MAC_LED_IDENT) {
+                if (ixgbe_blink_led_stop(hw, lidx) != IXGBE_SUCCESS) {
+                        return (EIO);
+                }
+                ixgbe->ixgbe_led_blink = B_FALSE;
+        }
+
+        if (mode != MAC_LED_DEFAULT && !ixgbe->ixgbe_led_active) {
+                ixgbe->ixgbe_led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
+                ixgbe->ixgbe_led_active = B_TRUE;
+        }
+
+        switch (mode) {
+        case MAC_LED_DEFAULT:
+                if (ixgbe->ixgbe_led_active) {
+                        IXGBE_WRITE_REG(hw, IXGBE_LEDCTL, ixgbe->ixgbe_led_reg);
+                        ixgbe->ixgbe_led_active = B_FALSE;
+                }
+                break;
+        case MAC_LED_IDENT:
+                if (ixgbe_blink_led_start(hw, lidx) != IXGBE_SUCCESS)
+                        return (EIO);
+                ixgbe->ixgbe_led_blink = B_TRUE;
+                break;
+        case MAC_LED_OFF:
+                if (ixgbe_led_off(hw, lidx) != IXGBE_SUCCESS)
+                        return (EIO);
+                break;
+        case MAC_LED_ON:
+                if (ixgbe_led_on(hw, lidx) != IXGBE_SUCCESS)
+                        return (EIO);
+                break;
+        default:
+                return (ENOTSUP);
+        }
+
+        return (0);
+}
+
 /*
  * Obtain the MAC's capabilities and associated data from
  * the driver.
  */
 boolean_t

@@ -293,10 +348,20 @@
                 mct->mct_ntransceivers = 1;
                 mct->mct_info = ixgbe_transceiver_info;
                 mct->mct_read = ixgbe_transceiver_read;
                 return (B_TRUE);
         }
+        case MAC_CAPAB_LED: {
+                mac_capab_led_t *mcl = cap_data;
+
+                mcl->mcl_flags = 0;
+                mcl->mcl_modes = MAC_LED_DEFAULT | MAC_LED_ON | MAC_LED_OFF |
+                    MAC_LED_IDENT;
+                mcl->mcl_set = ixgbe_led_set;
+                break;
+
+        }
         default:
                 return (B_FALSE);
         }
         return (B_TRUE);
 }

@@ -418,10 +483,14 @@
                         hw->fc.requested_mode = ixgbe_fc_full;
                         break;
                 }
 setup_link:
                 if (err == 0) {
+                        /* Don't autoneg if forcing a value */
+                        ixgbe->hw.fc.disable_fc_autoneg = TRUE;
+                        (void) ixgbe_fc_enable(hw);
+
                         if (ixgbe_driver_setup_link(ixgbe, B_TRUE) !=
                             IXGBE_SUCCESS)
                                 err = EINVAL;
                 }
                 break;