From patchwork Tue Jun 15 10:46:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Dong X-Patchwork-Id: 94211 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08F70A0C47; Tue, 15 Jun 2021 12:46:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 03CC74113D; Tue, 15 Jun 2021 12:46:35 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 491B240140 for ; Tue, 15 Jun 2021 12:46:33 +0200 (CEST) IronPort-SDR: BB+dK8AClTV2O1MheKJSfS9iDmZ97SBuN2qGWyX5q/5Y2YakrlLYe081f7NJuQFs2Z9zhOxs4/ 7BExbi46lYDw== X-IronPort-AV: E=McAfee;i="6200,9189,10015"; a="291598490" X-IronPort-AV: E=Sophos;i="5.83,275,1616482800"; d="scan'208";a="291598490" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2021 03:46:32 -0700 IronPort-SDR: NnVxt7rY131c9arQHe+QivXJTJZbFkQk/K52rzo56HUMyvdb3zzuG5K12l8Mb7ppJ8/PRtA2n4 jAi0yh0iF2Xg== X-IronPort-AV: E=Sophos;i="5.83,275,1616482800"; d="scan'208";a="484428203" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.240.182.57]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2021 03:46:31 -0700 From: Jun Dong To: junx.dong@intel.com Cc: dts@dpdk.org Date: Tue, 15 Jun 2021 18:46:11 +0800 Message-Id: <20210615104613.14658-4-junx.dong@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210615104613.14658-1-junx.dong@intel.com> References: <20210615104613.14658-1-junx.dong@intel.com> MIME-Version: 1.0 Subject: [dts] [PATCH V1 4/6] nics/net_device: update NetDevice class after removed fm10k X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" 1. update method description base context 2. update NetDevice factory function about removed fm10k related NICs. Signed-off-by: Jun Dong --- 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.