diff options
author | Jack Morgenstein <jackm@dev.mellanox.co.il> | 2012-06-19 04:21:40 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-07-10 12:47:10 -0400 |
commit | 00f5ce99dc6ee46c3113393cc8fa12173f9bbcd7 (patch) | |
tree | cbcd8e2afcd492b3677bf3eedec29b34f249129c /include/linux/mlx4 | |
parent | 3045f0920367e625bbec7d66fadb444e673515af (diff) |
mlx4: Use port management change event instead of smp_snoop
The port management change event can replace smp_snoop. If the
capability bit for this event is set in dev-caps, the event is used
(by the driver setting the PORT_MNG_CHG_EVENT bit in the async event
mask in the MAP_EQ fw command). In this case, when the driver passes
incoming SMP PORT_INFO SET mads to the FW, the FW generates port
management change events to signal any changes to the driver.
If the FW generates these events, smp_snoop shouldn't be invoked in
ib_process_mad(), or duplicate events will occur (once from the
FW-generated event, and once from smp_snoop).
In the case where the FW does not generate port management change
events smp_snoop needs to be invoked to create these events. The flow
in smp_snoop has been modified to make use of the same procedures as
in the fw-generated-event event case to generate the port management
events (LID change, Client-rereg, Pkey change, and/or GID change).
Port management change event handling required changing the
mlx4_ib_event and mlx4_dispatch_event prototypes; the "param" argument
(last argument) had to be changed to unsigned long in order to
accomodate passing the EQE pointer.
We also needed to move the definition of struct mlx4_eqe from
net/mlx4.h to file device.h -- to make it available to the IB driver,
to handle port management change events.
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'include/linux/mlx4')
-rw-r--r-- | include/linux/mlx4/device.h | 99 | ||||
-rw-r--r-- | include/linux/mlx4/driver.h | 3 |
2 files changed, 100 insertions, 2 deletions
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 8eadf0f14cc5..560b2201519f 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -96,7 +96,8 @@ enum { | |||
96 | MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, | 96 | MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41, |
97 | MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, | 97 | MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42, |
98 | MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, | 98 | MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48, |
99 | MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55 | 99 | MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55, |
100 | MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59, | ||
100 | }; | 101 | }; |
101 | 102 | ||
102 | enum { | 103 | enum { |
@@ -138,6 +139,7 @@ enum mlx4_event { | |||
138 | MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18, | 139 | MLX4_EVENT_TYPE_COMM_CHANNEL = 0x18, |
139 | MLX4_EVENT_TYPE_FATAL_WARNING = 0x1b, | 140 | MLX4_EVENT_TYPE_FATAL_WARNING = 0x1b, |
140 | MLX4_EVENT_TYPE_FLR_EVENT = 0x1c, | 141 | MLX4_EVENT_TYPE_FLR_EVENT = 0x1c, |
142 | MLX4_EVENT_TYPE_PORT_MNG_CHG_EVENT = 0x1d, | ||
141 | MLX4_EVENT_TYPE_NONE = 0xff, | 143 | MLX4_EVENT_TYPE_NONE = 0xff, |
142 | }; | 144 | }; |
143 | 145 | ||
@@ -235,6 +237,24 @@ enum { | |||
235 | MLX4_MAX_FAST_REG_PAGES = 511, | 237 | MLX4_MAX_FAST_REG_PAGES = 511, |
236 | }; | 238 | }; |
237 | 239 | ||
240 | enum { | ||
241 | MLX4_DEV_PMC_SUBTYPE_GUID_INFO = 0x14, | ||
242 | MLX4_DEV_PMC_SUBTYPE_PORT_INFO = 0x15, | ||
243 | MLX4_DEV_PMC_SUBTYPE_PKEY_TABLE = 0x16, | ||
244 | }; | ||
245 | |||
246 | /* Port mgmt change event handling */ | ||
247 | enum { | ||
248 | MLX4_EQ_PORT_INFO_MSTR_SM_LID_CHANGE_MASK = 1 << 0, | ||
249 | MLX4_EQ_PORT_INFO_GID_PFX_CHANGE_MASK = 1 << 1, | ||
250 | MLX4_EQ_PORT_INFO_LID_CHANGE_MASK = 1 << 2, | ||
251 | MLX4_EQ_PORT_INFO_CLIENT_REREG_MASK = 1 << 3, | ||
252 | MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK = 1 << 4, | ||
253 | }; | ||
254 | |||
255 | #define MSTR_SM_CHANGE_MASK (MLX4_EQ_PORT_INFO_MSTR_SM_SL_CHANGE_MASK | \ | ||
256 | MLX4_EQ_PORT_INFO_MSTR_SM_LID_CHANGE_MASK) | ||
257 | |||
238 | static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) | 258 | static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) |
239 | { | 259 | { |
240 | return (major << 32) | (minor << 16) | subminor; | 260 | return (major << 32) | (minor << 16) | subminor; |
@@ -511,6 +531,81 @@ struct mlx4_dev { | |||
511 | int num_vfs; | 531 | int num_vfs; |
512 | }; | 532 | }; |
513 | 533 | ||
534 | struct mlx4_eqe { | ||
535 | u8 reserved1; | ||
536 | u8 type; | ||
537 | u8 reserved2; | ||
538 | u8 subtype; | ||
539 | union { | ||
540 | u32 raw[6]; | ||
541 | struct { | ||
542 | __be32 cqn; | ||
543 | } __packed comp; | ||
544 | struct { | ||
545 | u16 reserved1; | ||
546 | __be16 token; | ||
547 | u32 reserved2; | ||
548 | u8 reserved3[3]; | ||
549 | u8 status; | ||
550 | __be64 out_param; | ||
551 | } __packed cmd; | ||
552 | struct { | ||
553 | __be32 qpn; | ||
554 | } __packed qp; | ||
555 | struct { | ||
556 | __be32 srqn; | ||
557 | } __packed srq; | ||
558 | struct { | ||
559 | __be32 cqn; | ||
560 | u32 reserved1; | ||
561 | u8 reserved2[3]; | ||
562 | u8 syndrome; | ||
563 | } __packed cq_err; | ||
564 | struct { | ||
565 | u32 reserved1[2]; | ||
566 | __be32 port; | ||
567 | } __packed port_change; | ||
568 | struct { | ||
569 | #define COMM_CHANNEL_BIT_ARRAY_SIZE 4 | ||
570 | u32 reserved; | ||
571 | u32 bit_vec[COMM_CHANNEL_BIT_ARRAY_SIZE]; | ||
572 | } __packed comm_channel_arm; | ||
573 | struct { | ||
574 | u8 port; | ||
575 | u8 reserved[3]; | ||
576 | __be64 mac; | ||
577 | } __packed mac_update; | ||
578 | struct { | ||
579 | __be32 slave_id; | ||
580 | } __packed flr_event; | ||
581 | struct { | ||
582 | __be16 current_temperature; | ||
583 | __be16 warning_threshold; | ||
584 | } __packed warming; | ||
585 | struct { | ||
586 | u8 reserved[3]; | ||
587 | u8 port; | ||
588 | union { | ||
589 | struct { | ||
590 | __be16 mstr_sm_lid; | ||
591 | __be16 port_lid; | ||
592 | __be32 changed_attr; | ||
593 | u8 reserved[3]; | ||
594 | u8 mstr_sm_sl; | ||
595 | __be64 gid_prefix; | ||
596 | } __packed port_info; | ||
597 | struct { | ||
598 | __be32 block_ptr; | ||
599 | __be32 tbl_entries_mask; | ||
600 | } __packed tbl_change_info; | ||
601 | } params; | ||
602 | } __packed port_mgmt_change; | ||
603 | } event; | ||
604 | u8 slave_id; | ||
605 | u8 reserved3[2]; | ||
606 | u8 owner; | ||
607 | } __packed; | ||
608 | |||
514 | struct mlx4_init_port_param { | 609 | struct mlx4_init_port_param { |
515 | int set_guid0; | 610 | int set_guid0; |
516 | int set_node_guid; | 611 | int set_node_guid; |
@@ -536,6 +631,8 @@ struct mlx4_init_port_param { | |||
536 | 631 | ||
537 | #define MLX4_INVALID_SLAVE_ID 0xFF | 632 | #define MLX4_INVALID_SLAVE_ID 0xFF |
538 | 633 | ||
634 | void handle_port_mgmt_change_event(struct work_struct *work); | ||
635 | |||
539 | static inline int mlx4_is_master(struct mlx4_dev *dev) | 636 | static inline int mlx4_is_master(struct mlx4_dev *dev) |
540 | { | 637 | { |
541 | return dev->flags & MLX4_FLAG_MASTER; | 638 | return dev->flags & MLX4_FLAG_MASTER; |
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h index 5f1298b1b5ef..0f509229fb3d 100644 --- a/include/linux/mlx4/driver.h +++ b/include/linux/mlx4/driver.h | |||
@@ -42,13 +42,14 @@ enum mlx4_dev_event { | |||
42 | MLX4_DEV_EVENT_PORT_UP, | 42 | MLX4_DEV_EVENT_PORT_UP, |
43 | MLX4_DEV_EVENT_PORT_DOWN, | 43 | MLX4_DEV_EVENT_PORT_DOWN, |
44 | MLX4_DEV_EVENT_PORT_REINIT, | 44 | MLX4_DEV_EVENT_PORT_REINIT, |
45 | MLX4_DEV_EVENT_PORT_MGMT_CHANGE, | ||
45 | }; | 46 | }; |
46 | 47 | ||
47 | struct mlx4_interface { | 48 | struct mlx4_interface { |
48 | void * (*add) (struct mlx4_dev *dev); | 49 | void * (*add) (struct mlx4_dev *dev); |
49 | void (*remove)(struct mlx4_dev *dev, void *context); | 50 | void (*remove)(struct mlx4_dev *dev, void *context); |
50 | void (*event) (struct mlx4_dev *dev, void *context, | 51 | void (*event) (struct mlx4_dev *dev, void *context, |
51 | enum mlx4_dev_event event, int port); | 52 | enum mlx4_dev_event event, unsigned long param); |
52 | void * (*get_dev)(struct mlx4_dev *dev, void *context, u8 port); | 53 | void * (*get_dev)(struct mlx4_dev *dev, void *context, u8 port); |
53 | struct list_head list; | 54 | struct list_head list; |
54 | enum mlx4_protocol protocol; | 55 | enum mlx4_protocol protocol; |