@@ -390,12 +390,23 @@ static int devlink_nl_health_reporter_get_dump_one(struct sk_buff *msg,
390
390
int flags )
391
391
{
392
392
struct devlink_nl_dump_state * state = devlink_dump_state (cb );
393
+ const struct genl_dumpit_info * info = genl_dumpit_info (cb );
393
394
struct devlink_health_reporter * reporter ;
395
+ unsigned long port_index_end = ULONG_MAX ;
396
+ struct nlattr * * attrs = info -> attrs ;
397
+ unsigned long port_index_start = 0 ;
394
398
struct devlink_port * port ;
395
399
unsigned long port_index ;
396
400
int idx = 0 ;
397
401
int err ;
398
402
403
+ if (attrs && attrs [DEVLINK_ATTR_PORT_INDEX ]) {
404
+ port_index_start = nla_get_u32 (attrs [DEVLINK_ATTR_PORT_INDEX ]);
405
+ port_index_end = port_index_start ;
406
+ flags |= NLM_F_DUMP_FILTERED ;
407
+ goto per_port_dump ;
408
+ }
409
+
399
410
list_for_each_entry (reporter , & devlink -> reporter_list , list ) {
400
411
if (idx < state -> idx ) {
401
412
idx ++ ;
@@ -412,7 +423,9 @@ static int devlink_nl_health_reporter_get_dump_one(struct sk_buff *msg,
412
423
}
413
424
idx ++ ;
414
425
}
415
- xa_for_each (& devlink -> ports , port_index , port ) {
426
+ per_port_dump :
427
+ xa_for_each_range (& devlink -> ports , port_index , port ,
428
+ port_index_start , port_index_end ) {
416
429
list_for_each_entry (reporter , & port -> reporter_list , list ) {
417
430
if (idx < state -> idx ) {
418
431
idx ++ ;
0 commit comments