e71383fb9cd1 net/mlx5: Light probe local SFs
kernel 6.5 merge了上面的commit后,SF的行为有了个变化,以前active local sf的时候,auxiliary sub-device就会创建,现在要等到devlink reload之后。
devlink port add pci/0000:08:00.0 flavour pcisf pfnum 0 sfnum 1
devlink port function set en8f0pf0sf1 state active
devlink dev param set auxiliary/mlx5_core.sf.2 name enable_eth value true cmode driverinit
devlink会传DEVLINK_PORT_FLAVOUR_PCI_SF到kernel,创建local sf
devlink_nl_cmd_port_new_doit
mlx5_devlink_sf_port_new
mlx5_sf_add
mlx5_sf_alloc
mlx5_sf_hw_table_sf_alloc
mlx5_sf_hw_table_sf_alloc
mlx5_cmd_alloc_sf
mlx5_modify_vhca_sw_id
mlx5_eswitch_load_sf_vport
mlx5_esw_offloads_init_sf_rep
mlx5_esw_offloads_sf_devlink_port_init
mlx5_eswitch_load_vport
mlx5_esw_vport_enable
mlx5_esw_offloads_load_rep
mlx5_esw_offloads_devlink_port_register
devl_port_register_with_ops
devl_rate_leaf_create
mlx5_esw_offloads_rep_load
# devlink port function set en8f0pf0sf1 state active
mlx5_devlink_sf_port_fn_state_set
mlx5_sf_table_try_get
mlx5_sf_lookup_by_index
mlx5_sf_state_set
mlx5_sf_activate
mlx5_cmd_sf_enable_hca
mlx5_sf_inactivate
mlx5_cmd_sf_disable_hca
下面的notifier block函数会被连续调好几遍:
[Fri Oct 27 11:52:03 2023] mlx5_sf_vhca_event: called
[Fri Oct 27 11:52:03 2023] mlx5_sf_hw_vhca_event: called
[Fri Oct 27 11:52:03 2023] mlx5_sf_dev_state_change_handler: called
8.339618 135039 135039 kworker/u48:0 mlx5_sf_dev_probe
b'mlx5_sf_dev_probe+0x5 [mlx5_core]'
b'call_driver_probe+0x26 [kernel]'
b'really_probe+0x1a6 [kernel]'
b'__driver_probe_device+0x7e [kernel]'
b'driver_probe_device+0x23 [kernel]'
b'__device_attach_driver+0x92 [kernel]'
b'bus_for_each_drv+0x8d [kernel]'
b'__device_attach+0xc6 [kernel]'
b'device_initial_probe+0x17 [kernel]'
b'bus_probe_device+0xa8 [kernel]'
b'device_add+0x431 [kernel]'
b'__auxiliary_device_add+0x45 [kernel]'
b'mlx5_sf_dev_add+0x10f [mlx5_core]'
b'mlx5_sf_dev_state_change_handler+0x152 [mlx5_core]'
b'notifier_call_chain+0x49 [kernel]'
b'blocking_notifier_call_chain+0x4d [kernel]'
b'mlx5_vhca_event_notify+0xf2 [mlx5_core]'
b'mlx5_vhca_state_work_handler+0x22 [mlx5_core]'
b'process_one_work+0x1f5 [kernel]'
b'worker_thread+0x1cd [kernel]'
b'kthread+0x10d [kernel]'
b'ret_from_fork+0x3d [kernel]'
b'ret_from_fork_asm+0x1b [kernel]'
devlink dev reload auxiliary/mlx5_core.sf.2
12.00634 145115 145115 devlink register_netdev
b'register_netdev+0x5 [kernel]'
mlx5e_probe
b'auxiliary_bus_probe+0x42 [kernel]'
b'call_driver_probe+0x26 [kernel]'
b'really_probe+0x1a6 [kernel]'
b'__driver_probe_device+0x7e [kernel]'
b'driver_probe_device+0x23 [kernel]'
b'__device_attach_driver+0x92 [kernel]'
b'bus_for_each_drv+0x8d [kernel]'
b'__device_attach+0xc6 [kernel]'
b'device_initial_probe+0x17 [kernel]'
b'bus_probe_device+0xa8 [kernel]'
b'device_add+0x431 [kernel]'
b'__auxiliary_device_add+0x45 [kernel]'
b'add_adev+0x9e [mlx5_core]'
b'add_drivers+0xa6 [mlx5_core]'
b'mlx5_rescan_drivers_locked+0x4e [mlx5_core]'
b'mlx5_register_device+0x40 [mlx5_core]'
b'mlx5_init_one_devl_locked+0x114 [mlx5_core]'
b'mlx5_devlink_reload_up+0xc8 [mlx5_core]'
b'devlink_reload+0xfe [kernel]'
b'devlink_nl_cmd_reload+0x12a [kernel]'
b'genl_family_rcv_msg_doit+0xd7 [kernel]'
b'genl_family_rcv_msg+0x148 [kernel]'
b'genl_rcv_msg+0x50 [kernel]'
b'netlink_rcv_skb+0x5d [kernel]'
b'genl_rcv+0x2d [kernel]'
b'netlink_unicast+0x1b6 [kernel]'
b'netlink_sendmsg+0x25c [kernel]'
b'sock_sendmsg+0xbb [kernel]'
b'__sys_sendto+0x12b [kernel]'
b'__x64_sys_sendto+0x2d [kernel]'
b'do_syscall_64+0x3c [kernel]'
b'entry_SYSCALL_64_after_hwframe+0x6e [kernel]'