Skip to content

Commit 98b9ee2

Browse files
stuartsummersdledford
authored andcommitted
IB/hfi1: Cache neighbor secure data after link up
Secure data is transferred across the link during verify cap. This includes Neighbor Guid, Type, and Port Number. This transfer is not guaranteed to complete until the 8051 firmware has completed processing of the state_complete frame. Move the consumption of this data from verify cap handling to link up handling to ensure the data is finalized. Additionally, do not notify the SM that the link is up until after this data is actually available. Reviewed-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Easwar Hariharan <easwar.hariharan@intel.com> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Stuart Summers <john.s.summers@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent 03e80e9 commit 98b9ee2

File tree

3 files changed

+27
-38
lines changed

3 files changed

+27
-38
lines changed

drivers/infiniband/hw/hfi1/chip.c

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7323,15 +7323,6 @@ void handle_verify_cap(struct work_struct *work)
73237323
lcb_shutdown(dd, 0);
73247324
adjust_lcb_for_fpga_serdes(dd);
73257325

7326-
/*
7327-
* These are now valid:
7328-
* remote VerifyCap fields in the general LNI config
7329-
* CSR DC8051_STS_REMOTE_GUID
7330-
* CSR DC8051_STS_REMOTE_NODE_TYPE
7331-
* CSR DC8051_STS_REMOTE_FM_SECURITY
7332-
* CSR DC8051_STS_REMOTE_PORT_NO
7333-
*/
7334-
73357326
read_vc_remote_phy(dd, &power_management, &continious);
73367327
read_vc_remote_fabric(dd, &vau, &z, &vcu, &vl15buf,
73377328
&partner_supported_crc);
@@ -7462,20 +7453,6 @@ void handle_verify_cap(struct work_struct *work)
74627453
write_csr(dd, DC_LCB_ERR_EN, 0); /* mask LCB errors */
74637454
set_8051_lcb_access(dd);
74647455

7465-
ppd->neighbor_guid =
7466-
read_csr(dd, DC_DC8051_STS_REMOTE_GUID);
7467-
ppd->neighbor_port_number = read_csr(dd, DC_DC8051_STS_REMOTE_PORT_NO) &
7468-
DC_DC8051_STS_REMOTE_PORT_NO_VAL_SMASK;
7469-
ppd->neighbor_type =
7470-
read_csr(dd, DC_DC8051_STS_REMOTE_NODE_TYPE) &
7471-
DC_DC8051_STS_REMOTE_NODE_TYPE_VAL_MASK;
7472-
ppd->neighbor_fm_security =
7473-
read_csr(dd, DC_DC8051_STS_REMOTE_FM_SECURITY) &
7474-
DC_DC8051_STS_LOCAL_FM_SECURITY_DISABLED_MASK;
7475-
dd_dev_info(dd,
7476-
"Neighbor Guid: %llx Neighbor type %d MgmtAllowed %d FM security bypass %d\n",
7477-
ppd->neighbor_guid, ppd->neighbor_type,
7478-
ppd->mgmt_allowed, ppd->neighbor_fm_security);
74797456
if (ppd->mgmt_allowed)
74807457
add_full_mgmt_pkey(ppd);
74817458

@@ -10535,11 +10512,8 @@ int set_link_state(struct hfi1_pportdata *ppd, u32 state)
1053510512
goto unexpected;
1053610513
}
1053710514

10538-
ppd->host_link_state = HLS_UP_INIT;
1053910515
ret = wait_logical_linkstate(ppd, IB_PORT_INIT, 1000);
1054010516
if (ret) {
10541-
/* logical state didn't change, stay at going_up */
10542-
ppd->host_link_state = HLS_GOING_UP;
1054310517
dd_dev_err(dd,
1054410518
"%s: logical state did not change to INIT\n",
1054510519
__func__);
@@ -10553,6 +10527,7 @@ int set_link_state(struct hfi1_pportdata *ppd, u32 state)
1055310527
add_rcvctrl(dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
1055410528

1055510529
handle_linkup_change(dd, 1);
10530+
ppd->host_link_state = HLS_UP_INIT;
1055610531
}
1055710532
break;
1055810533
case HLS_UP_ARMED:

drivers/infiniband/hw/hfi1/hfi.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,16 @@ int hfi1_reset_device(int);
13071307
/* return the driver's idea of the logical OPA port state */
13081308
static inline u32 driver_lstate(struct hfi1_pportdata *ppd)
13091309
{
1310-
return ppd->lstate; /* use the cached value */
1310+
/*
1311+
* The driver does some processing from the time the logical
1312+
* link state is at INIT to the time the SM can be notified
1313+
* as such. Return IB_PORT_DOWN until the software state
1314+
* is ready.
1315+
*/
1316+
if (ppd->lstate == IB_PORT_INIT && !(ppd->host_link_state & HLS_UP))
1317+
return IB_PORT_DOWN;
1318+
else
1319+
return ppd->lstate;
13111320
}
13121321

13131322
void receive_interrupt_work(struct work_struct *work);

drivers/infiniband/hw/hfi1/intr.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,24 @@ void handle_linkup_change(struct hfi1_devdata *dd, u32 linkup)
131131
if (quick_linkup || dd->icode == ICODE_FUNCTIONAL_SIMULATOR) {
132132
set_up_vl15(dd, dd->vau, dd->vl15_init);
133133
assign_remote_cm_au_table(dd, dd->vcu);
134-
ppd->neighbor_guid =
135-
read_csr(dd, DC_DC8051_STS_REMOTE_GUID);
136-
ppd->neighbor_type =
137-
read_csr(dd, DC_DC8051_STS_REMOTE_NODE_TYPE) &
138-
DC_DC8051_STS_REMOTE_NODE_TYPE_VAL_MASK;
139-
ppd->neighbor_port_number =
140-
read_csr(dd, DC_DC8051_STS_REMOTE_PORT_NO) &
141-
DC_DC8051_STS_REMOTE_PORT_NO_VAL_SMASK;
142-
dd_dev_info(dd, "Neighbor GUID: %llx Neighbor type %d\n",
143-
ppd->neighbor_guid,
144-
ppd->neighbor_type);
145134
}
146135

136+
ppd->neighbor_guid =
137+
read_csr(dd, DC_DC8051_STS_REMOTE_GUID);
138+
ppd->neighbor_type =
139+
read_csr(dd, DC_DC8051_STS_REMOTE_NODE_TYPE) &
140+
DC_DC8051_STS_REMOTE_NODE_TYPE_VAL_MASK;
141+
ppd->neighbor_port_number =
142+
read_csr(dd, DC_DC8051_STS_REMOTE_PORT_NO) &
143+
DC_DC8051_STS_REMOTE_PORT_NO_VAL_SMASK;
144+
ppd->neighbor_fm_security =
145+
read_csr(dd, DC_DC8051_STS_REMOTE_FM_SECURITY) &
146+
DC_DC8051_STS_LOCAL_FM_SECURITY_DISABLED_MASK;
147+
dd_dev_info(dd,
148+
"Neighbor Guid %llx, Type %d, Port Num %d\n",
149+
ppd->neighbor_guid, ppd->neighbor_type,
150+
ppd->neighbor_port_number);
151+
147152
/* physical link went up */
148153
ppd->linkup = 1;
149154
ppd->offline_disabled_reason =

0 commit comments

Comments
 (0)