+
    €DAiÐR  ã                   óö   € ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIHtHtHtHt ^RI	H
t
 ^RIHt ^ RIt ! R R]4      tR R ltR	 R
 ltR R ltR R ltR tR R ltR R ltR R ltR tR tRR ltRR ltR# )é    N)ÚDictÚListÚOptionalÚSet)Úutils)ÚConfigurationErrorc                   ó^  a € ] tR t^"t o RtV 3R lR lt]V 3R lR l4       t]V 3R lR l4       tV 3R lR	 lt	]V 3R
 lR l4       t
]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       tV 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )Ú	PCIDevicez.Helper class for interaction with a PCI devicec                ó    <€ V ^8„  d   QhRS[ /# )é   Úpci_addr©Ústr)ÚformatÚ__classdict__s   "€Ú+/usr/share/netplan/netplan_cli/cli/sriov.pyÚ__annotate__ÚPCIDevice.__annotate__%   s   ø€ ÷ !ñ !¡ñ !ó    c                ó   € Wn         R# )zVInitialise a new PCI device handler
:param pci_addr: PCI address of device
:type: str
N©r   )Úselfr   s   &&r   Ú__init__ÚPCIDevice.__init__%   s	   € ð
 !Žr   c                ó    <€ V ^8„  d   QhRS[ /# ©r   Úreturnr   )r   r   s   "€r   r   r   -   s   ø€ ÷ ñ ‘Sñ r   c                ó   € R# )z]sysfs path (can be overridden for testing)
:return: full path to /sys filesystem
:rtype: str
z/sys© ©r   s   &r   ÚsysÚPCIDevice.sys,   s   € ñ r   c                ó    <€ V ^8„  d   QhRS[ /# r   r   )r   r   s   "€r   r   r   5   s   ø€ ÷ Hñ H‘cñ Hr   c                ól   € \         P                  P                  V P                  RV P                  4      # )zY/sys path for PCI device
:return: full path to PCI device in /sys filesystem
:rtype: str
zbus/pci/devices)ÚosÚpathÚjoinr!   r   r    s   &r   r&   ÚPCIDevice.path4   s$   € ô �w‰w�|‰|˜DŸH™HÐ&7¸¿¹ÓGÐGr   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# )r   Úsubpathr   r   )r   r   s   "€r   r   r   <   s   ø€ ÷ 0ñ 0™sð 0¡sñ 0r   c                óV   € \         P                  P                  V P                  V4      # )z…/sys subpath helper for PCI device
:param subpath: subpath to construct path for
:type: str
:return: self.path + subpath
:rtype: str
)r%   r&   r'   )r   r*   s   &&r   r*   ÚPCIDevice.subpath<   s   € ô �w‰w�|‰|˜DŸI™I wÓ/Ð/r   c                ó    <€ V ^8„  d   QhRS[ /# r   r   )r   r   s   "€r   r   r   F   s   ø€ ÷ ñ ™ñ r   c                óö   € Rp\         P                  P                  V P                  R4      4      '       dC   \         P                  P	                  \         P
                  ! V P                  R4      4      4      pV# )zRKernel driver for PCI device
:return: kernel driver in use for device
:rtype: str
Ú Údriver)r%   r&   Úexistsr*   ÚbasenameÚreadlink)r   r0   s   & r   r0   ÚPCIDevice.driverE   sP   € ð ˆÜ�7‰7�>‰>˜$Ÿ,™, xÓ0×1Ò1Ü—W‘W×%Ñ%¤b§k¢k°$·,±,¸xÓ2HÓ&IÓJˆFØˆr   c                ó    <€ V ^8„  d   QhRS[ /# r   ©Úbool)r   r   s   "€r   r   r   Q   ó   ø€ ÷ 6ñ 6‘tñ 6r   c                ó^   € \         P                  P                  V P                  R4      4      # )zqDetermine if device is bound to a kernel driver
:return: whether device is bound to a kernel driver
:rtype: bool
r0   ©r%   r&   r1   r*   r    s   &r   ÚboundÚPCIDevice.boundP   ó    € ô �w‰w�~‰~˜dŸl™l¨8Ó4Ó5Ð5r   c                ó    <€ V ^8„  d   QhRS[ /# r   r6   )r   r   s   "€r   r   r   Y   s   ø€ ÷ <ñ <‘tñ <r   c                ó^   € \         P                  P                  V P                  R4      4      # )z_Determine if device is a SR-IOV Physical Function
:return: whether device is a PF
:rtype: bool
Úsriov_numvfsr:   r    s   &r   Úis_pfÚPCIDevice.is_pfX   s    € ô �w‰w�~‰~˜dŸl™l¨>Ó:Ó;Ð;r   c                ó    <€ V ^8„  d   QhRS[ /# r   r6   )r   r   s   "€r   r   r   a   r8   r   c                ó^   € \         P                  P                  V P                  R4      4      # )z^Determine if device is a SR-IOV Virtual Function
:return: whether device is a VF
:rtype: bool
Úphysfnr:   r    s   &r   Úis_vfÚPCIDevice.is_vf`   r=   r   c                ó    <€ V ^8„  d   QhRS[ /# r   ©Úlist)r   r   s   "€r   r   r   i   s   ø€ ÷ ñ ™$ñ r   c                ó  € . p^ p  VP                  \        P                  P                  \        P                  ! V P                  RP                  V4      4      4      4      4       T^,          pKm    \         d     T# i ; i)zŠList Virtual Function addresses associated with a Physical Function
:return: List of PCI addresses of Virtual Functions
:rtype: list[str]
zvirtfn{})Úappendr%   r&   r2   r3   r*   r   ÚFileNotFoundError)r   Úvf_addrsÚis   &  r   rN   ÚPCIDevice.vf_addrsh   sx   € ð ˆØˆØðØ—‘Ü—G‘G×$Ñ$ÜŸš D§L¡L°×1BÑ1BÀ1Ó1EÓ$FÓGóôð ��FŠAøô %ô Øàˆðús   ‡A A2 Á2BÂ Bc                ó    <€ V ^8„  d   QhRS[ /# r   rI   )r   r   s   "€r   r   r   }   s   ø€ ÷ ;ñ ;‘Tñ ;r   c                óV   € V P                    Uu. uF  p\        V4      NK  	  up# u upi )z„List Virtual Function associated with a Physical Function
:return: List of PCI devices of Virtual Functions
:rtype: list[PCIDevice]
)rN   r
   )r   Úaddrs   & r   ÚvfsÚPCIDevice.vfs|   s$   € ð -1¯MªMÓ:©M D”	˜$–©MÑ:Ð:ùÒ:s   �&c                ó,   <€ V ^8„  d   QhRS[ RS[ RS[ /# )r   Úobj_nameÚpropÚvaluer   )r   r   s   "€r   r   r   „   s"   ø€ ÷ 
ñ 
¡Cð 
©sð 
¹3ñ 
r   c           	     ór   € \         P                  ! RRVRRP                  V P                  4      VV.4       R# )z¿Set devlink options for the PCI device
:param obj_name: devlink object to set options on
:type: str
:param prop: property to set
:type: str
:param value: value to set for property
:type: str
ú/sbin/devlinkÚdevÚsetzpci/{}N)Ú
subprocessÚ
check_callr   r   )r   rW   rX   rY   s   &&&&r   Údevlink_setÚPCIDevice.devlink_set„   s9   € ô 	×ÒàØØØØ—‘ §¡Ó.ØØðö
	
r   c                ó    <€ V ^8„  d   QhRS[ /# r   r   )r   r   s   "€r   r   r   ™   s   ø€ ÷ Uñ U¡cñ Ur   c                óB  € RV P                    2p \        P                  ! RRRRRV.\        P                  R7      p\
        P                  ! T4      pTP                  R/ 4      P                  T/ 4      P                  R	R4      #   \        P                   d     R# i ; i)
z…Query eswitch mode via devlink for the PCI device
:return: the eswitch mode or '__undetermined' if it can't be retrieved
:rtype: str
zpci/r[   z-jr\   ÚeswitchÚshow)ÚstderrÚ__undeterminedÚmode)r   r^   Úcheck_outputÚDEVNULLÚCalledProcessErrorÚjsonÚloadsÚget)r   ÚpciÚoutputÚjson_outputs   &   r   Údevlink_eswitch_modeÚPCIDevice.devlink_eswitch_mode™   s£   € ð
 �T—]‘]�OÐ$ˆð	$Ü×,Ò,à#ØØØØØðô "×)Ñ)ô
ˆFô —j’j Ó(ˆð �‰˜u bÓ)×-Ñ-¨c°2Ó6×:Ñ:¸6ÐCSÓTÐTøô ×,Ñ,ô 	$Ú#ð	$ús   ‘,B ÂBÂBc                ó    <€ V ^8„  d   QhRS[ /# r   r   )r   r   s   "€r   r   r   ¶   s   ø€ ÷ ñ ™ñ r   c                ó   € V P                   # )zJString represenation of object
:return: PCI address of string
:rtype: str
r   r    s   &r   Ú__str__ÚPCIDevice.__str__¶   s   € ð
 �}‰}Ðr   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Úpropertyr!   r&   r*   r0   r;   rA   rF   rN   rT   r`   rr   rv   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r
   r
   "   sÞ   ø‡ € Ù8÷!ð !ð ÷ó ðð ÷Hó ðH÷0ð 0ð ÷ó ðð ÷6ó ð6ð ÷<ó ð<ð ÷6ó ð6ð ÷ó ðð& ÷;ó ð;÷
ð 
÷*Uð U÷:ö r   r
   c                óN   € V ^8„  d   QhR\         P                  \        ,          /# )r   rT   ©ÚtypingÚIterabler
   )r   s   "r   r   r   ¾   s   € ÷ ñ ”&—/‘/¤)Õ,ñ r   c                ó  € . pV  Fo  pVP                   '       d   K  \        RP                  V4      R4      ;_uu_ 4       pVP                  VP                  4       VP                  V4       RRR4       Kq  	  V#   + '       g   i     K†  ; i)zBind unbound VFs to driver.z/sys/bus/pci/drivers/{}/bindÚwtN©r;   Úopenr   Úwriter   rL   )rT   r0   Ú	bound_vfsÚvfÚfs   &&   r   Úbind_vfsrŒ   ¾   sq   € à€IÛˆØ�x�xŠxÜÐ4×;Ñ;¸FÓCÀT×JÔJÈaØ—‘˜Ÿ™Ô$Ø× Ñ  Ô$÷ KÑJñ ð
 Ð÷ K×JÐJúó   ¿-A:Á:Bc                ó„   € V ^8„  d   QhR\         P                  \        ,          R\         P                  \        ,          /# )r   rT   r   r�   )r   s   "r   r   r   É   s,   € ÷ ñ ”F—O‘O¤IÕ.ð ¼6¿?¹?Ì9Õ;Uñ r   c                ó  € . pV  Fo  pVP                   '       g   K  \        RP                  V4      R4      ;_uu_ 4       pVP                  VP                  4       VP                  V4       RRR4       Kq  	  V#   + '       g   i     K†  ; i)zUnbind bound VFs from driver.z/sys/bus/pci/drivers/{}/unbindr…   Nr†   )rT   r0   Úunbound_vfsrŠ   r‹   s   &&   r   Ú
unbind_vfsr‘   É   sr   € à€KÛˆØ�8�8Š8ÜÐ6×=Ñ=¸fÓEÀt×LÔLÐPQØ—‘˜Ÿ™Ô$Ø×"Ñ" 2Ô&÷ MÑLñ ð
 Ð÷ M×LÐLúr�   c                óP   € V ^8„  d   QhR\         P                  R\        R\        /# )r   ÚnetdefÚ	interfacer   )ÚnetplanÚNetDefinitionr   r7   )r   s   "r   r   r   Ô   s'   € ÷ =ñ =œw×4Ñ4ð =Äð =Ìñ =r   c                 óz   € V P                  V\        P                  ! V4      \        P                  ! V4      R 7      # ))Ú
iface_nameÚiface_driverÚ	iface_mac)Ú_match_interfacer   Úget_interface_driver_nameÚget_interface_macaddress)r“   r”   s   &&r   Ú_interface_matchesrž   Ô   s9   € Ø×"Ñ"ØÜ×4Ò4°YÓ?Ü×0Ò0°Ó;ð #ó =ð =r   c                óZ   € V ^8„  d   QhR\         P                  R\        \        ,          /# )r   r“   r   )r•   r–   r   r   )r   s   "r   r   r   Û   s$   € ÷ !ñ !¬7×+@Ñ+@ð !ÄXÌcÅ]ñ !r   c                óÆ  € \         P                  ! 4       pV P                  '       d�   V P                  pV'       d	   W!9   d   V# \	        4       pV FS  p\        W4      '       g   K  \        V4      ^8”  d   \        RV P                  ,          4      hVP                  V4       KU  	  V'       d   \        V4      ^ ,          #  R# V P                  V9   d   V P                  # R# )zz
Try to match a netdef with the real system network interface.
Throws ConfigurationError if there is more than one match.
z3matched more than one interface for a PF device: %sN)r   Úget_interfacesÚ
_has_matchÚset_namer]   rž   Úlenr   ÚidÚaddrJ   )r“   Ú
interfacesr£   Úmatchesr”   s   &    r   Ú_get_interface_name_for_netdefr©   Û   sÂ   € ô
 "×0Ò0Ó2€JØ××ÐàŸ™ˆß˜Ô.ð ˆOä #£ˆGó (�	Ü)¨&×<Ò<Ùô �w“< !Ô#Ü,Ð-bÐek×enÑenÕ-nÓoÐoØ—‘˜IÖ&ñ (÷ Ü˜G“} QÕ'Ð'ð ñ ð �9‰9˜
Ô"Ø—9‘9Ðár   c           	     óÖ  € \         P                  P                  RV R4      p \        V4      ;_uu_ 4       pRpVP	                  4        FQ  pVP                  4       pVP                  R4      '       g   K,  VP                  R^4      ^,          pVu uuRRR4       # 	  RRR4       R#   + '       g   i     R# ; i  \         d"   p\        RT : R\        T4      : 24      hRp?ii ; i)z-
Read PCI slot name for given interface name
ú/sys/class/netzdevice/ueventNzPCI_SLOT_NAME=Ú=z!failed parsing PCI slot name for ú: )r%   r&   r'   r‡   Ú	readlinesÚstripÚ
startswithÚsplitÚIOErrorÚRuntimeErrorr   )ÚnetdevÚuevent_pathr‹   Úpci_slot_nameÚlineÚes   &     r   Ú_get_pci_slot_namer¹   ÿ   s¸   € ô —'‘'—,‘,Ð/°¸ÓI€Kð	YÜ�+×Ô !Ø ˆMØŸ™ž�Ø—z‘z“|�Ø—?‘?Ð#3×4Ô4Ø$(§J¡J¨s°AÓ$6°qÕ$9�MØ(Ñ(÷ Òá%÷ ××Òûô ô YÝËÔPSÐTUÕPVÐWÓXÐXûðYúsF   £B< ¶:B(Á5B(Â
B< ÂB(ÂB< Â(B9	Â3B< Â9B< Â<C(ÃC#Ã#C(c                óf   € V ^8„  d   QhR\         P                  R\        \        \        3,          /# ©r   Únp_stater   )r•   ÚStater   r   )r   s   "r   r   r     s&   € ÷ ñ ¤g§m¡mð ¼¼SÄ#¸X½ñ r   c                ó6  € / pV P                   P                  4        FÇ  pVP                  P                  R4      ;p'       d6   \	        WP
                  ,          4      ;p'       d   WAVP
                  &   KY  K[  VP                  '       d"   \	        V4      ;p'       d   WAVP
                  &    VP                  pT^ 8”  g   K¤  \	        T4      ;p'       g   K¹  YATP
                  &   KÉ  	  V#   \        P                   d   p\        \        T4      4      hRp?ii ; i)zz
Go through the list of netplan ethernet devices and identify which are
PFs matching them with actual network interfaces.
ÚsriovN)Ú	ethernetsÚvaluesÚlinksrn   r©   r¥   Ú_embedded_switch_modeÚ	_vf_countr•   ÚNetplanExceptionr   r   )r¼   Úpfsr“   ÚlinkÚifaceÚcountr¸   s   &      r   Ú_get_physical_functionsrÊ     sò   € ð
 €CØ×$Ñ$×+Ñ+Ö-ˆà—<‘<×#Ñ# GÓ,Ð,ˆ4Ö,Ü6°xÇÁÕ7HÓIÐIˆuÖIØ$�D—G‘G“ñ Jð
 ×+×+Ð+Ü:¸6ÓBÐB�5ÖBØ%*˜Ÿ	™	‘Nð1Ø×(Ñ(�ð �qŽyÜ:¸6ÓBÐB�5×BÐBØ%*˜Ÿ	™	“Nñ' .ð* €Jøô ×+Ñ+ô 1Ü(¬¨Q«Ó0Ð0ûð1ús   Â,C*Ã*DÃ?DÄDc                óf   € V ^8„  d   QhR\         P                  R\        \        \        3,          /# r»   )r•   r½   r   r   Úint)r   s   "r   r   r   .  s&   € ÷ ñ ¤G§M¡Mð ´d¼3Ä¸8µnñ r   c                ó  € / pV P                   P                  4        F2  p VP                  pT^ 8”  g   K  \        T4      ;p'       g   K.  Y1T&   K4  	  V#   \        P                   d   p\        \        T4      4      hRp?ii ; i)zê
Go through the list of netplan ethernet devices and identify which ones
have VFs. netdef._vf_count ultimately calls _netplan_state_get_vf_count_for_def
from libnetplan which return MAX(sriov_explicit_vf_count, number of VF netdefs).
N)rÀ   rÁ   rÄ   r•   rÅ   r   r   r©   )r¼   Ú	vf_countsr“   rÉ   r¸   rÈ   s   &     r   Ú_get_vf_number_per_pfrÏ   .  s…   € ð €IØ×$Ñ$×+Ñ+Ö-ˆð	-Ø×$Ñ$ˆEð �1Ž9Ü6°vÓ>Ð>ˆu×>Ð>Ø#(˜%Ó ñ .ð Ðøô ×'Ñ'ô 	-Ü$¤S¨£VÓ,Ð,ûð	-ús   ¡AÁBÁ*A>Á>Bc                óZ   € V ^8„  d   QhR\         P                  R\        \        ,          /# r»   )r•   r½   r   r   )r   s   "r   r   r   A  s"   € ÷ ñ ¤W§]¡]ð ´s¼3µxñ r   c                ó"  € \        4       pV P                  P                  4        Ff  pVP                  P	                  R4      ;p'       g   K(  \        WP                  ,          4      '       g   KK  VP                  VP                  4       Kh  	  V# )z_
Go through the list of netplan ethernet devices and identify which ones
are virtual functions
r¿   )r]   rÀ   rÁ   rÂ   rn   r©   r¥   r¦   )r¼   rT   r“   rÇ   s   &   r   Ú_get_virtual_functionsrÒ   A  sj   € ô
 ‹%€CØ×$Ñ$×+Ñ+Ö-ˆà—<‘<×#Ñ# GÓ,Ð,ˆ4×,Ð,Ü-¨h·w±wÕ.?×@Ô@Ø—‘˜Ÿ	™	Ö"ñ	 .ð
 €Jr   c                óR  € VR8”  d   \        RV : RV: R24      h\        P                  P                  RV R4      p\        P                  P                  VR4      p\        P                  P                  VR4      p \	        V4      ;_uu_ 4       p\        VP                  4       P                  4       4      pR	R	R	4       TX8”  d   \        RT : RT: RT: R24      h \	        TR4      ;_uu_ 4       pTP                  \        T4      4       R	R	R	4       R#   + '       g   i     Li; i  \         d"   p\        R
T : R\        T4      : 24      hR	p?i\         d    \        RT ,          4      hi ; i  + '       g   i     R# ; i  \         Ed   pRpTP                  ^8X  dÉ   \        P                  ! RT ,          4        \	        TR4      ;_uu_ 4       pTP                  R4       R	R	R	4       M  + '       g   i     M; i\	        TR4      ;_uu_ 4       pTP                  \        T4      4       R	R	R	4       M  + '       g   i     M; iRpM  \         d   p	T	p R	p	?	MR	p	?	ii ; iT'       d!   \        RT: RT : R\        T4      : 24      h R	p?R# R	p?ii ; i)z:
Allocate the required number of VFs for the selected PF.
é   z cannot allocate more VFs for PF z than the SR-IOV maximum: z > 256r«   Údevicer@   Úsriov_totalvfsNz"failed parsing sriov_totalvfs for r­   z#invalid sriov_totalvfs value for %sz than supported: z > z (sriov_totalvfs)ÚwTzLdevice or resource busy while setting sriov_numvfs for %s, trying workaroundÚ0Fzfailed setting sriov_numvfs to z for )r   r%   r&   r'   r‡   rÌ   Úreadr¯   r²   r³   r   Ú
ValueErrorrˆ   ÚerrnoÚloggingÚwarning)
ÚpfÚvf_countÚdevdirÚnumvfs_pathÚtotalvfs_pathr‹   Úvf_maxr¸   ÚbailÚe_inners
   &&        r   Úset_numvfs_for_pfræ   O  s  € ð �#„~Ý ÛVXÓZbÐcóeð 	eô �W‰W�\‰\Ð*¨B°Ó9€FÜ—'‘'—,‘,˜v ~Ó6€KÜ—G‘G—L‘L Ð)9Ó:€MðGÜ�-× Ô  AÜ˜Ÿ™›Ÿ™Ó)Ó*ˆF÷ !ð �&ÔÝ Û]_ÓaiÓkqÐrótð 	tðhÜ�+˜s×#Ô# qØ�G‰G”C˜“MÔ"÷ $ñ( ÷A !× ûäô VÝËÌSÐQRÍVÐTÓUÐUûÜô GÜÐ@À2ÕEÓFÐFðGú÷ $Ö#ñ( ûô% õ hØˆØ�7‰7�bŒ=Ü�OŠOÐjÐmoÕoÔpð
ô ˜+ s×+Ô+¨qØ—G‘G˜C”L÷ ,×+×+Ð+úä˜+ s×+Ô+¨qØ—G‘GœC ›MÔ*÷ ,×+×+Ð+úð
 ‘øô ô Ø•ûðú÷ ÝÓQYÓ[]Ô_bÐcdÕ_eÐfÓgÐgó ñ ûð%húsÒ   Á>D- Â(DÂ9D- Ã!F Ã5E8ÄF ÄD*	Ä%D- Ä*D- Ä-E5Ä8EÅE5Å!E5Å8F		ÆF Æ	F ÆJ&Æ0J!Ç	IÇG8Ç/	IÇ8HÈIÈIÈ:	IÉIÉIÉJ!ÉI0É$I+É&J!É+I0É0
J!É; J!Ê!J&c           	     óª  € \         P                  P                  RV R4      p \        \         P                  P                  VR4      4      ;_uu_ 4       pVP	                  4       P                  4       R,          pRRR4       \        \         P                  P                  VR4      4      ;_uu_ 4       pVP	                  4       P                  4       R,          pRRR4       RP                  XX.4      pR	pYg9   d   R# R#   + '       g   i     LŽ; i  + '       g   i     LB; i  \         d"   p\        RT : R\        T4      : 24      hRp?ii ; i)
zu
Perform any hardware-specific quirks for the given SR-IOV device to make
sure all the VF-count changes are applied.
r«   rÕ   Úvendor:r   NNNz,could not determine vendor and device ID of r­   Ú:r   )	r%   r&   r'   r‡   rÙ   r¯   r²   r³   r   )rÞ   rà   r‹   Ú	device_idÚ	vendor_idr¸   Úcombined_idÚquirk_devicess   &       r   Ú perform_hardware_specific_quirksrî   ~  sô   € ô
 �W‰W�\‰\Ð*¨B°Ó9€Fð`Ü”"—'‘'—,‘,˜v xÓ0×1Ô1°QØŸ™›Ÿ™Ó(¨Õ,ˆI÷ 2ä”"—'‘'—,‘,˜v xÓ0×1Ô1°QØŸ™›Ÿ™Ó(¨Õ,ˆI÷ 2ð
 —(‘(˜I yÐ1Ó2€KØ€MØÔ#ñ 	ñ $÷ 2×1úç1×1ûäô `ÝÓSUÔWZÐ[\ÕW]Ð^Ó_Ð_ûð`úsM   £1D& Á&D Á:9D& Â3&DÃD& Ä D	ÄD& ÄD#	ÄD& Ä#D& Ä&EÄ1EÅEc                ó&  € Rp\         P                  P                  VRVR4      p\         P                  P                  \         P                  ! V4      4      p\         P                  P                  VRV R4      p\         P
                  ! V4       Fo  p	RV	9   g   K  \         P                  P                  W‰4      p
\         P                  P                  \         P                  ! V
4      4      pW·8X  g   Kf  V	R,          p M	  V'       g   \        RV: RV: 24      h \        P                  ! RR	R
RV RVR\        V4      .	\        P                  \        P                  R7       R#   \        P                   d    \        RT,          4      hi ; i)z8
Apply the hardware VLAN filtering for the selected VF.
Nzsys/class/netrÕ   Úvirtfn:é   NNz%could not determine the VF index for z while configuring vlan ÚiprÇ   r]   r\   rŠ   Úvlan)Ústdoutrf   zJfailed setting SR-IOV VLAN filter for vlan %s (ip link set command failed))r%   r&   r'   r2   r3   Úlistdirr³   r^   r_   r   rj   rk   )rÞ   rŠ   Ú	vlan_nameÚvlan_idÚprefixÚvf_indexÚ	vf_devdirÚ	vf_dev_idÚ	pf_devdirr‹   Údev_pathÚdev_ids   &&&&&       r   Úapply_vlan_filter_for_vfrÿ   ›  sE  € ð €Hä—‘—‘˜V _°b¸(ÓC€IÜ—‘× Ñ ¤§¢¨YÓ!7Ó8€IÜ—‘—‘˜V _°b¸(ÓC€IÜ�ZŠZ˜	Ö"ˆØ�qŽ=Ü—w‘w—|‘| IÓ1ˆHÜ—W‘W×%Ñ%¤b§k¢k°(Ó&;Ó<ˆFØÖ"Ø˜R�5�Ùñ #÷ ÝÛSUÒW`Ðaócð 	cð	fÜ×Ò˜t V¨UØ$ bØ# XØ%¤s¨7£|ð5ô &0×%7Ñ%7Ü%/×%7Ñ%7÷	9øô ×(Ñ(ô fÜØXÐ[dÕdófð 	fðfús   ÄAE( Å((Fc           
     ó2  € V P                  4        \        P                  ! 4       pV P                  p\	        V4      p\        V4      p\        V4      p. pV'       d>   VP                  4        F)  w  r‰\        W‰4      '       g   K  VP                  V4       K+  	  V'       d*   V F  p\        V4       K  	  \        P                  ! 4       p/ p
V Fx  pW;,          pVP                  '       dP   V FG  pVP                  VR7      '       g   K  Wº9   d!   W«,          '       d   \        RV,          4      hWÚV&   KI  	  Kl  W²9   g   Kt  WºV&   Kz  	  VP                  4        EFE  w  rïW>,          pVP                  pVR9   g   K#  \        V4      p\!        V4      pVP#                  4       pVV8w  g   KR  VP$                  '       g   Kf  \&        P(                  ! RP+                  VVP,                  4      4       VP.                  '       d"    \1        VP.                  VP2                  4       \&        P(                  ! RV RV R	V 24       VP;                  R
RV4       VP.                  '       g   EK  VP<                  '       d   EK%  \?        VP.                  VP2                  4       EKH  	  \A        4       pVPB                  P                  4        EF  w  ppVPD                  '       g   K  VPF                  PI                  R4      pVPJ                  pV
PI                  VPL                  4      pV'       g,   \&        P6                  ! RV: RVPL                  : R24       K�  VPI                  VPF                  PI                  R4      PL                  4      pVV9   d#   \        RV: RVPL                  : RV: R24      h\O        W‹VV4       VPQ                  V4       EK  	  R#   \4         d1   p\&        P6                  ! RT R\9        T4       24        Rp?ELíRp?ii ; i)zs
Go through all interfaces, identify which ones are SR-IOV VFs, create
them and perform all other necessary setup.
)r˜   z3matched more than one interface for a VF device: %szFound VFs of {}: {}zUnbinding of VFs for z	 failed: NzChanging eswitch mode from z to z for: rd   rh   ró   zSR-IOV vlan defined for z
 but link z% is either not a VF or has no matchesr¿   z
interface z for netplan device z (z$) already has an SR-IOV vlan defined)Ú	switchdevÚlegacy))Úparser   r¡   r¼   rÏ   rÒ   rÊ   Úitemsræ   rL   rî   r¢   r›   r   rÃ   r¹   r
   rr   rA   rÜ   Údebugr   rN   rT   r‘   r0   Ú	ExceptionrÝ   r   r`   Ú_delay_virtual_functions_rebindrŒ   r]   ÚvlansÚ_has_sriov_vlan_filterrÂ   rn   Ú_vlan_idr¥   rÿ   r¦   )Úconfig_managerÚrootdirr§   r¼   rÎ   Úvfs_setrÆ   Úvf_count_changedrÞ   rß   rT   rŠ   r“   r”   Ú	netdef_idrÈ   Úeswitch_moder   ÚpcidevÚcurrent_eswitch_mode_systemr¸   Úfiltered_vlans_setró   rÇ   r÷   s   &&                       r   Úapply_sriov_configr  Â  s[  € ð
 ×ÑÔÜ×%Ò%Ó'€JØ×&Ñ&€Hô & hÓ/€Iô % XÓ.€GÜ
! (Ó
+€Cð
 ÐßØ%ŸO™OÖ-‰LˆBÜ$ R×2Ò2Ùà×#Ñ# BÖ'ñ	 .÷ ó #ˆBÜ,¨RÖ0ñ #ô
 ×)Ò)Ó+ˆ
ð €CÛˆØ•ˆØ××Ðó
 (�	Ø×*Ñ*°iÐ*×@Ô@Ø”y S§W¤WÜ0Ð1fÐikÕ1kÓlÐlØ'˜“Gó	 (ð ÖØ�B“ñ ð"  ŸI™IŸKÑˆ	ØÕ$ˆØ×3Ñ3ˆØÐ2Ö2Ü)¨%Ó0ˆHÜ˜xÓ(ˆFØ*0×*EÑ*EÓ*GÐ'ØÐ:Ö:Ø—<—<’<Ü—M’MÐ"7×">Ñ">¸vÀvÇÁÓ"WÔXØ—z—z�zðbÜ& v§z¡z°6·=±=ÔAô —M’MÐ$?Ð@[Ð?\Ð\`ÐamÐ`nÐntÐu~Ðtð  #Aô  BØ×&Ñ& y°&¸,ÔGà—z—z“zØ%×E×EÓEÜ$ V§Z¡Z°·±×?ñ+ (ô. ›ÐØ Ÿ™×,Ñ,×.‰ˆˆfð ×(×(Ò(à—<‘<×#Ñ# FÓ+ˆDØ—o‘oˆGà—‘˜Ÿ™Ó!ˆBßô —“ÛeiÐko×krÔkrÐsôuáð
 —‘˜Ÿ™Ÿ™¨Ó0×3Ñ3Ó4ˆBàÐ'Ô'Ý(ÛdfÐhl×hoÔhoÓquÐvóxð xô % R¨T°7Ô;Ø×"Ñ" 2×&ó9 /øô  )ô bÜ#ŸOšOÐ.CÀIÀ;ÈiÔX[Ð\]ÓX^ÐW_Ð,`×aÒaûðbús   È OÏPÏ&%PÐP)Ú/)rl   rÜ   r%   r^   r‚   r   r   r   r   r/   r   Úconfigmanagerr   r•   Úobjectr
   rŒ   r‘   rž   r©   r¹   rÊ   rÏ   rÒ   ræ   rî   rÿ   r  r   r   r   Ú<module>r     sv   ðó& Û Û 	Û Û ß ,Ó ,å Ý .Û ôY�ô Yõxõõ=õ!òHYõ"õ<õ&ò,ò^ô:$föNs'r   