@@ -1238,7 +1238,7 @@ static int port_states_transition_allowed(struct hfi1_pportdata *ppd,
1238
1238
}
1239
1239
1240
1240
static int set_port_states (struct hfi1_pportdata * ppd , struct opa_smp * smp ,
1241
- u32 logical_state , u32 phys_state )
1241
+ u32 logical_state , u32 phys_state , int local_mad )
1242
1242
{
1243
1243
struct hfi1_devdata * dd = ppd -> dd ;
1244
1244
u32 link_state ;
@@ -1314,7 +1314,7 @@ static int set_port_states(struct hfi1_pportdata *ppd, struct opa_smp *smp,
1314
1314
* Don't send a reply if the response would be sent
1315
1315
* through the disabled port.
1316
1316
*/
1317
- if (link_state == HLS_DN_DISABLE && smp -> hop_cnt )
1317
+ if (link_state == HLS_DN_DISABLE && ! local_mad )
1318
1318
return IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_CONSUMED ;
1319
1319
break ;
1320
1320
case IB_PORT_ARMED :
@@ -1350,7 +1350,7 @@ static int set_port_states(struct hfi1_pportdata *ppd, struct opa_smp *smp,
1350
1350
*/
1351
1351
static int __subn_set_opa_portinfo (struct opa_smp * smp , u32 am , u8 * data ,
1352
1352
struct ib_device * ibdev , u8 port ,
1353
- u32 * resp_len , u32 max_len )
1353
+ u32 * resp_len , u32 max_len , int local_mad )
1354
1354
{
1355
1355
struct opa_port_info * pi = (struct opa_port_info * )data ;
1356
1356
struct ib_event event ;
@@ -1634,7 +1634,7 @@ static int __subn_set_opa_portinfo(struct opa_smp *smp, u32 am, u8 *data,
1634
1634
*/
1635
1635
1636
1636
if (!invalid ) {
1637
- ret = set_port_states (ppd , smp , ls_new , ps_new );
1637
+ ret = set_port_states (ppd , smp , ls_new , ps_new , local_mad );
1638
1638
if (ret )
1639
1639
return ret ;
1640
1640
}
@@ -2085,7 +2085,7 @@ static int __subn_get_opa_psi(struct opa_smp *smp, u32 am, u8 *data,
2085
2085
2086
2086
static int __subn_set_opa_psi (struct opa_smp * smp , u32 am , u8 * data ,
2087
2087
struct ib_device * ibdev , u8 port ,
2088
- u32 * resp_len , u32 max_len )
2088
+ u32 * resp_len , u32 max_len , int local_mad )
2089
2089
{
2090
2090
u32 nports = OPA_AM_NPORT (am );
2091
2091
u32 start_of_sm_config = OPA_AM_START_SM_CFG (am );
@@ -2122,7 +2122,7 @@ static int __subn_set_opa_psi(struct opa_smp *smp, u32 am, u8 *data,
2122
2122
}
2123
2123
2124
2124
if (!invalid ) {
2125
- ret = set_port_states (ppd , smp , ls_new , ps_new );
2125
+ ret = set_port_states (ppd , smp , ls_new , ps_new , local_mad );
2126
2126
if (ret )
2127
2127
return ret ;
2128
2128
}
@@ -4190,15 +4190,15 @@ static int subn_get_opa_sma(__be16 attr_id, struct opa_smp *smp, u32 am,
4190
4190
4191
4191
static int subn_set_opa_sma (__be16 attr_id , struct opa_smp * smp , u32 am ,
4192
4192
u8 * data , struct ib_device * ibdev , u8 port ,
4193
- u32 * resp_len , u32 max_len )
4193
+ u32 * resp_len , u32 max_len , int local_mad )
4194
4194
{
4195
4195
int ret ;
4196
4196
struct hfi1_ibport * ibp = to_iport (ibdev , port );
4197
4197
4198
4198
switch (attr_id ) {
4199
4199
case IB_SMP_ATTR_PORT_INFO :
4200
4200
ret = __subn_set_opa_portinfo (smp , am , data , ibdev , port ,
4201
- resp_len , max_len );
4201
+ resp_len , max_len , local_mad );
4202
4202
break ;
4203
4203
case IB_SMP_ATTR_PKEY_TABLE :
4204
4204
ret = __subn_set_opa_pkeytable (smp , am , data , ibdev , port ,
@@ -4222,7 +4222,7 @@ static int subn_set_opa_sma(__be16 attr_id, struct opa_smp *smp, u32 am,
4222
4222
break ;
4223
4223
case OPA_ATTRIB_ID_PORT_STATE_INFO :
4224
4224
ret = __subn_set_opa_psi (smp , am , data , ibdev , port ,
4225
- resp_len , max_len );
4225
+ resp_len , max_len , local_mad );
4226
4226
break ;
4227
4227
case OPA_ATTRIB_ID_BUFFER_CONTROL_TABLE :
4228
4228
ret = __subn_set_opa_bct (smp , am , data , ibdev , port ,
@@ -4314,7 +4314,7 @@ static int subn_get_opa_aggregate(struct opa_smp *smp,
4314
4314
4315
4315
static int subn_set_opa_aggregate (struct opa_smp * smp ,
4316
4316
struct ib_device * ibdev , u8 port ,
4317
- u32 * resp_len )
4317
+ u32 * resp_len , int local_mad )
4318
4318
{
4319
4319
int i ;
4320
4320
u32 num_attr = be32_to_cpu (smp -> attr_mod ) & 0x000000ff ;
@@ -4344,7 +4344,9 @@ static int subn_set_opa_aggregate(struct opa_smp *smp,
4344
4344
}
4345
4345
4346
4346
(void )subn_set_opa_sma (agg -> attr_id , smp , am , agg -> data ,
4347
- ibdev , port , NULL , (u32 )agg_data_len );
4347
+ ibdev , port , NULL , (u32 )agg_data_len ,
4348
+ local_mad );
4349
+
4348
4350
if (smp -> status & IB_SMP_INVALID_FIELD )
4349
4351
break ;
4350
4352
if (smp -> status & ~IB_SMP_DIRECTION ) {
@@ -4519,7 +4521,7 @@ static int hfi1_pkey_validation_pma(struct hfi1_ibport *ibp,
4519
4521
static int process_subn_opa (struct ib_device * ibdev , int mad_flags ,
4520
4522
u8 port , const struct opa_mad * in_mad ,
4521
4523
struct opa_mad * out_mad ,
4522
- u32 * resp_len )
4524
+ u32 * resp_len , int local_mad )
4523
4525
{
4524
4526
struct opa_smp * smp = (struct opa_smp * )out_mad ;
4525
4527
struct hfi1_ibport * ibp = to_iport (ibdev , port );
@@ -4588,11 +4590,11 @@ static int process_subn_opa(struct ib_device *ibdev, int mad_flags,
4588
4590
default :
4589
4591
ret = subn_set_opa_sma (attr_id , smp , am , data ,
4590
4592
ibdev , port , resp_len ,
4591
- data_size );
4593
+ data_size , local_mad );
4592
4594
break ;
4593
4595
case OPA_ATTRIB_ID_AGGREGATE :
4594
4596
ret = subn_set_opa_aggregate (smp , ibdev , port ,
4595
- resp_len );
4597
+ resp_len , local_mad );
4596
4598
break ;
4597
4599
}
4598
4600
break ;
@@ -4832,6 +4834,7 @@ static int hfi1_process_opa_mad(struct ib_device *ibdev, int mad_flags,
4832
4834
{
4833
4835
int ret ;
4834
4836
int pkey_idx ;
4837
+ int local_mad = 0 ;
4835
4838
u32 resp_len = 0 ;
4836
4839
struct hfi1_ibport * ibp = to_iport (ibdev , port );
4837
4840
@@ -4846,13 +4849,14 @@ static int hfi1_process_opa_mad(struct ib_device *ibdev, int mad_flags,
4846
4849
switch (in_mad -> mad_hdr .mgmt_class ) {
4847
4850
case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE :
4848
4851
case IB_MGMT_CLASS_SUBN_LID_ROUTED :
4849
- if (is_local_mad (ibp , in_mad , in_wc )) {
4852
+ local_mad = is_local_mad (ibp , in_mad , in_wc );
4853
+ if (local_mad ) {
4850
4854
ret = opa_local_smp_check (ibp , in_wc );
4851
4855
if (ret )
4852
4856
return IB_MAD_RESULT_FAILURE ;
4853
4857
}
4854
4858
ret = process_subn_opa (ibdev , mad_flags , port , in_mad ,
4855
- out_mad , & resp_len );
4859
+ out_mad , & resp_len , local_mad );
4856
4860
goto bail ;
4857
4861
case IB_MGMT_CLASS_PERF_MGMT :
4858
4862
ret = hfi1_pkey_validation_pma (ibp , in_mad , in_wc );
0 commit comments