Author: hselasky
Date: Wed Mar  7 14:51:50 2018
New Revision: 330604
URL: https://svnweb.freebsd.org/changeset/base/330604

Log:
  Add log message for unsupported QSFPs in mlx5core.
  
  Submitted by: Matthew Finlay <m...@mellanox.com>
  MFC after:    1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx5/device.h
  head/sys/dev/mlx5/mlx5_core/mlx5_eq.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c

Modified: head/sys/dev/mlx5/device.h
==============================================================================
--- head/sys/dev/mlx5/device.h  Wed Mar  7 14:49:27 2018        (r330603)
+++ head/sys/dev/mlx5/device.h  Wed Mar  7 14:51:50 2018        (r330604)
@@ -501,9 +501,10 @@ struct mlx5_eqe_vport_change {
 #define PORT_MODULE_EVENT_ERROR_TYPE_MASK     0xF
 
 enum {
-       MLX5_MODULE_STATUS_PLUGGED    = 0x1,
-       MLX5_MODULE_STATUS_UNPLUGGED  = 0x2,
-       MLX5_MODULE_STATUS_ERROR      = 0x3,
+       MLX5_MODULE_STATUS_PLUGGED_ENABLED      = 0x1,
+       MLX5_MODULE_STATUS_UNPLUGGED            = 0x2,
+       MLX5_MODULE_STATUS_ERROR                = 0x3,
+       MLX5_MODULE_STATUS_PLUGGED_DISABLED     = 0x4,
 };
 
 enum {
@@ -512,7 +513,7 @@ enum {
        MLX5_MODULE_EVENT_ERROR_BUS_STUCK                             = 0x2,
        MLX5_MODULE_EVENT_ERROR_NO_EEPROM_RETRY_TIMEOUT               = 0x3,
        MLX5_MODULE_EVENT_ERROR_ENFORCE_PART_NUMBER_LIST              = 0x4,
-       MLX5_MODULE_EVENT_ERROR_UNKNOWN_IDENTIFIER                    = 0x5,
+       MLX5_MODULE_EVENT_ERROR_UNSUPPORTED_CABLE                     = 0x5,
        MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE                      = 0x6,
        MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED                      = 0x7,
 };

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_eq.c       Wed Mar  7 14:49:27 2018        
(r330603)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_eq.c       Wed Mar  7 14:51:50 2018        
(r330604)
@@ -618,8 +618,8 @@ static const char *mlx5_port_module_event_error_type_t
                return "No EEPROM/retry timeout";
        case MLX5_MODULE_EVENT_ERROR_ENFORCE_PART_NUMBER_LIST:
                return "Enforce part number list";
-       case MLX5_MODULE_EVENT_ERROR_UNKNOWN_IDENTIFIER:
-               return "Unknown identifier";
+       case MLX5_MODULE_EVENT_ERROR_UNSUPPORTED_CABLE:
+               return "Unsupported Cable";
        case MLX5_MODULE_EVENT_ERROR_HIGH_TEMPERATURE:
                return "High Temperature";
        case MLX5_MODULE_EVENT_ERROR_CABLE_IS_SHORTED:
@@ -655,8 +655,8 @@ static void mlx5_port_module_event(struct mlx5_core_de
                     PORT_MODULE_EVENT_ERROR_TYPE_MASK;
 
        switch (module_status) {
-       case MLX5_MODULE_STATUS_PLUGGED:
-               device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, status: 
plugged\n", module_num);
+       case MLX5_MODULE_STATUS_PLUGGED_ENABLED:
+               device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, status: 
plugged and enabled\n", module_num);
                break;
 
        case MLX5_MODULE_STATUS_UNPLUGGED:
@@ -665,6 +665,10 @@ static void mlx5_port_module_event(struct mlx5_core_de
 
        case MLX5_MODULE_STATUS_ERROR:
                device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, status: 
error, %s\n", module_num, 
mlx5_port_module_event_error_type_to_string(error_type));
+               break;
+
+       case MLX5_MODULE_STATUS_PLUGGED_DISABLED:
+               device_printf((&pdev->dev)->bsddev, "INFO: ""Module %u, status: 
plugged but disabled\n", module_num);
                break;
 
        default:

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c    Wed Mar  7 14:49:27 2018        
(r330603)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c    Wed Mar  7 14:51:50 2018        
(r330604)
@@ -2639,6 +2639,7 @@ mlx5e_ioctl(struct ifnet *ifp, u_long command, caddr_t
        int error = 0;
        int mask = 0;
        int size_read = 0;
+       int module_status;
        int module_num;
        int max_mtu;
        uint8_t read_addr;
@@ -2838,8 +2839,9 @@ out:
                        goto err_i2c;
                }
                /* Check if module is present before doing an access */
-               if (mlx5_query_module_status(priv->mdev, module_num) !=
-                   MLX5_MODULE_STATUS_PLUGGED) {
+               module_status = mlx5_query_module_status(priv->mdev, 
module_num);
+               if (module_status != MLX5_MODULE_STATUS_PLUGGED_ENABLED &&
+                   module_status != MLX5_MODULE_STATUS_PLUGGED_DISABLED) {
                        error = EINVAL;
                        goto err_i2c;
                }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to