Author: hselasky
Date: Tue Feb 13 15:05:23 2018
New Revision: 329205
URL: https://svnweb.freebsd.org/changeset/base/329205

Log:
  MFC r325648:
  Implement support for decoding general port notification event in
  the mlx5 core module.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/device.h
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/device.h
==============================================================================
--- stable/11/sys/dev/mlx5/device.h     Tue Feb 13 14:57:34 2018        
(r329204)
+++ stable/11/sys/dev/mlx5/device.h     Tue Feb 13 15:05:23 2018        
(r329205)
@@ -526,6 +526,11 @@ struct mlx5_eqe_port_module_event {
        u8        error_type;
 };
 
+struct mlx5_eqe_general_notification_event {
+       u32       rq_user_index_delay_drop;
+       u32       rsvd0[6];
+};
+
 union ev_data {
        __be32                          raw[7];
        struct mlx5_eqe_cmd             cmd;
@@ -539,6 +544,7 @@ union ev_data {
        struct mlx5_eqe_page_req        req_pages;
        struct mlx5_eqe_port_module_event port_module_event;
        struct mlx5_eqe_vport_change    vport_change;
+       struct mlx5_eqe_general_notification_event general_notifications;
 } __packed;
 
 struct mlx5_eqe {
@@ -1427,6 +1433,10 @@ static inline int mlx5_get_cqe_format(const struct mlx
 {
        return (cqe->op_own & MLX5E_CQE_FORMAT_MASK) >> 2;
 }
+
+enum {
+       MLX5_GEN_EVENT_SUBTYPE_DELAY_DROP_TIMEOUT = 0x1,
+};
 
 /* 8 regular priorities + 1 for multicast */
 #define MLX5_NUM_BYPASS_FTS    9

Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c  Tue Feb 13 14:57:34 2018        
(r329204)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_eq.c  Tue Feb 13 15:05:23 2018        
(r329205)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2015, Mellanox Technologies, Ltd.  All rights reserved.
+ * Copyright (c) 2013-2017, Mellanox Technologies, Ltd.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -80,6 +80,8 @@ struct cre_des_eq {
 /*Function prototype*/
 static void mlx5_port_module_event(struct mlx5_core_dev *dev,
                                   struct mlx5_eqe *eqe);
+static void mlx5_port_general_notification_event(struct mlx5_core_dev *dev,
+                                                struct mlx5_eqe *eqe);
 
 static int mlx5_cmd_destroy_eq(struct mlx5_core_dev *dev, u8 eqn)
 {
@@ -157,6 +159,8 @@ static const char *eqe_type_str(u8 type)
                return "MLX5_EVENT_TYPE_NIC_VPORT_CHANGE";
        case MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT:
                return "MLX5_EVENT_TYPE_CODING_DCBX_CHANGE_EVENT";
+       case MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT:
+               return "MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT";
        default:
                return "Unrecognized event";
        }
@@ -296,6 +300,10 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru
                        }
                        break;
 
+               case MLX5_EVENT_TYPE_CODING_GENERAL_NOTIFICATION_EVENT:
+                       mlx5_port_general_notification_event(dev, eqe);
+                       break;
+
                case MLX5_EVENT_TYPE_CQ_ERROR:
                        cqn = be32_to_cpu(eqe->data.cq_err.cqn) & 0xffffff;
                        mlx5_core_warn(dev, "CQ error on CQN 0x%x, syndrom 
0x%x\n",
@@ -665,5 +673,26 @@ static void mlx5_port_module_event(struct mlx5_core_de
        /* store module status */
        if (module_num < MLX5_MAX_PORTS)
                dev->module_status[module_num] = module_status;
+}
+
+static void mlx5_port_general_notification_event(struct mlx5_core_dev *dev,
+                                                struct mlx5_eqe *eqe)
+{
+       u8 port = (eqe->data.port.port >> 4) & 0xf;
+       u32 rqn = 0;
+       struct mlx5_eqe_general_notification_event *general_event = NULL;
+
+       switch (eqe->sub_type) {
+       case MLX5_GEN_EVENT_SUBTYPE_DELAY_DROP_TIMEOUT:
+               general_event = &eqe->data.general_notifications;
+               rqn = be32_to_cpu(general_event->rq_user_index_delay_drop) &
+                         0xffffff;
+               break;
+       default:
+               mlx5_core_warn(dev,
+                              "general event with unrecognized subtype: port 
%d, sub_type %d\n",
+                              port, eqe->sub_type);
+               break;
+       }
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to