[dts] [PATCH V1 4/6] nics/net_device: update NetDevice class after removed fm10k

Jun Dong junx.dong at intel.com
Tue Jun 15 12:46:11 CEST 2021


 1. update method description base context 
 2. update NetDevice factory function about removed fm10k related NICs.

Signed-off-by: Jun Dong <junx.dong at intel.com>
---
 nics/net_device.py | 26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/nics/net_device.py b/nics/net_device.py
index 98d31237..3ddfc4eb 100644
--- a/nics/net_device.py
+++ b/nics/net_device.py
@@ -954,6 +954,7 @@ def get_from_list(host, domain_id, bus_id, devfun_id):
                 return nic['port']
     return None
 
+
 def remove_from_list(host):
     """
     Remove network device object from global structure
@@ -963,38 +964,25 @@ def remove_from_list(host):
         if host == nic['host']:
             NICS_LIST.remove(nic)
 
+
 def GetNicObj(crb, domain_id, bus_id, devfun_id):
     """
     Get network device object. If network device has been initialized, just
-    return object. Based on nic type, some special nics like RRC will return
-    object different from default.
+    return object.
     """
     # find existed NetDevice object
     obj = get_from_list(crb.crb['My IP'], domain_id, bus_id, devfun_id)
     if obj:
         return obj
 
-    pci_id = get_pci_id(crb, domain_id, bus_id, devfun_id)
-    nic = settings.get_nic_name(pci_id)
-
-    if nic == 'redrockcanyou':
-        # redrockcanyou nic need special initialization
-        from rrc import RedRockCanyou
-        obj = RedRockCanyou(crb, domain_id, bus_id, devfun_id)
-    elif nic == 'atwood':
-        # atwood nic need special initialization
-        from atwood import Atwood
-        obj = Atwood(crb, domain_id, bus_id, devfun_id)
-    elif nic == 'boulderrapid':
-        # atwood nic need special initialization
-        from br import BoulderRapid
-        obj = BoulderRapid(crb, domain_id, bus_id, devfun_id)
-    else:
-        obj = NetDevice(crb, domain_id, bus_id, devfun_id)
+    # generate NetDevice object
+    obj = NetDevice(crb, domain_id, bus_id, devfun_id)
 
+    # save NetDevice object to cache, directly get it from cache next time
     add_to_list(crb.crb['My IP'], obj)
     return obj
 
+
 def RemoveNicObj(crb):
     """
     Remove network device object.
-- 
2.27.0



More information about the dts mailing list