svn commit: r325648 - in head/sys/dev/mlx5: . mlx5_core

Hans Petter Selasky hselasky at FreeBSD.org
Fri Nov 10 13:25:31 UTC 2017


Author: hselasky
Date: Fri Nov 10 13:25:29 2017
New Revision: 325648
URL: https://svnweb.freebsd.org/changeset/base/325648

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

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

Modified: head/sys/dev/mlx5/device.h
==============================================================================
--- head/sys/dev/mlx5/device.h	Fri Nov 10 13:17:40 2017	(r325647)
+++ head/sys/dev/mlx5/device.h	Fri Nov 10 13:25:29 2017	(r325648)
@@ -486,6 +486,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;
@@ -499,6 +504,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 {
@@ -1386,6 +1392,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: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_eq.c	Fri Nov 10 13:17:40 2017	(r325647)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_eq.c	Fri Nov 10 13:25:29 2017	(r325648)
@@ -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;
+	}
 }
 


More information about the svn-src-head mailing list