Implement support for decoding general port notification event in

the mlx5 core module.

Sponsored by:	Mellanox Technologies
MFC after:	1 week
This commit is contained in:
hselasky 2017-11-10 13:25:29 +00:00
parent c2e27b84ac
commit a511b8c8a5
2 changed files with 40 additions and 1 deletions

View File

@ -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 {
@ -1387,6 +1393,10 @@ static inline int mlx5_get_cqe_format(const struct mlx5_cqe64 *cqe)
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

View File

@ -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, struct mlx5_eq *eq)
}
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",
@ -667,3 +675,24 @@ static void mlx5_port_module_event(struct mlx5_core_dev *dev,
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;
}
}