0e7312b9d2
VF representors need to proxy devcmd through the PF vnic_dev instance. Extend vnic_dev to accommodate them as follows. 1. Add vnic_vf_rep_register() A VF representor creates its own vnic_dev instance via this function and saves VF ID. When performing devcmd, vnic_dev uses the saved VF ID to proxy devcmd through the PF vnic_dev instance. 2. Add vnic_register_lock() As PF and VF representors appear as independent ports to the application, its threads may invoke APIs on them simultaneously, leading to race conditions on the PF vnic_dev. For example, thread A can query stats on PF port, while thread B queries stats on a VF representor. The PF port invokes this function to provide a lock to vnic_dev. This lock is used to serialize devcmd calls from PF and VF representors. 3. Add utility functions to assist VF representor settings vnic_dev_mtu() and vnic_dev_uif() retrieve vnic MTU and UIF number (uplink index), respectively. Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com> Reviewed-by: John Daley <johndale@cisco.com>